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

This commit is contained in:
Laurent Destailleur 2022-04-02 18:09:59 +02:00
commit ab5bccb06e
3 changed files with 20 additions and 9 deletions

View File

@ -8864,7 +8864,7 @@ class Form
// Add where from hooks
if (is_object($hookmanager)) {
$parameters = array();
$parameters = array('showrefnav' => true);
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
$object->next_prev_filter .= $hookmanager->resPrint;
}

View File

@ -64,7 +64,15 @@ function societe_prepare_head(Societe $object)
} else {
$sql = "SELECT COUNT(p.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
// Add table from hooks
$parameters = array('contacttab' => true);
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " WHERE p.fk_soc = ".((int) $object->id);
// Add where from hooks
$parameters = array('contacttab' => true);
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);

View File

@ -2539,6 +2539,9 @@ print $formconfirm;
* Action bar
*/
if ($action != 'create' && $action != 'edit') {
$cloneProductUrl = $_SERVER["PHP_SELF"].'?action=clone&token='.newToken();
$cloneButtonId = 'action-clone-no-ajax';
print "\n".'<div class="tabsAction">'."\n";
$parameters = array();
@ -2546,15 +2549,15 @@ if ($action != 'create' && $action != 'edit') {
if (empty($reshook)) {
if ($usercancreate) {
if (!isset($object->no_button_edit) || $object->no_button_edit <> 1) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Modify").'</a>';
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, '', $usercancreate);
}
if (!isset($object->no_button_copy) || $object->no_button_copy <> 1) {
if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) {
print '<span id="action-clone" class="butAction">'.$langs->trans('ToClone').'</span>'."\n";
} else {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=clone&token='.newToken().'&id='.$object->id.'">'.$langs->trans("ToClone").'</a>';
$cloneProductUrl = '';
$cloneButtonId = 'action-clone';
}
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $cloneProductUrl, $cloneButtonId, $usercancreate);
}
}
$object_is_used = $object->isObjectUsed($object->id);
@ -2562,15 +2565,15 @@ if ($action != 'create' && $action != 'edit') {
if ($usercandelete) {
if (empty($object_is_used) && (!isset($object->no_button_delete) || $object->no_button_delete <> 1)) {
if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) {
print '<span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span>'."\n";
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', '#', 'action-delete', true);
} else {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Delete").'</a>';
print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '');
}
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("ProductIsUsed").'">'.$langs->trans("Delete").'</a>';
print dolGetButtonAction($langs->trans("ProductIsUsed"), $langs->trans('Delete'), 'delete', '#', '', false);
}
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Delete").'</a>';
print dolGetButtonAction($langs->trans("NotEnoughPermissions"), $langs->trans('Delete'), 'delete', '#', '', false);
}
}