From 5e2d8eac2b13bbce11fbf4a9d4094cec5a369b87 Mon Sep 17 00:00:00 2001 From: Laurent De Coninck Date: Mon, 20 Sep 2021 22:51:43 +0200 Subject: [PATCH 01/77] Allow to edit the header of receipt by using HTML In the current version the WYSIWYG oesn't allow any HTML by thus fix you can use any button from the wysiwyg and it displays on the receipe. [see: X] --- htdocs/takepos/admin/receipt.php | 4 ++-- htdocs/takepos/receipt.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 01873d317c4..61fd71bdf29 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -42,8 +42,8 @@ if (GETPOST('action', 'alpha') == 'set') { $db->begin(); - $res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'none'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'none'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_RECEIPT_NAME", GETPOST('TAKEPOS_RECEIPT_NAME', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SHOW_CUSTOMER", GETPOST('TAKEPOS_SHOW_CUSTOMER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity); diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 6a305362839..a37c4a6c880 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -109,7 +109,7 @@ if (!empty($conf->global->TAKEPOS_HEADER) || !empty($conf->global->{$constFreeTe $substitutionarray = getCommonSubstitutionArray($langs); if (!empty($conf->global->TAKEPOS_HEADER)) $newfreetext .= make_substitutions($conf->global->TAKEPOS_HEADER, $substitutionarray); if (!empty($conf->global->{$constFreeText})) $newfreetext .= make_substitutions($conf->global->{$constFreeText}, $substitutionarray); - print $newfreetext; + print nl2br($newfreetext); } ?>

From c89468428e5417d7ba3f15c6ed3c9aadc99761f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Tue, 21 Sep 2021 11:22:59 +0200 Subject: [PATCH 02/77] add warehouse in projects elements count --- htdocs/core/lib/project.lib.php | 5 ++++- htdocs/projet/element.php | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 722f99d3b69..4e4adaf9d3e 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -126,7 +126,7 @@ function project_prepare_head(Project $project, $moreparam = '') if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || !empty($conf->contrat->enabled) - || !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled)) { + || !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled) || !empty($conf->stock->enabled)) { $nbElements = 0; // Enable caching of thirdrparty count Contacts $cachekey = 'count_elements_project_'.$project->id; @@ -134,6 +134,9 @@ function project_prepare_head(Project $project, $moreparam = '') if (!is_null($dataretrieved)) { $nbElements = $dataretrieved; } else { + if (!empty ($conf->stock->enabled)) { + $nbElements += $project->getElementCount('stock', 'entrepot', 'fk_project'); + } if (!empty($conf->propal->enabled)) { $nbElements += $project->getElementCount('propal', 'propal'); } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 7fcfe3bc92b..9e14a53e7ea 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -36,6 +36,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +if (!empty($conf->stock->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; +} if (!empty($conf->propal->enabled)) { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; } From 6c7c6c9efd6d0fa491fa814498e58a3e1e60595c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Sep 2021 12:47:06 +0200 Subject: [PATCH 03/77] FIX legal issue on expense report pdf (must also show price without tax) --- .../doc/pdf_standard.modules.php | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index b1f48450d0d..f5862bfc5f2 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -175,10 +175,11 @@ class pdf_standard extends ModeleExpenseReport //$this->posxdate=88; //$this->posxtype=107; //$this->posxprojet=120; - $this->posxtva = 130; - $this->posxup = 145; - $this->posxqty = 168; - $this->postotalttc = 178; + $this->posxtva = 112; + $this->posxup = 127; + $this->posxqty = 150; + $this->postotalht = 160; + $this->postotalttc = 180; // if (empty($conf->projet->enabled)) { // $this->posxtva-=20; // $this->posxup-=20; @@ -642,11 +643,15 @@ class pdf_standard extends ModeleExpenseReport // Quantity $pdf->SetXY($this->posxqty, $curY); - $pdf->MultiCell($this->postotalttc - $this->posxqty - 0.8, 4, $object->lines[$linenumber]->qty, 0, 'R'); + $pdf->MultiCell($this->postotalht - $this->posxqty - 0.8, 4, $object->lines[$linenumber]->qty, 0, 'R'); + + // Total without taxes + $pdf->SetXY($this->postotalht, $curY); + $pdf->MultiCell($this->postotalttc - $this->postotalht - 0.8, 4, price($object->lines[$linenumber]->total_ht), 0, 'R'); // Total with all taxes $pdf->SetXY($this->postotalttc - 1, $curY); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc, 4, price($object->lines[$linenumber]->total_ttc), 0, 'R'); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc + 1, 4, price($object->lines[$linenumber]->total_ttc), 0, 'R'); // Comments $pdf->SetXY($this->posxcomment, $curY); @@ -950,14 +955,14 @@ class pdf_standard extends ModeleExpenseReport // Accountancy piece if (empty($hidetop)) { $pdf->SetXY($this->posxpiece - 1, $tab_top + 1); - $pdf->MultiCell($this->posxcomment - $this->posxpiece - 1, 1, '', '', 'R'); + $pdf->MultiCell($this->posxcomment - $this->posxpiece - 0.8, 1, '', '', 'R'); } // Comments $pdf->line($this->posxcomment - 1, $tab_top, $this->posxcomment - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxcomment - 1, $tab_top + 1); - $pdf->MultiCell($this->posxdate - $this->posxcomment - 1, 1, $outputlangs->transnoentities("Description"), '', 'L'); + $pdf->MultiCell($this->posxdate - $this->posxcomment - 0.8, 1, $outputlangs->transnoentities("Description"), '', 'L'); } // Date @@ -990,7 +995,7 @@ class pdf_standard extends ModeleExpenseReport if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxtva - 1, $tab_top + 1); + $pdf->SetXY($this->posxtva - 0.8, $tab_top + 1); $pdf->MultiCell($this->posxup - $this->posxtva - 1, 2, $outputlangs->transnoentities("VAT"), '', 'C'); } } @@ -998,22 +1003,29 @@ class pdf_standard extends ModeleExpenseReport // Unit price $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxup - 1, $tab_top + 1); - $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceU"), '', 'C'); + $pdf->SetXY($this->posxup - 0.8, $tab_top + 1); + $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUTTC"), '', 'C'); } // Quantity $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxqty - 1, $tab_top + 1); - $pdf->MultiCell($this->postotalttc - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); + $pdf->SetXY($this->posxqty - 0.8, $tab_top + 1); + $pdf->MultiCell($this->postotalht - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); + } + + // Total without taxes + $pdf->line($this->postotalht - 1, $tab_top, $this->postotalht - 1, $tab_top + $tab_height); + if (empty($hidetop)) { + $pdf->SetXY($this->postotalht - 0.8, $tab_top + 1); + $pdf->MultiCell($this->postotalttc - $this->postotalht + 1, 2, $outputlangs->transnoentities("TotalHT"), '', 'C'); } // Total with all taxes $pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->postotalttc - 1, $tab_top + 1); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"), '', 'R'); + $pdf->SetXY($this->postotalttc - 0.8, $tab_top + 1); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc + 1, 2, $outputlangs->transnoentities("TotalTTC"), '', 'R'); } $pdf->SetTextColor(0, 0, 0); From d91d14d10c9fd3e87185647188aee6962009baa8 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 22 Sep 2021 12:48:05 +0200 Subject: [PATCH 04/77] FIX init hookmanager after loading $conf values --- htdocs/install/upgrade2.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 83be835b64a..ea71b1947e7 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -144,11 +144,6 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port); - // Create the global $hookmanager object - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager = new HookManager($db); - $hookmanager->initHooks(array('upgrade')); - if (!$db->connected) { print ''.$langs->trans("ErrorFailedToConnectToDatabase", $conf->db->name).''.$langs->trans('Error').''; dolibarr_install_syslog('upgrade2: failed to connect to database :'.$conf->db->name.' on '.$conf->db->host.' for user '.$conf->db->user, LOG_ERR); @@ -182,6 +177,11 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; } + // Create the global $hookmanager object + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($db); + $hookmanager->initHooks(array('upgrade')); + /*************************************************************************************** * From 144147c5d131059b96aaccc6ce44ec32d9d70b67 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 22 Sep 2021 14:58:03 +0200 Subject: [PATCH 05/77] FIX check if greater 0 --- htdocs/product/reassort.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index f8db6915409..c327b24e8f0 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -189,7 +189,7 @@ if ($fourn_id > 0) { $sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".((int) $fourn_id); } // Insert categ filter -if ($search_categ) { +if ($search_categ > 0) { $sql .= " AND cp.fk_categorie = ".((int) $search_categ); } $sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,"; From 2824c8b8abbb3ce7e8d339da251142d2f2508331 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Sep 2021 15:11:18 +0200 Subject: [PATCH 06/77] FIX support of localtax on expense report --- htdocs/commande/card.php | 18 +- htdocs/core/class/commonobject.class.php | 3 +- htdocs/expensereport/card.php | 30 ++- .../class/expensereport.class.php | 247 ++++++++++-------- 4 files changed, 170 insertions(+), 128 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 224c443754a..c40a64032c0 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -278,6 +278,7 @@ if (empty($reshook)) { if (!empty($origin) && !empty($originid)) { // Parse element/subelement (ex: project_task) $element = $subelement = $origin; + $regs = array(); if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) { $element = $regs [1]; $subelement = $regs [2]; @@ -1394,6 +1395,7 @@ if (empty($reshook)) { /* * View */ + $title = $langs->trans('Order')." - ".$langs->trans('Card'); $help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge'; llxHeader('', $title, $help_url); @@ -2347,17 +2349,17 @@ if ($action == 'create' && $usercancreate) { if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT print ''.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).''; - print ''.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).''; + print ''.price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).''; print ''; // Multicurrency Amount VAT print ''.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).''; - print ''.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).''; + print ''.price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).''; print ''; // Multicurrency Amount TTC print ''.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).''; - print ''.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).''; + print ''.price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).''; print ''; } @@ -2367,23 +2369,23 @@ if ($action == 'create' && $usercancreate) { $alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount)); } print ''.$langs->trans('AmountHT').''; - print ''.price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).$alert.''; + print ''.price($object->total_ht, 1, '', 1, -1, -1, $conf->currency).$alert.''; // Total VAT - print ''.$langs->trans('AmountVAT').''.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency).''; + print ''.$langs->trans('AmountVAT').''.price($object->total_tva, 1, '', 1, -1, -1, $conf->currency).''; // Amount Local Taxes if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1 print ''.$langs->transcountry("AmountLT1", $mysoc->country_code).''; - print ''.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).''; + print ''.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).''; } if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF print ''.$langs->transcountry("AmountLT2", $mysoc->country_code).''; - print ''.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).''; + print ''.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).''; } // Total TTC - print ''.$langs->trans('AmountTTC').''.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).''; + print ''.$langs->trans('AmountTTC').''.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).''; // Statut //print '' . $langs->trans('Status') . '' . $object->getLibStatut(4) . ''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1f0edd23401..d53b8829686 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3526,7 +3526,7 @@ abstract class CommonObject $this->db->free($resql); - // Now update global field total_ht, total_ttc and tva + // Now update global field total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_* $fieldht = 'total_ht'; $fieldtva = 'tva'; $fieldlocaltax1 = 'localtax1'; @@ -3569,6 +3569,7 @@ abstract class CommonObject dol_syslog(get_class($this)."::update_price", LOG_DEBUG); $resql = $this->db->query($sql); + if (!$resql) { $error++; $this->error = $this->db->lasterror(); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index c01c720f481..138b98bd419 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -220,7 +220,7 @@ if (empty($reshook)) { $object->fk_user_author = $user->id; } - // Check that expense report is for a user inside the hierarchy or advanced permission for all is set + // Check that expense report is for a user inside the hierarchy, or that advanced permission for all is set if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer) && empty($user->rights->expensereport->writeall_advance))) { $error++; @@ -1095,7 +1095,7 @@ if (empty($reshook)) { $action = ''; } - if ((int) $tmpvat < 0 || $tmpvat == '') { + if ((float) $tmpvat < 0 || $tmpvat === '') { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("VAT")), null, 'errors'); $action = ''; @@ -1190,7 +1190,6 @@ if (empty($reshook)) { } } - $object->update_totaux_del($object_ligne->total_ht, $object_ligne->total_tva); header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int')); exit; } else { @@ -1240,7 +1239,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); $action = ''; } - if ((int) $tmpvat < 0 || $tmpvat == '') { + if ((float) $tmpvat < 0 || $tmpvat == '') { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors'); $action = ''; @@ -1277,8 +1276,6 @@ if (empty($reshook)) { } } - $result = $object->recalculer($id); - //header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); //exit; } else { @@ -1441,8 +1438,6 @@ if ($action == 'create') { } elseif ($id > 0 || $ref) { $result = $object->fetch($id, $ref); - $res = $object->fetch_optionals(); - if ($result > 0) { if (!in_array($object->fk_user_author, $user->getAllChildIds(1))) { if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous) @@ -1843,12 +1838,22 @@ if ($action == 'create') { print ''; print ''.$langs->trans("AmountVAT").''; - print ''.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency).''; + print ''.price($object->total_tva, 1, '', 1, -1, -1, $conf->currency).''; print ''; + // Amount Local Taxes + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1 + print ''.$langs->transcountry("AmountLT1", $mysoc->country_code).''; + print ''.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).''; + } + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF + print ''.$langs->transcountry("AmountLT2", $mysoc->country_code).''; + print ''.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).''; + } + print ''; print ''.$langs->trans("AmountTTC").''; - print ''.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).''; + print ''.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).''; print ''; // List of payments already done @@ -2053,7 +2058,7 @@ if ($action == 'create') { // Comment print ''.dol_nl2br($line->comments).''; // VAT rate - print ''.vatrate($line->vatrate, true).''; + print ''.vatrate($line->vatrate.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), true).''; // Unit price HT print ''; if (!empty($line->value_unit_ht)) { @@ -2260,8 +2265,9 @@ if ($action == 'create') { print ''; // VAT + $selectedvat = price2num($line->vatrate).($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''); print ''; - print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $line->vatrate), $mysoc, '', 0, 0, '', false, 1); + print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $selectedvat), $mysoc, '', 0, 0, '', false, 1); print ''; // Unit price diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index d9e97baa81c..86852640596 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -80,8 +80,6 @@ class ExpenseReport extends CommonObject */ public $fk_statut; - public $vat_src_code; - public $fk_c_paiement; public $paid; @@ -124,6 +122,9 @@ class ExpenseReport extends CommonObject // Paiement public $user_paid_infos; + public $localtax1; // for backward compatibility (real field should be total_localtax1 defined into CommonObject) + public $localtax2; // for backward compatibility (real field should be total_localtax2 defined into CommonObject) + /** * Draft status @@ -213,6 +214,10 @@ class ExpenseReport extends CommonObject $this->total_ht = 0; $this->total_ttc = 0; $this->total_tva = 0; + $this->total_localtax1 = 0; + $this->total_localtax2 = 0; + $this->localtax1 = 0; // For backward compatibility + $this->localtax2 = 0; // For backward compatibility $this->modepaymentid = 0; // List of language codes for status @@ -314,12 +319,18 @@ class ExpenseReport extends CommonObject $newndfline->fk_project = $line->fk_project; $newndfline->vatrate = $line->vatrate; $newndfline->vat_src_code = $line->vat_src_code; + $newndfline->localtax1_tx = $line->localtax1_tx; + $newndfline->localtax2_tx = $line->localtax2_tx; + $newndfline->localtax1_type = $line->localtax1_type; + $newndfline->localtax2_type = $line->localtax2_type; $newndfline->comments = $line->comments; $newndfline->qty = $line->qty; $newndfline->value_unit = $line->value_unit; $newndfline->total_ht = $line->total_ht; $newndfline->total_ttc = $line->total_ttc; $newndfline->total_tva = $line->total_tva; + $newndfline->total_localtax1 = $line->total_localtax1; + $newndfline->total_localtax2 = $line->total_localtax2; $newndfline->date = $line->date; $newndfline->rule_warning_message = $line->rule_warning_message; $newndfline->fk_c_exp_tax_cat = $line->fk_c_exp_tax_cat; @@ -539,7 +550,8 @@ class ExpenseReport extends CommonObject $sql = "SELECT d.rowid, d.entity, d.ref, d.note_public, d.note_private,"; // DEFAULT $sql .= " d.detail_refuse, d.detail_cancel, d.fk_user_refuse, d.fk_user_cancel,"; // ACTIONS $sql .= " d.date_refuse, d.date_cancel,"; // ACTIONS - $sql .= " d.total_ht, d.total_ttc, d.total_tva,"; // TOTAUX (int) + $sql .= " d.total_ht, d.total_ttc, d.total_tva,"; + $sql .= " d.localtax1 as total_localtax1, d.localtax2 as total_localtax2,"; $sql .= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve,"; // DATES (datetime) $sql .= " d.fk_user_creat, d.fk_user_author, d.fk_user_modif, d.fk_user_validator,"; $sql .= " d.fk_user_valid, d.fk_user_approve,"; @@ -565,6 +577,11 @@ class ExpenseReport extends CommonObject $this->total_ht = $obj->total_ht; $this->total_tva = $obj->total_tva; $this->total_ttc = $obj->total_ttc; + $this->localtax1 = $obj->total_localtax1; // For backward compatibility + $this->localtax2 = $obj->total_localtax2; // For backward compatibility + $this->total_localtax1 = $obj->total_localtax1; + $this->total_localtax2 = $obj->total_localtax2; + $this->note_public = $obj->note_public; $this->note_private = $obj->note_private; $this->detail_refuse = $obj->detail_refuse; @@ -962,54 +979,6 @@ class ExpenseReport extends CommonObject } } - /** - * recalculer - * TODO Replace this with call to update_price if not already done - * - * @param int $id Id of expense report - * @return int <0 if KO, >0 if OK - */ - public function recalculer($id) - { - $sql = 'SELECT tt.total_ht, tt.total_ttc, tt.total_tva'; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as tt'; - $sql .= ' WHERE tt.'.$this->fk_element.' = '.((int) $id); - - $total_ht = 0; $total_tva = 0; $total_ttc = 0; - - $result = $this->db->query($sql); - if ($result) { - $num = $this->db->num_rows($result); - $i = 0; - while ($i < $num) { - $objp = $this->db->fetch_object($result); - $total_ht += $objp->total_ht; - $total_tva += $objp->total_tva; - $i++; - } - - $total_ttc = $total_ht + $total_tva; - $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; - $sql .= " total_ht = ".price2num($total_ht, 'MT'); - $sql .= " , total_ttc = ".price2num($total_ttc, 'MT'); - $sql .= " , total_tva = ".price2num($total_tva, 'MT'); - $sql .= " WHERE rowid = ".((int) $id); - $result = $this->db->query($sql); - if ($result) { - $this->db->free($result); - return 1; - } else { - $this->error = $this->db->lasterror(); - dol_syslog(get_class($this)."::recalculer: Error ".$this->error, LOG_ERR); - return -3; - } - } else { - $this->error = $this->db->lasterror(); - dol_syslog(get_class($this)."::recalculer: Error ".$this->error, LOG_ERR); - return -3; - } - } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * fetch_lines @@ -1024,14 +993,18 @@ class ExpenseReport extends CommonObject $this->lines = array(); $sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,'; - $sql .= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project, de.tva_tx, de.fk_ecm_files,'; + $sql .= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project,'; + $sql .= ' de.tva_tx, de.vat_src_code,'; + $sql .= ' de.localtax1_tx, de.localtax2_tx, de.localtax1_type, de.localtax2_type,'; + $sql .= ' de.fk_ecm_files,'; $sql .= ' de.total_ht, de.total_tva, de.total_ttc,'; + $sql .= ' de.total_localtax1, de.total_localtax2,'; $sql .= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,'; $sql .= ' p.ref as ref_projet, p.title as title_projet'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as de'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_fees as ctf ON de.fk_c_type_fees = ctf.id'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as p ON de.fk_projet = p.rowid'; - $sql .= ' WHERE de.'.$this->fk_element.' = '.$this->id; + $sql .= ' WHERE de.'.$this->fk_element.' = '.((int) $this->id); if (!empty($conf->global->EXPENSEREPORT_LINES_SORTED_BY_ROWID)) { $sql .= ' ORDER BY de.rang ASC, de.rowid ASC'; } else { @@ -1065,11 +1038,20 @@ class ExpenseReport extends CommonObject $deplig->total_ht = $objp->total_ht; $deplig->total_tva = $objp->total_tva; $deplig->total_ttc = $objp->total_ttc; + $deplig->total_localtax1 = $objp->total_localtax1; + $deplig->total_localtax2 = $objp->total_totaltax2; $deplig->type_fees_code = empty($objp->code_type_fees) ? 'TF_OTHER' : $objp->code_type_fees; $deplig->type_fees_libelle = $objp->libelle_type_fees; - $deplig->tva_tx = $objp->tva_tx; + + $deplig->tva_tx = $objp->tva_tx; $deplig->vatrate = $objp->tva_tx; + $deplig->vat_src_code = $objp->vat_src_code; + $deplig->localtax1_tx = $objp->localtax1_tx; + $deplig->localtax2_tx = $objp->localtax2_tx; + $deplig->localtax1_type = $objp->localtax1_type; + $deplig->localtax2_type = $objp->localtax2_type; + $deplig->projet_ref = $objp->ref_projet; $deplig->projet_title = $objp->title_projet; @@ -1757,41 +1739,12 @@ class ExpenseReport extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Update total of an expense report when you delete a line. - * - * @param string $ligne_total_ht Amount without taxes - * @param string $ligne_total_tva Amount of all taxes - * @return void - */ - public function update_totaux_del($ligne_total_ht, $ligne_total_tva) - { - // phpcs:enable - $this->total_ht = $this->total_ht - $ligne_total_ht; - $this->total_tva = $this->total_tva - $ligne_total_tva; - $this->total_ttc = $this->total_ht + $this->total_tva; - - $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; - $sql .= " total_ht = ".$this->total_ht; - $sql .= " , total_ttc = ".$this->total_ttc; - $sql .= " , total_tva = ".$this->total_tva; - $sql .= " WHERE rowid = ".$this->id; - - $result = $this->db->query($sql); - if ($result) { - return 1; - } else { - $this->error = $this->db->error(); - return -1; - } - } /** * addline * * @param float $qty Qty - * @param double $up Value init + * @param double $up Unit price (price with tax) * @param int $fk_c_type_fees Type payment * @param string $vatrate Vat rate (Can be '10' or '10 (ABC)') * @param string $date Date @@ -1838,7 +1791,14 @@ class ExpenseReport extends CommonObject $this->line = new ExpenseReportLine($this->db); - $localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $mysoc, $this->thirdparty); + // We don't know seller and buyer for expense reports + $seller = $mysoc; // We use same than current company (expense report are often done in same country) + $seller->tva_assuj = 1; // Most seller uses vat + $seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company + $seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company + $buyer = new Societe($this->db); + + $localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $buyer, $seller); $vat_src_code = ''; $reg = array(); @@ -1848,16 +1808,22 @@ class ExpenseReport extends CommonObject } $vatrate = preg_replace('/\*/', '', $vatrate); - $seller = ''; // seller is unknown - - $tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type); + $tmp = calcul_price_total($qty, $up, 0, $vatrate, -1, -1, 0, 'TTC', 0, $type, $seller, $localtaxes_type); $this->line->value_unit = $up; + $this->line->vat_src_code = $vat_src_code; $this->line->vatrate = price2num($vatrate); + $this->line->localtax1_tx = $localtaxes_type[1]; + $this->line->localtax2_tx = $localtaxes_type[3]; + $this->line->localtax1_type = $localtaxes_type[0]; + $this->line->localtax2_type = $localtaxes_type[2]; + $this->line->total_ttc = $tmp[2]; $this->line->total_ht = $tmp[0]; $this->line->total_tva = $tmp[1]; + $this->line->total_localtax1 = $tmp[9]; + $this->line->total_localtax2 = $tmp[10]; $this->line->fk_expensereport = $this->id; $this->line->qty = $qty; @@ -1899,13 +1865,13 @@ class ExpenseReport extends CommonObject /** * Check constraint of rules and update price if needed * - * @param int $type type of line - * @param string $seller seller, but actually he is unknown - * @return true or false + * @param int $type Type of line + * @param string $seller Seller, but actually he is unknown + * @return true or false */ public function checkRules($type = 0, $seller = '') { - global $user, $conf, $db, $langs; + global $user, $conf, $db, $langs, $mysoc; $langs->load('trips'); @@ -1913,6 +1879,15 @@ class ExpenseReport extends CommonObject return true; // if don't use rules } + // We don't know seller and buyer for expense reports + if (!is_object($seller)) { + $seller = $mysoc; // We use same than current company (expense report are often done in same country) + $seller->tva_assuj = 1; // Most seller uses vat + $seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company + $seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company + } + //$buyer = new Societe($this->db); + $rulestocheck = ExpenseReportRule::getAllRule($this->line->fk_c_type_fees, $this->line->date, $this->fk_user_author); $violation = 0; @@ -1960,6 +1935,8 @@ class ExpenseReport extends CommonObject $this->line->total_ttc = $tmp[2]; $this->line->total_ht = $tmp[0]; $this->line->total_tva = $tmp[1]; + $this->line->total_localtax1 = $tmp[9]; + $this->line->total_localtax2 = $tmp[10]; return false; } else { @@ -1970,11 +1947,13 @@ class ExpenseReport extends CommonObject /** * Method to apply the offset if needed * - * @return boolean true=applied, false=not applied + * @param int $type Type of line + * @param string $seller Seller, but actually he is unknown + * @return boolean True=applied, False=not applied */ - public function applyOffset() + public function applyOffset($type = 0, $seller = '') { - global $conf; + global $conf, $mysoc; if (empty($conf->global->MAIN_USE_EXPENSE_IK)) { return false; @@ -1987,6 +1966,15 @@ class ExpenseReport extends CommonObject return false; } + // We don't know seller and buyer for expense reports + if (!is_object($seller)) { + $seller = $mysoc; // We use same than current company (expense report are often done in same country) + $seller->tva_assuj = 1; // Most seller uses vat + $seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company + $seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company + } + //$buyer = new Societe($this->db); + $range = ExpenseReportIk::getRangeByUser($userauthor, $this->line->fk_c_exp_tax_cat); if (empty($range)) { @@ -2010,6 +1998,8 @@ class ExpenseReport extends CommonObject $this->line->total_ttc = $tmp[2]; $this->line->total_ht = $tmp[0]; $this->line->total_tva = $tmp[1]; + $this->line->total_localtax1 = $tmp[9]; + $this->line->total_localtax2 = $tmp[10]; return true; } @@ -2033,7 +2023,7 @@ class ExpenseReport extends CommonObject $sql .= ' AND d.rowid <> '.$this->line->id; } - dol_syslog(get_class($this)."::offsetAlreadyGiven sql=".$sql); + dol_syslog(get_class($this)."::offsetAlreadyGiven"); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -2056,7 +2046,7 @@ class ExpenseReport extends CommonObject * @param double $vatrate Vat rate. Can be '8.5' or '8.5* (8.5NPROM...)' * @param string $comments Description * @param float $qty Qty - * @param double $value_unit Value init + * @param double $value_unit Unit price (with taxes) * @param int $date Date * @param int $expensereport_id Expense report id * @param int $fk_c_exp_tax_cat Id of category of car @@ -2073,7 +2063,10 @@ class ExpenseReport extends CommonObject $type = 0; // TODO What if type is service ? // We don't know seller and buyer for expense reports - $seller = $mysoc; + $seller = $mysoc; // We use same than current company (expense report are often done in same country) + $seller->tva_assuj = 1; // Most seller uses vat + $seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company + $seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company $buyer = new Societe($this->db); $localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $buyer, $seller); @@ -2087,8 +2080,8 @@ class ExpenseReport extends CommonObject } $vatrate = preg_replace('/\*/', '', $vatrate); - $tmp = calcul_price_total($qty, $value_unit, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type); - + $tmp = calcul_price_total($qty, $value_unit, 0, $vatrate, -1, -1, 0, 'TTC', 0, $type, $seller, $localtaxes_type); + //var_dump($vatrate);var_dump($localtaxes_type);var_dump($tmp);exit; // calcul total of line //$total_ttc = price2num($qty*$value_unit, 'MT'); @@ -2109,14 +2102,17 @@ class ExpenseReport extends CommonObject $this->line->vat_src_code = $vat_src_code; $this->line->vatrate = price2num($vatrate); - $this->line->total_ttc = $tmp[2]; - $this->line->total_ht = $tmp[0]; - $this->line->total_tva = $tmp[1]; $this->line->localtax1_tx = $localtaxes_type[1]; $this->line->localtax2_tx = $localtaxes_type[3]; $this->line->localtax1_type = $localtaxes_type[0]; $this->line->localtax2_type = $localtaxes_type[2]; + $this->line->total_ttc = $tmp[2]; + $this->line->total_ht = $tmp[0]; + $this->line->total_tva = $tmp[1]; + $this->line->total_localtax1 = $tmp[9]; + $this->line->total_localtax2 = $tmp[10]; + $this->line->fk_ecm_files = $fk_ecm_files; $this->line->id = ((int) $rowid); @@ -2184,6 +2180,8 @@ class ExpenseReport extends CommonObject return -1; } + $this->update_price(); + $this->db->commit(); return 1; @@ -2593,9 +2591,17 @@ class ExpenseReportLine public $projet_title; public $vatrate; + public $vat_src_code; + public $localtax1_tx; + public $localtax2_tx; + public $localtax1_type; + public $localtax2_type; + public $total_ht; public $total_tva; public $total_ttc; + public $total_localtax1; + public $total_localtax2; /** * @var int ID into llx_ecm_files table to link line to attached file @@ -2623,6 +2629,7 @@ class ExpenseReportLine { $sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_c_exp_tax_cat, fde.fk_projet as fk_project, fde.date,'; $sql .= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc, fde.fk_ecm_files,'; + $sql .= ' fde.localtax1_tx, fde.localtax2_tx, fde.localtax1_type, fde.localtax2_type, fde.total_localtax1, fde.total_localtax2,'; $sql .= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,'; $sql .= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref'; $sql .= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde'; @@ -2652,11 +2659,20 @@ class ExpenseReportLine $this->type_fees_libelle = $objp->type_fees_libelle; $this->projet_ref = $objp->projet_ref; $this->projet_title = $objp->projet_title; + $this->vatrate = $objp->vatrate; $this->vat_src_code = $objp->vat_src_code; + $this->localtax1_tx = $objp->localtax1_tx; + $this->localtax2_tx = $objp->localtax2_tx; + $this->localtax1_type = $objp->localtax1_type; + $this->localtax2_type = $objp->localtax2_type; + $this->total_ht = $objp->total_ht; $this->total_tva = $objp->total_tva; $this->total_ttc = $objp->total_ttc; + $this->total_localtax1 = $objp->total_localtax1; + $this->total_localtax2 = $objp->total_localtax2; + $this->fk_ecm_files = $objp->fk_ecm_files; $this->db->free($result); @@ -2695,18 +2711,29 @@ class ExpenseReportLine $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det'; $sql .= ' (fk_expensereport, fk_c_type_fees, fk_projet,'; - $sql .= ' tva_tx, vat_src_code, comments, qty, value_unit, total_ht, total_tva, total_ttc, date, rule_warning_message, fk_c_exp_tax_cat, fk_ecm_files)'; + $sql .= ' tva_tx, vat_src_code,'; + $sql .= ' localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; + $sql .= ' comments, qty, value_unit,'; + $sql .= ' total_ht, total_tva, total_ttc,'; + $sql .= ' total_localtax1, total_localtax2,'; + $sql .= ' date, rule_warning_message, fk_c_exp_tax_cat, fk_ecm_files)'; $sql .= " VALUES (".$this->db->escape($this->fk_expensereport).","; $sql .= " ".((int) $this->fk_c_type_fees).","; $sql .= " ".((int) (!empty($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : ((!empty($this->fk_projet) && $this->fk_projet > 0) ? $this->fk_projet : 'null')).","; $sql .= " ".((float) $this->vatrate).","; $sql .= " '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."',"; + $sql .= " ".((float) price2num($this->localtax1_tx)).","; + $sql .= " ".((float) price2num($this->localtax2_tx)).","; + $sql .= " '".$this->db->escape($this->localtax1_type)."',"; + $sql .= " '".$this->db->escape($this->localtax2_type)."',"; $sql .= " '".$this->db->escape($this->comments)."',"; $sql .= " ".((float) $this->qty).","; $sql .= " ".((float) $this->value_unit).","; $sql .= " ".((float) price2num($this->total_ht)).","; $sql .= " ".((float) price2num($this->total_tva)).","; $sql .= " ".((float) price2num($this->total_ttc)).","; + $sql .= " ".((float) price2num($this->total_localtax1)).","; + $sql .= " ".((float) price2num($this->total_localtax2)).","; $sql .= " '".$this->db->idate($this->date)."',"; $sql .= " ".(empty($this->rule_warning_message) ? 'null' : "'".$this->db->escape($this->rule_warning_message)."'").","; $sql .= " ".((int) $this->fk_c_exp_tax_cat).","; @@ -2814,11 +2841,17 @@ class ExpenseReportLine $sql .= ", value_unit = ".((float) $this->value_unit); $sql .= ", qty=".((float) $this->qty); $sql .= ", date='".$this->db->idate($this->date)."'"; - $sql .= ", total_ht=".((float) price2num($this->total_ht, 'MT')).""; - $sql .= ", total_tva=".((float) price2num($this->total_tva, 'MT')).""; - $sql .= ", total_ttc=".((float) price2num($this->total_ttc, 'MT')).""; + $sql .= ", total_ht=".((float) price2num($this->total_ht, 'MT')); + $sql .= ", total_tva=".((float) price2num($this->total_tva, 'MT')); + $sql .= ", total_ttc=".((float) price2num($this->total_ttc, 'MT')); + $sql .= ", total_localtax1=".((float) price2num($this->total_localtax1, 'MT')); + $sql .= ", total_localtax2=".((float) price2num($this->total_localtax2, 'MT')); $sql .= ", tva_tx=".((float) $this->vatrate); $sql .= ", vat_src_code='".$this->db->escape($this->vat_src_code)."'"; + $sql .= ", localtax1_tx=".((float) $this->localtax1_tx); + $sql .= ", localtax2_tx=".((float) $this->localtax2_tx); + $sql .= ", localtax1_type='".$this->db->escape($this->localtax1_type)."'"; + $sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'"; $sql .= ", rule_warning_message='".$this->db->escape($this->rule_warning_message)."'"; $sql .= ", fk_c_exp_tax_cat=".$this->db->escape($this->fk_c_exp_tax_cat); $sql .= ", fk_ecm_files=".($this->fk_ecm_files > 0 ? ((int) $this->fk_ecm_files) : 'null'); From 066013c31f90d4d134057e2bc8ec68796962186b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Wed, 22 Sep 2021 15:15:39 +0200 Subject: [PATCH 07/77] typo stickler --- htdocs/core/lib/project.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 4e4adaf9d3e..2467baa034a 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -134,7 +134,7 @@ function project_prepare_head(Project $project, $moreparam = '') if (!is_null($dataretrieved)) { $nbElements = $dataretrieved; } else { - if (!empty ($conf->stock->enabled)) { + if (!empty($conf->stock->enabled)) { $nbElements += $project->getElementCount('stock', 'entrepot', 'fk_project'); } if (!empty($conf->propal->enabled)) { From 2bd0fdd364b35d60625d81aaac23c669b9ac9d67 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 22 Sep 2021 14:09:29 +0000 Subject: [PATCH 08/77] Fixing style errors. --- htdocs/expensereport/card.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 138b98bd419..81995792dbb 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1842,14 +1842,14 @@ if ($action == 'create') { print ''; // Amount Local Taxes - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1 - print ''.$langs->transcountry("AmountLT1", $mysoc->country_code).''; - print ''.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).''; - } - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF - print ''.$langs->transcountry("AmountLT2", $mysoc->country_code).''; - print ''.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).''; - } + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1 + print ''.$langs->transcountry("AmountLT1", $mysoc->country_code).''; + print ''.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).''; + } + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF + print ''.$langs->transcountry("AmountLT2", $mysoc->country_code).''; + print ''.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).''; + } print ''; print ''.$langs->trans("AmountTTC").''; From 70e66627fed60b611adda6d1fab22f4647580914 Mon Sep 17 00:00:00 2001 From: Laurent De Coninck Date: Wed, 22 Sep 2021 20:14:47 +0200 Subject: [PATCH 09/77] restrict the html --- htdocs/takepos/admin/receipt.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 61fd71bdf29..3350da50104 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -42,8 +42,8 @@ if (GETPOST('action', 'alpha') == 'set') { $db->begin(); - $res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'none'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'none'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'restricthtml'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'restricthtml'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_RECEIPT_NAME", GETPOST('TAKEPOS_RECEIPT_NAME', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SHOW_CUSTOMER", GETPOST('TAKEPOS_SHOW_CUSTOMER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity); From 51b6318f880fb3e3bb2fcc705894abd081a45f6f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 02:10:39 +0200 Subject: [PATCH 10/77] FIX Test when date of invoie is in future (pb with TZ and offset) --- htdocs/compta/facture/card.php | 51 +++++++++++++++---------------- htdocs/core/lib/functions.lib.php | 2 +- htdocs/fourn/facture/card.php | 22 +++++++------ 3 files changed, 39 insertions(+), 36 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d019b2dcf9a..6ea03d8bd23 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -393,13 +393,21 @@ if (empty($reshook)) { } elseif ($action == 'setinvoicedate' && $usercancreate) { $object->fetch($id); $old_date_lim_reglement = $object->date_lim_reglement; - $date = dol_mktime(12, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int')); - if (empty($date)) { + $newdate = dol_mktime(0, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int'), 'tzserver'); + if (empty($newdate)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); - header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate'); + header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate&token='.newToken()); exit; } - $object->date = $date; + if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) { + setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings'); + } else { + setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings'); + } + } + + $object->date = $newdate; $new_date_lim_reglement = $object->calculate_date_lim_reglement(); if ($new_date_lim_reglement > $old_date_lim_reglement) { $object->date_lim_reglement = $new_date_lim_reglement; @@ -413,7 +421,9 @@ if (empty($reshook)) { } } elseif ($action == 'setdate_pointoftax' && $usercancreate) { $object->fetch($id); - $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); + + $date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver'); + $object->date_pointoftax = $date_pointoftax; $result = $object->update($user); if ($result < 0) { @@ -986,14 +996,16 @@ if (empty($reshook)) { $error++; } + $dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server + $date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver'); + // Replacement invoice if (GETPOST('type') == Facture::TYPE_REPLACEMENT) { - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = 'create'; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -1005,8 +1017,6 @@ if (empty($reshook)) { $action = 'create'; } - $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); - if (!$error) { // This is a replacement invoice $result = $object->fetch(GETPOST('fac_replacement', 'int')); @@ -1049,19 +1059,16 @@ if (empty($reshook)) { $action = 'create'; } - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = 'create'; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; } - $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); - if (!$error) { if (!empty($originentity)) { $object->entity = $originentity; @@ -1265,19 +1272,16 @@ if (empty($reshook)) { // Standard invoice or Deposit invoice, created from a Predefined template invoice if ((GETPOST('type') == Facture::TYPE_STANDARD || GETPOST('type') == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0) { - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = 'create'; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; } - $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); - if (!$error) { $object->socid = GETPOST('socid', 'int'); $object->type = GETPOST('type'); @@ -1312,8 +1316,6 @@ if (empty($reshook)) { $typeamount = GETPOST('typedeposit', 'aZ09'); $valuestandardinvoice = price2num(str_replace('%', '', GETPOST('valuestandardinvoice', 'alpha')), 'MU'); $valuedeposit = price2num(str_replace('%', '', GETPOST('valuedeposit', 'alpha')), 'MU'); - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); - $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); if (GETPOST('socid', 'int') < 1) { $error++; @@ -1325,7 +1327,7 @@ if (empty($reshook)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = 'create'; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -1807,19 +1809,16 @@ if (empty($reshook)) { // Situation invoices if (GETPOST('type') == Facture::TYPE_SITUATION && GETPOST('situations')) { - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")); setEventMessages($mesg, null, 'errors'); - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; } - $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); - if (!(GETPOST('situations', 'int') > 0)) { $error++; $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation")); @@ -3514,7 +3513,8 @@ if ($action == 'create') { print ''; } - $newdateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + $newdateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); + $date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver'); // Date invoice print ''.$langs->trans('DateInvoice').''; @@ -3524,7 +3524,6 @@ if ($action == 'create') { // Date point of tax if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) { print ''.$langs->trans('DatePointOfTax').''; - $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1); print ''; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3ae97098a79..370b10da626 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2487,7 +2487,7 @@ function dol_getdate($timestamp, $fast = false, $forcetimezone = '') * False or 0 or 'tzserver' = local to server TZ * 'auto' * 'tzuser' = local to user TZ taking dst into account at the current date. Not yet implemented. - * 'tzuserrel' = local to user TZ taking dst into account at the given date. Use this one to convert date input from user. + * 'tzuserrel' = local to user TZ taking dst into account at the given date. Use this one to convert date input from user into a GMT date. * 'tz,TimeZone' = use specified timezone * @param int $check 0=No check on parameters (Can use day 32, etc...) * @return int|string Date as a timestamp, '' or false if error diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index db1497f5166..86ddda9769a 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -408,9 +408,9 @@ if (empty($reshook)) { dol_print_error($db); } } elseif ($action == 'setdatef' && $usercancreate) { - $newdate = dol_mktime(0, 0, 0, $_POST['datefmonth'], $_POST['datefday'], $_POST['datefyear']); - if ($newdate > (dol_now() + (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE) ? 0 : $conf->global->INVOICE_MAX_OFFSET_IN_FUTURE))) { - if (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE)) { + $newdate = dol_mktime(0, 0, 0, GETPOST('datefmonth', 'int'), GETPOST('datefday', 'int'), GETPOST('datefyear', 'int'), 'tzserver'); + if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) { setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings'); } else { setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings'); @@ -434,7 +434,7 @@ if (empty($reshook)) { } } elseif ($action == 'setdate_lim_reglement' && $usercancreate) { $object->fetch($id); - $object->date_echeance = dol_mktime(12, 0, 0, $_POST['date_lim_reglementmonth'], $_POST['date_lim_reglementday'], $_POST['date_lim_reglementyear']); + $object->date_echeance = dol_mktime(12, 0, 0, GETPOST('date_lim_reglementmonth', 'int'), GETPOST('date_lim_reglementday', 'int'), GETPOST('date_lim_reglementyear', 'int')); if (!empty($object->date_echeance) && $object->date_echeance < $object->date) { $object->date_echeance = $object->date; setEventMessages($langs->trans("DatePaymentTermCantBeLowerThanObjectDate"), null, 'warnings'); @@ -692,8 +692,12 @@ if (empty($reshook)) { $error++; } - $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); - $datedue = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int')); + $dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server + $datedue = dol_mktime(0, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'), 'tzserver'); + /*var_dump($dateinvoice.' '.dol_print_date($dateinvoice, 'dayhour')); + var_dump(dol_now('tzuserrel').' '.dol_get_last_hour(dol_now('tzuserrel')).' '.dol_print_date(dol_now('tzuserrel'),'dayhour').' '.dol_print_date(dol_get_last_hour(dol_now('tzuserrel')), 'dayhour')); + var_dump($db->idate($dateinvoice)); + exit;*/ // Replacement invoice if (GETPOST('type') == FactureFournisseur::TYPE_REPLACEMENT) { @@ -702,7 +706,7 @@ if (empty($reshook)) { $action = 'create'; $_GET['socid'] = $_POST['socid']; $error++; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -766,7 +770,7 @@ if (empty($reshook)) { $action = 'create'; $_GET['socid'] = $_POST['socid']; $error++; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -875,7 +879,7 @@ if (empty($reshook)) { $action = 'create'; $_GET['socid'] = $_POST['socid']; $error++; - } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; From 128f6d9a5cb4a7ce34bbf296861809ae0c244231 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 02:38:53 +0200 Subject: [PATCH 11/77] Fix combo box for thirdparties in invoice stats used bad component --- htdocs/compta/facture/stats/index.php | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index ca4d3d6ccaf..5fe028e1268 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -42,7 +42,7 @@ $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height'); // Load translation files required by the page $langs->loadLangs(array('bills', 'companies', 'other')); -$mode = GETPOST("mode") ?GETPOST("mode") : 'customer'; +$mode = GETPOST("mode") ? GETPOST("mode") : 'customer'; if ($mode == 'customer' && !$user->rights->facture->lire) { accessforbidden(); } @@ -244,7 +244,7 @@ if (!count($arrayyears)) { $h = 0; $head = array(); -$head[$h][0] = DOL_URL_ROOT.'/compta/facture/stats/index.php?mode='.$mode; +$head[$h][0] = DOL_URL_ROOT.'/compta/facture/stats/index.php?mode='.urlencode($mode); $head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][2] = 'byyear'; $h++; @@ -261,12 +261,12 @@ complete_head_from_modules($conf, $langs, null, $head, $h, $type); print dol_get_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1); // We use select_thirdparty_list instead of select_company so we can use $filter and share same code for customer and supplier. -$tmp_companies = $form->select_thirdparty_list($socid, 'socid', $filter, 1, 0, 0, array(), '', 1); -//Array passed as an argument to Form::selectarray to build a proper select input -$companies = array(); - -foreach ($tmp_companies as $value) { - $companies[$value['key']] = $value['label']; +$filter = ''; +if ($mode == 'customer') { + $filter = 's.client in (1,2,3)'; +} +if ($mode == 'supplier') { + $filter = 's.fournisseur = 1'; } print '
'; @@ -281,14 +281,8 @@ print ''; print ''; // Company print ''; // ThirdParty Type From 31d9eb192fa1ab455b138c14ce06b54c91b51498 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 02:51:36 +0200 Subject: [PATCH 12/77] Clean code --- .../eventorganization/conferenceorboothattendee_card.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 0517210333f..84f99182192 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -205,13 +205,12 @@ if (!empty($projectstatic->socid)) { $projectstatic->fetch_thirdparty(); } -$withProjectUrl=''; + $object->project = clone $projectstatic; if (!empty($withproject)) { // Tabs for project $tab = 'eventorganisation'; - $withProjectUrl = "&withproject=1"; $head = project_prepare_head($projectstatic); print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', ''); @@ -421,8 +420,10 @@ if (!empty($withproject)) { if ($action == 'create') { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("ConferenceOrBoothAttendee")), '', 'object_'.$object->picto); - print '
'; + + print ''; print ''; + print ''; if ($confOrBooth->id > 0) { print ''; @@ -432,8 +433,6 @@ if ($action == 'create') { print ''; } - - print ''; if ($backtopage) { print ''; } From 3467faab6bea5a336f97a1efa047e3d0a2900652 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 03:20:15 +0200 Subject: [PATCH 13/77] Fix property --- htdocs/expensereport/class/expensereport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 86852640596..9eaa2f96cb5 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1039,7 +1039,7 @@ class ExpenseReport extends CommonObject $deplig->total_tva = $objp->total_tva; $deplig->total_ttc = $objp->total_ttc; $deplig->total_localtax1 = $objp->total_localtax1; - $deplig->total_localtax2 = $objp->total_totaltax2; + $deplig->total_localtax2 = $objp->total_localtax2; $deplig->type_fees_code = empty($objp->code_type_fees) ? 'TF_OTHER' : $objp->code_type_fees; $deplig->type_fees_libelle = $objp->libelle_type_fees; From a2a4a74964542767d2ee19aa3b9228124935ea87 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Sep 2021 16:18:21 +0200 Subject: [PATCH 14/77] Fix trans --- htdocs/langs/en_US/accountancy.lang | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index fc4b86a2cdb..40c83977076 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -37,8 +37,8 @@ OtherInfo=Other information DeleteCptCategory=Remove accounting account from group ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account from the accounting account group? JournalizationInLedgerStatus=Status of journalization -AlreadyInGeneralLedger=Already transferred in accounting journals and ledger -NotYetInGeneralLedger=Not yet transferred in accouting journals and ledger +AlreadyInGeneralLedger=Already transferred to accounting journals and ledger +NotYetInGeneralLedger=Not yet transferred to accouting journals and ledger GroupIsEmptyCheckSetup=Group is empty, check setup of the personalized accounting group DetailByAccount=Show detail by account AccountWithNonZeroValues=Accounts with non-zero values @@ -298,7 +298,7 @@ NoNewRecordSaved=No more record to journalize ListOfProductsWithoutAccountingAccount=List of products not bound to any accounting account ChangeBinding=Change the binding Accounted=Accounted in ledger -NotYetAccounted=Not yet accounted in the ledger +NotYetAccounted=Not yet transferred to accounting ShowTutorial=Show Tutorial NotReconciled=Not reconciled WarningRecordWithoutSubledgerAreExcluded=Warning, all operations without subledger account defined are filtered and excluded from this view From 36a902167f66957174d9d42308367c91f3519a0a Mon Sep 17 00:00:00 2001 From: DevIntact Date: Thu, 23 Sep 2021 14:54:38 +0200 Subject: [PATCH 15/77] Translation of event title for incoming email Event title for incoming email is not translated while collected by cronjob. i.e : ActionAC_EMAIL_IN --- htdocs/emailcollector/class/emailcollector.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 16df7774470..f4341109000 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -956,7 +956,7 @@ class EmailCollector extends CommonObject dol_syslog("EmailCollector::doCollectOneCollector start for id=".$this->id, LOG_DEBUG); - $langs->loadLangs(array("project", "companies", "mails", "errors", "ticket", "agenda")); + $langs->loadLangs(array("project", "companies", "mails", "errors", "ticket", "agenda", "commercial")); $error = 0; $this->output = ''; From 8fb52862607f9d0d9b94461619a6f8df3ca0fca4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Sep 2021 02:02:12 +0200 Subject: [PATCH 16/77] FIX #18797 --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 5d394ce3135..b127d3aa686 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -813,7 +813,7 @@ class Project extends CommonObject 'propal'=>'fk_projet', 'commande'=>'fk_projet', 'facture'=>'fk_projet', 'supplier_proposal'=>'fk_projet', 'commande_fournisseur'=>'fk_projet', 'facture_fourn'=>'fk_projet', 'expensereport_det'=>'fk_projet', 'contrat'=>'fk_projet', 'fichinter'=>'fk_projet', 'don'=>'fk_projet', - 'actioncomm'=>'fk_project', 'mrp_mo'=>'fk_project' + 'actioncomm'=>'fk_project', 'mrp_mo'=>'fk_project', 'entrepot'=>'fk_project' ); foreach ($listoftables as $key => $value) { $sql = "UPDATE ".MAIN_DB_PREFIX.$key." SET ".$value." = NULL where ".$value." = ".((int) $this->id); From 4c80e0425b1c8e7a7979733bf9bd092a73483e4e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Sep 2021 02:10:42 +0200 Subject: [PATCH 17/77] Fix date for tasks created during project creation --- ..._modEventOrganization_EventOrganization.class.php | 7 +++++-- htdocs/projet/class/task.class.php | 12 ++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php index 04f9aaa17cc..dd1462ecf5f 100644 --- a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php +++ b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php @@ -101,8 +101,11 @@ class InterfaceEventOrganization extends DolibarrTriggers $defaultref = ''; } $task->ref = $defaultref; - $task->date_start = $object->date_start; - $task->date_end = $object->date_end; + + // TODO Can set offset for start date or endline from setup of task to create when creating event + $task->date_start = null; + $task->date_end = null; + $result = $task->create($user); if ($result < 0) { $this->errors=array_merge($this->errors, $task->errors); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 8ea6d0c78a3..87ef51daefd 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -173,16 +173,16 @@ class Task extends CommonObject $sql .= ", planned_workload"; $sql .= ", progress"; $sql .= ") VALUES ("; - $sql .= $conf->entity; - $sql .= ", ".$this->fk_project; + $sql .= ((int) $conf->entity); + $sql .= ", ".((int) $this->fk_project); $sql .= ", ".(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'null'); - $sql .= ", ".$this->fk_task_parent; + $sql .= ", ".((int) $this->fk_task_parent); $sql .= ", '".$this->db->escape($this->label)."'"; $sql .= ", '".$this->db->escape($this->description)."'"; $sql .= ", '".$this->db->idate($now)."'"; - $sql .= ", ".$user->id; - $sql .= ", ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null'); - $sql .= ", ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); + $sql .= ", ".((int) $user->id); + $sql .= ", ".($this->date_start ? "'".$this->db->idate($this->date_start)."'" : 'null'); + $sql .= ", ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : 'null'); $sql .= ", ".(($this->planned_workload != '' && $this->planned_workload >= 0) ? $this->planned_workload : 'null'); $sql .= ", ".(($this->progress != '' && $this->progress >= 0) ? $this->progress : 'null'); $sql .= ")"; From 3d22cbe4dac2ca5b2c62fec3138d6dc5d98be33e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Sep 2021 02:16:40 +0200 Subject: [PATCH 18/77] Fix look and feel --- htdocs/projet/ganttview.php | 52 +++++++++++++++++++++---------------- htdocs/projet/tasks.php | 6 ++--- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index c5e5b20fb88..b5325ca93b2 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -89,6 +89,7 @@ if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $c $title = ($object->ref ? $object->ref.' '.$object->name.' - ' : '').$langs->trans("Gantt"); } $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; + llxHeader("", $title, $help_url, '', 0, 0, $arrayofjs, $arrayofcss); if (($id > 0 && is_numeric($id)) || !empty($ref)) { @@ -136,29 +137,36 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) { print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; -if ($mode == 'customer') { - $filter = 's.client in (1,2,3)'; -} -if ($mode == 'supplier') { - $filter = 's.fournisseur = 1'; -} print img_picto('', 'company', 'class="pictofixedwidth"'); -print $form->selectarray('socid', $companies, $socid, 1, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth300', 1); +print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300'); print '
'; // Usage - print ''; - print ''; + print ''; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) { - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) { - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } - print ''; // Visibility print '
'; - print $langs->trans("Usage"); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print '
'; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) { + print '
'; + print $langs->trans("Usage"); + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + if (!empty($conf->eventorganization->enabled)) { + print 'usage_organize_event ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("EventOrganizationDescriptionLong"); + print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext); + } + print '
'.$langs->trans("Visibility").''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index d4b5bf89bbf..d266d659da7 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -459,7 +459,7 @@ if ($id > 0 || !empty($ref)) { print '
'; print '
'; - print ''; + print '
'; // Usage if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) { @@ -532,7 +532,7 @@ if ($id > 0 || !empty($ref)) { print '
'; print '
'; - print '
'; + print '
'; // Description print '"; } From b09c4166b30f11de03541011b03fc8a96dc173e7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Sep 2021 02:24:04 +0200 Subject: [PATCH 19/77] Fix set position of lines in tasks of a project --- htdocs/core/ajax/row.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 7b271fafdf2..6047d8d289c 100644 --- a/htdocs/core/ajax/row.php +++ b/htdocs/core/ajax/row.php @@ -99,6 +99,8 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3) $perm = 1; } elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) { $perm = 1; + } elseif ($table_element_line == 'projet_task' && $fk_element == 'fk_projet' && $user->rights->projet->creer) { + $perm = 1; } else { $tmparray = explode('_', $table_element_line); $tmpmodule = $tmparray[0]; $tmpobject = preg_replace('/line$/', '', $tmparray[1]); @@ -111,7 +113,7 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3) // We should not be here. If we are not allowed to reorder rows, feature should not be visible on script. // If we are here, it is a hack attempt, so we report a warning. print 'Bad permission to modify position of lines for object in table '.$table_element_line; - dol_syslog('Bad permission to modify position of lines for object in table '.$table_element_line.', fk_element '.$fk_element, LOG_WARNING); + dol_syslog('Bad permission to modify position of lines for object in table='.$table_element_line.', fk_element='.$fk_element, LOG_WARNING); accessforbidden('Bad permission to modify position of lines for object in table '.$table_element_line); } From cd46ccdb669b48c3d505e00b0ae86d1a96b26172 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Sep 2021 02:31:15 +0200 Subject: [PATCH 20/77] Code comment --- htdocs/core/lib/project.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 2467baa034a..c293b7c47ae 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -977,6 +977,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } } + // Computed progress if (count($arrayfields) > 0 && !empty($arrayfields['t.progress_calculated']['checked'])) { print ''; } + + // Declared progress if (count($arrayfields) > 0 && !empty($arrayfields['t.progress']['checked'])) { print '
'.$langs->trans("Description").''; @@ -541,7 +541,7 @@ if ($id > 0 || !empty($ref)) { // Categories if ($conf->categorie->enabled) { - print '
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print "
'; if ($total_projectlinesa_planned) { @@ -984,6 +985,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } print ''; if ($total_projectlinesa_planned) { From 15313b8d374392641c957d4b7b2e9386728592b8 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 24 Sep 2021 06:03:01 +0200 Subject: [PATCH 21/77] FIX Accountancy - Missing specific filename for export on format FEC2 --- htdocs/accountancy/tpl/export_journal.tpl.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index ecb0f7a6b09..93215b9b8db 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -38,7 +38,9 @@ header('Content-Type: text/csv'); include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; $accountancyexport = new AccountancyExport($db); -if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$EXPORT_TYPE_FEC && $type_export == "general_ledger") { // Specific filename for FEC model export into the general ledger +// Specific filename for FEC model export into the general ledger +if ($accountancyexport->getFormatCode($formatexportset) == ($accountancyexport::$EXPORT_TYPE_FEC || $accountancyexport::$EXPORT_TYPE_FEC2) + && $type_export == "general_ledger") { // FEC format is defined here: https://www.legifrance.gouv.fr/affichCodeArticle.do?idArticle=LEGIARTI000027804775&cidTexte=LEGITEXT000006069583&dateTexte=20130802&oldAction=rechCodeArticle if (empty($search_date_end)) { // TODO Get the max date into bookeeping table From 3e485dcb4142a87db4eb3b2a8937edb08194f5a5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 24 Sep 2021 06:38:43 +0200 Subject: [PATCH 22/77] FIX Accountancy - Option of export popup are inverted --- htdocs/accountancy/bookkeeping/list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index bc260c77ed3..ec01d9c697c 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -591,7 +591,7 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex if (!empty($accountancyexport->errors)) { setEventMessages('', $accountancyexport->errors, 'errors'); - } elseif (!$notifiedexportdate || !$notifiedvalidationdate) { + } elseif (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) { // Specify as export : update field date_export or date_validated $error = 0; $db->begin(); @@ -602,17 +602,17 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex $sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping"; $sql .= " SET"; - if (!$notifiedexportdate && !$notifiedvalidationdate) { + if (!empty($notifiedexportdate) && !empty($notifiedvalidationdate)) { $sql .= " date_export = '".$db->idate($now)."'"; $sql .= ", date_validated = '".$db->idate($now)."'"; - } elseif (!$notifiedexportdate) { + } elseif (!empty($notifiedexportdate)) { $sql .= " date_export = '".$db->idate($now)."'"; - } elseif (!$notifiedvalidationdate) { + } elseif (!empty($notifiedvalidationdate)) { $sql .= " date_validated = '".$db->idate($now)."'"; } $sql .= " WHERE rowid = ".((int) $movement->id); - dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG); + dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG); $result = $db->query($sql); if (!$result) { $error++; From f88d12f55d79900b739b5c69f976738834f564af Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 24 Sep 2021 11:16:34 +0200 Subject: [PATCH 23/77] Fix #18809 : error on client tooltip --- htdocs/comm/propal/list.php | 6 +++--- htdocs/commande/list.php | 6 +++--- htdocs/compta/facture/list.php | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 75b5f5eb633..dcba8a63ed8 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -471,7 +471,7 @@ $sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date $sql .= ' p.note_public, p.note_private,'; $sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,'; $sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; -$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender'; +$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender'; if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", sc.fk_soc, sc.fk_user"; } @@ -1708,8 +1708,8 @@ if ($resql) { $userstatic->login = $obj->login; $userstatic->lastname = $obj->lastname; $userstatic->firstname = $obj->firstname; - $userstatic->email = $obj->email; - $userstatic->statut = $obj->statut; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; $userstatic->entity = $obj->user_entity; $userstatic->photo = $obj->photo; $userstatic->office_phone = $obj->office_phone; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index e0208d3cdcc..b3a0ec37167 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -426,7 +426,7 @@ $sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multic $sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,'; $sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,'; $sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,'; -$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,'; +$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,'; $sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,'; $sql .= ' c.fk_input_reason'; if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { @@ -1682,8 +1682,8 @@ if ($resql) { $userstatic->login = $obj->login; $userstatic->lastname = $obj->lastname; $userstatic->firstname = $obj->firstname; - $userstatic->email = $obj->email; - $userstatic->statut = $obj->statut; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; $userstatic->entity = $obj->entity; $userstatic->photo = $obj->photo; $userstatic->office_phone = $obj->office_phone; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 117db3f0485..0cdd2140b5d 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -497,7 +497,7 @@ $sql .= ' typent.code as typent_code,'; $sql .= ' state.code_departement as state_code, state.nom as state_name,'; $sql .= ' country.code as country_code,'; $sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,'; -$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender'; +$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender'; // We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0) // TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field. if (!$sall) { @@ -1915,8 +1915,8 @@ if ($resql) { $userstatic->login = $obj->login; $userstatic->lastname = $obj->lastname; $userstatic->firstname = $obj->firstname; - $userstatic->email = $obj->email; - $userstatic->statut = $obj->statut; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; $userstatic->entity = $obj->entity; $userstatic->photo = $obj->photo; $userstatic->office_phone = $obj->office_phone; From dbf7a9a0d063b86db324fe115be58ebeb5f02ae9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Sep 2021 11:48:43 +0200 Subject: [PATCH 24/77] FIX payment using wrong type in takepos when too many payment mode --- htdocs/takepos/pay.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 6e22f27f7ff..60a4840471e 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -329,7 +329,7 @@ print ''; + print ''; } else { print ''; } @@ -355,7 +355,7 @@ print ''; + print ''; } else { $button = array_pop($action_buttons); print ''; @@ -382,7 +382,7 @@ print ''; + print ''; } else { $button = array_pop($action_buttons); print ''; @@ -394,7 +394,23 @@ print ''; + $paycode = $arrayOfValidPaymentModes[$i]->code; + $payIcon = ''; + if ($paycode == 'LIQ') { + if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) { + $payIcon = 'coins'; + } + } elseif ($paycode == 'CB') { + if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) { + $payIcon = 'credit-card'; + } + } elseif ($paycode == 'CHQ') { + if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) { + $payIcon = 'money-check'; + } + } + + print ''; $i = $i + 1; } From 128bba1d9b798c67b5a0ef477893f8efce39a4b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Sep 2021 13:29:03 +0200 Subject: [PATCH 25/77] Fix GETPOST --- htdocs/reception/card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 57ef8981393..40b605bbe17 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -914,7 +914,7 @@ if ($action == 'create') { $ent = "entrepot_".$reg[1].'_'.$reg[2]; $pu = "pu_".$reg[1].'_'.$reg[2]; // This is unit price including discount $fk_commandefourndet = "fk_commandefourndet_".$reg[1].'_'.$reg[2]; - $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int')); + $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int')); } // with batch module enabled @@ -929,13 +929,13 @@ if ($action == 'create') { $ent = 'entrepot_'.$reg[1].'_'.$reg[2]; $pu = 'pu_'.$reg[1].'_'.$reg[2]; $lot = 'lot_number_'.$reg[1].'_'.$reg[2]; - $dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$reg[1].'_'.$reg[2].'month'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'day'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'year']); - $dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$reg[1].'_'.$reg[2].'month'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'day'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'year']); + $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo_'.$reg[1].'_'.$reg[2].'month', 'int'), GETPOST('dluo_'.$reg[1].'_'.$reg[2].'day', 'int'), GETPOST('dluo_'.$reg[1].'_'.$reg[2].'year', 'int')); + $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc_'.$reg[1].'_'.$reg[2].'month', 'int'), GETPOST('dlc_'.$reg[1].'_'.$reg[2].'day', 'int'), GETPOST('dlc_'.$reg[1].'_'.$reg[2].'year', 'int')); $fk_commandefourndet = 'fk_commandefourndet_'.$reg[1].'_'.$reg[2]; - $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); + $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' =>GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); } - // If create form is coming from same page post was sent but an error occured + // If create form is coming from same page, it means that post was sent but an error occured if (preg_match('/^productid([0-9]+)$/i', $key, $reg)) { $numAsked++; @@ -951,7 +951,7 @@ if ($action == 'create') { $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo'.$reg[1].'month', 'int'), GETPOST('dluo'.$reg[1].'day', 'int'), GETPOST('dluo'.$reg[1].'year', 'int')); $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc'.$reg[1].'month', 'int'), GETPOST('dlc'.$reg[1].'day', 'int'), GETPOST('dlc'.$reg[1].'year', 'int')); $fk_commandefourndet = 'fk_commandefournisseurdet'.$reg[1]; - $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST($comment), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); + $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' =>GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' =>GETPOST($comment), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); } } From 8f5f657e4dcda80443599ed7c233a64a48a58e0f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 25 Sep 2021 07:12:33 +0200 Subject: [PATCH 26/77] FIX Accountancy - Missing specific filename for export on format FEC2, Ciel & repare it --- htdocs/accountancy/tpl/export_journal.tpl.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index 93215b9b8db..b595402228e 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -39,11 +39,11 @@ include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; $accountancyexport = new AccountancyExport($db); // Specific filename for FEC model export into the general ledger -if ($accountancyexport->getFormatCode($formatexportset) == ($accountancyexport::$EXPORT_TYPE_FEC || $accountancyexport::$EXPORT_TYPE_FEC2) +if (($accountancyexport->getFormatCode($formatexportset) == 'fec' || $accountancyexport->getFormatCode($formatexportset) == 'fec2') && $type_export == "general_ledger") { // FEC format is defined here: https://www.legifrance.gouv.fr/affichCodeArticle.do?idArticle=LEGIARTI000027804775&cidTexte=LEGITEXT000006069583&dateTexte=20130802&oldAction=rechCodeArticle if (empty($search_date_end)) { - // TODO Get the max date into bookeeping table + // TODO Get the max date into bookkeeping table $search_date_end = dol_now(); } $datetouseforfilename = $search_date_end; @@ -60,7 +60,7 @@ if ($accountancyexport->getFormatCode($formatexportset) == ($accountancyexport:: $endaccountingperiod = dol_print_date(dol_get_last_day($tmparray['year'], $tmparray['mon']), 'dayxcard'); $completefilename = $siren."FEC".$endaccountingperiod.".txt"; -} elseif ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$EXPORT_TYPE_CIEL && $type_export == "general_ledger" && !empty($conf->global->ACCOUNTING_EXPORT_XIMPORT_FORCE_FILENAME)) { +} elseif ($accountancyexport->getFormatCode($formatexportset) == 'ciel' && $type_export == "general_ledger" && !empty($conf->global->ACCOUNTING_EXPORT_XIMPORT_FORCE_FILENAME)) { $completefilename = "XIMPORT.TXT"; } else { $completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format; From 567334318aca2d7c5659aafdb23a6f1fcc1a07f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Sep 2021 21:13:55 +0200 Subject: [PATCH 27/77] Fix sql eventorganization --- htdocs/core/actions_addupdatedelete.inc.php | 1 + .../class/conferenceorboothattendee.class.php | 11 +++++++---- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 11 +++++++++-- ...ventorganization_conferenceorboothattendee.key.sql | 6 +----- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index f871ed73de8..44a0f159143 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -117,6 +117,7 @@ if ($action == 'add' && !empty($permissiontoadd)) { if (!$error) { $result = $object->create($user); + var_dump($object);exit; if ($result > 0) { // Creation OK $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist; diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 572d6f13856..4d44bc13287 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -248,9 +248,9 @@ class ConferenceOrBoothAttendee extends CommonObject } $result = $this->createCommon($user, $notrigger); - if ($result>0) { - $result =$this->fetch($result); - if ($result>0) { + if ($result > 0) { + $result = $this->fetch($result); + if ($result > 0) { $this->ref = $this->id; $result = $this->update($user); } @@ -293,7 +293,7 @@ class ConferenceOrBoothAttendee extends CommonObject // Clear fields if (property_exists($object, 'ref')) { - $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default']; + $object->ref = empty($this->fields['ref']['default']) ? "(PROV)" : $this->fields['ref']['default']; } if (property_exists($object, 'label')) { $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; @@ -327,6 +327,9 @@ class ConferenceOrBoothAttendee extends CommonObject $error++; $this->error = $object->error; $this->errors = $object->errors; + } else { + $object->ref = $object->id; + $result = $object->update($user); } if (!$error) { diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 63f20198658..ac9da2b1092 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -425,14 +425,21 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee( ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL; ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_invoice integer NULL; +ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_soc; +ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_actioncomm; +ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_project; + ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_soc (fk_soc); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_actioncomm (fk_actioncomm); -ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm(id); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_email (email); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_status (status); -ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_soc, fk_actioncomm, email); + +-- VMYSQL4.1 DROP INDEX uk_eventorganization_conferenceorboothattendee on llx_eventorganization_conferenceorboothattendee; +-- VPGSQL8.2 DROP INDEX uk_eventorganization_conferenceorboothattendee; + +ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_project, email, fk_actioncomm); create table llx_eventorganization_conferenceorboothattendee_extrafields ( diff --git a/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.key.sql b/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.key.sql index 0633e3cc2a2..9e1bbcde191 100644 --- a/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.key.sql +++ b/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.key.sql @@ -18,15 +18,11 @@ ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_soc (fk_soc); -ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_actioncomm (fk_actioncomm); -ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm(id); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_project (fk_project); -ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_project FOREIGN KEY (fk_project) REFERENCES llx_projet(rowid); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_email (email); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_status (status); -- END MODULEBUILDER INDEXES -ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_soc, fk_project, fk_actioncomm, email); - +ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_project, email, fk_actioncomm); From a47cd224500a7ef53259385f34a8f7be9dea2191 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Sep 2021 21:15:53 +0200 Subject: [PATCH 28/77] Fix sql --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index ac9da2b1092..e6578a1bc66 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -425,9 +425,9 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee( ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL; ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_invoice integer NULL; -ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_soc; -ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_actioncomm; -ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_project; +ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_soc; +ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_actioncomm; +ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_project; ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref); From c02b5b08eaebe788deb10c98762153928d4d71f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Sep 2021 12:58:34 +0200 Subject: [PATCH 29/77] Fix trans --- htdocs/eventorganization/conferenceorbooth_list.php | 2 +- htdocs/eventorganization/conferenceorboothattendee_card.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 5f6e2820591..9c086528120 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -41,7 +41,7 @@ global $dolibarr_main_url_root; //dol_include_once('/othermodule/class/otherobject.class.php'); // Load translation files required by the page -$langs->loadLangs(array("eventorganization", "other", "projects")); +$langs->loadLangs(array("eventorganization", "other", "projects", "companies")); $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 84f99182192..09cc8a12b57 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page -$langs->loadLangs(array("eventorganization", "other")); +$langs->loadLangs(array("eventorganization", "other", "projects", "companies")); // Get parameters $id = GETPOST('id', 'int'); @@ -110,6 +110,7 @@ $permissionnote = $user->rights->eventorganization->write; // Used by the includ $permissiondellink = $user->rights->eventorganization->write; // Used by the include of actions_dellink.inc.php $upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1]; + /* * Actions */ From cb964a3ab3fe62fa3050896822abf9f62d89f982 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Sep 2021 13:55:19 +0200 Subject: [PATCH 30/77] Fix cancel button --- htdocs/eventorganization/conferenceorboothattendee_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 09cc8a12b57..e6c03b0a74a 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -135,7 +135,7 @@ if (empty($reshook)) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { - $backtopage = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?id='.($id > 0 ? $id : '__ID__'); + $backtopage = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?fk_project='.((int) $fk_project).'&id='.($id > 0 ? $id : '__ID__'); } } } From d5d4b8d8e09994a3f31e97870d6b61e409211eff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Sep 2021 14:21:23 +0200 Subject: [PATCH 31/77] Fix escape the undescore on search in website module --- htdocs/core/db/Database.interface.php | 8 ++++++++ htdocs/core/db/mysqli.class.php | 11 +++++++++++ htdocs/core/db/pgsql.class.php | 11 +++++++++++ htdocs/core/db/sqlite3.class.php | 11 +++++++++++ htdocs/core/lib/website.lib.php | 7 ++++--- htdocs/debugbar/class/TraceableDB.php | 11 +++++++++++ 6 files changed, 56 insertions(+), 3 deletions(-) diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index 898421978db..f3e5d45afef 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -177,6 +177,14 @@ interface Database */ public function escape($stringtoencode); + /** + * Escape a string to insert data + * + * @param string $stringtoencode String to escape + * @return string String escaped + */ + public function escapeunderscore($stringtoencode); + /** * Sanitize a string for SQL forging * diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 343f4c8cc3e..3a8aabd3bf9 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -430,6 +430,17 @@ class DoliDBMysqli extends DoliDB return $this->db->real_escape_string($stringtoencode); } + /** + * Escape a string to insert data + * + * @param string $stringtoencode String to escape + * @return string String escaped + */ + public function escapeunderscore($stringtoencode) + { + return str_replace('_', '\_', $stringtoencode); + } + /** * Return generic error code of last operation. * diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 5a9d47dc40c..543e24a1b12 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -700,6 +700,17 @@ class DoliDBPgsql extends DoliDB return pg_escape_string($stringtoencode); } + /** + * Escape a string to insert data + * + * @param string $stringtoencode String to escape + * @return string String escaped + */ + public function escapeunderscore($stringtoencode) + { + return str_replace('_', '\_', $stringtoencode); + } + /** * Format a SQL IF * diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 563ccb19aac..008c7311ac8 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -635,6 +635,17 @@ class DoliDBSqlite3 extends DoliDB return Sqlite3::escapeString($stringtoencode); } + /** + * Escape a string to insert data + * + * @param string $stringtoencode String to escape + * @return string String escaped + */ + public function escapeunderscore($stringtoencode) + { + return str_replace('_', '\_', $stringtoencode); + } + /** * Renvoie le code erreur generique de l'operation precedente. * diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 89fd777cd20..20380e02aab 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -866,11 +866,11 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so $sql .= " AND ("; $searchalgo = ''; if (preg_match('/meta/', $algo)) { - $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.title LIKE '%".$db->escape($searchstring)."%' OR wp.description LIKE '%".$db->escape($searchstring)."%'"; - $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.keywords LIKE '".$db->escape($searchstring).",%' OR wp.keywords LIKE '% ".$db->escape($searchstring)."%'"; // TODO Use a better way to scan keywords + $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.title LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%' OR wp.description LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%'"; + $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.keywords LIKE '".$db->escapeunderscore($db->escape($searchstring)).",%' OR wp.keywords LIKE '% ".$db->escapeunderscore($db->escape($searchstring))."%'"; // TODO Use a better way to scan keywords } if (preg_match('/content/', $algo)) { - $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.content LIKE '%".$db->escape($searchstring)."%'"; + $searchalgo .= ($searchalgo ? ' OR ' : '')."wp.content LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%'"; } $sql .= $searchalgo; if (is_array($otherfilters) && !empty($otherfilters['category'])) { @@ -879,6 +879,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so $sql .= ")"; $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($max); + //print $sql; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index af11f4c1d67..093e9b36280 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -250,6 +250,17 @@ class TraceableDB extends DoliDB return $this->db->escape($stringtoencode); } + /** + * Escape a string to insert data + * + * @param string $stringtoencode String to escape + * @return string String escaped + */ + public function escapeunderscore($stringtoencode) + { + return $this->db->escapeunderscore($stringtoencode); + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Get last ID after an insert INSERT From 6d92591358fb9974559397a00095b7cbb36d39d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Sep 2021 20:23:15 +0200 Subject: [PATCH 32/77] Fix look and feel v15 --- htdocs/admin/translation.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 8d77e009cb3..7d78297b30d 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -37,6 +37,7 @@ if (!$user->admin) { $id = GETPOST('rowid', 'int'); $action = GETPOST('action', 'aZ09'); $optioncss = GETPOST('optionscss', 'aZ09'); +$contextpage = GETPOST('contextpage', 'aZ09'); $langcode = GETPOST('langcode', 'alphanohtml'); $transkey = GETPOST('transkey', 'alphanohtml'); @@ -458,18 +459,8 @@ if ($mode == 'searchkey') { print '
'; print ''; - print ''; - print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder); - print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder); - print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder); - //if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder); - print ''; - print "\n"; - // Line to search new record - print "\n"; - - print ''."\n"; @@ -495,6 +486,15 @@ if ($mode == 'searchkey') { print ''; print ''; + print ''; + print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder); + print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder); + print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder); + //if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder); + print ''; + print "\n"; + + if ($sortfield == 'transkey' && strtolower($sortorder) == 'asc') { ksort($recordtoshow); } From c9ae46db50f4aee2775ca0839f86b9ad08b00a44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Sep 2021 20:56:17 +0200 Subject: [PATCH 33/77] FIX Filter on categories --- htdocs/comm/propal/list.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index dcba8a63ed8..a0877a50028 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -475,7 +475,7 @@ $sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as u if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", sc.fk_soc, sc.fk_user"; } -if ($search_categ_cus) { +if (!empty($search_categ_cus) && $search_categ_cus != '-1') { $sql .= ", cc.fk_categorie, cc.fk_soc"; } // Add fields from extrafields @@ -493,7 +493,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; -if (!empty($search_categ_cus)) { +if (!empty($search_categ_cus) && $search_categ_cus != '-1') { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ } $sql .= ', '.MAIN_DB_PREFIX.'propal as p'; @@ -592,6 +592,7 @@ if ($search_multicurrency_montant_ttc != '') { if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } + if ($search_categ_cus > 0) { $sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus); } From 9b825df158852f81e9c03486d8b377c3f2b65644 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Sep 2021 11:36:40 +0200 Subject: [PATCH 34/77] Clean code --- htdocs/compta/facture/list.php | 2 +- htdocs/societe/list.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 0cdd2140b5d..5023d818f78 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -520,7 +520,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; -if (!empty($search_categ_cus) && $search_categ_cus!=-1) { +if (!empty($search_categ_cus) && $search_categ_cus != '-1') { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 15c5e47cc99..988b2aad33e 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -89,9 +89,9 @@ $search_idprof4 = trim(GETPOST('search_idprof4', 'alpha')); $search_idprof5 = trim(GETPOST('search_idprof5', 'alpha')); $search_idprof6 = trim(GETPOST('search_idprof6', 'alpha')); $search_vat = trim(GETPOST('search_vat', 'alpha')); -$search_sale = trim(GETPOST("search_sale", 'int')); -$search_categ_cus = trim(GETPOST("search_categ_cus", 'int')); -$search_categ_sup = trim(GETPOST("search_categ_sup", 'int')); +$search_sale = GETPOST("search_sale", 'int'); +$search_categ_cus = GETPOST("search_categ_cus", 'int'); +$search_categ_sup = GETPOST("search_categ_sup", 'int'); $search_country = GETPOST("search_country", 'intcomma'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); $search_price_level = GETPOST('search_price_level', 'int'); @@ -100,8 +100,8 @@ $search_status = GETPOST("search_status", 'int'); $search_type = GETPOST('search_type', 'alpha'); $search_level = GETPOST("search_level", "array"); $search_stcomm = GETPOST('search_stcomm', 'int'); -$search_import_key = GETPOST("search_import_key", "alpha"); -$search_parent_name = GETPOST('search_parent_name', 'alpha'); +$search_import_key = trim(GETPOST("search_import_key", "alpha")); +$search_parent_name = trim(GETPOST('search_parent_name', 'alpha')); $type = GETPOST('type', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); @@ -494,7 +494,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_ef $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)"; // We'll need this table joined to the select in order to filter by categ -if (!empty($search_categ_cus) && $search_categ_cus!=-1) { +if (!empty($search_categ_cus) && $search_categ_cus != '-1') { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ } if (!empty($search_categ_sup) && $search_categ_sup!=-1) { From b77cadf39ac87aef4124327b6e792f9cde661c4e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Sep 2021 11:38:34 +0200 Subject: [PATCH 35/77] Fix filter --- htdocs/contact/list.php | 6 +++--- htdocs/fourn/facture/list.php | 2 +- htdocs/societe/list.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index a63a1bf7e49..27c6208ad0d 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -570,13 +570,13 @@ if ($limit > 0 && $limit != $conf->liste_limit) { } $param .= '&begin='.urlencode($begin).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); $param .= '&type='.urlencode($type).'&view='.urlencode($view); -if (!empty($search_categ)) { +if (!empty($search_categ) && $search_categ != '-1') { $param .= '&search_categ='.urlencode($search_categ); } -if (!empty($search_categ_thirdparty)) { +if (!empty($search_categ_thirdparty) && $search_categ_thirdparty != '-1') { $param .= '&search_categ_thirdparty='.urlencode($search_categ_thirdparty); } -if (!empty($search_categ_supplier)) { +if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') { $param .= '&search_categ_supplier='.urlencode($search_categ_supplier); } if ($sall != '') { diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index ac64a9af82e..6c81904b794 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -441,7 +441,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; -if (!empty($search_categ_sup)) { +if (!empty($search_categ_sup) && $search_categ_supplier != '-1') { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 988b2aad33e..8b2236cd484 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -497,7 +497,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_regio if (!empty($search_categ_cus) && $search_categ_cus != '-1') { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ } -if (!empty($search_categ_sup) && $search_categ_sup!=-1) { +if (!empty($search_categ_sup) && $search_categ_sup != '-1') { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ } $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id"; From 6abe6462e6c1dde1f9e1cba2ba2049e52723e512 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Mon, 27 Sep 2021 14:33:57 +0200 Subject: [PATCH 36/77] FIX: products/services card: hidden extrafields were overridden --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index d74cab0ada4..542c66dee25 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -487,7 +487,7 @@ if (empty($reshook)) if ($accountancy_code_buy_export <= 0) { $object->accountancy_code_buy_export = ''; } else { $object->accountancy_code_buy_export = $accountancy_code_buy_export; } // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) $error++; if (!$error && $object->check()) From 0e1cc2b0965c79c787afe51f29fd621eb2f96a53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Sep 2021 18:46:27 +0200 Subject: [PATCH 37/77] Fix cost price is 0. --- htdocs/bom/bom_card.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index ab6112c0fed..4396dd36e92 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -75,6 +75,7 @@ if ($object->id > 0) { $object->calculateCosts(); } + // Security check - Protection if external user //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; @@ -115,8 +116,13 @@ if (empty($reshook)) { $triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record + // Actions cancel, add, update, delete or clone include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; + // The fetch/fetch_lines was redone into the inc.php so we must recall the calculateCosts() + if ($action == 'confirm_validate' && $object->id > 0) { + $object->calculateCosts(); + } // Actions when linking object each other include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; From ec3154075a71a7514a6778a86bc22f747afb59ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Sep 2021 22:16:08 +0200 Subject: [PATCH 38/77] Comment --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index e6578a1bc66..db0e40790dc 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -441,6 +441,7 @@ ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_evento ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_project, email, fk_actioncomm); + create table llx_eventorganization_conferenceorboothattendee_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, From 43ed88f056eb5f89b46b994d16deeb7944e5cb67 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 27 Sep 2021 23:02:19 +0200 Subject: [PATCH 39/77] FIX Propal list - Problem of pagination on date --- htdocs/comm/propal/list.php | 144 ++++++++++++++++++++++++++++-------- 1 file changed, 114 insertions(+), 30 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index a0877a50028..692468b8485 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -13,9 +13,9 @@ * Copyright (C) 2016-2021 Ferran Marcet * Copyright (C) 2017-2018 Charlene Benke * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2019 Alexandre Spangaro + * Copyright (C) 2019-2021 Alexandre Spangaro * Copyright (C) 2021 Anthony Berton - * Copyright (C) 2021 Frédéric France + * Copyright (C) 2021 Frédéric France * * 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 @@ -88,12 +88,30 @@ $search_zip = GETPOST('search_zip', 'alpha'); $search_state = GETPOST("search_state"); $search_country = GETPOST("search_country", 'int'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); -$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); -$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); -$search_dateend_start = dol_mktime(0, 0, 0, GETPOST('search_dateend_startmonth', 'int'), GETPOST('search_dateend_startday', 'int'), GETPOST('search_dateend_startyear', 'int')); -$search_dateend_end = dol_mktime(23, 59, 59, GETPOST('search_dateend_endmonth', 'int'), GETPOST('search_dateend_endday', 'int'), GETPOST('search_dateend_endyear', 'int')); -$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int')); -$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int')); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); +$search_date_end_startday = GETPOST('search_date_end_startday', 'int'); +$search_date_end_startmonth = GETPOST('search_date_end_startmonth', 'int'); +$search_date_end_startyear = GETPOST('search_date_end_startyear', 'int'); +$search_date_end_endday = GETPOST('search_date_end_endday', 'int'); +$search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int'); +$search_date_end_endyear = GETPOST('search_date_end_endyear', 'int'); +$search_date_end_start = dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear); // Use tzserver +$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); +$search_date_delivery_startday = GETPOST('search_date_delivery_startday', 'int'); +$search_date_delivery_startmonth = GETPOST('search_date_delivery_startmonth', 'int'); +$search_date_delivery_startyear = GETPOST('search_date_delivery_startyear', 'int'); +$search_date_delivery_endday = GETPOST('search_date_delivery_endday', 'int'); +$search_date_delivery_endmonth = GETPOST('search_date_delivery_endmonth', 'int'); +$search_date_delivery_endyear = GETPOST('search_date_delivery_endyear', 'int'); +$search_date_delivery_start = dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear); +$search_date_delivery_end = dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear); $search_availability = GETPOST('search_availability', 'int'); $search_categ_cus = GETPOST("search_categ_cus", 'int'); $search_fk_cond_reglement = GETPOST("search_fk_cond_reglement", 'int'); @@ -278,12 +296,30 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_type = ''; $search_country = ''; $search_type_thirdparty = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; $search_date_start = ''; $search_date_end = ''; - $search_dateend_start = ''; - $search_dateend_end = ''; - $search_datedelivery_start = ''; - $search_datedelivery_end = ''; + $search_date_end_startday = ''; + $search_date_end_startmonth = ''; + $search_date_end_startyear = ''; + $search_date_end_endday = ''; + $search_date_end_endmonth = ''; + $search_date_end_endyear = ''; + $search_date_end_start = ''; + $search_date_end_end = ''; + $search_date_delivery_startday = ''; + $search_date_delivery_startmonth = ''; + $search_date_delivery_startyear = ''; + $search_date_delivery_endday = ''; + $search_date_delivery_endmonth = ''; + $search_date_delivery_endyear = ''; + $search_date_delivery_start = ''; + $search_date_delivery_end = ''; $search_availability = ''; $search_status = ''; $object_statut = ''; @@ -628,17 +664,17 @@ if ($search_date_start) { if ($search_date_end) { $sql .= " AND p.datep <= '".$db->idate($search_date_end)."'"; } -if ($search_dateend_start) { - $sql .= " AND p.fin_validite >= '".$db->idate($search_dateend_start)."'"; +if ($search_date_end_start) { + $sql .= " AND p.fin_validite >= '".$db->idate($search_date_end_start)."'"; } -if ($search_dateend_end) { - $sql .= " AND p.fin_validite <= '".$db->idate($search_dateend_end)."'"; +if ($search_date_end_end) { + $sql .= " AND p.fin_validite <= '".$db->idate($search_date_end_end)."'"; } -if ($search_datedelivery_start) { - $sql .= " AND p.date_livraison >= '".$db->idate($search_datedelivery_start)."'"; +if ($search_date_delivery_start) { + $sql .= " AND p.date_livraison >= '".$db->idate($search_date_delivery_start)."'"; } -if ($search_datedelivery_end) { - $sql .= " AND p.date_livraison <= '".$db->idate($search_datedelivery_end)."'"; +if ($search_date_delivery_end) { + $sql .= " AND p.date_livraison <= '".$db->idate($search_date_delivery_end)."'"; } if ($search_sale > 0) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); @@ -713,12 +749,60 @@ if ($resql) { if ($sall) { $param .= '&sall='.urlencode($sall); } - if ($search_date_start) $param .= '&search_date_startday='.urlencode(dol_print_date($search_date_start, '%d')).'&search_date_startmonth='.urlencode(dol_print_date($search_date_start, '%m')).'&search_date_startyear='.urlencode(dol_print_date($search_date_start, '%Y')); - if ($search_date_end) $param .= '&search_date_endday='.urlencode(dol_print_date($search_date_end, '%d')).'&search_date_endmonth='.urlencode(dol_print_date($search_date_end, '%m')).'&search_date_endyear='.urlencode(dol_print_date($search_date_end, '%Y')); - if ($search_dateend_start) $param .= '&search_dateend_startday='.urlencode(dol_print_date($search_dateend_start, '%d')).'&search_dateend_startmonth='.urlencode(dol_print_date($search_dateend_start, '%m')).'&search_dateend_startyear='.urlencode(dol_print_date($search_dateend_start, '%Y')); - if ($search_dateend_end) $param .= '&search_dateend_endday='.urlencode(dol_print_date($search_dateend_end, '%d')).'&search_dateend_endmonth='.urlencode(dol_print_date($search_dateend_end, '%m')).'&search_dateend_endyear='.urlencode(dol_print_date($search_dateend_end, '%Y')); - if ($search_datedelivery_start) $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start, '%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start, '%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start, '%Y')); - if ($search_datedelivery_end) $param .= '&search_datedelivery_endday='.urlencode(dol_print_date($search_datedelivery_end, '%d')).'&search_datedelivery_endmonth='.urlencode(dol_print_date($search_datedelivery_end, '%m')).'&search_datedelivery_endyear='.urlencode(dol_print_date($search_datedelivery_end, '%Y')); + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); + } + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + } + if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); + } + if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); + } + if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + } + if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); + } + if ($search_date_end_startday) { + $param .= '&search_date_end_startday='.urlencode($search_date_end_startday); + } + if ($search_date_end_startmonth) { + $param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth); + } + if ($search_date_end_startyear) { + $param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear); + } + if ($search_date_end_endday) { + $param .= '&search_date_end_endday='.urlencode($search_date_end_endday); + } + if ($search_date_end_endmonth) { + $param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth); + } + if ($search_date_end_endyear) { + $param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear); + } + if ($search_date_delivery_startday) { + $param .= '&search_date_delivery_startday='.urlencode($search_date_delivery_startday); + } + if ($search_date_delivery_startmonth) { + $param .= '&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth); + } + if ($search_date_delivery_startyear) { + $param .= '&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear); + } + if ($search_date_delivery_endday) { + $param .= '&search_date_delivery_endday='.urlencode($search_date_delivery_endday); + } + if ($search_date_delivery_endmonth) { + $param .= '&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth); + } + if ($search_date_delivery_endyear) { + $param .= '&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear); + } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); } @@ -1018,10 +1102,10 @@ if ($resql) { if (!empty($arrayfields['p.fin_validite']['checked'])) { print ''; } @@ -1029,10 +1113,10 @@ if ($resql) { if (!empty($arrayfields['p.date_livraison']['checked'])) { print ''; } From 0750d4bb6e8fccaf568e235fae240eec5b25dcab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Sep 2021 00:21:54 +0200 Subject: [PATCH 40/77] Look and feel v14 --- htdocs/compta/prelevement/line.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index 5aa7344eea5..05bbb547102 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -151,7 +151,9 @@ if ($id) { print $bon->getNomUrl(1).''; print ''; - print ''; + + print ''; + print ''; if ($lipre->statut == 3) { @@ -159,6 +161,7 @@ if ($id) { $resf = $rej->fetch($lipre->id); if ($resf == 0) { print ''; + print ''; + print ''; } else { print ''; @@ -229,7 +233,7 @@ if ($id) { /* * Action bar */ - print "
"; + print '
'; if ($action == '') { if ($bon->statut == BonPrelevement::STATUS_CREDITED) { @@ -245,7 +249,7 @@ if ($id) { } } - print "
"; + print '
'; /* * List of invoices @@ -267,7 +271,7 @@ if ($id) { if ($socid) { $sql .= " AND s.rowid = ".((int) $socid); } - $sql .= " ORDER BY $sortfield $sortorder "; + $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($conf->liste_limit + 1, $offset); $result = $db->query($sql); From e6e224f33cdaf0222cf06bb9ad167c310133a9c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Sep 2021 11:53:00 +0200 Subject: [PATCH 41/77] Better translation --- htdocs/admin/mails_templates.php | 9 +++++---- htdocs/langs/en_US/admin.lang | 2 +- htdocs/user/group/card.php | 2 +- htdocs/user/home.php | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 3545892d486..7d8bc2f22b1 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -160,6 +160,7 @@ if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $tabhelp = array(); $tabhelp[25] = array( + 'label'=>$langs->trans('EnterAnyCode'), 'topic'=>''.$helpsubstit.'', 'joinfiles'=>$langs->trans('AttachMainDocByDefault'), 'content'=>''.$helpsubstit.'', @@ -683,8 +684,8 @@ if ($action == 'view') { $tmpaction = 'create'; $parameters = array( - 'fieldlist' => $fieldlist, - 'tabname' => $tabname[$id] + 'fieldlist' => $fieldlist, + 'tabname' => $tabname[$id] ); $reshook = $hookmanager->executeHooks('createEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error = $hookmanager->error; @@ -822,7 +823,7 @@ if ($resql) { print ''; } elseif ($value == 'fk_user') { print ''; } elseif ($value == 'topic') { print ''; @@ -1187,7 +1188,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') if ($value == 'fk_user') { print '
'; + print '
'; //print $formadmin->select_language($langcode,'langcode',0,null,$langs->trans("All"),0,0,'',1); print $formadmin->select_language($langcode, 'langcode', 0, null, 0, 0, 0, 'maxwidth250', 1); print '
'; print '
'; - print $form->selectDate($search_dateend_start ? $search_dateend_start : -1, 'search_dateend_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print $form->selectDate($search_date_end_start ? $search_date_end_start : -1, 'search_date_end_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; print '
'; - print $form->selectDate($search_dateend_end ? $search_dateend_end : -1, 'search_dateend_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print $form->selectDate($search_date_end_end ? $search_date_end_end : -1, 'search_date_end_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; print '
'; print '
'; - print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print $form->selectDate($search_date_delivery_start ? $search_date_delivery_start : -1, 'search_date_delivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; print '
'; - print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print $form->selectDate($search_date_delivery_end ? $search_date_delivery_end : -1, 'search_date_delivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; print '
'.$langs->trans("Date").''.dol_print_date($bon->datec, 'day').'
'.$langs->trans("Amount").''.price($lipre->amount).'
'.$langs->trans("Amount").''.price($lipre->amount).'
'.$langs->trans("Status").''.$lipre->LibStatut($lipre->statut, 1).'
'.$langs->trans("RefusedReason").''.$rej->motif.'
'.$langs->trans("RefusedData").''; if ($rej->date_rejet == 0) { /* Historique pour certaines install */ @@ -167,6 +170,7 @@ if ($id) { print dol_print_date($rej->date_rejet, 'day'); } print '
'.$langs->trans("RefusedInvoicing").''.$rej->invoicing.'
'.$resf.'
'; - print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 1, '', 0, '', 'maxwidth150'); + print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth150'); print ''; if ($user->admin) { - print $form->select_dolusers(empty($obj->{$value}) ? '' : $obj->{$value}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 1, '', 0, '', 'maxwidth200'); + print $form->select_dolusers(empty($obj->{$value}) ? '' : $obj->{$value}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'minwidth150 maxwidth300'); } else { if ($context == 'add') { // I am not admin and we show the add form print $user->getNomUrl(1); // Me diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 367f68e6a9b..d446e076dc3 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1921,7 +1921,7 @@ SellTaxRate=Sales tax rate RecuperableOnly=Yes for VAT "Not Perceived but Recoverable" dedicated for some state in France. Keep value to "No" in all other cases. UrlTrackingDesc=If the provider or transport service offers a page or web site to check the status of your shipments, you may enter it here. You can use the key {TRACKID} in the URL parameters so the system will replace it with the tracking number the user entered into the shipment card. OpportunityPercent=When you create a lead, you will define an estimated amount of project/lead. According to status of the lead, this amount may be multiplied by this rate to evaluate a total amount all your leads may generate. Value is a percentage (between 0 and 100). -TemplateForElement=This template record is dedicated to which element +TemplateForElement=This mail template is related to what type of object? An email template is available only when using the "Send Email" button from the related object. TypeOfTemplate=Type of template TemplateIsVisibleByOwnerOnly=Template is visible to owner only VisibleEverywhere=Visible everywhere diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 5c1e16e4a0c..56af96740d4 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -415,7 +415,7 @@ if ($action == 'create') { print ''."\n"; print ''."\n"; print ''; -// EMail -//If linked user, then emails are going to be sent to users' email -if (!$object->fk_user_creat) { - print ''; -} - // Receive an email with each vote print ''; // Author print ''; diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php index 30e662be7ea..6ed1f2073d2 100644 --- a/htdocs/opensurvey/wizard/create_survey.php +++ b/htdocs/opensurvey/wizard/create_survey.php @@ -170,7 +170,7 @@ if ($_SESSION["mailsonde"]) { $cochemail = "checked"; } -print ' '.$langs->trans("ToReceiveEMailForEachVote").'
'."\n"; +print '
'."\n"; if ($_SESSION['allow_comments']) { $allow_comments = 'checked'; @@ -178,7 +178,7 @@ if ($_SESSION['allow_comments']) { if (GETPOSTISSET('allow_comments')) { $allow_comments = GETPOST('allow_comments') ? 'checked' : ''; } -print ' '.$langs->trans('CanComment').'
'."\n"; +print '
'."\n"; if ($_SESSION['allow_spy']) { $allow_spy = 'checked'; @@ -186,7 +186,7 @@ if ($_SESSION['allow_spy']) { if (GETPOSTISSET('allow_spy')) { $allow_spy = GETPOST('allow_spy') ? 'checked' : ''; } -print ' '.$langs->trans('CanSeeOthersVote').'
'."\n"; +print '
'."\n"; if (GETPOST('choix_sondage')) { if (GETPOST('choix_sondage') == 'date') { From a495d5e9824458b7620551c508fb0da50026723f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Sep 2021 17:14:37 +0200 Subject: [PATCH 59/77] Fix translation --- htdocs/index.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/index.php b/htdocs/index.php index 0f457b0f40b..c4d3e5e4d78 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -336,6 +336,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { ), 'supplier_proposal' => array( + 'lang' => 'supplier_proposal', 'groupName' => 'SupplierProposals', 'globalStatsKey' => 'askprice', 'stats' => @@ -485,6 +486,9 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } if (!empty($boards)) { + if (!empty($groupElement['lang'])) { + $langs->load($groupElement['lang']); + } $groupName = $langs->trans($groupElement['groupName']); $groupKeyLowerCase = strtolower($groupKey); $nbTotalForGroup = 0; From 11c48a53a5cfac791d4be3c03c4d53eddcd979d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Sep 2021 17:20:59 +0200 Subject: [PATCH 60/77] Fix name of file --- ...n_user_group.sql => llx_workstation_workstation_usergroup.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename htdocs/install/mysql/tables/{llx_workstation_workstation_user_group.sql => llx_workstation_workstation_usergroup.sql} (100%) diff --git a/htdocs/install/mysql/tables/llx_workstation_workstation_user_group.sql b/htdocs/install/mysql/tables/llx_workstation_workstation_usergroup.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_workstation_workstation_user_group.sql rename to htdocs/install/mysql/tables/llx_workstation_workstation_usergroup.sql From 3d239e75288bb8ed97e1aca6cb5c7dd958efc74a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Sep 2021 17:28:06 +0200 Subject: [PATCH 61/77] Trans --- htdocs/admin/tools/purge.php | 2 +- htdocs/langs/en_US/admin.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php index 09647549c8b..eb274163697 100644 --- a/htdocs/admin/tools/purge.php +++ b/htdocs/admin/tools/purge.php @@ -110,7 +110,7 @@ if (!empty($conf->syslog->enabled)) { print '

'; +print '>

'; print '%s directory). Using this feature is not normally necessary. It is provided as a workaround for users whose Dolibarr is hosted by a provider that does not offer permissions to delete files generated by the web server. PurgeDeleteLogFile=Delete log files, including %s defined for Syslog module (no risk of losing data) PurgeDeleteTemporaryFiles=Delete all log and temporary files (no risk of losing data). Parameter can be 'tempfilesold', 'logfiles' or both 'tempfilesold+logfiles'. Note: Deletion of temporary files is done only if the temp directory was created more than 24 hours ago. -PurgeDeleteTemporaryFilesShort=Delete log and temporary files +PurgeDeleteTemporaryFilesShort=Delete log and temporary files (no risk of losing data) PurgeDeleteAllFilesInDocumentsDir=Delete all files in directory: %s.
This will delete all generated documents related to elements (third parties, invoices etc...), files uploaded into the ECM module, database backup dumps and temporary files. PurgeRunNow=Purge now PurgeNothingToDelete=No directory or files to delete. From fca39d91792ce0cb443704c84d8af3f9f71c0739 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Sep 2021 01:15:36 +0200 Subject: [PATCH 62/77] css --- htdocs/compta/index.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index ca7cd08a6fe..9cb9bca667b 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -206,6 +206,7 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) { print '
'; - print ''; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) { print ''; } print ''; + print ''; + print ''; + print ''; $total_ttc += $obj->total_ttc; From 04fa5ff70b5d3d7d7526a81479e02acc67406472 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Sep 2021 01:50:11 +0200 Subject: [PATCH 63/77] css --- htdocs/holiday/define_holiday.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index fdcdb5f88e6..621443fb408 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -358,7 +358,7 @@ if (count($typeleaves) == 0) { //var_dump($users['rowid'].' - '.$val['rowid']); print '
'.$langs->trans("NonAffectedUsers").''; - print $form->select_dolusers('', 'user', 1, $exclude, 0, '', '', $object->entity, 0, 0, '', 0, '', 'maxwidth300'); + print $form->select_dolusers('', 'user', 1, $exclude, 0, '', '', $object->entity, 0, 0, '', 0, '', 'minwidth200 maxwidth500'); print '   '; print ''; print ''; diff --git a/htdocs/user/home.php b/htdocs/user/home.php index fbfe4638bd5..924dceb14ab 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -89,12 +89,12 @@ $searchbox .= ''; $searchbox .= ''; $searchbox .= ''; $searchbox .= ''; +$searchbox .= $langs->trans("User").':'; // Search Group if ($canreadperms) { $searchbox .= ''; + $searchbox .= $langs->trans("Group").':'; } $searchbox .= ''; From 0e3ec3ea2d82ea5e095d4d1cf06000e611858938 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Sep 2021 11:56:43 +0200 Subject: [PATCH 42/77] Trans --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 370b10da626..f26b18152b9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6944,7 +6944,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = 'Security key for payment on a member subscription (one key per member)'; $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = 'Security key for payment on an order'; $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = 'Security key for payment on an invoice'; - $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'Security key for payment on a a service'; + $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'Security key for payment on a service of a contract'; $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = 'Direct download url of a proposal'; $substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = 'Direct download url of an order'; From 2472dff67bd84284d36a121c4e5f832b19c51272 Mon Sep 17 00:00:00 2001 From: Indelog Date: Tue, 28 Sep 2021 12:08:45 +0200 Subject: [PATCH 43/77] Fix FormFile::list_of_autoecmfiles object_instance classname after hook FormFile::list_of_autoecmfiles() can instantiate object with parameters resulting of hook `addSectionECMAuto` but for do this, it use `${$hookmanager->resArray['classname']}` which return a `null`. Instead we should do this `$hookmanager->resArray['classname']`. --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 60054ecf5ad..71d8c02b5f2 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1672,7 +1672,7 @@ class FormFile dol_include_once($hookmanager->resArray['classpath']); if (array_key_exists('classname', $hookmanager->resArray) && !empty($hookmanager->resArray['classname'])) { if (class_exists($hookmanager->resArray['classname'])) { - $object_instance = new ${$hookmanager->resArray['classname']}($this->db); + $object_instance = new $hookmanager->resArray['classname']($this->db); } } } From a70f5dd90e89e87468ca5403fbe2fda940d3c734 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Sep 2021 12:12:11 +0200 Subject: [PATCH 44/77] Doc --- htdocs/core/class/extrafields.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 5c9401fca35..5b6fbf1ab9d 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2047,9 +2047,9 @@ class ExtraFields * * @param array $extralabels Deprecated (old $array of extrafields, now set this to null) * @param object $object Object - * @param string $onlykey Only some keys are filled:$this - * 'string' => When we make update of only one extrafield ($action = 'update_extras'), calling page can set this to avoid to have other extrafields being reset. - * '@GETPOSTISSET' => When we make update of extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset. + * @param string $onlykey Only some keys are filled: + * 'string' => When we make update of only one extrafield ($action = 'update_extras'), calling page can set this to avoid to have other extrafields being reset. + * '@GETPOSTISSET' => When we make update of several extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset. * @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example) */ public function setOptionalsFromPost($extralabels, &$object, $onlykey = '') From 9426af8f6a1ea5f15b71f28a9b525043919c78d3 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 25 Sep 2021 07:49:08 +0200 Subject: [PATCH 45/77] NEW #18820 Accountancy - Add product account in import/export of thirdparty (level 3) --- htdocs/core/modules/modSociete.class.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index af4fb9e64b8..7c3d93499e4 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -281,6 +281,9 @@ class modSociete extends DolibarrModules if (!empty($conf->global->PRODUIT_MULTIPRICES)) { $this->export_fields_array[$r]['s.price_level'] = 'PriceLevel'; } + if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { + $this->export_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode'); + } // Add multicompany field if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) { $nbofallowedentities = count(explode(',', getEntity('societe'))); // If project are shared, nb will be > 1 @@ -317,7 +320,8 @@ class modSociete extends DolibarrModules 'payterm.libelle'=>'Text', 'paymode.libelle'=>'Text', 's.outstanding_limit'=>'Numeric', 'pbacc.ref'=>'Text', 'incoterm.code'=>'Text', 'u.login'=>'Text', 'u.firstname'=>'Text', 'u.lastname'=>'Text', - 's.entity'=>'Numeric', 's.price_level'=>'Numeric' + 's.entity'=>'Numeric', 's.price_level'=>'Numeric', + 's.accountancy_code_sell'=>'Text', 's.accountancy_code_buy'=>'Text' ); $this->export_entities_array[$r] = array('u.login'=>'user', 'u.firstname'=>'user', 'u.lastname'=>'user'); // We define here only fields that use another picto @@ -488,6 +492,9 @@ class modSociete extends DolibarrModules if (!empty($conf->global->PRODUIT_MULTIPRICES)) { $this->import_fields_array[$r]['s.price_level'] = 'PriceLevel'; } + if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { + $this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode'); + } // Add extra fields $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); @@ -621,7 +628,9 @@ class modSociete extends DolibarrModules 's.canvas' => "empty / a custom canvas form layout url e.g. mycanvas@mymodule", 's.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'), 's.fk_multicurrency' => '0 (use system default currency) / 1 (use local currency)', - 's.multicurrency_code' => 'GBP/USD etc... matches field "code_iso" in table "'.MAIN_DB_PREFIX.'c_currencies"' + 's.multicurrency_code' => 'GBP/USD etc... matches field "code_iso" in table "'.MAIN_DB_PREFIX.'c_currencies"', + 's.accountancy_code_sell' => '707', + 's.accountancy_code_buy' => '607', ); $this->import_updatekeys_array[$r] = array( 's.nom' => 'Name', From fc56b88a1f7c5cbd6d3f0fcdcd9f8508c3b8c05d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Sep 2021 13:44:42 +0200 Subject: [PATCH 46/77] FIX select list of orders not complete when field type of company is on --- htdocs/commande/class/commande.class.php | 12 ++++++------ htdocs/commande/list.php | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 050b7251898..f02e74687af 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -299,13 +299,9 @@ class Commande extends CommonOrder 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25), - 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>56), - 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60), + 'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60), + 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62), 'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65), - 'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>70), - 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>75), - 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>80), 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>85), 'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>90), 'source' =>array('type'=>'smallint(6)', 'label'=>'Source', 'enabled'=>1, 'visible'=>-1, 'position'=>95), @@ -344,6 +340,10 @@ class Commande extends CommonOrder 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>270), 'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>275), 'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>280), + 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>300), + 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>302), + 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>304), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>306), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>400), 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500), ); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index b3a0ec37167..e2ea9b2222c 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -545,7 +545,7 @@ if ($search_state) { if ($search_country) { $sql .= " AND s.fk_pays IN (".$db->sanitize($search_country).')'; } -if ($search_type_thirdparty) { +if ($search_type_thirdparty && $search_type_thirdparty != '-1') { $sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')'; } if ($search_company) { @@ -787,7 +787,7 @@ if ($resql) { if ($search_country != '') { $param .= '&search_country='.urlencode($search_country); } - if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { + if ($search_type_thirdparty && $search_type_thirdparty != '-1') { $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); } if ($search_product_category != '') { From 5b8b55cfba0e9459126fcffb6f2923b472cea8ba Mon Sep 17 00:00:00 2001 From: Indelog Date: Tue, 28 Sep 2021 15:26:08 +0200 Subject: [PATCH 47/77] Fix append module suffix on src_object_type when create ecm file Files added to `llx_ecm_files` for externals modules never be removed on object deletion. When `CommonObject::deleteEcmFiles()` is called with `mode=1`, it use this sql filter to find the file related to the object which is removed : ``` $sql .= " WHERE fk_object IN (SELECT rowid FROM ".MAIN_DB_PREFIX."ecm_files WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? '' : '@'.$this->module))."' AND src_object_id = ".((int) $this->id).")"; ``` We see it append `'@'.$this->module` to `$this->table_element` but when file is add to the `llx_ecm_files` by `CommonObject::commonGenerateDocument()` , it added whiteout the `'@'.$this->module` suffix. So the file is never remove from `llx_ecm_files` when object is deleted. This fix it by appending module suffix on `src_object_type` if object has `module` property when add document to the `llx_ecm_files`. --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d53b8829686..858d21d5e4d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5297,7 +5297,7 @@ abstract class CommonObject $ecmfile->gen_or_uploaded = 'generated'; $ecmfile->description = ''; // indexed content $ecmfile->keywords = ''; // keyword content - $ecmfile->src_object_type = $this->table_element; + $ecmfile->src_object_type = $this->table_element.(empty($this->module) ? '' : '@'.$this->module); $ecmfile->src_object_id = $this->id; $result = $ecmfile->create($user); From fae0337b3e58cc160afdd2bc20343a6563af47c2 Mon Sep 17 00:00:00 2001 From: Indelog Date: Tue, 28 Sep 2021 16:22:28 +0200 Subject: [PATCH 48/77] Fix show for external module in ecm index auto page This set the correct `modulepart` parameter for link generated to `document.php` of ecm auto index page if `src_object_type` for ecm document has a module suffix (`@modulename`). --- htdocs/core/class/html.formfile.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 60054ecf5ad..55460c587d8 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1811,9 +1811,11 @@ class FormFile print ''; // File + // Check if document source has external module part, if it the case use it for module part on document.php + preg_match('/^[^@]*@([^@]*)$/', $modulepart.'@expertisemedical', $modulesuffix); print '\n"; From 43a47999d7261f60430bcb64a76e3aa8fd575fb6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 28 Sep 2021 16:35:01 +0200 Subject: [PATCH 49/77] FIX avoid warning if $categories is an id --- htdocs/core/class/commonobject.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d53b8829686..ee1d9b51ede 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9135,6 +9135,11 @@ abstract class CommonObject */ public function setCategoriesCommon($categories, $type_categ = '', $remove_existing = true) { + // Handle single category + if (!is_array($categories)) { + $categories = array($categories); + } + dol_syslog(get_class($this)."::setCategoriesCommon Oject Id:".$this->id.' type_categ:'.$type_categ.' nb tag add:'.count($categories), LOG_DEBUG); require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; @@ -9144,11 +9149,6 @@ abstract class CommonObject return -1; } - // Handle single category - if (!is_array($categories)) { - $categories = array($categories); - } - // Get current categories $c = new Categorie($this->db); $existing = $c->containing($this->id, $type_categ, 'id'); From 1e840fe7ed17ea100906452a433a520a17952a38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Sep 2021 18:07:04 +0200 Subject: [PATCH 50/77] Code comment --- htdocs/core/class/extrafields.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 5b6fbf1ab9d..abc2cd2bd49 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2048,8 +2048,8 @@ class ExtraFields * @param array $extralabels Deprecated (old $array of extrafields, now set this to null) * @param object $object Object * @param string $onlykey Only some keys are filled: - * 'string' => When we make update of only one extrafield ($action = 'update_extras'), calling page can set this to avoid to have other extrafields being reset. - * '@GETPOSTISSET' => When we make update of several extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset. + * 'string' => When we make update of only one extrafield ($action = 'update_extras'), calling page can set this to avoid to have other extrafields being reset. + * '@GETPOSTISSET' => When we make update of several extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset. * @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example) */ public function setOptionalsFromPost($extralabels, &$object, $onlykey = '') From baadf2dc6c7de60b7ba97ff608eaa1f8a8f82d9b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Sep 2021 01:51:34 +0200 Subject: [PATCH 51/77] Fix reposition --- htdocs/core/class/html.formfile.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 60054ecf5ad..61c6ff3b310 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -136,6 +136,7 @@ class FormFile $out .= ''."\n"; $out .= ''."\n"; $out .= ''."\n"; + $out .= ''."\n"; } $out .= '
'.$langs->trans("Search").'
'; -$searchbox .= $langs->trans("User").':
'; - $searchbox .= $langs->trans("Group").':
'; //print "XX".$file['name']; //$file['name'] must be utf8 - print 'getDocumentsLink($modulepart, $modulesubdir, $filedir, '^'.preg_quote($file['name'],'/').'$'); - print $this->showPreview($file, $modulepart, $file['relativename']); + print $this->showPreview($file, (empty($modulesuffix) ? $modulepart : $modulesuffix[1]), $file['relativename']); print "
'; @@ -215,13 +216,13 @@ class FormFile $langs->load('link'); $out .= ''; } - $out .= 'trans("Upload").'"'; $out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : ''); $out .= '>'; if ($addcancel) { $out .= '   '; - $out .= ''; + $out .= ''; } if (!empty($conf->global->MAIN_UPLOAD_DOC)) { @@ -275,6 +276,7 @@ class FormFile $out .= ''."\n"; $out .= ''."\n"; $out .= ''."\n"; + $out .= ''."\n"; } $out .= '
'; @@ -293,7 +295,7 @@ class FormFile $out .= ''; $out .= '
'; $out .= '
'; - $out .= 'trans("ToLink").'"'; $out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : ''); $out .= '>'; $out .= '
'; From 6e08ecde0488c3defd398ab0a25f8970792431a1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Sep 2021 08:47:22 +0200 Subject: [PATCH 52/77] FIX indentation --- htdocs/core/class/commonobject.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ee1d9b51ede..1eb661471ae 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9135,10 +9135,10 @@ abstract class CommonObject */ public function setCategoriesCommon($categories, $type_categ = '', $remove_existing = true) { - // Handle single category - if (!is_array($categories)) { - $categories = array($categories); - } + // Handle single category + if (!is_array($categories)) { + $categories = array($categories); + } dol_syslog(get_class($this)."::setCategoriesCommon Oject Id:".$this->id.' type_categ:'.$type_categ.' nb tag add:'.count($categories), LOG_DEBUG); From 10ea7ddeef9058119a9d149b1ea2b04646f90ce5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Sep 2021 12:31:25 +0200 Subject: [PATCH 53/77] Fix link param --- htdocs/contrat/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 2438505a13c..bdbdb27331e 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -421,16 +421,16 @@ if ($search_dfyear != '') { if ($search_dfmonth != '') { $param .= '&search_dfmonth='.urlencode($search_dfmonth); } -if ($search_sale != '') { +if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); } -if ($search_user != '') { +if ($search_user > 0) { $param .= '&search_user='.urlencode($search_user); } -if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { +if ($search_type_thirdparty > 0) { $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); } -if ($search_product_category != '') { +if ($search_product_category > 0) { $param .= '&search_product_category='.urlencode($search_product_category); } if ($show_files) { From a395ff5ee394dfa445356fd8b3ac1b7536b31fc5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Sep 2021 16:19:47 +0200 Subject: [PATCH 54/77] Css --- htdocs/admin/system/perf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 758a93a765d..bbfa4b85c41 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -63,7 +63,7 @@ print '
'; print ''.$langs->trans("XDebug").': '; $test = !function_exists('xdebug_is_enabled'); if ($test) { - print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotSlowedDownByThis"); + print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' '.$langs->trans("NotSlowedDownByThis").''; } else { print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("XDebug")); print ' - '.$langs->trans("MoreInformation").' XDebug admin page'; From 34dacca77c8241e97b6b0f5559a0b87b7fd04005 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Sep 2021 16:31:40 +0200 Subject: [PATCH 55/77] Css --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f26b18152b9..e0dcc51917b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3704,7 +3704,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'action'=>'infobox-action', 'account'=>'infobox-bank_account', 'accountline'=>'infobox-bank_account', 'accountancy'=>'infobox-bank_account', 'asset'=>'infobox-bank_account', 'bank_account'=>'bg-infobox-bank_account', 'bill'=>'infobox-commande', 'billa'=>'infobox-commande', 'billr'=>'infobox-commande', 'billd'=>'infobox-commande', - 'conferenceorbooth'=>'infobox-project', + 'margin'=>'infobox-bank_account', 'conferenceorbooth'=>'infobox-project', 'cash-register'=>'infobox-bank_account', 'contract'=>'infobox-contrat', 'check'=>'font-status4', 'collab'=>'infobox-action', 'conversation'=>'infobox-contrat', 'donation'=>'infobox-commande', 'dolly'=>'infobox-commande', 'dollyrevert'=>'flip infobox-order_supplier', 'ecm'=>'infobox-action', 'eventorganization'=>'infobox-project', From 1d35d8fd2d679c6beccc13fb034de2c4de02fe90 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Sep 2021 16:42:52 +0200 Subject: [PATCH 56/77] CSS popup company --- htdocs/societe/class/societe.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index e7597b311c2..818d5249a6c 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2575,13 +2575,13 @@ class Societe extends CommonObject $label .= ' '.$this->getLibStatut(5); } - if (!empty($this->name)) { - $label .= '
'.$langs->trans('Name').': '.dol_escape_htmltag($this->name); - if (!empty($this->name_alias)) { - $label .= ' ('.dol_escape_htmltag($this->name_alias).')'; - } + $label .= '
'.$langs->trans('Name').': '.dol_escape_htmltag($this->name); + if (!empty($this->name_alias)) { + $label .= ' ('.dol_escape_htmltag($this->name_alias).')'; + } + if ($this->email) { + $label .= '
'.img_picto('', 'email', 'class="pictofixedwidth"').$this->email; } - $label .= '
'.img_picto('', 'email', 'class="pictofixedwidth"').$this->email; if (!empty($this->phone) || !empty($this->fax)) { $phonelist = array(); if ($this->phone) { From 52fb627a64501c9d3f099450403f4bb46f9463c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Sep 2021 16:45:48 +0200 Subject: [PATCH 57/77] Look and feel v14 --- htdocs/adherents/type.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 10560d38648..76099ff7d66 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -318,6 +318,19 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ""; $i++; } + + // If no record found + if ($num == 0) { + /*$colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + }*/ + $colspan = 8; + print '
'; + } + print "
'.$langs->trans("NoRecordFound").'
"; print ''; From 2dd55301deb1e41310893bbb292ea17466b3201e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Sep 2021 17:06:51 +0200 Subject: [PATCH 58/77] Fix duplicate field and look and feel --- htdocs/opensurvey/card.php | 20 ++++++-------------- htdocs/opensurvey/wizard/create_survey.php | 6 +++--- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index fd9fa3e0456..40e9d14adca 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -251,18 +251,6 @@ if ($action == 'edit') { } print '
'.$langs->trans("EMail").''; - if ($action == 'edit') { - print ''; - } else { - print dol_print_email($object->mail_admin, 0, 0, 1); - } - print '
'.$langs->trans('ToReceiveEMailForEachVote').''; if ($action == 'edit') { @@ -312,10 +300,14 @@ print '
'; print $langs->trans("Author").''; -if ($object->fk_user_creat) { +if ($object->fk_user_creat > 0) { print $userstatic->getLoginUrl(1); } else { - print dol_htmlentities($object->nom_admin); + if ($action == 'edit') { + print ''; + } else { + print dol_print_email($object->mail_admin, 0, 0, 1); + } } print '
'; print ''; + print ''; @@ -222,15 +223,19 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) { print '
'; print $tmpinvoice->getNomUrl(1, ''); print '
'; print '
'; + + print ''; print $thirdpartystatic->getNomUrl(1, 'customer', 44); print ''.price($obj->total_ht).''.price($obj->total_ttc).''.dol_print_date($db->jdate($obj->tms), 'day').''.$tmpinvoice->getLibStatut(3, $obj->am).'
'; if ($canedit) { - print ''; + print ''; } else { print $nbtoshow; } From 4e86f872ca3b0634433fbe12a5798c880c86dab7 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Tue, 28 Sep 2021 13:46:03 +0200 Subject: [PATCH 64/77] it was impossible to update a task after some investigation i saw those errors but they are maybe some more around here --- htdocs/projet/class/api_tasks.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index e3d6af2de53..9366422002d 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -454,7 +454,7 @@ class Tasks extends DolibarrApi throw new RestException(404, 'Task not found'); } - if (!DolibarrApi::_checkAccessToResource('tasks', $this->project->id)) { + if (!DolibarrApi::_checkAccessToResource('task', $this->task->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach ($request_data as $field => $value) { @@ -488,7 +488,7 @@ class Tasks extends DolibarrApi throw new RestException(404, 'Task not found'); } - if (!DolibarrApi::_checkAccessToResource('tasks', $this->project->id)) { + if (!DolibarrApi::_checkAccessToResource('task', $this->task->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } From ae9643bbeff659ee7424cafba02eee6bfce616e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Sep 2021 13:38:38 +0200 Subject: [PATCH 65/77] Update html.formfile.class.php --- htdocs/core/class/html.formfile.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 71d8c02b5f2..53c00327746 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1672,7 +1672,8 @@ class FormFile dol_include_once($hookmanager->resArray['classpath']); if (array_key_exists('classname', $hookmanager->resArray) && !empty($hookmanager->resArray['classname'])) { if (class_exists($hookmanager->resArray['classname'])) { - $object_instance = new $hookmanager->resArray['classname']($this->db); + $tmpclassname = $hookmanager->resArray['classname']; + $object_instance = new $tmpclassname($this->db); } } } From 332fa77d902b87338c07904718dde58be55b3b07 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 30 Sep 2021 13:49:02 +0200 Subject: [PATCH 66/77] fix: search code on tva dict --- htdocs/admin/dict.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 5542ad43b2a..5e5793cc361 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1048,6 +1048,7 @@ if ($id) elseif ($search_code != '' && $id == 28) $sql .= natural_search("h.code", $search_code); elseif ($search_code != '' && $id == 32) $sql .= natural_search("a.code", $search_code); elseif ($search_code != '' && $id == 3) $sql .= natural_search("r.code_region", $search_code); + elseif ($search_code != '' && $id == 10) $sql .= natural_search("t.code", $search_code); elseif ($search_code != '' && $id != 9) $sql .= natural_search("code", $search_code); if ($sortfield) From 620d7109b5b243237e6a53181edcc31f63cde198 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Sep 2021 14:04:56 +0200 Subject: [PATCH 67/77] Update dict.php --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 5e5793cc361..32db04c455f 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1048,7 +1048,7 @@ if ($id) elseif ($search_code != '' && $id == 28) $sql .= natural_search("h.code", $search_code); elseif ($search_code != '' && $id == 32) $sql .= natural_search("a.code", $search_code); elseif ($search_code != '' && $id == 3) $sql .= natural_search("r.code_region", $search_code); - elseif ($search_code != '' && $id == 10) $sql .= natural_search("t.code", $search_code); + elseif ($search_code != '' && $id == 10) $sql .= natural_search("t.code", $search_code); elseif ($search_code != '' && $id != 9) $sql .= natural_search("code", $search_code); if ($sortfield) From fc4a16b356a6e720f80ebca24cbc9a74af577e6f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Sep 2021 16:18:07 +0200 Subject: [PATCH 68/77] Fix avoid error when trigger run on downgraded version. --- .../triggers/interface_90_modSociete_ContactRoles.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php index e2759eb3926..15c84bc41a1 100644 --- a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php +++ b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php @@ -79,7 +79,11 @@ class InterfaceContactRoles extends DolibarrTriggers require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $contactdefault = new Contact($this->db); $contactdefault->socid = $socid; - $TContact = $contactdefault->getContactRoles($object->element); + + $TContact = array(); + if (method_exists($contactdefault, 'getContactRoles')) { // For backward compatibility + $TContact = $contactdefault->getContactRoles($object->element); + } if (is_array($TContact) && !empty($TContact)) { $TContactAlreadyLinked = array(); From 166d3b08d6ec719428ab7566750915e90215995c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Sep 2021 20:00:48 +0200 Subject: [PATCH 69/77] Add LIBXML_NONET to simplexml_load_string --- htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php | 2 +- htdocs/admin/system/dolibarr.php | 2 +- htdocs/admin/system/filecheck.php | 2 +- htdocs/admin/tools/update.php | 2 +- htdocs/api/class/api_setup.class.php | 2 +- htdocs/core/class/rssparser.class.php | 2 +- htdocs/core/tpl/login.tpl.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index adaf82d6964..5a23133923e 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -232,7 +232,7 @@ class PrestaShopWebservice if ($response != '') { libxml_clear_errors(); libxml_use_internal_errors(true); - $xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA); + $xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); if (libxml_get_errors()) { $msg = var_export(libxml_get_errors(), true); libxml_clear_errors(); diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 90e35c8e970..75ca036b92f 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -51,7 +51,7 @@ if ($action == 'getlastversion') { $result = getURLContent('https://sourceforge.net/projects/dolibarr/rss'); //var_dump($result['content']); if (function_exists('simplexml_load_string')) { - $sfurl = simplexml_load_string($result['content']); + $sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); } else { setEventMessages($langs->trans("ErrorPHPDoesNotSupport", "xml"), null, 'errors'); } diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 272ac8d8f19..5ca87663c7a 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -171,7 +171,7 @@ if (GETPOST('target') == 'remote') { if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') { $xmlfile = $xmlarray['content']; //print "xmlfilestart".$xmlfile."xmlfileend"; - $xml = simplexml_load_string($xmlfile); + $xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); } else { $errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg']; setEventMessages($errormsg, null, 'errors'); diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php index 821bcd9e3f3..8de6e32e8a0 100644 --- a/htdocs/admin/tools/update.php +++ b/htdocs/admin/tools/update.php @@ -61,7 +61,7 @@ $version = '0.0'; if ($action == 'getlastversion') { $result = getURLContent('https://sourceforge.net/projects/dolibarr/rss'); //var_dump($result['content']); - $sfurl = simplexml_load_string($result['content']); + $sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); } diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index f5f301e9c16..9856acfacdc 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1683,7 +1683,7 @@ class Setup extends DolibarrApi if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') { $xmlfile = $xmlarray['content']; //print "xmlfilestart".$xmlfile."endxmlfile"; - $xml = simplexml_load_string($xmlfile); + $xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); } else { $errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg']; throw new RestException(500, $errormsg); diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 6a8a91dbb05..c3c434d1aed 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -240,7 +240,7 @@ class RssParser if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { //print 'xx'.LIBXML_NOCDATA; libxml_use_internal_errors(false); - $rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA); + $rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA|LIBXML_NOCDATA); } else { if (!function_exists('xml_parser_create')) { $this->error = 'Function xml_parser_create are not supported by your PHP'; diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 7b20e7209f7..7f460587248 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -346,7 +346,7 @@ if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) { $resgetcommitstrip = getURLContent("https://www.commitstrip.com/en/feed/"); } if ($resgetcommitstrip && $resgetcommitstrip['http_code'] == '200') { - $xml = simplexml_load_string($resgetcommitstrip['content']); + $xml = simplexml_load_string($resgetcommitstrip['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); $little = $xml->channel->item[0]->children('content', true); print preg_replace('/width="650" height="658"/', '', $little->encoded); } From d68719226b7aac5cdb43c173427f2d8635b44ad4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Oct 2021 14:10:50 +0200 Subject: [PATCH 70/77] Fix can install module with name module_abc-x.y.z (w).zip --- htdocs/admin/modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 53cbc1aad69..00142deb9e8 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -133,7 +133,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); + $original_file = preg_replace('/\s*\(\d+\)\.zip$/i', '.zip', $original_file); $newfile = $conf->admin->dir_temp.'/'.$original_file.'/'.$original_file; if (!$original_file) { From 2be2423dee0136679c95641f2db4a0fa9805dbaf Mon Sep 17 00:00:00 2001 From: JR-Polyline <91737050+JR-Polyline@users.noreply.github.com> Date: Fri, 1 Oct 2021 21:30:25 +0800 Subject: [PATCH 71/77] Fix dynamic prices not updating When Dynamic price module active and an a math expression is used to compute buy price on supplier product card, the calculated price does not update on the card when saved. Changing line 849 appears to solve this without any ill effect. --- htdocs/fourn/class/fournisseur.product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 3eaed8d27b8..230c794b038 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -846,7 +846,7 @@ class ProductFournisseur extends Product $this->fourn_qty = $record["quantity"]; $this->fourn_remise_percent = $record["remise_percent"]; $this->fourn_remise = $record["remise"]; - $this->fourn_unitprice = $record["unitprice"]; + $this->fourn_unitprice = $fourn_unitprice; $this->fourn_charges = $record["charges"]; // deprecated $this->fourn_tva_tx = $record["tva_tx"]; $this->fourn_id = $record["fourn_id"]; From fd7d1374c2f54dd17e63774680dbca6baa93b94e Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 1 Oct 2021 16:37:54 +0200 Subject: [PATCH 72/77] FIX Product accountancy affectation with product_perentity activated (PR #18620) --- htdocs/accountancy/admin/productaccount.php | 27 +++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index e29653a3e40..58ffa9bd150 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -186,18 +186,35 @@ if ($action == 'update') { $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'
'.$sql.'
'; $ko++; } else { - $db->begin(); - + $sql = ''; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_perentity (fk_product, entity, '".$db->escape($accountancy_field_name)."')"; - $sql .= " VALUES (".((int) $productid).", ".((int) $conf->entity).", '".$db->escape($accounting->account_number)."')"; - $sql .= " ON DUPLICATE KEY UPDATE ".$accountancy_field_name." = '".$db->escape($accounting->account_number)."'"; + $sql_exists = "SELECT rowid FROM " . MAIN_DB_PREFIX . "product_perentity"; + $sql_exists .= " WHERE fk_product = " . ((int) $productid) . " AND entity = " . ((int) $conf->entity); + $resql_exists = $db->query($sql_exists); + if (!$resql_exists) { + $msg .= '
'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'
'.$resql_exists.'
'; + $ko++; + } else { + $nb_exists = $db->num_rows($resql_exists); + if ($nb_exists <= 0) { + // insert + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, '" . $db->escape($accountancy_field_name) . "')"; + $sql .= " VALUES (" . ((int) $productid) . ", " . ((int) $conf->entity) . ", '" . $db->escape($accounting->account_number) . "')"; + } else { + $obj_exists = $db->fetch_object($resql_exists); + // update + $sql = "UPDATE " . MAIN_DB_PREFIX . "product_perentity"; + $sql .= " SET " . $accountancy_field_name . " = '" . $db->escape($accounting->account_number) . "'"; + $sql .= " WHERE rowid = " . ((int) $obj_exists->rowid); + } + } } else { $sql = " UPDATE ".MAIN_DB_PREFIX."product"; $sql .= " SET ".$accountancy_field_name." = '".$db->escape($accounting->account_number)."'"; $sql .= " WHERE rowid = ".((int) $productid); } + $db->begin(); dol_syslog("/accountancy/admin/productaccount.php sql=".$sql, LOG_DEBUG); if ($db->query($sql)) { $ok++; From d99b3d601a2d020bb17965045909a3d1814acb54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Oct 2021 20:07:09 +0200 Subject: [PATCH 73/77] FIX #18854 --- htdocs/ecm/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 3a8d33343c7..813ee69b6fb 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -42,6 +42,7 @@ if (!$section) { $section = 0; } $section_dir = GETPOST('section_dir', 'alpha'); +$overwritefile = GETPOST('overwritefile', 'int'); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); @@ -120,7 +121,7 @@ if (GETPOST("sendit", 'alphanohtml') && !empty($conf->global->MAIN_UPLOAD_DOC)) if (!$error) { $generatethumbs = 0; - $res = dol_add_file_process($upload_dir, 0, 1, 'userfile', '', null, '', $generatethumbs); + $res = dol_add_file_process($upload_dir, $overwritefile, 1, 'userfile', '', null, '', $generatethumbs); if ($res > 0) { $result = $ecmdir->changeNbOfFiles('+'); } From d6e1a6be93f3323b5ffff5478f4936d0443d2296 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Oct 2021 18:20:01 +0200 Subject: [PATCH 74/77] Look and feel v14 --- htdocs/core/class/html.form.class.php | 14 +++++++------- htdocs/core/tpl/contacts.tpl.php | 10 +++++----- .../eventorganization/conferenceorbooth_list.php | 1 + .../conferenceorboothattendee_list.php | 1 + htdocs/projet/tasks/time.php | 1 + 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 221e641ad8d..39d53e9dbc7 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1675,11 +1675,6 @@ class Form if ($resql) { $num = $this->db->num_rows($resql); - if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT); - } - if ($htmlname != 'none' && !$options_only) { $out .= ''; } + if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; + $out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT); + } + $this->num = $num; return $out; } else { @@ -8529,8 +8529,8 @@ class Form public function showFilterButtons() { $out = '
'; - $out .= ''; - $out .= ''; + $out .= ''; + $out .= ''; $out .= '
'; return $out; diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 1257d473ced..4ec84283345 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -135,19 +135,19 @@ if ($permission) { + '; } ?> -
+
socid) ? 0 : $object->socid); $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?>
- -
+
selectcontacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp'); + print img_object('', 'contact', 'class="pictofixedwidth"').$form->selectcontacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp widthcentpercentminusxx maxwidth400'); $nbofcontacts = $form->num; $newcardbutton = ''; @@ -157,7 +157,7 @@ if ($permission) { print $newcardbutton; ?>
-
+
element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) { diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 9c086528120..a002aa2844c 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -643,6 +643,7 @@ print ''; print ''; print ''; print ''; +print ''; $title = $langs->trans("ListOfConferencesOrBooths"); diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 801ecb1d69f..849513710f7 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -697,6 +697,7 @@ print ''; print ''; print ''; print ''; +print ''; $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 8e5877c7d0d..9e27f026c9d 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -992,6 +992,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { print ''; print ''; print ''; + print ''; // Form to convert time spent into invoice if ($massaction == 'generateinvoice') { From 2c32c6c5c9b7d9b454068d37c85653c8bf87c58d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Oct 2021 19:17:23 +0200 Subject: [PATCH 75/77] Fix contextpage for list of tickets --- htdocs/theme/eldy/global.inc.php | 21 ++++++++++++++++++--- htdocs/ticket/list.php | 5 ++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 79977faac6a..9ddaab40e65 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1732,6 +1732,20 @@ td.showDragHandle { display: inline-block; } +/* +.classforhorizontalscrolloftabs .fiche .div-table-responsive +{ + transform:rotateX(180deg); + -ms-transform:rotateX(180deg); + -webkit-transform:rotateX(180deg); +} +.classforhorizontalscrolloftabs .fiche .div-table-responsive-inside +{ + transform:rotateX(180deg); + -ms-transform:rotateX(180deg); + -webkit-transform:rotateX(180deg); +} +*/ global->THEME_DISABLE_STICKY_TOPMENU)) { ?> @@ -1842,10 +1856,11 @@ div.vmenu, td.vmenu { display: none; } - /* if no side-nav, we don't need to have width forced */ + /* if no side-nav, we don't need to have width forced to calc(100% - 210px); */ .classforhorizontalscrolloftabs #id-right { - width: unset; - display: unset; + width: 100%; + /* width: unset; */ + /* display: unset; */ } body.sidebar-collapse .login_block { diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index c79a75e851c..6991516ede8 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -45,7 +45,7 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'tickep#selectedfieldstlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'ticketlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') @@ -698,6 +698,7 @@ print ''; print ''; print ''; print ''; + if ($socid) { print ''; } @@ -759,6 +760,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfi $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table +print '
'; print ''."\n"; @@ -1088,6 +1090,7 @@ print $hookmanager->resPrint; print '
'."\n"; print '
'."\n"; +print '
'."\n"; print ''."\n"; From e46d064d5e4f5bb19757b649f4badb980483476f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Oct 2021 20:36:03 +0200 Subject: [PATCH 76/77] Clean text --- README.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7878f6270a7..5116c7b21ce 100644 --- a/README.md +++ b/README.md @@ -154,18 +154,18 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) ### Other application/modules -- Electronic Document Management (EDM) +- Electronic Document Management (EDM) - Bookmarks management - Reporting - Data export/import -- Barcodes +- Barcodes - Margin calculations - LDAP connectivity - ClickToDial integration - Mass emailing - RSS integration - Skype integration -- Social platforms linking +- Social platforms linking - Payment platforms integration (PayPal, Stripe, Paybox...) - Email-Collector @@ -179,14 +179,11 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Multi-Users and groups with finely grained rights - Multi-Currency - Multi-Company (by adding of an external module) - - Very user friendly and easy to use - customizable Dashboard - Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one) - - APIs (REST, SOAP) - Code that is easy to understand, maintain and develop (PHP with no heavy framework; trigger and hook architecture) - - Support a lot of country specific features: - Spanish Tax RE and ISPF - French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM) @@ -197,7 +194,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Compatible with European GDPR rules - ... - Flexible PDF & ODT generation for invoices, proposals, orders... -- … +- ... ### System Environment / Requirements From 91ee704dc3a28a32988ec65162aba9a301518429 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Oct 2021 12:16:50 +0200 Subject: [PATCH 77/77] Move trans from admin to main --- htdocs/langs/en_US/admin.lang | 1 - htdocs/langs/en_US/main.lang | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 5f71e77eb71..58b21ca3554 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -131,7 +131,6 @@ IdModule=Module ID IdPermissions=Permissions ID LanguageBrowserParameter=Parameter %s LocalisationDolibarrParameters=Localization parameters -ClientTZ=Client Time Zone (user) ClientHour=Client time (user) OSTZ=Server OS Time Zone PHPTZ=PHP server Time Zone diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index ddd60a9b68e..9fba774e7a5 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1138,4 +1138,5 @@ InformationOnLinkToContract=This amount is only the total of all the lines of th ConfirmCancel=Are you sure you want to cancel EmailMsgID=Email MsgID Forthcoming=Forthcoming -Currently=Currently \ No newline at end of file +Currently=Currently +ClientTZ=Client Time Zone (user)