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

This commit is contained in:
Laurent Destailleur
2022-12-20 23:25:59 +01:00
55 changed files with 456 additions and 257 deletions

View File

@@ -197,6 +197,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
$script .= '
// For customer price when PRODUIT_CUSTOMER_PRICES_BY_QTY is on
console.log("PRODUIT_CUSTOMER_PRICES_BY_QTY is on, propagate also prices by quantity into data-pbqxxx properties");
$("#'.$htmlnamejquery.'").attr("data-pbq", ui.item.pbq);
$("#'.$htmlnamejquery.'").attr("data-pbqup", ui.item.price_ht);
$("#'.$htmlnamejquery.'").attr("data-pbqbase", ui.item.pricebasetype);

View File

@@ -73,9 +73,11 @@ function expedition_prepare_head(Expedition $object)
*/
function expedition_admin_prepare_head()
{
global $langs, $conf, $user;
global $langs, $conf, $user, $db;
$langs->load("sendings");
$extrafields = new ExtraFields($db);
$h = 0;
$head = array();
@@ -87,23 +89,29 @@ function expedition_admin_prepare_head()
*/
if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
$extrafields->fetch_name_optionals_label('expedition');
$extrafields->fetch_name_optionals_label('expeditiondet');
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
$head[$h][1] = $langs->trans("Shipment");
$head[$h][2] = 'shipment';
$h++;
}
if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
$head[$h][0] = DOL_URL_ROOT.'/admin/expedition_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['expedition']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes_shipment';
$h++;
}
if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
$head[$h][0] = DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines");
$nbExtrafields = $extrafields->attributes['expeditiondet']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributeslines_shipment';
$h++;
}
@@ -114,15 +122,24 @@ function expedition_admin_prepare_head()
$h++;
if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
$extrafields->fetch_name_optionals_label('delivery');
$extrafields->fetch_name_optionals_label('deliverydet');
$head[$h][0] = DOL_URL_ROOT.'/admin/delivery_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['delivery']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes_receivings';
$h++;
}
if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
$head[$h][0] = DOL_URL_ROOT.'/admin/deliverydet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines");
$nbExtrafields = $extrafields->attributes['deliverydet']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributeslines_receivings';
$h++;
}

View File

@@ -19,6 +19,7 @@
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -9385,6 +9386,17 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type,
continue;
}
if ($values[3]) {
if ($filterorigmodule) { // If a filter of module origin has been requested
if (strpos($values[3], '@')) { // This is an external module
if ($filterorigmodule != 'external') {
continue;
}
} else { // This looks a core module
if ($filterorigmodule != 'core') {
continue;
}
}
}
$langs->load($values[3]);
}
if (preg_match('/SUBSTITUTION_([^_]+)/i', $values[2], $reg)) {

View File

@@ -1043,7 +1043,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
$regType = array();
if (preg_match('/\{(t+)\}/i', $mask, $regType)) {
$masktype = $regType[1];
$masktype_value = substr(preg_replace('/^TE_/', '', $objsoc->typent_code), 0, dol_strlen($regType[1])); // get n first characters of thirdparty typent_code (where n is length in mask)
$masktype_value = dol_substr(preg_replace('/^TE_/', '', $objsoc->typent_code), 0, dol_strlen($regType[1])); // get n first characters of thirdparty typent_code (where n is length in mask)
$masktype_value = str_pad($masktype_value, dol_strlen($regType[1]), "#", STR_PAD_RIGHT); // we fill on right with # to have same number of char than into mask
} else {
$masktype = '';