diff --git a/ChangeLog b/ChangeLog index a9199f8bf7c..bef3b3fbe52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,7 +18,7 @@ WARNING: The following changes may create regressions for some external modules, but were necessary to make Dolibarr better: * The directory /build has been moved into /dev/build. -* The use of GETPOST function is not allowed inside extrafields conditions or any strings that contains dynamic code evaluated with dol_eval() +* The use of GETPOST function is not allowed inside extrafields conditions or any strings that contains dynamic code evaluated with dol_eval(). * The deprecated variable $trigger_name (duplicate of variable $triggersendname) has been removed. You must use $triggersendname everywhere now. * The behavior of constant STOCK_ALLOW_NEGATIVE_TRANSFER has been reversed. It has been renamed to STOCK_DISALLOW_NEGATIVE_TRANSFER. diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 82569c9031a..62c18aced34 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -3103,7 +3103,8 @@ if ($action == 'create' && $usercancreate) { if ($numlines > 0) { print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=validate&token='.newToken().'&id='.$object->id, (string) $object->id, 1); } else { - print dolGetButtonAction($langs->trans("ErrorObjectMustHaveLinesToBeValidated", $object->ref), $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=validate&token='.newToken().'&id='.$object->id, (string) $object->id, 0); + $langs->load("errors"); + print dolGetButtonAction($langs->trans("ErrorObjectMustHaveLinesToBeValidated", $object->ref), $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=validate&token='.newToken().'&id='.$object->id, (string) $object->id, -1); } } // Edit @@ -3167,29 +3168,32 @@ if ($action == 'create' && $usercancreate) { }*/ $numshipping = 0; - if (isModEnabled('shipping')) { - $numshipping = $object->countNbOfShipments(); - } // Create shipment - if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { - if ((getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->hasRight('expedition', 'creer')) || (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->hasRight('expedition', 'delivery', 'creer'))) { - $arrayforbutaction[] = array( - 'lang' => 'sendings', - 'enabled' => (isModEnabled("shipping") && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')))), - 'perm' => $user->hasRight('expedition', 'creer'), - 'label' => 'CreateShipment', - 'url' => '/expedition/shipment.php?id=' . $object->id - ); - /* - if ($user->hasRight('expedition', 'creer')) { - print dolGetButtonAction('', $langs->trans('CreateShipment'), 'default', DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id, ''); + if (isModEnabled('shipping')) { + $numshipping = $object->countNbOfShipments(); + + if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { + if ((getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->hasRight('expedition', 'creer')) || (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->hasRight('expedition', 'delivery', 'creer'))) { + // Add button to create shipment into the combo + $arrayforbutaction[] = array( + 'lang' => 'sendings', + 'enabled' => (isModEnabled("shipping") && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')))), + 'perm' => $user->hasRight('expedition', 'creer'), + 'label' => 'CreateShipment', + 'url' => '/expedition/shipment.php?id=' . $object->id + ); } else { - print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('CreateShipment'), 'default', $_SERVER['PHP_SELF']. '#', '', false); - }*/ - } else { - $langs->load("errors"); - print dolGetButtonAction($langs->trans('ErrorModuleSetupNotComplete'), $langs->trans('CreateShipment'), 'default', $_SERVER['PHP_SELF']. '#', '', false); + //c$langs->load("errors"); + //print dolGetButtonAction($langs->trans('ErrorModuleSetupNotComplete'), $langs->trans('CreateShipment'), 'default', $_SERVER['PHP_SELF']. '#', '', false); + $arrayforbutaction[] = array( + 'lang' => 'sendings', + 'enabled' => (isModEnabled("shipping") && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')))), + 'perm' => 0, + 'label' => 'CreateShipment', + 'url' => '/expedition/shipment.php?id=' . $object->id + ); + } } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 73d226dc5df..9fe0895d2ad 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3921,7 +3921,7 @@ class Facture extends CommonInvoice // Deprecation warning if ($label) { dol_syslog(__METHOD__.": using line label is deprecated", LOG_WARNING); - //var_dump(debug_backtrace(false));exit; + //var_dump(getCallerInfoString());exit; } global $mysoc, $langs; diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index bdb0f3deff9..33321e3cb70 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -112,7 +112,6 @@ $resteapayer = 0; * Actions */ - $parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -857,6 +856,7 @@ if ($id > 0) { $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = 0; $delallowed = $user->hasRight('tax', 'charges', 'creer'); // If you can create/edit, you can remove a file on card + print $formfile->showdocuments('tax-vat', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index eba2abcc319..5183f1b4490 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6271,8 +6271,10 @@ abstract class CommonObject exit; } if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers(). + dol_syslog("call_trigger was called with no langs variable defined".getCallerInfoString(), LOG_WARNING); include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; $langs = new Translate('', $conf); + $langs->load("main"); } include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index bff41e186e6..c374eb881ca 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -198,8 +198,6 @@ class HookManager */ public function executeHooks($method, $parameters = array(), &$object = null, &$action = '') { - //global $debugbar; - //if (is_object($debugbar) && get_class($debugbar) === 'DolibarrDebugBar') { if (isModEnabled('debugbar') && function_exists('debug_backtrace')) { $trace = debug_backtrace(); if (isset($trace[0])) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2c2584dbbac..c2c9b80c5de 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7550,7 +7550,7 @@ class Form $retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript $retstring .= ' autocomplete="off">'; - // Icone calendrier + // Icon calendar if ($disabled) { $retstringbutton = ''; $retstring = $retstringbutton . $retstring; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 130939163af..feeb961571f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -813,7 +813,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null if (empty($check)) { dol_syslog("Deprecated use of GETPOST, called with 1st param = ".$paramname." and a 2nd param that is '', when calling page ".$_SERVER["PHP_SELF"], LOG_WARNING); // Enable this line to know who call the GETPOST with '' $check parameter. - //var_dump(debug_backtrace()[0]); + //var_dump(getCallerInfoString()); } if (empty($method)) { @@ -2409,8 +2409,12 @@ function getCallerInfoString() { $backtrace = debug_backtrace(); $msg = ""; - if (count($backtrace) >= 2) { - $trace = $backtrace[1]; + if (count($backtrace) >= 1) { + $pos = 1; + if (count($backtrace) == 1) { + $pos = 0; + } + $trace = $backtrace[$pos]; if (isset($trace['file'], $trace['line'])) { $msg = " From {$trace['file']}:{$trace['line']}."; } @@ -13004,7 +13008,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st * 30 => array('attr' => array('class'=>''), 'lang'=>'mymodule', 'enabled'=>isModEnabled("mymodule"), 'perm'=>$user->hasRight('mymodule', 'write'), 'label' => 'MyModuleOtherAction', 'urlraw' => '# || external Url || javascript: || tel: || mailto:' ), * ); ); * @param string $id Attribute id of action button. Example 'action-delete'. This can be used for full ajax confirm if this code is reused into the ->formconfirm() method. - * @param int|boolean $userRight User action right + * @param int|boolean $userRight User action right. Use 0 if user has no permission. It will add the message "No permission" on tooltip. Use -1 to have button not allowed without adding the message (because an explicit label is already set). * // phpcs:disable * @param array{confirm?:array{url?:string,title?:string,content?:string,use_unsecured_unescapedattr?:bool|string[],action-btn-label?:string,cancel-btn-label?:string,modal?:bool},attr?:array,areDropdownButtons?:bool,backtopage?:string,lang?:string,enabled?:bool,perm?:int<0,1>,label?:string,url?:string,isDropdown?:int<0,1>,isDropDown?:int<0,1>} $params = [ // Various params for future : recommended rather than adding more function arguments * 'attr' => [ // to add or override button attributes @@ -13132,11 +13136,11 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url = $attr['aria-label'] = $label; } - if (empty($userRight)) { + if (empty($userRight) || $userRight < 0) { $attr['class'] = 'butActionRefused'; $attr['href'] = ''; $attr['title'] = (($label && $text && $label != $text) ? $label : ''); - $attr['title'] = ($attr['title'] ? $attr['title'].'
' : '').$langs->trans('NotEnoughPermissions'); + $attr['title'] = ($attr['title'] ? $attr['title'] . (empty($userRight) ? '
' : '') : '').(empty($userRight) ? $langs->trans('NotEnoughPermissions') : ''); } if (!empty($id)) { diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 3b1b42cf063..0a30a021f39 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -1452,7 +1452,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } else { // TODO Merge all previous cases into this generic one - // $action = PASSWORD, BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, RECRUITMENTCANDIDATURE_MODIFY, ... + // $action = PASSWORD, ORDER_DELETE, BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, RECRUITMENTCANDIDATURE_MODIFY, ... // Can also be a value defined by an external module like SENTBYSMS, COMPANY_SENTBYSMS, MEMBER_SENTBYSMS, ... // Note: We are here only if getDolGlobalString('MAIN_AGENDA_ACTIONAUTO_action') is on (tested at beginning of this function). // Note that these activation key can be set in agenda setup (but only if defined into llx_c_action_trigger). @@ -1635,6 +1635,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // for such objects because there is already a dedicated field into table llx_actioncomm or llx_actioncomm_resources. if (!in_array($elementtype, array('societe', 'contact', 'project'))) { $actioncomm->fk_element = $elementid; + $actioncomm->elementid = $elementid; $actioncomm->elementtype = $elementtype.($elementmodule ? '@'.$elementmodule : ''); } diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 615ab26b2a3..ebeaa709323 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -1012,6 +1012,8 @@ class EcmFiles extends CommonObject $tmppath = preg_replace('/^(\d+\/)?fournisseur\/facture\//', '', $this->filepath); } elseif ($option == 'commande_fournisseur') { $tmppath = preg_replace('/^(\d+\/)?fournisseur\/commande\//', '', $this->filepath); + } elseif ($option == 'tax-vat') { // Remove part "tax/vat/" + $tmppath = preg_replace('/^(\d+\/)?tax\/vat\//', '', $this->filepath); } else { if ((int) $this->entity > 1) { // Remove the part "entityid/commande/" into "entityid/commande/REFXXX" to get only the ref diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 6518c74e35d..b0e5137e63e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1181,6 +1181,7 @@ if ($action == 'create') { print '
'; + print '
'; print ''; // Load shipments already done for same order @@ -1880,6 +1881,7 @@ if ($action == 'create') { } print "
"; + print '
'; print '
'; @@ -2304,7 +2306,7 @@ if ($action == 'create') { print '
'; print '
'; - print ''; + print '
'; print ''; print ''; // Adds a line numbering column @@ -2328,15 +2330,15 @@ if ($action == 'create') { } print ''; } else { @@ -2594,7 +2596,11 @@ if ($action == 'create') { // Warehouse source print ''; // Batch number management - print ''; + print ''; print ''; } elseif (count($lines[$i]->details_entrepot) > 1) { print ''; @@ -2605,7 +2611,11 @@ if ($action == 'create') { // Warehouse source print ''; // Batch number management - print ''; + print ''; print ''; } } elseif ($lines[$i]->product_type == Product::TYPE_SERVICE && getDolGlobalString('SHIPMENT_SUPPORTS_SERVICES')) { diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index db7db109dcd..0d60f594231 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -533,7 +533,7 @@ if ($object->id > 0 || !empty($object->ref)) { print ''; print '
'; if ($object->status <= 1) { - print $langs->trans("QtyToShip").' - '; + print $langs->trans("QtyToShip"); } else { - print $langs->trans("QtyShipped").' - '; + print $langs->trans("QtyShipped"); } if (isModEnabled('stock')) { - print $langs->trans("WarehouseSource").' - '; + print ' - '.$langs->trans("WarehouseSource"); } if (isModEnabled('productbatch')) { - print $langs->trans("Batch"); + print ' - '.$langs->trans("Batch"); } print ''.$formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).' - '.$langs->trans("NA").''; + if (isModEnabled('productbatch')) { + print ' - '.$langs->trans("NA"); + } + print '
'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).' - '.$langs->trans("NA").''; + if (isModEnabled('productbatch')) { + print ' - '.$langs->trans("NA"); + } + print '
'; - print '
'; + print '

'; if (isModEnabled('barcode') || $is_mod_batch_enabled) { print ''.img_picto('', 'barcode', 'class="paddingrightonly"').$langs->trans("UpdateByScaning").''; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index c2877ccba34..72b06d0efb6 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2960,7 +2960,7 @@ class Societe extends CommonObject } if (!empty($this->address)) { - $datas['address'] = '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); // Address + country + $datas['address'] = '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ', ', $langs); // Address + country } elseif (!empty($this->country_code)) { $datas['address'] = '
'.$langs->trans('Country').': '.$this->country_code; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index c4be72c48b6..cce01be1d61 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2021,7 +2021,7 @@ maxscreenheightless200 { .maxwidth40 { max-width: 40px; } .maxwidth50 { max-width: 50px; } .maxwidth75 { max-width: 75px; } -.maxwidthdate { max-width: 85px; } +.maxwidthdate { max-width: 95px; } .maxwidth100 { max-width: 100px; } .maxwidth125 { max-width: 125px; } .maxwidth150 { max-width: 150px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index d71b0d5f83e..90ecc18e5f1 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2160,7 +2160,7 @@ tr.nobottom td { .maxwidth40 { max-width: 40px; } .maxwidth50 { max-width: 50px; } .maxwidth75 { max-width: 75px; } -.maxwidthdate { max-width: 85px; } +.maxwidthdate { max-width: 95px; } .maxwidth100 { max-width: 100px; } .maxwidth125 { max-width: 125px; } .maxwidth150 { max-width: 150px; }