Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/core/lib/company.lib.php
This commit is contained in:
Laurent Destailleur 2024-08-13 04:47:12 +02:00
commit 79f1cc95bb
13 changed files with 65 additions and 27 deletions

View File

@ -2085,7 +2085,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</div><div class="fichehalfright">';
$MAX = 10;
$MAXEVENT = 10;
$morehtmlcenter = '';
$messagingUrl = DOL_URL_ROOT.'/adherents/messaging.php?rowid='.$object->id;
@ -2095,7 +2095,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1, 'listactions', $MAX, '', $morehtmlcenter);
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1, 'listactions', $MAXEVENT, '', $morehtmlcenter);
print '</div></div>';
}

View File

@ -409,7 +409,7 @@ if ($rowid && $action != 'edit') {
/*
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1);
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1, '', $MAXEVENT);
*/
print '</div></div>';

View File

@ -1299,7 +1299,7 @@ class ActionComm extends CommonObject
/**
* Load all objects with filters.
* @TODO WARNING: This make a fetch on all records instead of making one request with a join.
* @TODO WARNING: This make a fetch on all records instead of making one request with a join, like done into show_actions_done.
*
* @param int $socid Filter by thirdparty
* @param int $fk_element Id of element action is linked to
@ -1341,9 +1341,14 @@ class ActionComm extends CommonObject
if ($elementtype == 'project') {
$sql .= ' AND a.fk_project = '.((int) $fk_element);
} elseif ($elementtype == 'contact') {
$sql .= ' AND a.id IN';
$sql .= " (SELECT fk_actioncomm FROM ".MAIN_DB_PREFIX."actioncomm_resources WHERE";
$sql .= " element_type = 'socpeople' AND fk_element = ".((int) $fk_element).')';
$sql .= ' AND EXISTS';
$sql .= " (SELECT r.rowid FROM ".MAIN_DB_PREFIX."actioncomm_resources as r WHERE";
$sql .= " r.element_type = 'socpeople' AND r.fk_element = ".((int) $fk_element).' AND r.fk_actioncomm = a.id)';
} elseif ($elementtype == 'user') {
$sql .= " AND (a.fk_user_action = ".((int) $fk_element)." OR EXISTS";
$sql .= " (SELECT r.rowid FROM ".MAIN_DB_PREFIX."actioncomm_resources as r WHERE";
$sql .= " r.element_type = 'user' AND r.fk_element = ".((int) $fk_element).' AND r.fk_actioncomm = a.id)';
$sql .= ")";
} else {
$sql .= " AND a.fk_element = ".((int) $fk_element)." AND a.elementtype = '".$this->db->escape($elementtype)."'";
}

View File

@ -214,7 +214,7 @@ class FormActions
$url = DOL_URL_ROOT.'/comm/action/card.php?action=create&token='.newToken().'&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser'));
$url .= '&origin='.urlencode($typeelement).'&originid='.((int) $object->id).((!empty($object->socid) && $object->socid > 0) ? '&socid='.((int) $object->socid) : ((!empty($socid) && $socid > 0) ? '&socid='.((int) $socid) : ''));
$url .= ($projectid > 0 ? '&projectid='.((int) $projectid) : '').($taskid > 0 ? '&taskid='.((int) $taskid) : '');
$url .= ($assignedtouser > 0 ? '&assignedtouser='.$assignedtouser : '');
$url .= ($assignedtouser > 0 ? '&assignedtouser='.((int) $assignedtouser) : '');
$url .= '&backtopage='.urlencode($urlbacktopage);
$morehtmlright .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url);
}

View File

@ -1803,12 +1803,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr
// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
$hookmanager->initHooks(array('agendadao'));
// Recherche histo sur actioncomm
if (is_object($objcon) && $objcon->id > 0) {
$sql = "SELECT DISTINCT a.id, a.label as label,";
} else {
$sql = "SELECT a.id, a.label as label,";
}
$sql = "SELECT a.id, a.label as label,";
$sql .= " a.datep as dp,";
$sql .= " a.datep2 as dp2,";
$sql .= " a.percent as percent, 'action' as type,";
@ -1850,18 +1845,20 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr
}
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
// Link to the owner of action
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
// Link to action types
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
if (is_object($filterobj) && get_class($filterobj) !== 'User') {
$force_filter_contact = false;
} else {
// Set $force_filter_contact:
// - true for a filter on a user or a contact, so a link on table llx_actioncomm_resources or llx_actioncomm.fk_user_action
// - false for a link on table llx_element_resources
$force_filter_contact = false;
if (is_object($filterobj) && $filterobj->id > 0 && get_class($filterobj) == 'User') {
$force_filter_contact = true;
}
if (is_object($objcon) && $objcon->id > 0) {
$force_filter_contact = true;
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm";
$sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".((int) $objcon->id);
}
// Fields from hook
@ -1957,7 +1954,16 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr
return 'Bad value for $filterobj';
}
} else {
$sql .= " AND u.rowid = ". ((int) $filterobj->id);
if (is_object($filterobj) && $filterobj->id > 0 && get_class($filterobj) == 'User') {
$sql .= " AND (u.rowid = ". ((int) $filterobj->id).' OR ';
$sql .= " EXISTS (SELECT r.rowid FROM ".MAIN_DB_PREFIX."actioncomm_resources as r WHERE a.id = r.fk_actioncomm";
$sql .= " AND r.element_type = '".$db->escape($filterobj->table_element)."' AND r.fk_element = ".((int) $filterobj->id).')';
$sql .= ")";
}
if (is_object($objcon) && $objcon->id > 0) {
$sql .= " AND EXISTS (SELECT r.rowid FROM ".MAIN_DB_PREFIX."actioncomm_resources as r WHERE a.id = r.fk_actioncomm";
$sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".((int) $objcon->id).')';
}
}
if (!empty($tms_start) && !empty($tms_end)) {

View File

@ -102,6 +102,7 @@ class modAgenda extends DolibarrModules
} else {
dol_print_error($this->db, $this->db->lasterror());
}
//$this->const[] = array("MAIN_AGENDA_XCAL_EXPORTKEY", "chaine", "123456", "Securekey for the public link");
// New pages on tabs
// -----------------
@ -586,4 +587,28 @@ class modAgenda extends DolibarrModules
$keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
public function init($options = '')
{
global $conf;
// Permissions
$this->remove($options);
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type='member' AND entity = ".((int) $conf->entity),
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','member',".((int) $conf->entity).")"
);
return $this->_init($sql, $options);
}
}

View File

@ -357,8 +357,6 @@ class modExpedition extends DolibarrModules
}
}
$sql = array();
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'shipping' AND entity = ".((int) $conf->entity),
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."', 'shipping', ".((int) $conf->entity).")",

View File

@ -14,6 +14,7 @@ ConfirmDeleteAction=Are you sure you want to delete this event?
CardAction=Event card
ActionOnCompany=Related company
ActionOnContact=Related contact
ActionOnUser=Related user
TaskRDVWith=Meeting with %s
ShowTask=Show task
ShowAction=Show event

View File

@ -503,6 +503,7 @@ ContactsAddressesForCompany=Contacts/addresses for this third party
AddressesForCompany=Addresses for this third party
ActionsOnCompany=Events for this third party
ActionsOnContact=Events for this contact/address
ActionsOnUser=Events for this user
ActionsOnContract=Events for this contract
ActionsOnMember=Events about this member
ActionsOnProduct=Events about this product

View File

@ -2078,14 +2078,14 @@ if ($action == 'create') {
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('supplier_proposal'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
$MAXEVENT = 10;
print '</div><div class="fichehalfright">';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'supplier_proposal', $socid, 1);
$somethingshown = $formactions->showactions($object, 'supplier_proposal', $socid, 1, '', $MAXEVENT);
print '</div></div>';
}

View File

@ -197,7 +197,7 @@ if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') ||
$cachekey = 'count_events_user_'.$object->id;
$nbEvent = dol_getcache($cachekey);
$titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
$titlelist = $langs->trans("ActionsOnUser").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
if (!empty($conf->dol_optimize_smallscreen)) {
$titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
}

View File

@ -2974,12 +2974,14 @@ if ($action == 'create' || $action == 'adduserldap') {
$linktoelem = $form->showLinkToObjectBlock($object, null, null);
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
$MAXEVENT = 10;
print '</div><div class="fichehalfright">';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'user', $socid, 1, 'listactions', 0, '', '', $object->id);
$somethingshown = $formactions->showactions($object, 'user', $socid, 1, 'listactions', $MAXEVENT, '', '', $object->id);
print '</div></div>';
}

View File

@ -508,7 +508,7 @@ if ($action == 'create') {
// List of actions on element
/*include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'usergroup', $socid, 1);*/
$somethingshown = $formactions->showactions($object, 'usergroup', $socid, 1, '', $MAXEVENT);*/
print '</div></div>';
}