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

This commit is contained in:
Laurent Destailleur 2023-12-06 16:18:41 +01:00
commit 8896ae4800
6 changed files with 23 additions and 8 deletions

View file

@ -181,7 +181,7 @@ foreach ($dirbarcode as $reldir) {
}
if ($module->isEnabled()) {
$barcodelist[$filebis] = $module->info();
$barcodelist[$filebis] = $module->info($langs);
}
}
}

View file

@ -542,6 +542,8 @@ class Categorie extends CommonObject
*/
public function update(User $user)
{
global $langs;
$error = 0;
// Clean parameters

View file

@ -462,7 +462,7 @@ if (empty($reshook)) {
$tva_tx = GETPOST('tva_tx', 'alpha');
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef), 2) : 0);
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef), '', 2) : 0);
if (empty($remise_percent)) {
$remise_percent = 0;
}
@ -766,7 +766,7 @@ if (empty($reshook)) {
// TODO Use object->updateline instead objedtline->update
$price_ht = price2num(GETPOST('elprice'), 'MU');
$remise_percent = price2num(GETPOST('elremise_percent'), 2);
$remise_percent = price2num(GETPOST('elremise_percent'), '', 2);
if ($remise_percent > 0) {
$remise = round(($price_ht * $remise_percent / 100), 2);
$price_ht = ($price_ht - $remise);

View file

@ -18,7 +18,7 @@ insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, left
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 16__+MAX_llx_menu__, 'bom|mrp', 'isModEnabled("bom") || isModEnabled("mrp")', __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&amp;leftmenu=', 'MRP', -1, 'mrp', '$user->hasRight("bom","read") || $user->hasRight("mrp","read")', '', 0, 31, __ENTITY__, '<span class="fas fa-cubes fa-fw pictofixedwidth" style=" color: #a69944;"></span>');
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 7__+MAX_llx_menu__, 'projet', 'isModEnabled("project")', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&amp;leftmenu=', 'Projects', -1, 'projects', '$user->hasRight("projet","lire")', '', 2, 32, __ENTITY__, '<span class="fas fa-project-diagram em088 infobox-project fa-fw pictofixedwidth" style=""></span>');
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 5__+MAX_llx_menu__, 'propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', 'isModEnabled("propal") || isModEnabled("commande") || isModEnabled("supplier_order") || isModEnabled("contrat") || isModEnabled("ficheinter")', __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&amp;leftmenu=', 'Commercial', -1, 'commercial', '$user->hasRight("societe","lire") || $user->hasRight("societe","contact","lire")', '', 2, 40, __ENTITY__, '<span class="fas fa-suitcase em092 infobox-contrat fa-fw pictofixedwidth" style=""></span>');
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("facture") || isModEnabled("don") || isModEnabled("tax") || isModEnabled("salaries") || isModEnabled("supplier_invoice") || isModEnabled("loan") || isModEnabled("banque")', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&amp;leftmenu=', 'MenuFinancial', -1, 'compta', '$user->hasRight('facture','lire') || $user->hasRight('don','lire') || $user->hasRight('tax','charges','lire') || $user->hasRight('salaries','read') || $user->hasRight('loan','read') || $user->hasRight("banque","lire") || $user->hasRight("fournisseur","facture","lire") || $user->hasRight("supplier_invoice","read")', '', 2, 50, __ENTITY__, '<span class="fas fa-file-invoice-dollar infobox-commande fa-fw pictofixedwidth" style=""></span>');
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("facture") || isModEnabled("don") || isModEnabled("tax") || isModEnabled("salaries") || isModEnabled("supplier_invoice") || isModEnabled("loan") || isModEnabled("banque")', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&amp;leftmenu=', 'MenuFinancial', -1, 'compta', '$user->hasRight("facture","lire") || $user->hasRight("don","lire") || $user->hasRight("tax","charges","lire") || $user->hasRight("salaries","read") || $user->hasRight("loan","read") || $user->hasRight("banque","lire") || $user->hasRight("fournisseur","facture","lire") || $user->hasRight("supplier_invoice","read")', '', 2, 50, __ENTITY__, '<span class="fas fa-file-invoice-dollar infobox-commande fa-fw pictofixedwidth" style=""></span>');
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 14__+MAX_llx_menu__, 'banque|prelevement', 'isModEnabled("banque") || isModEnabled("prelevement")', __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&amp;leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->hasRight("banque","lire") || $user->hasRight("prelevement","bons","lire")', '', 0, 52, __ENTITY__, '<span class="fas fa-university infobox-bank_account fa-fw pictofixedwidth" style=""></span>');
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 9__+MAX_llx_menu__, 'comptabilite|accounting|asset', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("asset")', __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&amp;leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->hasRight("compta","resultat","lire") || $user->hasRight("accounting","mouvements","lire") || $user->hasRight("asset","read")', '', 2, 54, __ENTITY__, '<span class="fas fa-search-dollar infobox-bank_account fa-fw pictofixedwidth" style=""></span>');
insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity, prefix) values ( 8__+MAX_llx_menu__, '', '', __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&amp;leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__, '<span class="fas fa-tools fa-fw pictofixedwidth" style=""></span>');

View file

@ -510,6 +510,7 @@ if (empty($reshook)) {
dol_print_error($db, $object->error);
}
} elseif ($action == "setabsolutediscount" && $usercancreate) {
$db->begin();
// We use the credit to reduce amount of invoice
if (GETPOST("remise_id", "int")) {
$ret = $object->fetch($id);
@ -530,7 +531,8 @@ if (empty($reshook)) {
//var_dump($object->getRemainToPay(0));
//var_dump($discount->amount_ttc);exit;
if (price2num($discount->amount_ttc) > price2num($object->getRemainToPay(0))) {
$remaintopay = $object->getRemainToPay(0);
if (price2num($discount->amount_ttc) > price2num($remaintopay)) {
// TODO Split the discount in 2 automatically
$error++;
setEventMessages($langs->trans("ErrorDiscountLargerThanRemainToPaySplitItBefore"), null, 'errors');
@ -539,12 +541,23 @@ if (empty($reshook)) {
if (!$error) {
$result = $discount->link_to_invoice(0, $id);
if ($result < 0) {
$error++;
setEventMessages($discount->error, $discount->errors, 'errors');
}
}
if (!$error) {
$newremaintopay = $object->getRemainToPay(0);
if ($newremaintopay == 0) {
$object->setPaid($user);
}
}
}
if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
if (!$error) {
$db->commit();
} else {
$db->rollback();
}
if (empty($error) && !getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
$outputlangs = $langs;
$newlang = '';
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {

View file

@ -959,7 +959,7 @@ if (empty($reshook)) {
}
if (!$variants) {
if (!$variants || getDolGlobalString('VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT')) {
/*
* Stock detail (by warehouse). May go down into batch details.
*/