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

This commit is contained in:
Laurent Destailleur 2023-08-09 15:00:52 +02:00
commit 11ad17bcf3
13 changed files with 84 additions and 65 deletions

View file

@ -991,7 +991,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
}
// Picto + Name of module
print ' <td class="tdoverflowmax300 maxwidth300" title="'.dol_escape_htmltag($objMod->getName()).'">';
print ' <td class="tdoverflowmax200 minwidth200imp" title="'.dol_escape_htmltag($objMod->getName()).'">';
$alttext = '';
//if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
//if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
@ -1008,7 +1008,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
print "</td>\n";
// Desc
print '<td class="valignmiddle tdoverflowmax300">';
print '<td class="valignmiddle tdoverflowmax300 minwidth200imp">';
print nl2br($objMod->getDesc());
print "</td>\n";
@ -1019,7 +1019,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
print '</td>';
// Version
print '<td class="center nowrap" width="150px" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
print '<td class="center nowrap width150" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
if ($objMod->needUpdate) {
$versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
print '<span class="badge badge-warning classfortooltip" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
@ -1029,7 +1029,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
print "</td>\n";
// Link enable/disable
print '<td class="center valignmiddle left" width="60px">';
print '<td class="center valignmiddle left nowraponall" width="60px">';
print $codeenabledisable;
print "</td>\n";

View file

@ -702,6 +702,7 @@ if (empty($reshook)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
$action = 'closeas';
} elseif (GETPOST('statut', 'int') == $object::STATUS_SIGNED || GETPOST('statut', 'int') == $object::STATUS_NOTSIGNED) {
$locationTarget = '';
// prevent browser refresh from closing proposal several times
if ($object->statut == $object::STATUS_VALIDATED || ( ! empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE) && $object->statut == $object::STATUS_DRAFT)) {
$db->begin();
@ -710,10 +711,12 @@ if (empty($reshook)) {
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
} else {
// Needed if object linked modified by trigger (because linked objects can't be fetched two times : linkedObjectsFullLoaded)
$locationTarget = DOL_URL_ROOT . '/comm/propal/card.php?id=' . $object->id;
}
$deposit = null;
$locationTarget = '';
$deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);

View file

@ -1144,7 +1144,7 @@ if ($resql) {
$moreforfilter .= '</div>';
}
// If the user can view products
if (isModEnabled('categorie') && $user->hasRight('categorie', 'read') && ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire'))) {
if (isModEnabled('categorie') && $user->hasRight('categorie', 'read') && ($user->hasRight('product', 'read') || $user->hasRight('service', 'read'))) {
$searchCategoryProductOperator = -1;
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$tmptitle = $langs->trans('IncludingProductWithTag');

View file

@ -695,20 +695,6 @@ if (empty($reshook)) {
$tva_tx = GETPOST('tva_tx', 'alpha');
// Prepare a price equivalent for minimum price check
$pu_equivalent = $pu_ht;
$pu_equivalent_ttc = $pu_ttc;
$currency_tx = $object->multicurrency_tx;
// Check if we have a foreing currency
// If so, we update the pu_equiv as the equivalent price in base currency
if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') {
$pu_equivalent = $pu_ht_devise * $currency_tx;
}
if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') {
$pu_equivalent_ttc = $pu_ttc_devise * $currency_tx;
}
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0);
@ -1000,6 +986,20 @@ if (empty($reshook)) {
$fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : '');
$buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we muste keep this value
// Prepare a price equivalent for minimum price check
$pu_equivalent = $pu_ht;
$pu_equivalent_ttc = $pu_ttc;
$currency_tx = $object->multicurrency_tx;
// Check if we have a foreing currency
// If so, we update the pu_equiv as the equivalent price in base currency
if ($pu_ht == '' && $pu_ht_devise != '' && $currency_tx != '') {
$pu_equivalent = $pu_ht_devise * $currency_tx;
}
if ($pu_ttc == '' && $pu_ttc_devise != '' && $currency_tx != '') {
$pu_equivalent_ttc = $pu_ttc_devise * $currency_tx;
}
// Local Taxes
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty);
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty);

View file

@ -7008,7 +7008,7 @@ abstract class CommonObject
$value = price($value);
}
$out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam ? $moreparam : '').'> ';
} elseif ($type == 'select') {
} elseif ($type == 'select') { // combo list
$out = '';
if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_EXTRAFIELDS_DISABLE_SELECT2)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
@ -7382,8 +7382,9 @@ abstract class CommonObject
$out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, $moreparam, 0, empty($val['disabled']) ? 0 : 1);
if (!empty($param_list_array[2])) { // If the entry into $fields is set to add a create button
if (!GETPOSTISSET('backtopage') && empty($val['disabled']) && empty($nonewbutton)) { // To avoid to open several times the 'Create Object' button and to avoid to have button if field is protected by a "disabled".
if (!empty($param_list_array[2])) { // If the entry into $fields is set, we must add a create button
if ((!GETPOSTISSET('backtopage') || strpos(GETPOST('backtopage'), $_SERVER['PHP_SELF']) === 0) // // To avoid to open several times the 'Plus' button (we accept only one level)
&& empty($val['disabled']) && empty($nonewbutton)) { // and to avoid to show the button if the field is protected by a "disabled".
list($class, $classfile) = explode(':', $param_list[0]);
if (file_exists(dol_buildpath(dirname(dirname($classfile)).'/card.php'))) {
$url_path = dol_buildpath(dirname(dirname($classfile)).'/card.php', 1);

View file

@ -1734,11 +1734,12 @@ class ExtraFields
$translabel = '';
if (!empty($obj->$field_toshow)) {
$translabel = $langs->trans($obj->$field_toshow);
}
if ($translabel != $obj->$field_toshow) {
$value .= dol_trunc($translabel, 24).' ';
} else {
$value .= $obj->$field_toshow.' ';
if ($translabel != $obj->$field_toshow) {
$value .= dol_trunc($translabel, 24).' ';
} else {
$value .= $obj->$field_toshow.' ';
}
}
}
} else {

View file

@ -647,7 +647,7 @@ if ($num > 0) {
print '</td>';
// Duration
print '<td class="center" title="'.dol_escape_htmltag($datefromto).'">';
print '<td class="center nowraponall" title="'.dol_escape_htmltag($datefromto).'">';
if (!empty($datelastresult) && ($datelastresult >= $datelastrun)) {
$nbseconds = max($datelastresult - $datelastrun, 1);
print $nbseconds.' '.($nbseconds > 1 ? $langs->trans("SecondShort") : $langs->trans("SecondShort"));

View file

@ -822,15 +822,15 @@ if (empty($reshook)) {
// If status pending validation and validator = validator or user, or rights to do for others
if (($object->statut == Holiday::STATUS_VALIDATED || $object->statut == Holiday::STATUS_APPROVED) &&
(!empty($user->admin) || $user->id == $object->fk_validator || $cancreate || $cancreateall)) {
$db->begin();
$db->begin();
$oldstatus = $object->statut;
$object->date_cancel = dol_now();
$object->fk_user_cancel = $user->id;
$object->statut = Holiday::STATUS_CANCELED;
$object->status = Holiday::STATUS_CANCELED;
$oldstatus = $object->statut;
$object->date_cancel = dol_now();
$object->fk_user_cancel = $user->id;
$object->statut = Holiday::STATUS_CANCELED;
$object->status = Holiday::STATUS_CANCELED;
$result = $object->update($user);
$result = $object->update($user);
if ($result >= 0 && $oldstatus == Holiday::STATUS_APPROVED) { // holiday was already validated, status 3, so we must increase back the balance
// Call trigger
@ -863,7 +863,7 @@ if (empty($reshook)) {
$db->rollback();
}
// If no SQL error, we redirect to the request form
// If no SQL error, we redirect to the request form
if (!$error && $result > 0) {
// To
$destinataire = new User($db);
@ -920,20 +920,20 @@ if (empty($reshook)) {
}
/*
// Actions when printing a doc from card
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions when printing a doc from card
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions to send emails
$triggersendname = 'HOLIDAY_SENTBYMAIL';
$autocopy='MAIN_MAIL_AUTOCOPY_HOLIDAY_TO';
$trackid='leav'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
// Actions to send emails
$triggersendname = 'HOLIDAY_SENTBYMAIL';
$autocopy='MAIN_MAIL_AUTOCOPY_HOLIDAY_TO';
$trackid='leav'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
// Actions to build doc
$upload_dir = $conf->holiday->dir_output;
$permissiontoadd = $user->rights->holiday->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
*/
// Actions to build doc
$upload_dir = $conf->holiday->dir_output;
$permissiontoadd = $user->rights->holiday->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
*/
}

View file

@ -1152,7 +1152,7 @@ if ($step == 4 && $datatoimport) {
$entity = (!empty($objimport->array_import_entities[0][$code]) ? $objimport->array_import_entities[0][$code] : $objimport->array_import_icon[0]);
$entityicon = !empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity; // $entityicon must string name of picto of the field like 'project', 'company', 'contact', 'modulename', ...
$entitylang = $entitytolang[$entity] ? $entitytolang[$entity] : $objimport->array_import_label[0]; // $entitylang must be a translation key to describe object the field is related to, like 'Company', 'Contact', 'MyModyle', ...
$entitylang = !empty($entitytolang[$entity]) ? $entitytolang[$entity] : $objimport->array_import_label[0]; // $entitylang must be a translation key to describe object the field is related to, like 'Company', 'Contact', 'MyModyle', ...
print '<td class="nowraponall hideonsmartphone" style="font-weight: normal">=> </td>';
print '<td class="nowraponall" style="font-weight: normal">';

View file

@ -84,22 +84,34 @@ if (@file_exists($forcedfile)) {
// If forced install is enabled, replace the post values. These are empty because form fields are disabled.
if ($force_install_noedit) {
$main_dir = detect_dolibarr_main_document_root();
if (!empty($argv[1])) {
$main_dir = $argv[1]; // override when executing the script in command line
if (!empty($argv[3])) {
$main_dir = $argv[3]; // override when executing the script in command line
}
if (!empty($force_install_main_data_root)) {
$main_data_dir = $force_install_main_data_root;
} else {
$main_data_dir = detect_dolibarr_main_data_root($main_dir);
}
if (!empty($argv[4])) {
$main_data_dir = $argv[4]; // override when executing the script in command line
}
$main_url = detect_dolibarr_main_url_root();
if (!empty($argv[5])) {
$main_url = $argv[5]; // override when executing the script in command line
}
if (!empty($force_install_databaserootlogin)) {
$userroot = parse_database_login($force_install_databaserootlogin);
}
if (!empty($argv[6])) {
$userroot = $argv[6]; // override when executing the script in command line
}
if (!empty($force_install_databaserootpass)) {
$passroot = parse_database_pass($force_install_databaserootpass);
}
if (!empty($argv[7])) {
$passroot = $argv[7]; // override when executing the script in command line
}
}
if ($force_install_noedit == 2) {
if (!empty($force_install_type)) {

View file

@ -904,9 +904,9 @@ Permission609=Supprimer les étiquettes
Permission611=Lire les attributs des variantes produits
Permission612=Créer/mettre à jour les attributs des variantes produits
Permission613=Supprimer les attributs des variantes produits
Permission650=Lire les Nomenclatures (BOM)
Permission651=Créer/modifier les Nomenclatures (BOM)
Permission652=Supprimer les Nomenclatures (BOM)
Permission651=Lire les Nomenclatures (BOM)
Permission652=Créer/modifier les Nomenclatures (BOM)
Permission653=Supprimer les Nomenclatures (BOM)
Permission660=Lire les ordres de fabrication (OF)
Permission661=Créer/mettre à jour les ordres de fabrication (OF)
Permission662=Supprimer les ordres de fabrication (OF)

View file

@ -693,10 +693,12 @@ if (empty($reshook)) {
$object->setCategories($categories);
if (!empty($backtopage)) {
$backtopage = preg_replace('/__ID__/', $object->id, $backtopage); // New method to autoselect project after a New on another form object creation
$backtopage = preg_replace('/__ID__/', $object->id, $backtopage); // New method to autoselect parent project after a New on another form object creation
$backtopage = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $backtopage); // New method to autoselect parent after a New on another form object creation
if (preg_match('/\?/', $backtopage)) {
$backtopage .= '&productid='.$object->id; // Old method
}
header("Location: ".$backtopage);
exit;
} else {

View file

@ -2721,18 +2721,18 @@ class Product extends CommonObject
if ($resql) {
$result = $this->db->fetch_array($resql);
$this->multiprices[$i] = $result["price"];
$this->multiprices_ttc[$i] = $result["price_ttc"];
$this->multiprices_min[$i] = $result["price_min"];
$this->multiprices_min_ttc[$i] = $result["price_min_ttc"];
$this->multiprices_base_type[$i] = $result["price_base_type"];
$this->multiprices[$i] = (!empty($result["price"]) ? $result["price"] : 0);
$this->multiprices_ttc[$i] = (!empty($result["price_ttc"]) ? $result["price_ttc"] : 0);
$this->multiprices_min[$i] = (!empty($result["price_min"]) ? $result["price_min"] : 0);
$this->multiprices_min_ttc[$i] = (!empty($result["price_min_ttc"]) ? $result["price_min_ttc"] : 0);
$this->multiprices_base_type[$i] = (!empty($result["price_base_type"]) ? $result["price_base_type"] : '');
// Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on
$this->multiprices_tva_tx[$i] = $result["tva_tx"]; // TODO Add ' ('.$result['default_vat_code'].')'
$this->multiprices_recuperableonly[$i] = $result["recuperableonly"];
$this->multiprices_tva_tx[$i] = (!empty($result["tva_tx"]) ? $result["tva_tx"] : 0); // TODO Add ' ('.$result['default_vat_code'].')'
$this->multiprices_recuperableonly[$i] = (!empty($result["recuperableonly"]) ? $result["recuperableonly"] : 0);
// Price by quantity
$this->prices_by_qty[$i] = $result["price_by_qty"];
$this->prices_by_qty_id[$i] = $result["rowid"];
$this->prices_by_qty[$i] = (!empty($result["price_by_qty"]) ? $result["price_by_qty"] : 0);
$this->prices_by_qty_id[$i] = (!empty($result["rowid"]) ? $result["rowid"] : 0);
// Récuperation de la liste des prix selon qty si flag positionné
if ($this->prices_by_qty[$i] == 1) {
$sql = "SELECT rowid, price, unitprice, quantity, remise_percent, remise, price_base_type";