diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index b79464c80a1..fd6a11a71e1 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -2095,7 +2095,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Send if (empty($user->socid)) { if (Adherent::STATUS_VALIDATED == $object->status) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); } } diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 3d08bf8edea..f03d1099c41 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -674,7 +674,7 @@ class AdherentType extends CommonObject * Return the array of all amounts per membership type id * * @param int $status Filter on status of type - * @return array Array of membership type + * @return array Array of membership type */ public function amountByType($status = null) { diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index db84049d46e..fbd951ba5b8 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1,13 +1,13 @@ - * Copyright (C) 2016 Laurent Destailleur - * Copyright (C) 2017 Regis Houssin - * Copyright (C) 2017 Neil Orley - * Copyright (C) 2018-2025 Frédéric France - * Copyright (C) 2018-2022 Thibault FOUCART - * Copyright (C) 2024 Jon Bendtsen +/* Copyright (C) 2016 Xebax Christy + * Copyright (C) 2016 Laurent Destailleur + * Copyright (C) 2017-2025 Regis Houssin + * Copyright (C) 2017 Neil Orley + * Copyright (C) 2018-2025 Frédéric France + * Copyright (C) 2018-2022 Thibault FOUCART + * Copyright (C) 2024 Jon Bendtsen * Copyright (C) 2024-2025 MDW - * Copyright (C) 2025 Charlene Benke + * Copyright (C) 2025 Charlene Benke * * * This program is free software; you can redistribute it and/or modify @@ -1056,7 +1056,8 @@ class Setup extends DolibarrApi $sql = "SELECT rowid, code, label, affect, delay, newbymonth, fk_country"; $sql .= " FROM ".MAIN_DB_PREFIX."c_holiday_types as t"; - $sql .= " WHERE t.active = ".((int) $active); + $sql .= " WHERE t.entity IN (".getEntity('c_holiday_types').")"; + $sql .= " AND t.active = ".((int) $active); if ($fk_country) { $sql .= " AND (t.fk_country = ".((int) $fk_country); $sql .= " OR t.fk_country is null)"; @@ -1135,7 +1136,8 @@ class Setup extends DolibarrApi $sql = "SELECT id, code, dayrule, day, month, year, fk_country, code as label"; $sql .= " FROM ".MAIN_DB_PREFIX."c_hrm_public_holiday as t"; - $sql .= " WHERE t.active = ".((int) $active); + $sql .= " WHERE t.entity IN (".getEntity('c_hrm_public_holiday').")"; + $sql .= " AND t.active = ".((int) $active); if ($fk_country) { $sql .= " AND (t.fk_country = ".((int) $fk_country); $sql .= " OR t.fk_country is null)"; diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index bf4186a1062..6d7c7b9ad60 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -408,7 +408,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle'); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle'); } // Back to draft diff --git a/htdocs/blockedlog/ajax/block-add.php b/htdocs/blockedlog/ajax/block-add.php index f72f1885ef2..ea12a481bf9 100644 --- a/htdocs/blockedlog/ajax/block-add.php +++ b/htdocs/blockedlog/ajax/block-add.php @@ -48,7 +48,11 @@ require '../../main.inc.php'; $id = GETPOSTINT('id'); $element = GETPOST('element', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); // Can be DOC_PREVIEW or DOC_DOWNLOAD + +if (! in_array($action, array('DOC_PREVIEW', 'DOC_DOWNLOAD'))) { + accessforbidden('Bad value for action. Must be DOC_PREVIEW or DOC_DOWNLOAD'); +} if ($element === 'facture') { restrictedArea($user, 'facture', $id, '', '', 'fk_soc', 'rowid', 0); @@ -74,6 +78,14 @@ if ($element === 'facture') { // Test on permission done in top of page $facture = new Facture($db); if ($facture->fetch($id) > 0) { + // Increase counter by 1 + $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET pos_print_counter = pos_print_counter + 1"; + $sql .= " WHERE rowid = ".((int) $facture->id); + $db->query($sql); + + //$facture->pos_print_counter += 1; + //$facture->update($user, 1); // We disable trigger here because we already call the trigger $action = DOC_PREVIEW or DOC_DOWNLOAD just after + $facture->call_trigger($action, $user); } diff --git a/htdocs/bookcal/calendar_card.php b/htdocs/bookcal/calendar_card.php index 1c4cca6a56c..f11d7034da7 100644 --- a/htdocs/bookcal/calendar_card.php +++ b/htdocs/bookcal/calendar_card.php @@ -468,7 +468,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send /*if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); }*/ // Back to draft diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 62414a7b59a..33d759d1bc9 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -23,7 +23,7 @@ /** * \file htdocs/categories/edit.php * \ingroup category - * \brief Page d'edition de categorie produit + * \brief Page to edit a category */ // Load Dolibarr environment @@ -54,7 +54,7 @@ $dol_openinpopup = GETPOST('dol_openinpopup', 'aZ'); $socid = GETPOSTINT('socid'); $label = (string) GETPOST('label', 'alphanohtml'); $description = (string) GETPOST('description', 'restricthtml'); -$color = preg_replace('/^#/', '', preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('color', 'alphanohtml'))); +$color = preg_replace('/[^0-9a-f]/i', '', (string) GETPOST('color', 'alphanohtml')); $position = GETPOSTINT('position'); $visible = GETPOSTINT('visible'); $parent = GETPOSTINT('parent'); @@ -91,6 +91,7 @@ $error = 0; /* * Actions */ + $parameters = array('id' => $id, 'ref' => $ref, 'cancel' => $cancel, 'backtopage' => $backtopage, 'socid' => $socid, 'label' => $label, 'description' => $description, 'color' => $color, 'position' => $position, 'visible' => $visible, 'parent' => $parent); // Note that $action and $object may be modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index cab0d519abf..e5d201387b3 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -3578,7 +3578,7 @@ if ($action == 'create') { // Send if (empty($user->socid)) { if ($object->status == Propal::STATUS_VALIDATED || $object->status == Propal::STATUS_SIGNED || getDolGlobalString('PROPOSAL_SENDBYEMAIL_FOR_ALL_STATUS')) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?action=presend&token=' . newToken() . '&id=' . $object->id . '&mode=init#formmailbeforetitle', '', $usercansend); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"] . '?action=presend&token=' . newToken() . '&id=' . $object->id . '&mode=init#formmailbeforetitle', '', $usercansend); } } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c4d52388dac..8c928751d46 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -6604,14 +6604,14 @@ if ($action == 'create') { if (($object->status == Facture::STATUS_VALIDATED || $object->status == Facture::STATUS_CLOSED) || getDolGlobalString('FACTURE_SENDBYEMAIL_FOR_ALL_STATUS')) { if ($objectidnext) { $params['attr']['title'] = $langs->trans("DisabledBecauseReplacedInvoice"); - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false, $params); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', '#', '', false, $params); } else { if ($usercansend) { unset($params['attr']['title']); - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params); } else { unset($params['attr']['title']); - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false, $params); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', '#', '', false, $params); } } } @@ -6751,12 +6751,6 @@ if ($action == 'create') { } } - // Clone - if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) { - unset($params['attr']['title']); - print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice&token='.newToken(), '', true, $params); - } - // Clone as predefined / Create template if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->status == 0 && $usercancreate) { if (!$objectidnext && count($object->lines) > 0) { @@ -6765,6 +6759,12 @@ if ($action == 'create') { } } + // Clone + if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) { + unset($params['attr']['title']); + print dolGetButtonAction($langs->trans('ToClone'), '', 'clone', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice&token='.newToken(), '', true, $params); + } + // Remove situation from cycle if (in_array($object->status, array(Facture::STATUS_CLOSED, Facture::STATUS_VALIDATED)) && $object->isSituationInvoice() diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index ccca4e17503..a5a5a0f6ac7 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1538,10 +1538,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (empty($user->socid)) { if (!empty($object->email)) { $langs->load("mails"); - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); } else { $langs->load("mails"); - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', '#', '', false); } } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 12de36e36b6..5cadeaad743 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2253,9 +2253,9 @@ if ($action == 'create') { if (empty($user->socid)) { if ($object->status == $object::STATUS_VALIDATED) { if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('contrat', 'creer'))) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', true, $params); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', true, $params); } else { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false, $params); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', '#', '', false, $params); } } } diff --git a/htdocs/core/actions_printing.inc.php b/htdocs/core/actions_printing.inc.php index 8226dcae418..25bbe533432 100644 --- a/htdocs/core/actions_printing.inc.php +++ b/htdocs/core/actions_printing.inc.php @@ -20,13 +20,12 @@ /** * \file htdocs/core/actions_printing.inc.php - * \brief Code for actions print_file to print file with calling trigger + * \ingroup core + * \brief Code for actions print_file to print file (with calling trigger) when using the Direct Print feature. + * The relative filename to print must be provided into GETPOST('file', 'alpha') parameter */ -// $action must be defined -// $db, $user, $conf, $langs must be defined -// Filename to print must be provided into 'file' parameter /** * @var Conf $conf * @var DoliDB $db @@ -36,6 +35,7 @@ * * @var string $action */ + // Print file if ($action == 'print_file' && $user->hasRight('printing', 'read')) { $langs->load("printing"); @@ -44,7 +44,6 @@ if ($action == 'print_file' && $user->hasRight('printing', 'read')) { $list = $objectprint->listDrivers($db, 10); $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); if (!empty($list)) { - $errorprint = 0; $printerfound = 0; foreach ($list as $driver) { foreach ($dirmodels as $dir) { @@ -80,7 +79,26 @@ if ($action == 'print_file' && $user->hasRight('printing', 'read')) { break; } try { - $ret = $printer->printFile(GETPOST('file', 'alpha'), $module, $subdir); + // Case of printing an invoice + $filetoprint = GETPOST('file', 'alpha'); //Example FAYYMM-123/FAYYMM-123-xxx.pdf + if ($module == 'facture') { + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + $refinvoice = preg_replace('/[\\\/].*$/', '', $filetoprint); + $tmpinvoice = new Facture($db); + $tmpinvoice->fetch(0, $refinvoice); + if ($tmpinvoice->id > 0) { + // Increase counter by 1 + $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET pos_print_counter = pos_print_counter + 1"; + $sql .= " WHERE rowid = ".((int) $tmpinvoice->id); + $db->query($sql); + + //$tmpinvoice->pos_print_counter += 1; + //$tmpinvoice->update($user, 1); // We disable trigger here because we already call the trigger $action = DOC_PREVIEW or DOC_DOWNLOAD just after + } + } + + + $ret = $printer->printFile($filetoprint, $module, $subdir); if ($ret > 0) { //print '
'.print_r($printer->errors, true).'
'; setEventMessages($printer->error, $printer->errors, 'errors'); diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index beeae4b07b8..56abcb90ae5 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -453,6 +453,13 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO // Call of triggers (you should have set $triggersendname to execute trigger. if (!empty($triggersendname)) { + if ($triggersendname == 'BILL_SENTBYMAIL' && $object instanceof Facture) { + // If sending email for invoice, we increase the counter of invoices sent by email + $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET email_sent_counter = email_sent_counter + 1"; + $sql .= " WHERE rowid = ".((int) $object->id); + $db->query($sql); + } + $result = $object->call_trigger($triggersendname, $user); // @phan-suppress-current-line PhanPossiblyUndeclaredGlobalVariable if ($result < 0) { $error++; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 09760b5112c..27044699600 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -14072,7 +14072,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st * * @param string $label Label or tooltip of button if $text is provided. Also used as tooltip in title attribute. Can be escaped HTML content or full simple text. * @param string $text Optional : short label on button. Can be escaped HTML content or full simple text. - * @param string $actionType 'default', 'danger', 'email', 'clone', 'cancel', 'delete', ... + * @param string $actionType 'default', 'edit', 'danger', 'email', 'clone', 'cancel', 'delete', ... * @param string|array}> $url Url for link or array of subbutton description * Example when an array is used: * $arrayforbutaction = array( @@ -14182,13 +14182,18 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url = } // Here, $url is a simple link - if (!empty($params['isDropdown']) || !empty($params['isDropDown'])) { // Use the dropdown-item style (not for action button) $class = "dropdown-item"; } else { $class = 'butAction'; - if ($actionType == 'danger' || $actionType == 'delete') { - $class = 'butActionDelete'; + if ($actionType == 'edit') { + $class = 'butAction butActionEdit'; + } elseif ($actionType == 'email') { + $class = 'butAction butActionEmail'; + } elseif ($actionType == 'clone') { + $class = 'butAction butActionClone'; + } elseif ($actionType == 'danger' || $actionType == 'delete') { + $class = 'butAction butActionDelete'; if (!empty($url) && strpos($url, 'token=') === false) { $url .= '&token=' . newToken(); } @@ -14322,7 +14327,7 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url = * using `dolPrintHTMLForAttributeUrl()`. All other attributes are escaped using * `dolPrintHTMLForAttribute()`. * - * ⚠️ Note: Disabling escaping (via `$unescapedAttr`) is **not recommended** unless you + * Note: Disabling escaping (via `$unescapedAttr`) is **not recommended** unless you * fully trust the input data, as it may lead to XSS vulnerabilities. * * Example: diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 3f2a1a87e0f..bf8024e5dae 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -419,7 +419,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); - } elseif ($action == 'BILL_VALIDATE') { + } elseif ($action == 'BILL_VALIDATE' && $object instanceof Facture) { '@phan-var-force Facture $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -436,7 +436,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'BILL_UNVALIDATE') { + } elseif ($action == 'BILL_UNVALIDATE' && $object instanceof Facture) { '@phan-var-force Facture $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -453,7 +453,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'BILL_SENTBYMAIL') { + } elseif ($action == 'BILL_SENTBYMAIL' && $object instanceof Facture) { '@phan-var-force Facture $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -471,7 +471,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); - } elseif ($action == 'BILL_PAYED') { + } elseif ($action == 'BILL_PAYED' && $object instanceof Facture) { '@phan-var-force Facture $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -489,7 +489,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'BILL_CANCEL') { + } elseif ($action == 'BILL_CANCEL' && $object instanceof Facture) { '@phan-var-force Facture $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -506,7 +506,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'FICHINTER_CREATE') { + } elseif ($action == 'FICHINTER_CREATE' && $object instanceof Fichinter) { '@phan-var-force Fichinter $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -525,7 +525,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); $object->fk_element = 0; $object->elementtype = ''; - } elseif ($action == 'FICHINTER_VALIDATE') { + } elseif ($action == 'FICHINTER_VALIDATE' && $object instanceof Fichinter) { '@phan-var-force Fichinter $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -544,7 +544,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); $object->fk_element = 0; $object->elementtype = ''; - } elseif ($action == 'FICHINTER_MODIFY') { + } elseif ($action == 'FICHINTER_MODIFY' && $object instanceof Fichinter) { '@phan-var-force Fichinter $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -563,7 +563,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); $object->fk_element = 0; $object->elementtype = ''; - } elseif ($action == 'FICHINTER_SENTBYMAIL') { + } elseif ($action == 'FICHINTER_SENTBYMAIL' && $object instanceof Fichinter) { '@phan-var-force Fichinter $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -581,7 +581,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); - } elseif ($action == 'FICHINTER_CLASSIFY_BILLED') { + } elseif ($action == 'FICHINTER_CLASSIFY_BILLED' && $object instanceof Fichinter) { '@phan-var-force Fichinter $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -598,7 +598,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED') { + } elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED' && $object instanceof Fichinter) { '@phan-var-force Fichinter $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -615,7 +615,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'FICHINTER_CLOSE') { + } elseif ($action == 'FICHINTER_CLOSE' && $object instanceof Fichinter) { '@phan-var-force Fichinter $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -634,7 +634,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); $object->fk_element = 0; $object->elementtype = ''; - } elseif ($action == 'FICHINTER_DELETE') { + } elseif ($action == 'FICHINTER_DELETE' && $object instanceof Fichinter) { '@phan-var-force Fichinter $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -653,7 +653,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); $object->fk_element = 0; $object->elementtype = ''; - } elseif ($action == 'SHIPPING_VALIDATE') { + } elseif ($action == 'SHIPPING_VALIDATE' && $object instanceof Expedition) { '@phan-var-force Expedition $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "sendings")); @@ -671,7 +671,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); - } elseif ($action == 'SHIPPING_SENTBYMAIL') { + } elseif ($action == 'SHIPPING_SENTBYMAIL' && $object instanceof Expedition) { '@phan-var-force Expedition $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "sendings")); @@ -689,7 +689,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); - } elseif ($action == 'RECEPTION_VALIDATE') { + } elseif ($action == 'RECEPTION_VALIDATE' && $object instanceof Reception) { '@phan-var-force Reception $object'; $langs->load("agenda"); $langs->load("other"); @@ -708,7 +708,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); - } elseif ($action == 'RECEPTION_SENTBYMAIL') { + } elseif ($action == 'RECEPTION_SENTBYMAIL' && $object instanceof Reception) { '@phan-var-force Reception $object'; $langs->load("agenda"); $langs->load("other"); @@ -727,7 +727,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); - } elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE') { + } elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE' && $object instanceof SupplierProposal) { '@phan-var-force SupplierProposal $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -744,7 +744,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL') { + } elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL' && $object instanceof SupplierProposal) { '@phan-var-force SupplierProposal $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -762,7 +762,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); - } elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED') { + } elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED' && $object instanceof SupplierProposal) { '@phan-var-force SupplierProposal $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -779,7 +779,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED') { + } elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED' && $object instanceof SupplierProposal) { '@phan-var-force SupplierProposal $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -796,7 +796,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'ORDER_SUPPLIER_CREATE') { + } elseif ($action == 'ORDER_SUPPLIER_CREATE' && $object instanceof CommandeFournisseur) { '@phan-var-force CommandeFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -813,7 +813,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { + } elseif ($action == 'ORDER_SUPPLIER_VALIDATE' && $object instanceof CommandeFournisseur) { '@phan-var-force CommandeFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -830,7 +830,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'ORDER_SUPPLIER_APPROVE') { + } elseif ($action == 'ORDER_SUPPLIER_APPROVE' && $object instanceof CommandeFournisseur) { '@phan-var-force CommandeFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -847,7 +847,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'ORDER_SUPPLIER_REFUSE') { + } elseif ($action == 'ORDER_SUPPLIER_REFUSE' && $object instanceof CommandeFournisseur) { '@phan-var-force CommandeFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders", "main")); @@ -869,7 +869,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'ORDER_SUPPLIER_CANCEL') { + } elseif ($action == 'ORDER_SUPPLIER_CANCEL' && $object instanceof CommandeFournisseur) { '@phan-var-force CommandeFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders", "main")); @@ -891,7 +891,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'ORDER_SUPPLIER_SUBMIT') { + } elseif ($action == 'ORDER_SUPPLIER_SUBMIT' && $object instanceof CommandeFournisseur) { '@phan-var-force CommandeFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -913,7 +913,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'ORDER_SUPPLIER_RECEIVE') { + } elseif ($action == 'ORDER_SUPPLIER_RECEIVE' && $object instanceof CommandeFournisseur) { '@phan-var-force CommandeFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -930,7 +930,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { + } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL' && $object instanceof CommandeFournisseur) { '@phan-var-force CommandeFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills", "orders")); @@ -948,7 +948,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); - } elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED') { + } elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED' && $object instanceof CommandeFournisseur) { '@phan-var-force CommandeFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills", "orders")); @@ -965,7 +965,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'BILL_SUPPLIER_CREATE') { + } elseif ($action == 'BILL_SUPPLIER_CREATE' && $object instanceof FactureFournisseur) { '@phan-var-force FactureFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -982,7 +982,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'BILL_SUPPLIER_VALIDATE') { + } elseif ($action == 'BILL_SUPPLIER_VALIDATE' && $object instanceof FactureFournisseur) { '@phan-var-force FactureFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -999,7 +999,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'BILL_SUPPLIER_UNVALIDATE') { + } elseif ($action == 'BILL_SUPPLIER_UNVALIDATE' && $object instanceof FactureFournisseur) { '@phan-var-force FactureFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -1016,7 +1016,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') { + } elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL' && $object instanceof FactureFournisseur) { '@phan-var-force FactureFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills", "orders")); @@ -1034,7 +1034,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); - } elseif ($action == 'BILL_SUPPLIER_PAYED') { + } elseif ($action == 'BILL_SUPPLIER_PAYED' && $object instanceof FactureFournisseur) { '@phan-var-force FactureFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -1051,7 +1051,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'BILL_SUPPLIER_CANCELED') { + } elseif ($action == 'BILL_SUPPLIER_CANCELED' && $object instanceof FactureFournisseur) { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -1067,7 +1067,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'MEMBER_VALIDATE') { + } elseif ($action == 'MEMBER_VALIDATE' && $object instanceof Adherent) { '@phan-var-force Adherent $object'; // Members // Load translation files required by the page @@ -1087,7 +1087,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'MEMBER_MODIFY') { + } elseif ($action == 'MEMBER_MODIFY' && $object instanceof Adherent) { '@phan-var-force Adherent $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -1106,7 +1106,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE') { + } elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE' && $object instanceof Subscription) { '@phan-var-force Subscription $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -1138,7 +1138,7 @@ class InterfaceActionsAuto extends DolibarrTriggers if (isset($object->fk_soc) && $object->fk_soc > 0) { $object->socid = $object->fk_soc; } - } elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY') { + } elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY' && $object instanceof Subscription) { '@phan-var-force Subscription $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -1169,7 +1169,7 @@ class InterfaceActionsAuto extends DolibarrTriggers if (isset($object->fk_soc) && $object->fk_soc > 0) { $object->socid = $object->fk_soc; } - } elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE') { + } elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE' && $object instanceof Subscription) { '@phan-var-force Subscription $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -1201,7 +1201,7 @@ class InterfaceActionsAuto extends DolibarrTriggers if (isset($object->fk_soc) && $object->fk_soc > 0) { $object->socid = $object->fk_soc; } - } elseif ($action == 'MEMBER_RESILIATE') { + } elseif ($action == 'MEMBER_RESILIATE' && $object instanceof Adherent) { '@phan-var-force Adherent $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -1220,7 +1220,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'MEMBER_DELETE') { + } elseif ($action == 'MEMBER_DELETE' && $object instanceof Adherent) { '@phan-var-force Adherent $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -1239,7 +1239,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'MEMBER_EXCLUDE') { + } elseif ($action == 'MEMBER_EXCLUDE' && $object instanceof Adherent) { '@phan-var-force Adherent $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -1258,7 +1258,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'PROJECT_CREATE') { + } elseif ($action == 'PROJECT_CREATE' && $object instanceof Project) { '@phan-var-force Project $object'; // Projects // Load translation files required by the page @@ -1277,7 +1277,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'PROJECT_VALIDATE') { + } elseif ($action == 'PROJECT_VALIDATE' && $object instanceof Project) { '@phan-var-force Project $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -1295,7 +1295,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'PROJECT_MODIFY') { + } elseif ($action == 'PROJECT_MODIFY' && $object instanceof Project) { '@phan-var-force Project $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -1317,7 +1317,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'PROJECT_SENTBYMAIL') { + } elseif ($action == 'PROJECT_SENTBYMAIL' && $object instanceof Project) { '@phan-var-force Project $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -1335,7 +1335,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); - } elseif ($action == 'PROJECT_DELETE') { + } elseif ($action == 'PROJECT_DELETE' && $object instanceof Project) { '@phan-var-force Project $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -1346,7 +1346,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("ProjectDeletedInDolibarr", $object->ref); $object->sendtoid = array(); - } elseif ($action == 'PROJECT_CLOSE') { + } elseif ($action == 'PROJECT_CLOSE' && $object instanceof Project) { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -1362,7 +1362,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'TASK_CREATE') { + } elseif ($action == 'TASK_CREATE' && $object instanceof Task) { '@phan-var-force Task $object'; // Project tasks // Load translation files required by the page @@ -1381,7 +1381,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'TASK_MODIFY') { + } elseif ($action == 'TASK_MODIFY' && $object instanceof Task) { '@phan-var-force Task $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -1399,7 +1399,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'TASK_DELETE') { + } elseif ($action == 'TASK_DELETE' && $object instanceof Task) { '@phan-var-force Task $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -1417,7 +1417,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array(); - } elseif ($action == 'TICKET_ASSIGNED') { + } elseif ($action == 'TICKET_ASSIGNED' && $object instanceof Ticket) { '@phan-var-force Ticket $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index b04538e126b..33265f0eea5 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -693,7 +693,7 @@ if ($action == 'create') { } if ($user->hasRight('expedition', 'delivery', 'supprimer') && $action != 'presend') { if ($object->status == Delivery::STATUS_VALIDATED && $action != 'presend' && $expedition->status == Expedition::STATUS_VALIDATED) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', ''); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', ''); } if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION')) { print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&expid='.$object->origin_id.'&action=delete&token='.newToken().'&backtopage='.urlencode(DOL_URL_ROOT.'/expedition/card.php?id='.$object->origin_id), ''); diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index 6c45a8ccd02..967b415cfcd 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -610,7 +610,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.$withProjectUrl.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.$withProjectUrl.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); } print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.$withProjectUrl.'&action=edit&token='.newToken(), '', $permissiontoadd); diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 670b8da4d46..3e8bb6dd345 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -669,7 +669,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(is_object($confOrBooth) && !empty($confOrBooth->id) ? '&conforboothid='.$confOrBooth->id : '').(!empty($projectstatic->id) ? '&fk_project='.$projectstatic->id : '').'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.(is_object($confOrBooth) && !empty($confOrBooth->id) ? '&conforboothid='.$confOrBooth->id : '').(!empty($projectstatic->id) ? '&fk_project='.$projectstatic->id : '').'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); } print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(is_object($confOrBooth) && !empty($confOrBooth->id) ? '&conforboothid='.$confOrBooth->id : '').(!empty($projectstatic->id) ? '&fk_project='.$projectstatic->id : '').'&action=edit&token='.newToken(), '', $permissiontoadd); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 7d1b5e76637..f00273f3599 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -3726,9 +3726,9 @@ if ($action == 'create' && $usercancreate) { if (empty($user->socid)) { if ($object->status > 0) { if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('expedition', 'shipping_advance', 'send')) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?action=presend&token=' . newToken() . '&id=' . $object->id . '&mode=init#formmailbeforetitle', ''); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"] . '?action=presend&token=' . newToken() . '&id=' . $object->id . '&mode=init#formmailbeforetitle', ''); } else { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF'] . '#', '', false); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER['PHP_SELF'] . '#', '', false); } } } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index cac8f195a85..5479db47954 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2808,7 +2808,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'editline') { // Send if (empty($user->socid)) { if ($object->status > ExpenseReport::STATUS_DRAFT) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); } } diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index d6b9a3daebf..089374b8b6e 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1897,9 +1897,9 @@ if ($action == 'create') { if (empty($user->socid)) { if ($object->status > Fichinter::STATUS_DRAFT) { if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('ficheinter', 'ficheinter_advance', 'send')) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); } else { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', '#', '', false); } } } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 3d49ced5ae6..b4faa479cfd 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2654,7 +2654,7 @@ if ($action == 'create') { if (empty($user->socid)) { if (in_array($object->status, array(CommandeFournisseur::STATUS_ACCEPTED, 3, 4, 5)) || getDolGlobalString('SUPPLIER_ORDER_SENDBYEMAIL_FOR_ALL_STATUS')) { if ($usercanorder) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); } } } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 58f5094515c..dcb1146f934 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -4214,9 +4214,9 @@ if ($action == 'create') { if (empty($user->socid)) { if (($object->status == FactureFournisseur::STATUS_VALIDATED || $object->status == FactureFournisseur::STATUS_CLOSED)) { if ($usercansend) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); } else { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', '#', '', false); } } } diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index d552400d10c..22cc0e91436 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -369,9 +369,9 @@ if ($result > 0) { if ($user->socid == 0 && $action != 'presend') { $usercansend = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight("fournisseur", "supplier_invoice_advance", "send"))); if ($usercansend) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); } else { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', '#', '', false); } } diff --git a/htdocs/hrm/evaluation_card.php b/htdocs/hrm/evaluation_card.php index 695379d1efa..49873726c19 100644 --- a/htdocs/hrm/evaluation_card.php +++ b/htdocs/hrm/evaluation_card.php @@ -655,7 +655,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); } // Back to draft diff --git a/htdocs/intracommreport/card.php b/htdocs/intracommreport/card.php index fe27a668ba8..3f3f415e542 100644 --- a/htdocs/intracommreport/card.php +++ b/htdocs/intracommreport/card.php @@ -466,7 +466,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); } // Back to draft diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index d628834a68a..f46f9d34518 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -481,7 +481,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send //if (empty($user->socid)) { - //print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle'); + //print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle'); //} // Back to draft diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 58cd226b200..06d7c7a92a8 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -46,6 +46,8 @@ SuppliersCategoryShort=Vendors tag/category CustomersCategoryShort=Customers tag/category ProductsCategoryShort=Products tag/category MembersCategoryShort=Members tag/category +UsersCategoryShort=Users tag/category +ProjectsCategoryShort=Projects tag/category SuppliersCategoriesShort=Vendors tags/categories CustomersCategoriesShort=Customers tags/categories ProspectsCategoriesShort=Prospects tags/categories diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 0de6217deb6..c909f9d4b24 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -3680,7 +3680,9 @@ if (!function_exists("llxFooter")) { print ''."\n"; } - // JS wrapper to add log when clicking on download or preview + // JS wrapper to add an unalterable log when clicking on Download or Preview + // This is done on customer invoices only. + // This add a log and increase the pos_print_counter too (done by block-add.php). if (isModEnabled('blockedlog') && is_object($object) && !empty($object->id) && $object->id > 0) { if (in_array($object->element, array('facture')) && $object->statut > 0) { // Restrict for the moment to element 'facture' print "\n\n"; @@ -3691,9 +3693,9 @@ if (!function_exists("llxFooter")) { console.log("Call /blockedlog/ajax/block-add on a.documentpreview"); $.post('' , { - id:id; ?> - , element:'element) ?>' - , action:'DOC_PREVIEW' + id: id; ?> + , element: 'element) ?>' + , action: 'DOC_PREVIEW' , token: '' } ); @@ -3702,9 +3704,9 @@ if (!function_exists("llxFooter")) { console.log("Call /blockedlog/ajax/block-add a.documentdownload"); $.post('' , { - id:id; ?> - , element:'element) ?>' - , action:'DOC_DOWNLOAD' + id: id; ?> + , element: 'element) ?>' + , action: 'DOC_DOWNLOAD' , token: '' } ); diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 60ceb69cb5d..83b88bde016 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -536,7 +536,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); } // Back to draft diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index cdf6103b425..120d3ba02e1 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -552,7 +552,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); } print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 3b798eb0725..05868f72fb0 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -3107,7 +3107,7 @@ if ($action != 'create' && $action != 'edit') { } //Send - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle'); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle'); if (!isset($hookmanager->resArray['no_button_copy']) || $hookmanager->resArray['no_button_copy'] != 1) { if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index c1a3f631622..f5d240bcd74 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -398,7 +398,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); } // Back to draft diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index 5547ceab818..50e5ccd19b4 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -1018,7 +1018,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); } // Back to draft diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index da443ea6351..e97160987bf 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1666,7 +1666,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { // Send if (empty($user->socid)) { if ($object->status != Project::STATUS_CLOSED) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', ''); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', ''); } } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 795262320bb..1a7d2476aea 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -36,6 +36,13 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; @@ -47,14 +54,6 @@ if (isModEnabled('category')) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array('projects', 'companies', 'commercial')); if (isModEnabled('eventorganization') && $conf->eventorganization->enabled) { @@ -124,6 +123,15 @@ $search_price_registration = GETPOST("search_price_registration", 'alpha'); $search_price_booth = GETPOST("search_price_booth", 'alpha'); $search_login = GETPOST('search_login', 'alpha'); $search_import_key = GETPOST('search_import_key', 'alpha'); + +$searchCategoryUserOperator = 0; +if (GETPOSTISSET('formfilteraction')) { + $searchCategoryUserOperator = GETPOSTINT('search_category_user_operator'); +} elseif (getDolGlobalString('MAIN_SEARCH_CAT_USER_OR_BY_DEFAULT')) { + $searchCategoryUserOperator = getDolGlobalString('MAIN_SEARCH_CAT_USER_OR_BY_DEFAULT'); +} +$searchCategoryUserList = GETPOST('search_category_user_list', 'array:int'); + $searchCategoryCustomerOperator = 0; if (GETPOSTISSET('formfilteraction')) { $searchCategoryCustomerOperator = GETPOSTINT('search_category_customer_operator'); @@ -131,6 +139,7 @@ if (GETPOSTISSET('formfilteraction')) { $searchCategoryCustomerOperator = getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT'); } $searchCategoryCustomerList = GETPOST('search_category_customer_list', 'array:int'); + $search_omitChildren = 0; if (getDolGlobalInt('PROJECT_ENABLE_SUB_PROJECT')) { $search_omitChildren = GETPOST('search_omitChildren', 'alpha') == 'on' ? 1 : 0; @@ -187,9 +196,11 @@ $search_date_modif_endday = GETPOSTINT('search_date_modif_endday'); $search_date_modif_end = GETPOSTDATE('search_date_modif_end', 'end'); // Use tzserver $search_category_array = array(); +$search_category_user_array = array(); if (isModEnabled('category')) { $search_category_array = GETPOST("search_category_".Categorie::TYPE_PROJECT."_list", "array"); + $search_category_user_array = GETPOST("search_category_".Categorie::TYPE_USER."_list", "array"); } if (GETPOSTISARRAY('search_status') || GETPOST('search_status_multiselect')) { @@ -473,6 +484,7 @@ if (empty($reshook)) { $toselect = array(); $search_array_options = array(); $search_category_array = array(); + $search_category_user_array = array(); } @@ -806,7 +818,38 @@ if (getDolGlobalInt('PROJECT_ENABLE_SUB_PROJECT')) { } } -// Search for tag/category ($searchCategoryProjectList is an array of ID) +// Search for tag/category of User ($searchCategoryUserList is an array of ID) +$searchCategoryUserSqlList = $search_category_user_array; +$searchCategoryUserOperator = 0; +if (!empty($searchCategoryUserList)) { + $searchCategoryUserSqlList = array(); + $listofcategoryid = ''; + foreach ($searchCategoryUserList as $searchCategoryUser) { + if (intval($searchCategoryUser) == -2) { + $searchCategoryUserSqlList[] = "NOT EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX."categorie_user as ck WHERE u.rowid = ck.fk_user)"; + } elseif (intval($searchCategoryUser) > 0) { + if ($searchCategoryUserOperator == 0) { + $searchCategoryUserSqlList[] = " EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX."categorie_user as ck WHERE u.rowid = ck.fk_user AND ck.fk_categorie = ".((int) $searchCategoryUser).")"; + } else { + $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryUser); + } + } + } + if ($listofcategoryid) { + $searchCategoryUserSqlList[] = " EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX."categorie_user as ck WHERE u.rowid = ck.fk_User AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))"; + } + if ($searchCategoryUserOperator == 1) { + if (!empty($searchCategoryUserSqlList)) { + $sql .= " AND (".implode(' OR ', $searchCategoryUserSqlList).")"; + } + } else { + if (!empty($searchCategoryUserSqlList)) { + $sql .= " AND (".implode(' AND ', $searchCategoryUserSqlList).")"; + } + } +} + +// Search for tag/category or Project ($searchCategoryProjectList is an array of ID) $searchCategoryProjectList = $search_category_array; $searchCategoryProjectOperator = 0; if (!empty($searchCategoryProjectList)) { @@ -836,6 +879,9 @@ if (!empty($searchCategoryProjectList)) { } } } + +// Search for tag/category of Customer Third party ($searchCategoryCustomerList is an array of ID) +/* $searchCategoryCustomerSqlList = array(); if ($searchCategoryCustomerOperator == 1) { $existsCategoryCustomerList = array(); @@ -880,6 +926,8 @@ if ($searchCategoryCustomerOperator == 1) { $sql .= " AND (".implode(' AND ', $searchCategoryCustomerSqlList).")"; } } +*/ + // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks @@ -1086,11 +1134,21 @@ if ($search_date_modif_endday) { if ($search_date_modif_end) { $param .= '&search_date_modif_end=' . urlencode((string) $search_date_modif_end); } +if (!empty($search_category_user_array)) { + foreach ($search_category_user_array as $tmpval) { + $param .= '&search_categegory_user_list[]='.urlencode($tmpval); + } +} if (!empty($search_category_array)) { foreach ($search_category_array as $tmpval) { $param .= '&search_categegory_project_list[]='.urlencode($tmpval); } } +if (!empty($searchCategoryCustomerList)) { + foreach ($searchCategoryCustomerList as $searchCategoryCustomer) { + $param .= "&search_category_customer_list[]=".urlencode($searchCategoryCustomer); + } +} if ($search_id != '') { $param .= '&search_id='.urlencode($search_id); } @@ -1172,9 +1230,6 @@ if ($search_login) { if ($search_import_key) { $param .= '&search_import_key='.urlencode($search_import_key); } -foreach ($searchCategoryCustomerList as $searchCategoryCustomer) { - $param .= "&search_category_customer_list[]=".urlencode($searchCategoryCustomer); -} // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -1281,6 +1336,14 @@ if (!$user->hasRight('user', 'user', 'lire')) { $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, null, 0, $includeonly, '', '0', 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx'); $moreforfilter .= ''; +// Filter on user categories +if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) { + $langs->load("categories"); + $formcategory = new FormCategory($db); + $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_USER, $search_category_user_array, 'minwidth200imp minwidth200 widthcentpercentminusx', -1, 1, 1, $langs->trans("UsersCategoryShort")); +} + + $moreforfilter .= '
'; $tmptitle = $langs->trans('ProjectsWithThisContact'); $moreforfilter .= img_picto($tmptitle, 'contact', 'class="pictofixedwidth"').$form->select_contact(0, $search_project_contact ? $search_project_contact : '', 'search_project_contact', $tmptitle, '', '', 0, 'maxwidth300 widthcentpercentminusx'); @@ -1296,16 +1359,16 @@ if ($user->hasRight('user', 'user', 'lire')) { $moreforfilter .= '
'; } -// Filter on categories +// Filter on project categories if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) { $formcategory = new FormCategory($db); - $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array, 'minwidth300imp minwidth300 widthcentpercentminusx'); + $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array, 'minwidth200imp minwidth200 widthcentpercentminusx', -1, 1, 1, $langs->trans("ProjectsCategoryShort")); } // Filter on customer categories if (getDolGlobalString('MAIN_SEARCH_CATEGORY_CUSTOMER_ON_PROJECT_LIST') && isModEnabled("category") && $user->hasRight('categorie', 'lire')) { $formcategory = new FormCategory($db); - $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList, 'minwidth300', $searchCategoryCustomerList ? $searchCategoryCustomerList : 0); + $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList, 'minwidth200imp minwidth200 widthcentpercentminusx', $searchCategoryCustomerList ? $searchCategoryCustomerList : 0); } // alert on late date diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 1805f6df767..c6113539b99 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -555,7 +555,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); } // Back to draft diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php index fdd306d2406..daaf988f516 100644 --- a/htdocs/recruitment/recruitmentjobposition_card.php +++ b/htdocs/recruitment/recruitmentjobposition_card.php @@ -403,7 +403,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); } // Back to draft diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 30af36e7526..868b2adbba6 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -2073,9 +2073,9 @@ if ($action == 'create') { if (empty($user->socid)) { if ($object->status == SupplierProposal::STATUS_VALIDATED || $object->status == SupplierProposal::STATUS_SIGNED) { if ($usercansend) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', ''); } else { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', '#', '', false); } } } diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 70b7a4b291f..471ccda6e60 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -111,9 +111,12 @@ if ($facid > 0 && !GETPOST('specimen')) { } print ''; + // Record entry in blocked logs each time we print a receipt +// // This will also increase the counter of printings of the receipt // DOL_DOCUMENT_ROOT.'/blockedlog/ajax/block-add.php?id='.$object->id.'&element='.$object->element.'&action=DOC_PREVIEW&token='.newToken(); + print " '; - - print ''; - - $parameters = array(); - $reshook = $hookmanager->executeHooks('insertExtraFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - } - - print dol_get_fiche_end(); + $i++; } +print ''; +print ''; + +print ''; + +print ''; + +$parameters = array(); +$reshook = $hookmanager->executeHooks('insertExtraFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +print dol_get_fiche_end(); + + // End of page llxFooter(); $db->close(); diff --git a/htdocs/webhook/target_card.php b/htdocs/webhook/target_card.php index 1df877a8f83..341dd9db66b 100644 --- a/htdocs/webhook/target_card.php +++ b/htdocs/webhook/target_card.php @@ -473,7 +473,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send /*if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); }*/ print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); diff --git a/htdocs/webhook/triggerhistory_card.php b/htdocs/webhook/triggerhistory_card.php index 911a8834176..a6faa40cf15 100644 --- a/htdocs/webhook/triggerhistory_card.php +++ b/htdocs/webhook/triggerhistory_card.php @@ -489,7 +489,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { /*// Send if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); } // Back to draft diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 0769f0b0740..59ad1435c75 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -411,7 +411,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); + print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); } // Modify