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

This commit is contained in:
ldestailleur 2025-03-18 12:27:28 +01:00
commit be8cd3ebf2
15 changed files with 66 additions and 45 deletions

View file

@ -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.

View file

@ -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
);
}
}
}

View file

@ -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;

View file

@ -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);
}

View file

@ -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';

View file

@ -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])) {

View file

@ -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 = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
$retstring = $retstringbutton . $retstring;

View file

@ -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<string,mixed>,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'].'<br>' : '').$langs->trans('NotEnoughPermissions');
$attr['title'] = ($attr['title'] ? $attr['title'] . (empty($userRight) ? '<br>' : '') : '').(empty($userRight) ? $langs->trans('NotEnoughPermissions') : '');
}
if (!empty($id)) {

View file

@ -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 : '');
}

View file

@ -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

View file

@ -1181,6 +1181,7 @@ if ($action == 'create') {
print '<br>';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
// Load shipments already done for same order
@ -1880,6 +1881,7 @@ if ($action == 'create') {
}
print "</table>";
print '</div>';
print '<br>';
@ -2304,7 +2306,7 @@ if ($action == 'create') {
print '<br>';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%" id="tablelines" >';
print '<table class="noborder centpercent" id="tablelines" >';
print '<thead>';
print '<tr class="liste_titre">';
// Adds a line numbering column
@ -2328,15 +2330,15 @@ if ($action == 'create') {
}
print '<td class="center linecoleditlineotherinfo" colspan="'.$editColspan.'">';
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 '</td>';
} else {
@ -2594,7 +2596,11 @@ if ($action == 'create') {
// Warehouse source
print '<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'</td>';
// Batch number management
print '<td> - '.$langs->trans("NA").'</td>';
print '<td>';
if (isModEnabled('productbatch')) {
print ' - '.$langs->trans("NA");
}
print '</td>';
print '</tr>';
} elseif (count($lines[$i]->details_entrepot) > 1) {
print '<!-- case edit 3 -->';
@ -2605,7 +2611,11 @@ if ($action == 'create') {
// Warehouse source
print '<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'</td>';
// Batch number management
print '<td> - '.$langs->trans("NA").'</td>';
print '<td>';
if (isModEnabled('productbatch')) {
print ' - '.$langs->trans("NA");
}
print '</td>';
print '</tr>';
}
} elseif ($lines[$i]->product_type == Product::TYPE_SERVICE && getDolGlobalString('SHIPMENT_SUPPORTS_SERVICES')) {

View file

@ -533,7 +533,7 @@ if ($object->id > 0 || !empty($object->ref)) {
print '</td>';
print '</tr></table>';
print '<br><center>';
print '<br><br><center>';
if (isModEnabled('barcode') || $is_mod_batch_enabled) {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=updatebyscaning&token='.currentToken().'" class="marginrightonly paddingright marginleftonly paddingleft">'.img_picto('', 'barcode', 'class="paddingrightonly"').$langs->trans("UpdateByScaning").'</a>';
}

View file

@ -2960,7 +2960,7 @@ class Societe extends CommonObject
}
if (!empty($this->address)) {
$datas['address'] = '<br><b>'.$langs->trans("Address").':</b> '.dol_format_address($this, 1, ' ', $langs); // Address + country
$datas['address'] = '<br><b>'.$langs->trans("Address").':</b> '.dol_format_address($this, 1, ', ', $langs); // Address + country
} elseif (!empty($this->country_code)) {
$datas['address'] = '<br><b>'.$langs->trans('Country').':</b> '.$this->country_code;
}

View file

@ -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; }

View file

@ -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; }