From cefc8dcca2fd4e5fda774b5bf54610e3fa801a51 Mon Sep 17 00:00:00 2001 From: Marc Guenneugues Date: Sat, 6 Jun 2020 11:39:49 +0200 Subject: [PATCH 01/14] replenish : select expedition quantities only from opened orders when using virtual stocks --- htdocs/product/stock/replenish.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index feba2dbafcb..dbf07c92d01 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -376,8 +376,11 @@ if ($usevirtualstock) $sqlExpeditionsCli = "(SELECT ".$db->ifsql("SUM(ed2.qty) IS NULL", "0", "SUM(ed2.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL $sqlExpeditionsCli .= " FROM ".MAIN_DB_PREFIX."expedition as e2,"; $sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."expeditiondet as ed2,"; + $sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."commande as c2,"; $sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."commandedet as cd2"; $sqlExpeditionsCli .= " WHERE ed2.fk_expedition = e2.rowid AND cd2.rowid = ed2.fk_origin_line AND e2.entity IN (".getEntity('expedition').")"; + $sqlExpeditionsCli .= " AND cd2.fk_commande = c2.rowid"; + $sqlExpeditionsCli .= " AND c2.fk_statut IN (1,2)"; $sqlExpeditionsCli .= " AND cd2.fk_product = p.rowid"; $sqlExpeditionsCli .= " AND e2.fk_statut IN (1,2))"; } else { From b221c651654afa80e86fe2c8d9fc477be2ee635d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Jun 2020 21:56:23 +0200 Subject: [PATCH 02/14] Merge --- htdocs/core/class/commonobject.class.php | 10 ++++++++-- htdocs/modulebuilder/template/class/myobject.class.php | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 740645c8c8e..a13af375542 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -443,13 +443,19 @@ abstract class CommonObject public $next_prev_filter; + /** + * @var array List of child tables. To test if we can delete object. + */ + protected $childtables = array(); + /** * @var array List of child tables. To know object to delete on cascade. - * if name like with @ClassNAme:FilePathClass;ParentFkFieldName' it will - * call method deleteByParentField(parentId,ParentFkFieldName) to fetch and delete child object + * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will + * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object */ protected $childtablesoncascade = array(); + // No constructor as it is an abstract class /** * Check an object id/ref exists diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 03fffaaba5d..9a15aa59836 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -196,7 +196,9 @@ class MyObject extends CommonObject //protected $childtables = array(); /** - * @var array List of child tables. To know object to delete on cascade. + * @var array List of child tables. To know object to delete on cascade. + * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will + * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object */ //protected $childtablesoncascade = array('mymodule_myobjectdet'); From 115b82711523ac6fda8542d472d541bf4159ab58 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Jun 2020 22:52:36 +0200 Subject: [PATCH 03/14] Prepare v12 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index eda59d8e0bb..1697037619f 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (!defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr'); -if (!defined('DOL_VERSION')) define('DOL_VERSION', '12.0.0-beta'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (!defined('DOL_VERSION')) define('DOL_VERSION', '12.0.0'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (!defined('EURO')) define('EURO', chr(128)); From 4169aa716cf2186e9bebec2602a497699de0f048 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Jun 2020 00:23:20 +0200 Subject: [PATCH 04/14] FIX can install module even if (x) was appended during download. --- htdocs/admin/modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 72eb8240c10..b11808a2365 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -118,6 +118,7 @@ if ($action == 'install') // $original_file should match format module_modulename-x.y[.z].zip $original_file = basename($_FILES["fileinstall"]["name"]); + $original_file = preg_replace('/\(\d+\)\.zip$/i', '.zip', $original_file); $newfile = $conf->admin->dir_temp.'/'.$original_file.'/'.$original_file; if (!$original_file) From 04f68d25cd29592544614c3da2160a2c828b89a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Jun 2020 01:34:26 +0200 Subject: [PATCH 05/14] css --- htdocs/index.php | 6 +++--- htdocs/theme/eldy/global.inc.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/index.php b/htdocs/index.php index 1ad2d1b4f64..1e6b7bcf210 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -898,10 +898,10 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) $boxstat .= ''."\n"; $boxstat .= '
'; $boxstat .= ''; - $boxstat .= ''; - $boxstat .= ''; + $boxstat .= ''; $boxstat .= ''; $boxstat .= '
'; + $boxstat .= '
'; $boxstat .= '
'.$langs->trans("DolibarrStateBoard").'
'; - $boxstat .= ''; + $boxstat .= '
'; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index b3383a1d72c..d8c3cc81b5c 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1373,7 +1373,7 @@ td.showDragHandle { .side-nav { display: table-cell; - border-: 1px solid #d0d0d0; + border-: 1px solid #E0E0E0; box-shadow: 3px 0 6px -2px #eee; background: var(--colorbackvmenu1); transition: left 0.5s ease; From 42d44e996f38a09477783195e1d0151b6d14699b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Jun 2020 13:49:49 +0200 Subject: [PATCH 06/14] Fix link to setup page --- htdocs/admin/defaultvalues.php | 2 +- htdocs/admin/translation.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 094c4a8dd7c..6e315f4f23c 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -185,7 +185,7 @@ if ($action == 'delete') $form = new Form($db); $formadmin = new FormAdmin($db); -$wikihelp = 'EN:Setup|FR:Paramétrage|ES:Configuración'; +$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; llxHeader('', $langs->trans("Setup"), $wikihelp); $param = '&mode='.$mode; diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 05bfe39bb54..ecc25c58509 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -197,7 +197,7 @@ if ($action == 'delete') $form = new Form($db); $formadmin = new FormAdmin($db); -$wikihelp = 'EN:Setup|FR:Paramétrage|ES:Configuración'; +$wikihelp = 'EN:Setup Translation|FR:Paramétrage traduction|ES:Configuración'; llxHeader('', $langs->trans("Setup"), $wikihelp); $param = '&mode='.$mode; From 7b53ee2a6ff2abe9874b8497ab41e0ff75fcb410 Mon Sep 17 00:00:00 2001 From: Vaadasch Date: Sat, 6 Jun 2020 15:46:43 +0200 Subject: [PATCH 07/14] Update byratecountry.php Add "cc.code" in the "GROUP BY" clause. Error in PGSQL if absent. Add ORDER BY country / product_type / vatrate --- htdocs/compta/stats/byratecountry.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index acd58f90217..1e2890f57fa 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -275,7 +275,9 @@ if ($modecompta == 'CREANCES-DETTES') { $sql .= " AND f.type IN (0,1,2,3,5)"; } $sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; - $sql .= " GROUP BY fd.tva_tx,fd.product_type, cc.label "; + $sql .= " GROUP BY fd.tva_tx,fd.product_type, cc.label, cc.code "; + $sql .= " ORDER BY country, product_type, vatrate"; + dol_syslog("htdocs/compta/tva/index.php sql=".$sql, LOG_DEBUG); $resql = $db->query($sql); @@ -356,7 +358,8 @@ if ($modecompta == 'CREANCES-DETTES') { $sql .= " AND ff.type IN (0,1,2,3,5)"; } $sql2 .= " AND ff.entity IN (".getEntity("facture_fourn", 0).")"; - $sql2 .= " GROUP BY ffd.tva_tx, ffd.product_type, cc.label"; + $sql2 .= " GROUP BY ffd.tva_tx, ffd.product_type, cc.label, cc.code "; + $sql2 .= " ORDER BY country, product_type, vatrate"; //print $sql2; dol_syslog("htdocs/compta/tva/index.php sql=".$sql, LOG_DEBUG); From bd12972d7b1519ab6bccf986c9217152d6045829 Mon Sep 17 00:00:00 2001 From: Marc Guenneugues Date: Sat, 6 Jun 2020 11:39:49 +0200 Subject: [PATCH 08/14] replenish : select expedition quantities only from opened orders when using virtual stocks --- htdocs/product/stock/replenish.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 358ca742361..5f3ac1fd187 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -377,8 +377,11 @@ if ($usevirtualstock) $sqlExpeditionsCli = "(SELECT ".$db->ifsql("SUM(ed2.qty) IS NULL", "0", "SUM(ed2.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL $sqlExpeditionsCli .= " FROM ".MAIN_DB_PREFIX."expedition as e2,"; $sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."expeditiondet as ed2,"; + $sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."commande as c2,"; $sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."commandedet as cd2"; $sqlExpeditionsCli .= " WHERE ed2.fk_expedition = e2.rowid AND cd2.rowid = ed2.fk_origin_line AND e2.entity IN (".getEntity('expedition').")"; + $sqlExpeditionsCli .= " AND cd2.fk_commande = c2.rowid"; + $sqlExpeditionsCli .= " AND c2.fk_statut IN (1,2)"; $sqlExpeditionsCli .= " AND cd2.fk_product = p.rowid"; $sqlExpeditionsCli .= " AND e2.fk_statut IN (1,2))"; } else { From 180a0a45572b038f4234ac336752d8ffb50a8b56 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Jun 2020 18:30:46 +0200 Subject: [PATCH 09/14] Info for debug --- htdocs/compta/facture/class/facture.class.php | 5 +++-- htdocs/install/mysql/migration/repair.sql | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 1558b6cbfab..12d60b067fa 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1584,7 +1584,8 @@ class Facture extends CommonInvoice } /** - * Fetch previous and next situations invoices + * Fetch previous and next situations invoices. + * Return all previous and next invoices (both standard and credit notes). * * @return void */ @@ -1595,7 +1596,7 @@ class Facture extends CommonInvoice $this->tab_previous_situation_invoice = array(); $this->tab_next_situation_invoice = array(); - $sql = 'SELECT rowid, situation_counter FROM '.MAIN_DB_PREFIX.'facture WHERE rowid <> '.$this->id.' AND entity = '.$conf->entity.' AND situation_cycle_ref = '.(int) $this->situation_cycle_ref.' ORDER BY situation_counter ASC'; + $sql = 'SELECT rowid, type, situation_cycle_ref, situation_counter FROM '.MAIN_DB_PREFIX.'facture WHERE rowid <> '.$this->id.' AND entity = '.$conf->entity.' AND situation_cycle_ref = '.(int) $this->situation_cycle_ref.' ORDER BY situation_counter ASC'; dol_syslog(get_class($this).'::fetchPreviousNextSituationInvoice ', LOG_DEBUG); $result = $this->db->query($sql); diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index fe0eaff767a..86c37198347 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -476,7 +476,7 @@ UPDATE llx_accounting_bookkeeping set date_creation = tms where date_creation IS -- Test inconsistency of data into situation invoices: If it differs, it may be the total_ht that is wrong and situation_percent that is good. --- select f.rowid, f.type, qty, subprice, situation_percent, total_ht, total_ttc, total_tva, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc, (situation_percent / 100 * subprice * qty * (1 - (fd.remise_percent / 100))) +-- select f.rowid, f.type, fd.qty, fd.subprice, fd.situation_percent, fd.total_ht, fd.total_ttc, fd.total_tva, fd.multicurrency_total_ht, fd.multicurrency_total_tva, fd.multicurrency_total_ttc, (situation_percent / 100 * subprice * qty * (1 - (fd.remise_percent / 100))) -- from llx_facturedet as fd, llx_facture as f where fd.fk_facture = f.rowid AND (total_ht - situation_percent / 100 * subprice * qty * (1 - (fd.remise_percent / 100))) > 0.01 and f.type = 5; From 4020d9736206f97ed880fb4737623da5bc87f561 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Jun 2020 18:36:58 +0200 Subject: [PATCH 10/14] FIX Can create a credit note on situation invoice if previous is also credit note --- htdocs/compta/facture/card.php | 63 +++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index b97d22631a1..a134afba603 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -990,6 +990,11 @@ if (empty($reshook)) } $id = $object->create($user); + // NOTE: Pb with situation invoice + // NOTE: fields total on situation invoice are stored as cumulative values on total of lines (bad) but delta on invoice total + // NOTE: fields total on credit note are stored as delta both on total of lines and on invoice total (good) + // NOTE: fields situation_percent on situation invoice are stored as cumulative values on lines (bad) + // NOTE: fields situation_percent on credit note are stored as delta on lines (good) if (GETPOST('invoiceAvoirWithLines', 'int')==1 && $id>0) { if (!empty($facture_source->lines)) @@ -1010,36 +1015,38 @@ if (empty($reshook)) } - - - if($facture_source->type == Facture::TYPE_SITUATION) + if ($facture_source->type == Facture::TYPE_SITUATION) { $source_fk_prev_id = $line->fk_prev_id; // temporary storing situation invoice fk_prev_id - $line->fk_prev_id = $line->id; // Credit note line need to be linked to the situation invoice it is create from + $line->fk_prev_id = $line->id; // The new line of the new credit note we are creating must be linked to the situation invoice line it is created from - if(!empty($facture_source->tab_previous_situation_invoice)) + if (!empty($facture_source->tab_previous_situation_invoice)) { - // search the last invoice in cycle - $lineIndex = count($facture_source->tab_previous_situation_invoice) - 1; + // search the last standard invoice in cycle and the possible credit note between this last and facture_source + // TODO Move this out of loop of $facture_source->lines + $tab_jumped_credit_notes = array(); + $lineIndex = count($facture_source->tab_previous_situation_invoice) - 1; $searchPreviousInvoice = true; - while( $searchPreviousInvoice ) + while ($searchPreviousInvoice) { - if($facture_source->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_SITUATION || $lineIndex < 1) + if ($facture_source->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_SITUATION || $lineIndex < 1) { $searchPreviousInvoice=false; // find, exit; break; } else { + if ($facture_source->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_CREDIT_NOTE) { + $tab_jumped_credit_notes[$lineIndex] = $facture_source->tab_previous_situation_invoice[$lineIndex]->id; + } $lineIndex--; // go to previous invoice in cycle } } - $maxPrevSituationPercent = 0; - foreach($facture_source->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine) + foreach ($facture_source->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine) { - if($prevLine->id == $source_fk_prev_id) + if ($prevLine->id == $source_fk_prev_id) { $maxPrevSituationPercent = max($maxPrevSituationPercent, $prevLine->situation_percent); @@ -1059,6 +1066,36 @@ if (empty($reshook)) // prorata $line->situation_percent = $maxPrevSituationPercent - $line->situation_percent; + + //print 'New line based on invoice id '.$facture_source->tab_previous_situation_invoice[$lineIndex]->id.' fk_prev_id='.$source_fk_prev_id.' will be fk_prev_id='.$line->fk_prev_id.' '.$line->total_ht.' '.$line->situation_percent.'
'; + + // If there is some credit note between last situation invoice and invoice used for credit note generation (note: credit notes are stored as delta) + $maxPrevSituationPercent = 0; + foreach ($tab_jumped_credit_notes as $index => $creditnoteid) { + foreach ($facture_source->tab_previous_situation_invoice[$index]->lines as $prevLine) + { + if ($prevLine->fk_prev_id == $source_fk_prev_id) + { + $maxPrevSituationPercent = $prevLine->situation_percent; + + $line->total_ht -= $prevLine->total_ht; + $line->total_tva -= $prevLine->total_tva; + $line->total_ttc -= $prevLine->total_ttc; + $line->total_localtax1 -= $prevLine->total_localtax1; + $line->total_localtax2 -= $prevLine->total_localtax2; + + $line->multicurrency_subprice -= $prevLine->multicurrency_subprice; + $line->multicurrency_total_ht -= $prevLine->multicurrency_total_ht; + $line->multicurrency_total_tva -= $prevLine->multicurrency_total_tva; + $line->multicurrency_total_ttc -= $prevLine->multicurrency_total_ttc; + } + } + } + + // prorata + $line->situation_percent += $maxPrevSituationPercent; + + //print 'New line based on invoice id '.$facture_source->tab_previous_situation_invoice[$lineIndex]->id.' fk_prev_id='.$source_fk_prev_id.' will be fk_prev_id='.$line->fk_prev_id.' '.$line->total_ht.' '.$line->situation_percent.'
'; } } @@ -1078,7 +1115,7 @@ if (empty($reshook)) $line->multicurrency_total_tva = -$line->multicurrency_total_tva; $line->multicurrency_total_ttc = -$line->multicurrency_total_ttc; - $result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked + $result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount already linked $object->lines[] = $line; // insert new line in current object From 2a1d54726711a296394774bbea4dff7c5543f749 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Jun 2020 18:44:37 +0200 Subject: [PATCH 11/14] Celan dead code --- htdocs/core/lib/files.lib.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 494540b14d7..47d16d4fe3f 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2986,20 +2986,11 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, exit; } - /*$perm = GETPOST('perm', 'aZ09'); - $subperm = GETPOST('subperm', 'aZ09'); - if ($perm || $subperm) - { - if (($perm && !$subperm && $fuser->rights->$modulepart->$perm) || ($perm && $subperm && $fuser->rights->$modulepart->$perm->$subperm)) $accessallowed = 1; - } - else - {*/ // Check fuser->rights->modulepart->myobject->read and fuser->rights->modulepart->read $partsofdirinoriginalfile = explode('/', $original_file); $partofdirinoriginalfile = $partsofdirinoriginalfile[0]; if ($partofdirinoriginalfile && ($fuser->rights->$modulepart->$partofdirinoriginalfile->{$lire} || $fuser->rights->$modulepart->$partofdirinoriginalfile->{$read})) $accessallowed = 1; if ($fuser->rights->$modulepart->{$lire} || $fuser->rights->$modulepart->{$read}) $accessallowed = 1; - //} $original_file = $conf->$modulepart->dir_output.'/'.$original_file; } From 81c80b254ea6d43ba280fed993a901391a20b542 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Jun 2020 19:25:25 +0200 Subject: [PATCH 12/14] Fix lang property on database menu entry was not propagated --- htdocs/core/class/menu.class.php | 4 ++-- htdocs/core/class/menubase.class.php | 1 + htdocs/core/menus/standard/eldy.lib.php | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/menu.class.php b/htdocs/core/class/menu.class.php index 040cb4a3552..60bf6474031 100644 --- a/htdocs/core/class/menu.class.php +++ b/htdocs/core/class/menu.class.php @@ -52,7 +52,7 @@ class Menu * Add a menu entry into this->liste (at end) * * @param string $url Url to follow on click (does not include DOL_URL_ROOT) - * @param string $titre Label of menu to add + * @param string $titre Label of menu to add. The value must already be translated. * @param integer $level Level of menu to add * @param int $enabled Menu active or not (0=Not active, 1=Active, 2=Active but grey) * @param string $target Target link @@ -75,7 +75,7 @@ class Menu * * @param int $idafter Array key after which inserting new entry * @param string $url Url to follow on click - * @param string $titre Label of menu to add + * @param string $titre Label of menu to add. The value must already be translated. * @param integer $level Level of menu to add * @param int $enabled Menu active or not * @param string $target Target link diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 72ff932bfa6..b73492d41fb 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -725,6 +725,7 @@ class Menubase $tabMenu[$b]['mainmenu'] = $menu['mainmenu']; $tabMenu[$b]['leftmenu'] = $menu['leftmenu']; $tabMenu[$b]['perms'] = $perms; + $tabMenu[$b]['langs'] = $menu['langs']; $tabMenu[$b]['enabled'] = $enabled; $tabMenu[$b]['type'] = $menu['type']; //$tabMenu[$b]['langs'] = $menu['langs']; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 661eded1b33..cc47218e2db 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; * @param DoliDB $db Database handler * @param string $atarget Target (Example: '' or '_top') * @param int $type_user 0=Menu for backoffice, 1=Menu for front office - * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty). For eldy menu, it contains menu entries loaded from database. * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout 1=Disable output (Initialise &$menu only). * @param string $mode 'top', 'topnb', 'left', 'jmobile' @@ -49,6 +49,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $mainmenu = (empty($_SESSION["mainmenu"]) ? '' : $_SESSION["mainmenu"]); $leftmenu = (empty($_SESSION["leftmenu"]) ? '' : $_SESSION["leftmenu"]); + $id = 'mainmenu'; $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); From 09047dc19c9e73f2899828b682cdede17ab71704 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Jun 2020 19:26:37 +0200 Subject: [PATCH 13/14] Doc --- htdocs/core/class/menubase.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index b73492d41fb..a6d774090aa 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -725,10 +725,9 @@ class Menubase $tabMenu[$b]['mainmenu'] = $menu['mainmenu']; $tabMenu[$b]['leftmenu'] = $menu['leftmenu']; $tabMenu[$b]['perms'] = $perms; - $tabMenu[$b]['langs'] = $menu['langs']; + $tabMenu[$b]['langs'] = $menu['langs']; // Note that this should not be used, lang file should be already loaded. $tabMenu[$b]['enabled'] = $enabled; $tabMenu[$b]['type'] = $menu['type']; - //$tabMenu[$b]['langs'] = $menu['langs']; $tabMenu[$b]['fk_mainmenu'] = $menu['fk_mainmenu']; $tabMenu[$b]['fk_leftmenu'] = $menu['fk_leftmenu']; $tabMenu[$b]['position'] = (int) $menu['position']; From 9f8a3916c22d286a56f33e862aea215acb0e51f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Jun 2020 19:37:42 +0200 Subject: [PATCH 14/14] FIX #14051 #14052 --- .../modulebuilder/template/core/modules/modMyModule.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 3deba218b59..10cdfa54001 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -269,7 +269,7 @@ class modMyModule extends DolibarrModules $this->menu[$r++] = array( 'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type'=>'top', // This is a Top menu entry - 'titre'=>'MyModule', + 'titre'=>'ModuleMyModuleName', 'mainmenu'=>'mymodule', 'leftmenu'=>'', 'url'=>'/mymodule/mymoduleindex.php',