From e394e5ba43a4f881b5c0fc791302adc73a2b1dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Courtier?= Date: Tue, 18 Apr 2023 11:24:40 +0200 Subject: [PATCH 1/7] FIX: Fiscal year list ref display --- htdocs/accountancy/admin/fiscalyear.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 2eb77815b60..d20ba244375 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -143,6 +143,7 @@ if ($result) { while ($i < $num && $i < $max) { $obj = $db->fetch_object($result); + $fiscalyearstatic->ref = $obj->rowid; $fiscalyearstatic->id = $obj->rowid; print ''; From 3de0a682c1386e9e20cc317222c3fd67710d645f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 18 Apr 2023 16:31:58 +0200 Subject: [PATCH 2/7] FIX for empty shipping --- htdocs/expedition/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index e2220ec6367..3286f97002e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -317,7 +317,7 @@ if (empty($reshook)) { //var_dump($batch_line[2]); - if ($totalqty > 0) { // There is at least one thing to ship + if ($totalqty > 0 && !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) { // There is at least one thing to ship //var_dump($_POST);exit; for ($i = 0; $i < $num; $i++) { $qty = "qtyl".$i; @@ -327,7 +327,7 @@ if (empty($reshook)) { //shipment from multiple stock locations $nbstockline = count($stockLine[$i]); for ($j = 0; $j < $nbstockline; $j++) { - if ($stockLine[$i][$j]['qty'] > 0) { + if ($stockLine[$i][$j]['qty'] > 0 || ($stockLine[$i][$j]['qty'] == 0 && !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS))) { $ret = $object->addline($stockLine[$i][$j]['warehouse_id'], $stockLine[$i][$j]['ix_l'], $stockLine[$i][$j]['qty'], $array_options[$i]); if ($ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -336,7 +336,7 @@ if (empty($reshook)) { } } } else { - if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) { + if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS))) { $ent = "entl".$i; $idl = "idl".$i; $entrepot_id = is_numeric(GETPOST($ent, 'int')) ?GETPOST($ent, 'int') : GETPOST('entrepot_id', 'int'); From d7436d5d8c0d4629393746b7f906e91e3b2fd537 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 18 Apr 2023 16:38:13 +0200 Subject: [PATCH 3/7] fix test --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 3286f97002e..6dbcc538397 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -317,7 +317,7 @@ if (empty($reshook)) { //var_dump($batch_line[2]); - if ($totalqty > 0 && !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) { // There is at least one thing to ship + if ($totalqty > 0 || !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) { // There is at least one thing to ship //var_dump($_POST);exit; for ($i = 0; $i < $num; $i++) { $qty = "qtyl".$i; From b4c196b2fbd636e4645f041b27c811dae5011bef Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 20 Apr 2023 15:50:24 +0200 Subject: [PATCH 4/7] FIX: product notes rights --- htdocs/core/tpl/notes.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 0430ec16e0e..aa7e752fbc0 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -91,7 +91,7 @@ if ($module == 'propal') { } elseif ($module == 'shipping') { $permission = $user->hasRight("expedition", "creer"); } elseif ($module == 'product') { - $permission = $user->hasRight("produit", "creer"); + $permission = $user->hasRight("product", "creer"); } elseif ($module == 'service') { $permission = $user->hasRight("service", "creer"); } elseif ($module == 'ecmfiles') { From 5ec6b2934511ff3fffba9efdcf3ea3af23a58edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alo=C3=AFs=20Micard?= Date: Sun, 23 Apr 2023 14:01:52 +0200 Subject: [PATCH 5/7] Fix order line origin/origin_id when creating from proposal --- htdocs/commande/class/commande.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c636b4e905d..5c38cbdf51d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1325,6 +1325,9 @@ class Commande extends CommonOrder $line->marge_tx = $marginInfos[1]; $line->marque_tx = $marginInfos[2]; + $line->origin = $object->element; + $line->origin_id = $object->lines[$i]->id; + // get extrafields from original line $object->lines[$i]->fetch_optionals(); foreach ($object->lines[$i]->array_options as $options_key => $value) { From 08b81e90912b016b1925eed05470993aa51b4780 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 25 Apr 2023 11:17:27 +0200 Subject: [PATCH 6/7] fix: with auguria when user have only supplier invoie right the Financial top menu is not displayed --- htdocs/core/menus/init_menu_auguria.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 3b173cecb26..f488fc80a8e 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -14,7 +14,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', 16__+MAX_llx_menu__, __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire || ($user->rights->fournisseur->facture->lire || $user->rights->supplier_invoice->lire)', '', 2, 50, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); From 1d235c2fd94a7369d1c55ddfaac59f93057e69bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Apr 2023 11:32:49 +0200 Subject: [PATCH 7/7] FIX Creation of thumbs when images.lib.php was already included --- htdocs/core/class/commonobject.class.php | 10 ++++++++-- htdocs/core/lib/files.lib.php | 14 ++++++++++---- htdocs/core/lib/images.lib.php | 22 ++++++++++++++++++++++ 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7baa35d0f27..af1b077b020 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5687,9 +5687,15 @@ abstract class CommonObject */ public function addThumbs($file) { - global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini, $quality; + require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; // This define also $maxwidthsmall, $quality, ... + $tmparraysize = getDefaultImageSizes(); + $maxwidthsmall = $tmparraysize['maxwidthsmall']; + $maxheightsmall = $tmparraysize['maxheightsmall']; + $maxwidthmini = $tmparraysize['maxwidthmini']; + $maxheightmini = $tmparraysize['maxheightmini']; + //$quality = $tmparraysize['quality']; + $quality = 50; // For thumbs, we force quality to 50 $file_osencoded = dol_osencode($file); if (file_exists($file_osencoded)) { diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 9f067f7ada9..6d15fd180a4 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1690,10 +1690,16 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess $resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destfull, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles, $upload_dir); if (is_numeric($resupload) && $resupload > 0) { // $resupload can be 'ErrorFileAlreadyExists' - global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini; - include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; + $tmparraysize = getDefaultImageSizes(); + $maxwidthsmall = $tmparraysize['maxwidthsmall']; + $maxheightsmall = $tmparraysize['maxheightsmall']; + $maxwidthmini = $tmparraysize['maxwidthmini']; + $maxheightmini = $tmparraysize['maxheightmini']; + //$quality = $tmparraysize['quality']; + $quality = 50; // For thumbs, we force quality to 50 + // Generate thumbs. if ($generatethumbs) { if (image_format_supported($destfull) == 1) { @@ -1701,10 +1707,10 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess // We can't use $object->addThumbs here because there is no $object known // Used on logon for example - $imgThumbSmall = vignette($destfull, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs"); + $imgThumbSmall = vignette($destfull, $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs"); // Create mini thumbs for image (Ratio is near 16/9) // Used on menu or for setup page for example - $imgThumbMini = vignette($destfull, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs"); + $imgThumbMini = vignette($destfull, $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); } } diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 37cc70760eb..6892e22df41 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -23,12 +23,34 @@ */ // Define size of logo small and mini +// TODO Remove this and call getDefaultImageSizes() instead $maxwidthsmall = 480; $maxheightsmall = 270; // Near 16/9eme $maxwidthmini = 128; $maxheightmini = 72; // 16/9eme $quality = 80; +/** + * Return default values for image sizes + * + * @return array Array of default values + */ +function getDefaultImageSizes() +{ + $maxwidthsmall = 480; + $maxheightsmall = 270; // Near 16/9eme + $maxwidthmini = 128; + $maxheightmini = 72; // 16/9eme + $quality = 80; + + return array( + 'maxwidthsmall' => $maxwidthsmall, + 'maxheightsmall' => $maxheightsmall, + 'maxwidthmini' => $maxwidthmini, + 'maxheightmini' => $maxheightmini, + 'quality' => $quality + ); +} /** * Return if a filename is file name of a supported image format