From e5f6a648466aaff39542858b4bd6833cf446a857 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 9 Feb 2021 19:24:36 +0100 Subject: [PATCH 01/39] FIX update order by api fix update shipping method and shipping date by API (no change with code or functionality juste fix this pb with updating) --- htdocs/commande/class/commande.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index cc104261010..de279931055 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3289,6 +3289,7 @@ class Commande extends CommonOrder if (isset($this->note_public)) $this->note_public = trim($this->note_public); if (isset($this->modelpdf)) $this->modelpdf = trim($this->modelpdf); if (isset($this->import_key)) $this->import_key = trim($this->import_key); + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; // Check parameters // Put here code to add control on parameters values @@ -3313,6 +3314,8 @@ class Commande extends CommonOrder $sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").","; $sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").","; $sql .= " fk_mode_reglement=".(isset($this->mode_reglement_id) ? $this->mode_reglement_id : "null").","; + $sql .= " date_livraison=".(strval($this->delivery_date) != '' ? "'".$this->db->idate($this->delivery_date)."'" : 'null').","; + $sql .= " fk_shipping_method=".(isset($this->shipping_method_id) ? $this->shipping_method_id : "null").","; $sql .= " fk_account=".($this->fk_account > 0 ? $this->fk_account : "null").","; $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; From 0ae0eb575851622a4ab6c1863bcf745ecaaec69b Mon Sep 17 00:00:00 2001 From: LAURIER Alexis <19586755+AlexisLaurier@users.noreply.github.com> Date: Tue, 9 Feb 2021 20:13:13 +0100 Subject: [PATCH 02/39] fix regression of #16118 - entity not check Entity is not anymore check for user having permission $user->rights->societe->client->voir on the current entity. Then we can open object from any entity with current permissions and the entity field of objects are not anymore checked. --- htdocs/core/lib/security.lib.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 2f1e3d5596b..a9c6435348e 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -590,9 +590,9 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " WHERE dbt.rowid IN (".$objectid.")"; $sql .= " AND dbt.".$dbt_keyfield." = ".$user->socid; - } elseif (!empty($conf->societe->enabled)) { + } elseif (!empty($conf->societe->enabled) && !$user->rights->societe->client->voir) { // If internal user: Check permission for internal users that are restricted on their objects - if ($feature != 'ticket' && !$user->rights->societe->client->voir) { + if ($feature != 'ticket') { if (empty($dbt_keyfield)) dol_print_error('', 'Param dbt_keyfield is required but not defined'); $sql = "SELECT COUNT(sc.fk_soc) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; @@ -601,9 +601,8 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; $sql .= " AND sc.fk_soc = dbt.".$dbt_keyfield; $sql .= " AND sc.fk_user = ".$user->id; - } + } else { // On ticket, the thirdparty is not mandatory, so we need a special test to accept record with no thirdparties. - if ($feature == 'ticket' && !$user->rights->societe->client->voir) { $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = dbt.".$dbt_keyfield." AND sc.fk_user = ".$user->id; From 6ceaa02abe0dfa6ba806c7c940e8163af24f40ee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Feb 2021 23:08:59 +0100 Subject: [PATCH 03/39] Fix total in summary section was empty for income. --- htdocs/compta/resultat/clientfourn.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 3072dcdee2b..1596721667e 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -323,6 +323,9 @@ if ($modecompta == 'BOOKKEEPING') print ''.$langs->trans("NoRecordFound").''; } } else dol_print_error($db); + + $total_ht_income += $total_ht; + $total_ttc_income += $total_ttc; } else { /* * Factures clients @@ -446,6 +449,7 @@ if ($modecompta == 'BOOKKEEPING') $total_ht_income += $total_ht; $total_ttc_income += $total_ttc; + print ''; if ($modecompta == 'CREANCES-DETTES') print ''.price($total_ht).''; @@ -525,11 +529,12 @@ if ($modecompta == 'BOOKKEEPING') $total_ht_income += $subtotal_ht; $total_ttc_income += $subtotal_ttc; + print ''; if ($modecompta == 'CREANCES-DETTES') print ''.price($subtotal_ht).''; - print ''.price($subtotal_ttc).''; - print ''; + print ''.price($subtotal_ttc).''; + print ''; } /* @@ -609,6 +614,7 @@ if ($modecompta == 'BOOKKEEPING') $total_ht_outcome += $subtotal_ht; $total_ttc_outcome += $subtotal_ttc; + print ''; if ($modecompta == 'CREANCES-DETTES') print ''.price(-$subtotal_ht).''; @@ -686,6 +692,7 @@ if ($modecompta == 'BOOKKEEPING') $total_ht_outcome += $subtotal_ht; $total_ttc_outcome += $subtotal_ttc; + print ''; if ($modecompta == 'CREANCES-DETTES') print ''.price(-$subtotal_ht).''; @@ -764,6 +771,7 @@ if ($modecompta == 'BOOKKEEPING') $total_ht_outcome += $subtotal_ht; $total_ttc_outcome += $subtotal_ttc; + print ''; if ($modecompta == 'CREANCES-DETTES') print ''.price(-$subtotal_ht).''; @@ -841,6 +849,7 @@ if ($modecompta == 'BOOKKEEPING') $total_ht_outcome += $subtotal_ht; $total_ttc_outcome += $subtotal_ttc; + print ''; if ($modecompta == 'CREANCES-DETTES') print ''.price(-$subtotal_ht).''; @@ -926,6 +935,7 @@ if ($modecompta == 'BOOKKEEPING') $total_ht_outcome += $subtotal_ht; $total_ttc_outcome += $subtotal_ttc; + print ''; if ($modecompta == 'CREANCES-DETTES') print ''.price(-$subtotal_ht).''; print ''.price(-$subtotal_ttc).''; @@ -963,6 +973,7 @@ if ($modecompta == 'BOOKKEEPING') { $subtotal_ht += -$obj->amount; $subtotal_ttc += -$obj->amount; + $total_ht_outcome += $obj->amount; $total_ttc_outcome += $obj->amount; } @@ -978,6 +989,7 @@ if ($modecompta == 'BOOKKEEPING') { $subtotal_ht += $obj->amount; $subtotal_ttc += $obj->amount; + $total_ht_income += $obj->amount; $total_ttc_income += $obj->amount; } @@ -1038,8 +1050,10 @@ if ($modecompta == 'BOOKKEEPING') } $total_ht += $subtotal_ht; $total_ttc += $subtotal_ttc; + $total_ht_income += $subtotal_ht; $total_ttc_income += $subtotal_ttc; + print ''; if ($modecompta == 'CREANCES-DETTES') print ''.price($subtotal_ht).''; @@ -1101,8 +1115,10 @@ if ($modecompta == 'BOOKKEEPING') } else { dol_print_error($db); } + $total_ht_outcome -= 0; $total_ttc_outcome -= $amount; + print ' '; print "".$langs->trans("VATToPay")."\n"; print ' '."\n"; @@ -1151,6 +1167,7 @@ if ($modecompta == 'BOOKKEEPING') } else { dol_print_error($db); } + $total_ht_income += 0; $total_ttc_income += $amount; @@ -1197,8 +1214,10 @@ if ($modecompta == 'BOOKKEEPING') } else { dol_print_error($db); } + $total_ht_outcome -= 0; $total_ttc_outcome -= $amount; + print ' '; print "".$langs->trans("VATPaid")."\n"; if ($modecompta == 'CREANCES-DETTES') @@ -1243,8 +1262,10 @@ if ($modecompta == 'BOOKKEEPING') } else { dol_print_error($db); } + $total_ht_income += 0; $total_ttc_income += $amount; + print ' '; print "".$langs->trans("VATCollected")."\n"; if ($modecompta == 'CREANCES-DETTES') From 92a1235066c4182e561210649e6c748d55a953a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Feb 2021 23:34:42 +0100 Subject: [PATCH 04/39] Fix summary of report --- htdocs/compta/resultat/clientfourn.php | 31 +++++++++++++++++--------- htdocs/compta/resultat/index.php | 6 ++--- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 1596721667e..4f1a3043c76 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -252,7 +252,7 @@ if ($modecompta == 'BOOKKEEPING') $sql .= " AND f.entity = ".$conf->entity; if (!empty($date_start) && !empty($date_end)) $sql .= " AND f.doc_date >= '".$db->idate($date_start)."' AND f.doc_date <= '".$db->idate($date_end)."'"; - $sql .= " GROUP BY pcg_type, name, socid"; + $sql .= " GROUP BY pcg_type DESC, name, socid"; $sql .= $db->order($sortfield, $sortorder); $oldpcgtype = ''; @@ -284,6 +284,15 @@ if ($modecompta == 'BOOKKEEPING') $total_ht += (isset($objp->amount) ? $objp->amount : 0); $total_ttc += (isset($objp->amount) ? $objp->amount : 0); + if ($objp->pcg_type == 'INCOME') { + $total_ht_income += (isset($objp->amount) ? $objp->amount : 0); + $total_ttc_income += (isset($objp->amount) ? $objp->amount : 0); + } + if ($objp->pcg_type == 'EXPENSE') { + $total_ht_outcome -= (isset($objp->amount) ? $objp->amount : 0); + $total_ttc_outcome -= (isset($objp->amount) ? $objp->amount : 0); + } + // Loop on detail of all accounts // This make 14 calls for each detail of account (NP, N and month m) if ($showaccountdetail != 'no') @@ -323,9 +332,6 @@ if ($modecompta == 'BOOKKEEPING') print ''.$langs->trans("NoRecordFound").''; } } else dol_print_error($db); - - $total_ht_income += $total_ht; - $total_ttc_income += $total_ttc; } else { /* * Factures clients @@ -1300,19 +1306,22 @@ print ''; print ' '; print ''; -print ''.$langs->trans("Outcome").''; -if ($modecompta == 'CREANCES-DETTES') - print ''.price(price2num(-$total_ht_outcome, 'MT')).''; -print ''.price(price2num(-$total_ttc_outcome, 'MT')).''; -print ''; print ''.$langs->trans("Income").''; -if ($modecompta == 'CREANCES-DETTES') +if ($modecompta == 'CREANCES-DETTES') { print ''.price(price2num($total_ht_income, 'MT')).''; +} print ''.price(price2num($total_ttc_income, 'MT')).''; print ''; +print ''.$langs->trans("Outcome").''; +if ($modecompta == 'CREANCES-DETTES') { + print ''.price(price2num(-$total_ht_outcome, 'MT')).''; +} +print ''.price(price2num(-$total_ttc_outcome, 'MT')).''; +print ''; print ''.$langs->trans("Profit").''; -if ($modecompta == 'CREANCES-DETTES') +if ($modecompta == 'CREANCES-DETTES') { print ''.price(price2num($total_ht, 'MT')).''; +} print ''.price(price2num($total_ttc, 'MT')).''; print ''; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index ec2a8bb2623..b623c1648a2 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -846,7 +846,7 @@ if (!empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING')) if (!empty($date_start) && !empty($date_end)) $sql .= " AND b.doc_date >= '".$db->idate($date_start)."' AND b.doc_date <= '".$db->idate($date_end)."'"; $sql .= " GROUP BY b.doc_ref, b.numero_compte, b.subledger_account, b.subledger_label, pcg_type, dm"; - //print $sql; +//print $sql; $subtotal_ht = 0; $subtotal_ttc = 0; @@ -866,9 +866,9 @@ if (!empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING')) if ($obj->pcg_type == 'INCOME') { if (!isset($encaiss[$obj->dm])) $encaiss[$obj->dm] = 0; // To avoid warning of var not defined $encaiss[$obj->dm] += $obj->credit; - $encaiss[$obj->dm] -= $obj->credit; + $encaiss[$obj->dm] -= $obj->debit; } - if ($obj->pcg_type == 'INCOME') { + if ($obj->pcg_type == 'EXPENSE') { if (!isset($decaiss[$obj->dm])) $decaiss[$obj->dm] = 0; // To avoid warning of var not defined $decaiss[$obj->dm] += $obj->debit; $decaiss[$obj->dm] -= $obj->credit; From 33a43557438ef92089f3765f8d7289a3935c8e09 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Feb 2021 23:36:44 +0100 Subject: [PATCH 05/39] Fix summary of report --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 9b40b269861..ead9eb83d7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -53,6 +53,7 @@ FIX: User creation of expense report not visible FIX: warning when adding a line if $remise_percent is an empty string FIX: status late on purchase orders FIX: ODT generation very slow +FIX: amount in summary of report ***** ChangeLog for 13.0.0 compared to 12.0.0 ***** From afeeb40e2e75cfc7dd2c6b79b532c3f4a441924b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Feb 2021 00:18:00 +0100 Subject: [PATCH 06/39] Fix show property "enabled" of extrafields --- htdocs/core/class/extrafields.class.php | 2 +- htdocs/core/tpl/admin_extrafields_edit.tpl.php | 9 +++++++++ htdocs/core/tpl/admin_extrafields_view.tpl.php | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 8448ae8bc57..fa81515b90d 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -839,7 +839,7 @@ class ExtraFields $array_name_label = array(); // We should not have several time this request. If we have, there is some optimization to do by calling a simple $extrafields->fetch_optionals() in top of code and not into subcode - $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,printable,totalizable,fielddefault,fieldcomputed,entity,enabled,help"; + $sql = "SELECT rowid, name, label, type, size, elementtype, fieldunique, fieldrequired, param, pos, alwayseditable, perms, langs, list, printable, totalizable, fielddefault, fieldcomputed, entity, enabled, help"; $sql .= " FROM ".MAIN_DB_PREFIX."extrafields"; //$sql.= " WHERE entity IN (0,".$conf->entity.")"; // Filter is done later if ($elementtype) $sql .= " WHERE elementtype = '".$this->db->escape($elementtype)."'"; // Filed with object->table_element diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 8990f75951d..e56c7fb9257 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -169,6 +169,7 @@ $totalizable = $extrafields->attributes[$elementtype]['totalizable'][$attrname]; $help = $extrafields->attributes[$elementtype]['help'][$attrname]; $entitycurrentorall = $extrafields->attributes[$elementtype]['entityid'][$attrname]; $printable = $extrafields->attributes[$elementtype]['printable'][$attrname]; +$enabled = $extrafields->attributes[$elementtype]['enabled'][$attrname]; if ((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param)) { @@ -299,6 +300,14 @@ if (in_array($type, array_keys($typewecanchangeinto))) trans("AllEntities"); ?>> + + + + trans("EnabledCondition"); ?> + + + + diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index fb542f9037e..c62a95ec12b 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -76,6 +76,11 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel { foreach ($extrafields->attributes[$elementtype]['type'] as $key => $value) { + /*if (! dol_eval($extrafields->attributes[$elementtype]['enabled'][$key], 1)) { + // TODO Uncomment this to exclude extrafields of modules not enabled. Add a link to "Show extrafields disabled" + // continue; + }*/ + // Load language if required if (!empty($extrafields->attributes[$elementtype]['langfile'][$key])) { $langs->load($extrafields->attributes[$elementtype]['langfile'][$key]); From 408aefd46c5962980e4bc0cdacd28c4d1f9ddeb8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Feb 2021 01:10:31 +0100 Subject: [PATCH 07/39] FIX vat value when code contains number --- htdocs/fourn/class/fournisseur.commande.class.php | 2 -- htdocs/fourn/commande/card.php | 4 +++- htdocs/product/fournisseurs.php | 6 +++++- htdocs/societe/card.php | 2 +- htdocs/supplier_proposal/card.php | 4 +++- htdocs/takepos/invoice.php | 4 +++- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 598f19ee0a0..f4c493c8b52 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1562,8 +1562,6 @@ class CommandeFournisseur extends CommonOrder { global $langs, $mysoc, $conf; - $error = 0; - dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $fk_prod_fourn_price, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, $info_bits, $notrigger, $date_start, $date_end, $fk_unit, $pu_ht_devise, $origin, $origin_id"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index ef4e46e0d5a..520c8bc3c47 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -564,7 +564,9 @@ if (empty($reshook)) $fk_unit = GETPOST('units', 'alpha'); - $tva_tx = price2num($tva_tx); // When vat is text input field + if (!preg_match('/\((.*)\)/', $tva_tx)) { + $tva_tx = price2num($tva_tx); // When vat is text input field + } // Local Taxes $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 2aadd4b3813..d66d7338bfd 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -160,9 +160,13 @@ if (empty($reshook)) if (empty($ref_fourn_old)) $ref_fourn_old = $ref_fourn; $quantity = price2num(GETPOST("qty", 'nohtml'), 'MS'); $remise_percent = price2num(GETPOST('remise_percent', 'alpha')); + $npr = preg_match('/\*/', $_POST['tva_tx']) ? 1 : 0; $tva_tx = str_replace('*', '', GETPOST('tva_tx', 'alpha')); - $tva_tx = price2num($tva_tx); + if (!preg_match('/\((.*)\)/', $tva_tx)) { + $tva_tx = price2num($tva_tx); + } + $price_expression = GETPOST('eid', 'int') ? GETPOST('eid', 'int') : ''; // Discard expression if not in expression mode $delivery_time_days = GETPOST('delivery_time_days', 'int') ? GETPOST('delivery_time_days', 'int') : ''; $supplier_reputation = GETPOST('supplier_reputation'); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 7b997fbd613..7c470d880ca 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1923,7 +1923,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // Country print ''.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).''; print img_picto('', 'globe-americas', 'class="paddingrightonly"'); - print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 widthcentpercentminusx'); + print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 maxwidth500 widthcentpercentminusx'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index d7ee97e1b9d..e271a796585 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -720,7 +720,9 @@ if (empty($reshook)) $fk_unit = GETPOST('units', 'alpha'); - $tva_tx = price2num($tva_tx); // When vat is text input field + if (!preg_match('/\((.*)\)/', $tva_tx)) { + $tva_tx = price2num($tva_tx); // When vat is text input field + } // Local Taxes $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 33c00190655..4d463b0927c 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -530,7 +530,9 @@ if ($action == "freezone") { $tva_tx = GETPOST('tva_tx', 'alpha'); if ($tva_tx != '') { - $tva_tx = price2num($tva_tx); + if (!preg_match('/\((.*)\)/', $tva_tx)) { + $tva_tx = price2num($tva_tx); + } } else { $tva_tx = get_default_tva($mysoc, $customer); } From 060e64fe02c4b08cac4aaa25120b836f0b2bb316 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Feb 2021 01:10:51 +0100 Subject: [PATCH 08/39] FIX vat value when code contains number --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index ead9eb83d7b..30dc6308146 100644 --- a/ChangeLog +++ b/ChangeLog @@ -54,6 +54,7 @@ FIX: warning when adding a line if $remise_percent is an empty string FIX: status late on purchase orders FIX: ODT generation very slow FIX: amount in summary of report +FIX: vat value when code contains number ***** ChangeLog for 13.0.0 compared to 12.0.0 ***** From c875ad9a1cb48f6d5ae034a38da803a31f13d3fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Feb 2021 02:17:01 +0100 Subject: [PATCH 09/39] FIX #16240 --- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/ajax.lib.php | 3 +- htdocs/core/tpl/objectline_create.tpl.php | 133 +++++++++++----------- 3 files changed, 70 insertions(+), 68 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e75e1eeed44..fc50c21f793 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3047,7 +3047,7 @@ class Form // "key" value of json key array is used by jQuery automatically as selected value // "label" value of json key array is used by jQuery automatically as text for combo box $out .= $opt; - array_push($outarray, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'up'=>$objp->unitprice, 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'disabled'=>(empty($objp->idprodfournprice) ?true:false))); + array_push($outarray, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'up'=>price2num($objp->unitprice, 'MT'), 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'disabled'=>(empty($objp->idprodfournprice) ?true:false))); // Exemple of var_dump $outarray // array(1) {[0]=>array(6) {[key"]=>string(1) "2" ["value"]=>string(3) "ppp" // ["label"]=>string(76) "ppp (fff2) - ppp - 20,00 Euros/1unité (20,00 Euros/unité)" diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 58265700e26..8a364359e9d 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -147,7 +147,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen console.log("We will trigger change on input '.$htmlname.' because of the select definition of autocomplete code for input#search_'.$htmlname.'"); console.log("Selected id = "+ui.item.id+" - If this value is null, it means you select a record with key that is null so selection is not effective"); - console.log("Propagate before some properties"); + console.log("Propagate before some properties retrieved into data-xxx properties"); $("#'.$htmlname.'").attr("data-pbq", ui.item.pbq); $("#'.$htmlname.'").attr("data-pbqup", ui.item.price_ht); $("#'.$htmlname.'").attr("data-pbqbase", ui.item.pricebasetype); @@ -190,6 +190,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen console.log("Make action update on each ui.item.update") // loop on each "update" fields $.each(ui.item.update, function(key, value) { + console.log("Set value "+value+" into #"+key); $("#" + key).val(value).trigger("change"); }); } diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index a40b385913d..5f19ed672a7 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -32,6 +32,7 @@ * $senderissupplier (0 by default, 1 or 2 for supplier invoices/orders) * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) */ + // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error: this template page cannot be called directly as an URL"; @@ -239,18 +240,18 @@ if ($nolinesbefore) { array('qty'=>'qty', 'remise_percent' => 'discount', 'idprod' => 'idprod'), // html id tags that will be edited with each ajax json response key - 'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done - 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for example shown we select a disabled option into combo) + 'update' => array('qty'=>'qty', 'remise_percent' => 'discount', 'idprod' => 'idprod'), // html id tags that will be edited with each ajax json response key + 'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done + 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for example shown we select a disabled option into combo) ); $alsoproductwithnosupplierprice = 0; } else { $ajaxoptions = array( - 'update' => array('remise_percent' => 'discount') // html id tags that will be edited with each ajax json response key + 'update' => array('remise_percent' => 'discount', 'price_ht' => 'up') // html id tags that will be edited with each ajax json response key ); $alsoproductwithnosupplierprice = 1; } @@ -531,47 +532,47 @@ if (!empty($usemargins) && $user->rights->margins->creer) /* TODO This does not work for number with thousand separator that is , */ function checkFreeLine(e, npRate) { - var buying_price = $("input[name='buying_price']:first"); - var remise = $("input[name='remise_percent']:first"); + var buying_price = $("input[name='buying_price']:first"); + var remise = $("input[name='remise_percent']:first"); - var rate = $("input[name='"+npRate+"']:first"); - if (rate.val() == '') - return true; + var rate = $("input[name='"+npRate+"']:first"); + if (rate.val() == '') + return true; - if (! $.isNumeric(rate.val().replace(',','.'))) - { - alert('trans("rateMustBeNumeric")); ?>'); - e.stopPropagation(); - setTimeout(function () { rate.focus() }, 50); - return false; - } - if (npRate == "np_markRate" && rate.val() >= 100) - { - alert('trans("markRateShouldBeLesserThan100")); ?>'); - e.stopPropagation(); - setTimeout(function () { rate.focus() }, 50); - return false; - } + if (! $.isNumeric(rate.val().replace(',','.'))) + { + alert('trans("rateMustBeNumeric")); ?>'); + e.stopPropagation(); + setTimeout(function () { rate.focus() }, 50); + return false; + } + if (npRate == "np_markRate" && rate.val() >= 100) + { + alert('trans("markRateShouldBeLesserThan100")); ?>'); + e.stopPropagation(); + setTimeout(function () { rate.focus() }, 50); + return false; + } - var price = 0; - remisejs=price2numjs(remise.val()); + var price = 0; + remisejs=price2numjs(remise.val()); - if (remisejs != 100) // If a discount not 100 or no discount - { - if (remisejs == '') remisejs=0; + if (remisejs != 100) // If a discount not 100 or no discount + { + if (remisejs == '') remisejs=0; - bpjs=price2numjs(buying_price.val()); - ratejs=price2numjs(rate.val()); + bpjs=price2numjs(buying_price.val()); + ratejs=price2numjs(rate.val()); - if (npRate == "np_marginRate") - price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100)); - else if (npRate == "np_markRate") - price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100)); - } + if (npRate == "np_marginRate") + price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100)); + else if (npRate == "np_markRate") + price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100)); + } - $("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value + $("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value - return true; + return true; } rights->margins->creer) }); $("#prod_entry_mode_free").on( "click", function() { - setforfree(); + setforfree(); }); $("#select_type").change(function() { - setforfree(); - if (jQuery('#select_type').val() >= 0) - { - /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ - jQuery('#dp_desc').focus(); - /* focus if CKEDITOR */ - if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") - { - var editor = CKEDITOR.instances['dp_desc']; - if (editor) { editor.focus(); } - } - } - console.log("Hide/show date according to product type"); - if (jQuery('#select_type').val() == '0') - { - jQuery('#trlinefordates').hide(); - jQuery('.divlinefordates').hide(); - } - else - { - jQuery('#trlinefordates').show(); - jQuery('.divlinefordates').show(); - } + setforfree(); + if (jQuery('#select_type').val() >= 0) + { + /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ + jQuery('#dp_desc').focus(); + /* focus if CKEDITOR */ + if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") + { + var editor = CKEDITOR.instances['dp_desc']; + if (editor) { editor.focus(); } + } + } + console.log("Hide/show date according to product type"); + if (jQuery('#select_type').val() == '0') + { + jQuery('#trlinefordates').hide(); + jQuery('.divlinefordates').hide(); + } + else + { + jQuery('#trlinefordates').show(); + jQuery('.divlinefordates').show(); + } }); $("#prod_entry_mode_predef").on( "click", function() { - console.log("click prod_entry_mode_predef"); - setforpredef(); - jQuery('#trlinefordates').show(); + console.log("click prod_entry_mode_predef"); + setforpredef(); + jQuery('#trlinefordates').show(); }); rights->margins->creer) /* When changing predefined product, we reload list of supplier prices required for margin combo */ $("#idprod, #idprodfournprice").change(function() { - console.log("Call method change() after change on #idprod or #idprodfournprice. this.val = "+$(this).val()); + console.log("Call method change() after change on #idprod or #idprodfournprice (senderissupplier=). this.val = "+$(this).val()); setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva From 29100a47664b1348d275680c2779e2f209801fe1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Feb 2021 02:28:22 +0100 Subject: [PATCH 10/39] FIX #16221 --- htdocs/expensereport/card.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index c7efc735051..e1e5fb34f2a 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -225,10 +225,12 @@ if (empty($reshook)) if (!($object->fk_user_author > 0)) $object->fk_user_author = $user->id; // Check that expense report is for a user inside the hierarchy or 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->writeall_advance))) { + 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++; setEventMessages($langs->trans("NotEnoughPermission"), null, 'errors'); - } else { + } + if (!$error) { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)) { if (!in_array($object->fk_user_author, $childids)) { $error++; From d80f23589d7765cae517e914edd1a5d141a7d904 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Feb 2021 02:39:58 +0100 Subject: [PATCH 11/39] Fix missing entry --- htdocs/langs/en_US/companies.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 99bed13179f..d4c9f95b0b9 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -203,6 +203,7 @@ ProfId2IT=- ProfId3IT=- ProfId4IT=- ProfId5IT=EORI number +ProfId6IT=- ProfId1LU=Id. prof. 1 (R.C.S. Luxembourg) ProfId2LU=Id. prof. 2 (Business permit) ProfId3LU=- From 13e0d08cbb5bd88e5c180d688528e266b7f3b331 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Feb 2021 02:49:54 +0100 Subject: [PATCH 12/39] Code comment --- htdocs/theme/eldy/ckeditor/config.js | 1 + htdocs/theme/md/ckeditor/config.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/htdocs/theme/eldy/ckeditor/config.js b/htdocs/theme/eldy/ckeditor/config.js index 50bf77c00ff..e041516a292 100644 --- a/htdocs/theme/eldy/ckeditor/config.js +++ b/htdocs/theme/eldy/ckeditor/config.js @@ -11,6 +11,7 @@ CKEDITOR.editorConfig = function( config ) config.enterMode = CKEDITOR.ENTER_BR; //config.forceSimpleAmpersand = true; // When you put a into the textarea, and go into "source", then ckeditor change the & into &. We don't want this. But this option does not fix this. //config.entities = false; // When you put a into the textarea, and go into "source", then ckeditor change the & into &. We don't want this. But this option does not fix this. + //config.entities_greek = false; config.resize_enabled = false; //config.resize_maxHeight = 3000; //config.resize_maxWidth = 3000; diff --git a/htdocs/theme/md/ckeditor/config.js b/htdocs/theme/md/ckeditor/config.js index 50ff0cc6eed..acd38268f8f 100644 --- a/htdocs/theme/md/ckeditor/config.js +++ b/htdocs/theme/md/ckeditor/config.js @@ -9,6 +9,9 @@ CKEDITOR.editorConfig = function( config ) // http://docs.cksource.com/CKEditor_3.x/Developers_Guide // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html config.enterMode = CKEDITOR.ENTER_BR; + //config.forceSimpleAmpersand = true; // When you put a into the textarea, and go into "source", then ckeditor change the & into &. We don't want this. But this option does not fix this. + //config.entities = false; // When you put a into the textarea, and go into "source", then ckeditor change the & into &. We don't want this. But this option does not fix this. + //config.entities_greek = false; config.resize_enabled = false; //config.resize_maxHeight = 3000; //config.resize_maxWidth = 3000; From 4c3a96da08992b02fa497cf2b33fc6fe8ccaa3e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Feb 2021 02:57:08 +0100 Subject: [PATCH 13/39] FIX #16150 --- htdocs/compta/bank/list.php | 2 +- htdocs/core/boxes/box_comptes.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index f3efea15235..a7177b78b5a 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -576,7 +576,7 @@ foreach ($accounts as $key=>$type) if (!empty($arrayfields['balance']['checked'])) { print ''; - print ''.price($solde, 0, $langs, 0, -1, -1, $objecttmp->currency_code).''; + print ''.price($solde, 0, $langs, 1, -1, -1, $objecttmp->currency_code).''; print ''; if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'balance'; diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 53be2725680..f09a80f0227 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -135,7 +135,7 @@ class box_comptes extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="right nowraponall"', - 'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code) + 'text' => price($solde, 0, $langs, 1, -1, -1, $objp->currency_code) ); $line++; From 89154265c6c355e786c2f16e9ea3ec95c05f6597 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Feb 2021 03:12:19 +0100 Subject: [PATCH 14/39] FIX #16129 --- htdocs/core/class/translate.class.php | 2 +- htdocs/website/class/website.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 11e67104f9a..7f42a176378 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -113,7 +113,7 @@ class Translate } else $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]); } else { // If it's for a codetouse that is a short code xx // Array to convert short lang code into long code. - $longforshort = array('ar'=>'ar_SA', 'el'=>'el_GR', 'ca'=>'ca_ES', 'en'=>'en_US', 'ja'=>'ja_JP', 'nb'=>'nb_NO', 'no'=>'nb_NO'); + $longforshort = array('ar'=>'ar_SA', 'el'=>'el_GR', 'ca'=>'ca_ES', 'en'=>'en_US', 'ja'=>'ja_JP', 'nb'=>'nb_NO', 'no'=>'nb_NO', 'zh'=>'zh_CN'); if (isset($longforshort[strtolower($langpart[0])])) $srclang = $longforshort[strtolower($langpart[0])]; elseif (!empty($langpart[0])) $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]); else $srclang = 'en_US'; diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 34cc78e9a05..d0ffc3ccc03 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1396,7 +1396,7 @@ class Website extends CommonObject 'bn'=>'bn_DB', 'bs'=>'bs_BA', 'ca'=>'ca_ES', - 'zh'=>'zh_TW', + 'zh'=>'zh_CN', 'cs'=>'cs_CZ', 'da'=>'da_DK', 'et'=>'et_EE', From 4f2e7c51fc4771c90127338c954cb0f8bc52e289 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Feb 2021 03:20:50 +0100 Subject: [PATCH 15/39] Fix #16129 autodetect language on public pages --- htdocs/core/class/translate.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 7f42a176378..ab075348c3a 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -113,7 +113,12 @@ class Translate } else $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]); } else { // If it's for a codetouse that is a short code xx // Array to convert short lang code into long code. - $longforshort = array('ar'=>'ar_SA', 'el'=>'el_GR', 'ca'=>'ca_ES', 'en'=>'en_US', 'ja'=>'ja_JP', 'nb'=>'nb_NO', 'no'=>'nb_NO', 'zh'=>'zh_CN'); + $longforshort = array( + 'am'=>'am_ET', 'ar'=>'ar_SA', 'bn'=>'bn_DB', 'el'=>'el_GR', 'ca'=>'ca_ES', 'cs'=>'cs_CZ', 'en'=>'en_US', 'fa'=>'fa_IR', + 'gl'=>'gl_ES', 'he'=>'he_IL', 'hi'=>'hi_IN', 'ja'=>'ja_JP', + 'ka'=>'ka_GE', 'km'=>'km_KH', 'kn'=>'kn_IN', 'ko'=>'ko_KR', 'lo'=>'lo_LA', 'nb'=>'nb_NO', 'no'=>'nb_NO', 'ne'=>'ne_NP', + 'sl'=>'sl_SI', 'sq'=>'sq_AL', 'sr'=>'sr_RS', 'sv'=>'sv_SE', 'uk'=>'uk_UA', 'vi'=>'vi_VN', 'zh'=>'zh_CN' + ); if (isset($longforshort[strtolower($langpart[0])])) $srclang = $longforshort[strtolower($langpart[0])]; elseif (!empty($langpart[0])) $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]); else $srclang = 'en_US'; From 8e8db387979c74900df919ee17024b892719e80d Mon Sep 17 00:00:00 2001 From: LAURIER Alexis <19586755+AlexisLaurier@users.noreply.github.com> Date: Wed, 10 Feb 2021 12:39:14 +0100 Subject: [PATCH 16/39] contract card.php - manage multicompany files Use of multidir_output[$object->entity] instead of dir_output to manage shared entities --- htdocs/contrat/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index a346d955f14..5da79e45607 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2131,7 +2131,7 @@ if ($action == 'create') * Documents generes */ $filename = dol_sanitizeFileName($object->ref); - $filedir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref); + $filedir = $conf->contrat->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref); $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = $user->rights->contrat->lire; $delallowed = $user->rights->contrat->creer; From e2ac46f0255d70e91f99cc975599b3837292dc52 Mon Sep 17 00:00:00 2001 From: LAURIER Alexis <19586755+AlexisLaurier@users.noreply.github.com> Date: Wed, 10 Feb 2021 12:44:36 +0100 Subject: [PATCH 17/39] manage documents folder as contrat - document.php --- htdocs/contrat/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 5da79e45607..41fb7f0057e 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -883,8 +883,8 @@ if (empty($reshook)) $action = 'editref'; } else { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $old_filedir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($old_ref); - $new_filedir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($object->ref); + $old_filedir = $conf->contrat->multidir_output[$object->entity].'/'.dol_sanitizeFileName($old_ref); + $new_filedir = $conf->contrat->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); $files = dol_dir_list($old_filedir); if (!empty($files)) @@ -929,7 +929,7 @@ if (empty($reshook)) // Actions to build doc - $upload_dir = $conf->contrat->dir_output; + $upload_dir = $conf->contrat->multidir_output[$object->entity]; $permissiontoadd = $user->rights->contrat->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; @@ -2162,7 +2162,7 @@ if ($action == 'create') // Presend form $modelmail = 'contract'; $defaulttopic = 'SendContractRef'; - $diroutput = $conf->contrat->dir_output; + $diroutput = $conf->contrat->multidir_output[$object->entity]; $trackid = 'con'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; From ca5eed691dc7ede6638ea07569a9faf59800f43d Mon Sep 17 00:00:00 2001 From: LAURIER Alexis <19586755+AlexisLaurier@users.noreply.github.com> Date: Wed, 10 Feb 2021 12:45:45 +0100 Subject: [PATCH 18/39] manage entity folder in contrat/document.php --- htdocs/contrat/document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index b68da3170ed..ba15af0de19 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -74,7 +74,7 @@ if ($object->id > 0) $object->fetch_thirdparty(); } -$upload_dir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($object->ref); +$upload_dir = $conf->contrat->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); $modulepart = 'contract'; // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context From 92c374624e8613c0c41a21910d0f11525baf53ee Mon Sep 17 00:00:00 2001 From: LAURIER Alexis <19586755+AlexisLaurier@users.noreply.github.com> Date: Wed, 10 Feb 2021 12:58:40 +0100 Subject: [PATCH 19/39] contrat card.php - showdocuments add parameters Add missing parameters to showdocuments to manage properly contract entity --- htdocs/contrat/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 41fb7f0057e..be89fb2d3f6 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2137,7 +2137,7 @@ if ($action == 'create') $delallowed = $user->rights->contrat->creer; - print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); + print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object); // Show links to link elements From cb4295b702ad87054aea4a590b05c7a992ef722c Mon Sep 17 00:00:00 2001 From: LAURIER Alexis <19586755+AlexisLaurier@users.noreply.github.com> Date: Wed, 10 Feb 2021 13:02:13 +0100 Subject: [PATCH 20/39] dol_check_secure_access_document contrat multidir_ Use multidir_output for contracts document check to manage entity on each contract --- htdocs/core/lib/files.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 1bdaeef13ef..0703e3ede70 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2709,13 +2709,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } if (!empty($conf->stock->enabled)) $original_file = $conf->stock->multidir_output[$entity].'/movement/'.$original_file; } // Wrapping pour les contrats - elseif ($modulepart == 'contract' && !empty($conf->contrat->dir_output)) + elseif ($modulepart == 'contract' && !empty($conf->contrat->multidir_output[$entity])) { if ($fuser->rights->contrat->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } - $original_file = $conf->contrat->dir_output.'/'.$original_file; + $original_file = $conf->contrat->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."contrat WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('contract').")"; } // Wrapping pour les dons elseif ($modulepart == 'donation' && !empty($conf->don->dir_output)) From 468f40743d246af262985607b5c00975d2d95d71 Mon Sep 17 00:00:00 2001 From: Alexis LAURIER Date: Wed, 10 Feb 2021 13:18:55 +0100 Subject: [PATCH 21/39] contract - use multidir_output --- .../modules/contract/doc/doc_generic_contract_odt.modules.php | 4 ++-- htdocs/core/modules/contract/doc/pdf_strato.modules.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index edad675857f..bc6274482c4 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -219,7 +219,7 @@ class doc_generic_contract_odt extends ModelePDFContract // Load traductions files required by page $outputlangs->loadLangs(array("main", "dict", "companies", "bills")); - if ($conf->contrat->dir_output) + if ($conf->contrat->multidir_output[$object->entity]) { // If $object is id instead of object if (!is_object($object)) @@ -236,7 +236,7 @@ class doc_generic_contract_odt extends ModelePDFContract $object->fetch_thirdparty(); - $dir = $conf->contrat->dir_output; + $dir = $conf->contrat->multidir_output[$object->entity]; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; $file = $dir."/".$objectref.".odt"; diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 2b9fb62b1d4..45d86ab0ced 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -195,7 +195,7 @@ class pdf_strato extends ModelePDFContract $file = $dir."/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->contrat->dir_output."/".$objectref; + $dir = $conf->contrat->multidir_output[$object->entity]."/".$objectref; $file = $dir."/".$objectref.".pdf"; } From 5b2779a5f9bf8a35e3f9ca8bea90a4990e5c6016 Mon Sep 17 00:00:00 2001 From: Alexis LAURIER Date: Wed, 10 Feb 2021 13:27:42 +0100 Subject: [PATCH 22/39] contract - use multidir_output --- htdocs/contrat/class/contrat.class.php | 2 +- htdocs/contrat/list.php | 4 ++-- htdocs/core/lib/contract.lib.php | 2 +- htdocs/core/lib/files.lib.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 36edee80669..7c99a9483b9 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1296,7 +1296,7 @@ class Contrat extends CommonObject $ref = dol_sanitizeFileName($this->ref); if ($conf->contrat->dir_output) { - $dir = $conf->contrat->dir_output."/".$ref; + $dir = $conf->contrat->multidir_output[$this->entity]."/".$ref; if (file_exists($dir)) { $res = @dol_delete_dir_recursive($dir); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index bcddb637b68..a13026c1987 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -201,7 +201,7 @@ $socstatic = new Societe($db); $contracttmp = new Contrat($db); $sql = 'SELECT'; -$sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,"; +$sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity"; $sql .= ' s.rowid as socid, s.nom as name, s.name_alias, s.email, s.town, s.zip, s.fk_pays as country_id, s.client, s.code_client, s.status as company_status, s.logo as company_logo,'; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; @@ -640,7 +640,7 @@ while ($i < min($num, $limit)) } $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($obj->ref); + $filedir = $conf->contrat->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref); $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; print $formfile->getDocumentsLink($contracttmp->element, $filename, $filedir); print ''; diff --git a/htdocs/core/lib/contract.lib.php b/htdocs/core/lib/contract.lib.php index c72c46c8916..10f8d37a3c8 100644 --- a/htdocs/core/lib/contract.lib.php +++ b/htdocs/core/lib/contract.lib.php @@ -70,7 +70,7 @@ function contract_prepare_head(Contrat $object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref); + $upload_dir = $conf->contrat->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/contrat/document.php?id='.$object->id; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 0703e3ede70..0f3023d100d 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2316,10 +2316,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, if ($fuser->rights->ficheinter->{$lire}) $accessallowed = 1; $original_file = $conf->ficheinter->dir_output.'/'.$original_file; } // Wrapping pour les apercu conat - elseif (($modulepart == 'apercucontract') && !empty($conf->contrat->dir_output)) + elseif (($modulepart == 'apercucontract') && !empty($conf->contrat->multidir_output[$entity])) { if ($fuser->rights->contrat->{$lire}) $accessallowed = 1; - $original_file = $conf->contrat->dir_output.'/'.$original_file; + $original_file = $conf->contrat->multidir_output[$entity].'/'.$original_file; } // Wrapping pour les apercu supplier proposal elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output)) { From c9b296ed5718e34f4c1aa9925d1af073610664ee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Feb 2021 13:51:18 +0100 Subject: [PATCH 23/39] Remove bad use --- test/phpunit/FilesLibTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index ae8ea17efb6..d80abac42fe 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -1,6 +1,4 @@ * Copyright (C) 2012 Regis Houssin * From fbeac7c3742c2028c8d7217326600d6e7bf34a3b Mon Sep 17 00:00:00 2001 From: Alexis LAURIER Date: Wed, 10 Feb 2021 14:01:52 +0100 Subject: [PATCH 24/39] contract list.php - add group by for entity --- htdocs/contrat/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index a13026c1987..75a3b036338 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -256,7 +256,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -$sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,"; +$sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity,"; $sql .= ' s.rowid, s.nom, s.name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, s.status, s.logo,'; $sql .= " typent.code,"; $sql .= " state.code_departement, state.nom"; From 0849ce288cae0663b5f0fcbdedb85e384706e6d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Feb 2021 14:04:06 +0100 Subject: [PATCH 25/39] Fix phpcs --- htdocs/compta/resultat/index.php | 2 +- htdocs/core/lib/security.lib.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index b623c1648a2..38d0f4ec3f9 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -846,7 +846,7 @@ if (!empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING')) if (!empty($date_start) && !empty($date_end)) $sql .= " AND b.doc_date >= '".$db->idate($date_start)."' AND b.doc_date <= '".$db->idate($date_end)."'"; $sql .= " GROUP BY b.doc_ref, b.numero_compte, b.subledger_account, b.subledger_label, pcg_type, dm"; -//print $sql; + //print $sql; $subtotal_ht = 0; $subtotal_ttc = 0; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index a9c6435348e..4602e877bd1 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -602,7 +602,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand $sql .= " AND sc.fk_soc = dbt.".$dbt_keyfield; $sql .= " AND sc.fk_user = ".$user->id; } else { - // On ticket, the thirdparty is not mandatory, so we need a special test to accept record with no thirdparties. + // On ticket, the thirdparty is not mandatory, so we need a special test to accept record with no thirdparties. $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = dbt.".$dbt_keyfield." AND sc.fk_user = ".$user->id; From 8b125d8076f4ad22995817a7152dd076125c8a5d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Feb 2021 16:44:20 +0100 Subject: [PATCH 26/39] Fix MVC. Actions must be before output. --- htdocs/comm/propal/list.php | 147 +++++++++++++----------- htdocs/core/actions_massactions.inc.php | 1 + 2 files changed, 79 insertions(+), 69 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 535654458a7..5190adb379a 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -111,6 +111,11 @@ $pagenext = $page + 1; if (!$sortfield) $sortfield = 'p.ref'; if (!$sortorder) $sortorder = 'DESC'; +$permissiontoread = $user->rights->propal->lire; +$permissiontoadd = $user->rights->propal->write; +$permissiontodelete = $user->rights->propal->supprimer; +$permissiontoclose = $user->rights->propal->cloturer; + // Security check $module = 'propal'; $dbtable = ''; @@ -246,17 +251,83 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' } if ($object_statut != '') $search_status = $object_statut; + if (empty($reshook)) { $objectclass = 'Propal'; $objectlabel = 'Proposals'; - $permissiontoread = $user->rights->propal->lire; - $permissiontodelete = $user->rights->propal->supprimer; - $permissiontoclose = $user->rights->propal->cloturer; $uploaddir = $conf->propal->multidir_output[$conf->entity]; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } +// Mass action validate (after a confirmation question, it is $action that is used). +if ($action == 'validate') { + if (GETPOST('confirm') == 'yes') { + $tmpproposal = new Propal($db); + + $db->begin(); + $error = 0; + foreach ($toselect as $checked) { + if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) { + if ($tmpproposal->valid($user)) { + setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); + } else { + setEventMessage($langs->trans('CantBeValidated'), 'errors'); + $error++; + } + } else { + setEventMessage($tmpproposal->ref." ".$langs->trans('IsNotADraft'), 'errors'); + $error++; + } + } else { + dol_print_error($db); + $error++; + } + } + if ($error) { + $db->rollback(); + } else { + $db->commit(); + } + } +} + +// Mass action sign (after a confirmation question, it is $action that is used). +if ($action == "sign") { + if (GETPOST('confirm') == 'yes') { + $tmpproposal = new Propal($db); + + $db->begin(); + $error = 0; + foreach ($toselect as $checked) { + if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) { + $tmpproposal->statut = $tmpproposal::STATUS_SIGNED; + + if ($tmpproposal->update($user)) { + setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs'); + } else { + dol_print_error($db); + $error++; + } + } else { + setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors'); + $error++; + } + } else { + dol_print_error($db); + $error++; + } + } + if ($error) { + $db->rollback(); + } else { + $db->commit(); + } + } +} + /* @@ -1299,72 +1370,10 @@ if ($resql) $delallowed = $user->rights->propal->creer; print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); - - if ($action == 'validate') { - if (GETPOST('confirm') == 'yes') { - $tmpproposal = new Propal($db); - $db->begin(); - $error = 0; - foreach ($toselect as $checked) { - if ($tmpproposal->fetch($checked)) { - if ($tmpproposal->statut == 0) { - if ($tmpproposal->valid($user)) { - setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); - } else { - setEventMessage($langs->trans('CantBeValidated'), 'errors'); - $error++; - } - } else { - setEventMessage($tmpproposal->ref." ".$langs->trans('IsNotADraft'), 'errors'); - $error++; - } - } - dol_print_error($db); - $error++; - } - if ($error) { - $db->rollback(); - } else { - $db->commit(); - } - } - } - - if ($action == "sign") { - if (GETPOST('confirm') == 'yes') { - $tmpproposal = new Propal($db); - $db->begin(); - $error = 0; - foreach ($toselect as $checked) { - if ($tmpproposal->fetch($checked)) { - if ($tmpproposal->statut == 1) { - $tmpproposal->statut = 2; - if ($tmpproposal->update($user)) { - setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs'); - } else { - dol_print_error($db); - $error++; - } - } else { - setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors'); - $error++; - } - } else { - dol_print_error($db); - $error++; - } - } - if ($error) { - $db->rollback(); - } else { - $db->commit(); - } - } - } } else { - dol_print_error($db); + dol_print_error($db); } - // End of page - llxFooter(); - $db->close(); +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 356eb36a04b..b1b03e8de97 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1082,6 +1082,7 @@ if ($action == 'remove_file') $action = ''; } + // Validate records if (!$error && $massaction == 'validate' && $permissiontoadd) { From 90d1b2d349045bdbe604efa8ffc61e5a6cfbcded Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Feb 2021 18:05:36 +0100 Subject: [PATCH 27/39] Prepare 12.0.5 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index b57228f24e9..212ae107c42 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (!defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr'); -if (!defined('DOL_VERSION')) define('DOL_VERSION', '12.0.4'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (!defined('DOL_VERSION')) define('DOL_VERSION', '12.0.5'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (!defined('EURO')) define('EURO', chr(128)); From a2051fc01ee92ced49117d20578ebe8f5821dacd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Mestre?= Date: Wed, 10 Feb 2021 15:20:10 -0300 Subject: [PATCH 28/39] V13 Fix #16241 Date filter resets on Miscellaneous Payments Changed $search_datep_start, $search_datep_end, $search_datev_start and $search_datev_end variables to get values from search_datep_start, search_datep_end, search_datev_start and search_datev_end GET parameters if their value is empty after checking POST parameters --- htdocs/compta/bank/various_payment/list.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 0d91eb38e7d..0790f149da4 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -58,6 +58,10 @@ $search_accountancy_account = GETPOST("search_accountancy_account"); if ($search_accountancy_account == - 1) $search_accountancy_account = ''; $search_accountancy_subledger = GETPOST("search_accountancy_subledger"); if ($search_accountancy_subledger == - 1) $search_accountancy_subledger = ''; +if (empty($search_datep_start)) $search_datep_start = GETPOST("search_datep_start", 'int'); +if (empty($search_datep_end)) $search_datep_end = GETPOST("search_datep_end", 'int'); +if (empty($search_datev_start)) $search_datev_start = GETPOST("search_datev_start", 'int'); +if (empty($search_datev_end)) $search_datev_end = GETPOST("search_datev_end", 'int'); $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); From 09629d32d7b77dbc81e7967499cf81cafe313c79 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Feb 2021 14:53:29 +0100 Subject: [PATCH 29/39] Fix missing properties in fetch --- htdocs/fourn/class/fournisseur.commande.class.php | 9 ++++++--- htdocs/fourn/class/fournisseur.facture.class.php | 14 +++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index f4c493c8b52..e6421b1b7c9 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -139,6 +139,8 @@ class CommandeFournisseur extends CommonOrder public $cond_reglement_id; public $cond_reglement_code; + public $cond_reglement_label; // Label + public $cond_reglement_doc; // Label on documents /** * @var int ID @@ -312,7 +314,7 @@ class CommandeFournisseur extends CommonOrder $sql .= " c.note_private, c.note_public, c.model_pdf, c.extraparams, c.billed,"; $sql .= " c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc,"; $sql .= " cm.libelle as methode_commande,"; - $sql .= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc,"; + $sql .= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_label, cr.libelle_facture as cond_reglement_doc,"; $sql .= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle"; $sql .= ', c.fk_incoterms, c.location_incoterms'; $sql .= ', i.libelle as label_incoterms'; @@ -373,8 +375,9 @@ class CommandeFournisseur extends CommonOrder $this->fk_project = $obj->fk_project; $this->cond_reglement_id = $obj->fk_cond_reglement; $this->cond_reglement_code = $obj->cond_reglement_code; - $this->cond_reglement = $obj->cond_reglement_libelle; - $this->cond_reglement_doc = $obj->cond_reglement_libelle_doc; + $this->cond_reglement = $obj->cond_reglement_label; // deprecated + $this->cond_reglement_label = $obj->cond_reglement_label; + $this->cond_reglement_doc = $obj->cond_reglement_doc; $this->fk_account = $obj->fk_account; $this->mode_reglement_id = $obj->fk_mode_reglement; $this->mode_reglement_code = $obj->mode_reglement_code; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 83408d9ba6c..74be7bcf762 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -176,8 +176,11 @@ class FactureFournisseur extends CommonInvoice public $note_private; public $note_public; public $propalid; + public $cond_reglement_id; public $cond_reglement_code; + public $cond_reglement_label; + public $cond_reglement_doc; /** * @var int ID @@ -641,8 +644,8 @@ class FactureFournisseur extends CommonInvoice $sql .= " t.model_pdf,"; $sql .= " t.import_key,"; $sql .= " t.extraparams,"; - $sql .= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle,"; - $sql .= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle,"; + $sql .= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_label, cr.libelle_facture as cond_reglement_doc,"; + $sql .= " p.code as mode_reglement_code, p.libelle as mode_reglement_label,"; $sql .= ' s.nom as socnom, s.rowid as socid,'; $sql .= ' t.fk_incoterms, t.location_incoterms,'; $sql .= " i.libelle as label_incoterms,"; @@ -697,12 +700,13 @@ class FactureFournisseur extends CommonInvoice $this->fk_project = $obj->fk_project; $this->cond_reglement_id = $obj->fk_cond_reglement; $this->cond_reglement_code = $obj->cond_reglement_code; - $this->cond_reglement = $obj->cond_reglement_libelle; - $this->cond_reglement_doc = $obj->cond_reglement_libelle; + $this->cond_reglement = $obj->cond_reglement_label; // deprecated + $this->cond_reglement_label = $obj->cond_reglement_label; + $this->cond_reglement_doc = $obj->cond_reglement_doc; $this->fk_account = $obj->fk_account; $this->mode_reglement_id = $obj->fk_mode_reglement; $this->mode_reglement_code = $obj->mode_reglement_code; - $this->mode_reglement = $obj->mode_reglement_libelle; + $this->mode_reglement = $obj->mode_reglement_label; $this->date_echeance = $this->db->jdate($obj->date_lim_reglement); $this->note = $obj->note_private; // deprecated $this->note_private = $obj->note_private; From 1b11d9d0e9fcb0ce749f831ddc3704744f4e809d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Feb 2021 17:48:32 +0100 Subject: [PATCH 30/39] FIX payment term label on PDF --- ChangeLog | 1 + htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 2 +- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php | 2 +- htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php | 2 +- .../core/modules/supplier_proposal/doc/pdf_aurore.modules.php | 2 +- 10 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 30dc6308146..361f7989850 100644 --- a/ChangeLog +++ b/ChangeLog @@ -55,6 +55,7 @@ FIX: status late on purchase orders FIX: ODT generation very slow FIX: amount in summary of report FIX: vat value when code contains number +FIX: payment term label on PDF ***** ChangeLog for 13.0.0 compared to 12.0.0 ***** diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 0b99583e08e..f2f78efbaa2 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -707,7 +707,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc); + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); $pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L'); diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index d1492dbc5eb..6037714f6db 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -925,7 +925,7 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc); + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); $pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L'); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index ce44aac0319..9e336863467 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1004,7 +1004,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc); + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); $pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L'); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 423aa5b79d1..cf6ec0e4711 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1108,7 +1108,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc); + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); $pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L'); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index a17f8c9a8ac..0ad654e49d0 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -909,7 +909,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc); + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); $pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L'); diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 760e678e839..c4f11568456 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1048,7 +1048,7 @@ class pdf_cyan extends ModelePDFPropales $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc); + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); $pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L'); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 22bc80e161d..bcb1fac88b3 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -859,7 +859,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement); + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L'); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index b48cb60df45..5214ce47444 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -741,7 +741,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_id); + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L'); diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index d8307226e41..e9e2179823b 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -801,7 +801,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc); + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L'); From 2615d630241d938285dd07d3a9611ce31c466b91 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Feb 2021 18:02:21 +0100 Subject: [PATCH 31/39] Complete repair to clean not correctly available extrafields on proposal --- htdocs/install/repair.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 14138dc5664..baac0eb2cbd 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -223,7 +223,7 @@ if ($ok && GETPOST('standard', 'alpha')) { $extrafields = new ExtraFields($db); $listofmodulesextra = array('societe'=>'societe', 'adherent'=>'adherent', 'product'=>'product', - 'socpeople'=>'socpeople', 'commande'=>'commande', 'facture'=>'facture', + 'socpeople'=>'socpeople', 'propal'=>'propal', 'commande'=>'commande', 'facture'=>'facture', 'supplier_proposal'=>'supplier_proposal', 'commande_fournisseur'=>'commande_fournisseur', 'facture_fourn'=>'facture_fourn', 'actioncomm'=>'actioncomm', 'bom_bom'=>'bom_bom', 'mrp_mo'=>'mrp_mo', 'adherent_type'=>'adherent_type', 'user'=>'user', 'projet'=>'projet', 'projet_task'=>'projet_task'); From e1334f34b685331caa7fa97f900058a9ff7c4878 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Feb 2021 18:02:21 +0100 Subject: [PATCH 32/39] Complete repair to clean not correctly available extrafields on proposal --- htdocs/install/repair.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index e0402bb88a1..6a4051f1391 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -229,7 +229,7 @@ if ($ok && GETPOST('standard', 'alpha')) { $extrafields = new ExtraFields($db); $listofmodulesextra = array('societe'=>'societe', 'adherent'=>'adherent', 'product'=>'product', - 'socpeople'=>'socpeople', 'commande'=>'commande', 'facture'=>'facture', + 'socpeople'=>'socpeople', 'propal'=>'propal', 'commande'=>'commande', 'facture'=>'facture', 'supplier_proposal'=>'supplier_proposal', 'commande_fournisseur'=>'commande_fournisseur', 'facture_fourn'=>'facture_fourn', 'actioncomm'=>'actioncomm', 'bom_bom'=>'bom_bom', 'mrp_mo'=>'mrp_mo', 'adherent_type'=>'adherent_type', 'user'=>'user', 'projet'=>'projet', 'projet_task'=>'projet_task'); From 5392e11370efef0614d3235b41fd005b6fccd4aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Feb 2021 23:05:01 +0100 Subject: [PATCH 33/39] Add missing ethiopian birr currency --- htdocs/install/mysql/data/llx_c_currencies.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_c_currencies.sql b/htdocs/install/mysql/data/llx_c_currencies.sql index d05015721c8..478c263af4c 100644 --- a/htdocs/install/mysql/data/llx_c_currencies.sql +++ b/htdocs/install/mysql/data/llx_c_currencies.sql @@ -73,6 +73,7 @@ INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XCD' INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EGP', '[163]', 1, 'Egypt Pound'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'SVC', '[36]', 1, 'El Salvador Colon'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EEK', '[107,114]', 1, 'Estonia Kroon'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ETB', NULL, 1, 'Ethiopian Birr'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EUR', '[8364]', 1, 'Euro Member Countries'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FKP', '[163]', 1, 'Falkland Islands (Malvinas) Pound'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FJD', '[36]', 1, 'Fiji Dollar'); From 4b9f71d20e48db237c4a753025988befcaa2f4a0 Mon Sep 17 00:00:00 2001 From: LAURIER Alexis <19586755+AlexisLaurier@users.noreply.github.com> Date: Fri, 12 Feb 2021 09:00:29 +0100 Subject: [PATCH 34/39] Add missing comma in contract list.php --- htdocs/contrat/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 75a3b036338..f9c537aea2f 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -201,7 +201,7 @@ $socstatic = new Societe($db); $contracttmp = new Contrat($db); $sql = 'SELECT'; -$sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity"; +$sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity,"; $sql .= ' s.rowid as socid, s.nom as name, s.name_alias, s.email, s.town, s.zip, s.fk_pays as country_id, s.client, s.code_client, s.status as company_status, s.logo as company_logo,'; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; From 811c02b970e86eaa31d33a23f3e1fff2aaaac22c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 12 Feb 2021 15:45:49 +0100 Subject: [PATCH 35/39] fix inverted test --- 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 f58886c9a3b..c6e9799afa7 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -241,7 +241,7 @@ class Project extends CommonObject if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible'] = 0; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { $this->fields['fk_opp_status']['enabled'] = 0; $this->fields['opp_percent']['enabled'] = 0; $this->fields['opp_amount']['enabled'] = 0; From f4c23654f84d9997782d421ecffe57f6c1d6ea4c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 14 Feb 2021 22:44:04 +0100 Subject: [PATCH 36/39] FIX #16275 #15604 --- htdocs/langs/en_US/cashdesk.lang | 3 ++- htdocs/takepos/index.php | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 88ff8fecdb6..7263b04730a 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -56,7 +56,8 @@ Paymentnumpad=Type of Pad to enter payment Numberspad=Numbers Pad BillsCoinsPad=Coins and banknotes Pad DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr -TakeposNeedsCategories=TakePOS needs product categories to work +TakeposNeedsCategories=TakePOS needs at least one product categorie to work +TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 product category under the category %s to work OrderNotes=Order Notes CashDeskBankAccountFor=Default account to use for payments in NoPaimementModesDefined=No paiment mode defined in TakePOS configuration diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 8062368d360..172f95c5c3d 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -140,6 +140,7 @@ if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) } } } + $levelofmaincategories = $levelofrootcategory + 1; $maincategories = array(); @@ -961,7 +962,13 @@ if (empty($paiementsModes)) { setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors'); } if (count($maincategories) == 0) { - setEventMessages($langs->trans("TakeposNeedsCategories"), null, 'errors'); + if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) { + $tmpcategory = new Categorie($db); + $tmpcategory->fetch($conf->global->TAKEPOS_ROOT_CATEGORY_ID); + setEventMessages($langs->trans("TakeposNeedsAtLeastOnSubCategoryIntoParentCategory", $tmpcategory->label), null, 'errors'); + } else { + setEventMessages($langs->trans("TakeposNeedsCategories"), null, 'errors'); + } } // User menu and external TakePOS modules $menus = array(); From b2826025f6ebf6db2aa05a35adfd264112d097a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Feb 2021 11:48:48 +0100 Subject: [PATCH 37/39] Fix missing event type --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 4c8adf5282e..a19f8d34279 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -576,3 +576,6 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value -- Removed no more used function -- VPGSQL8.2 DROP FUNCTION IF EXISTS update_modified_column_date_m CASCADE; + +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 6,'AC_EMAIL_IN','system','reception Email',NULL, 1, 4); + From 6e218391693b53d3114df91b02df048baf6dcfc1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Feb 2021 11:50:59 +0100 Subject: [PATCH 38/39] Fix migration --- htdocs/install/mysql/data/llx_c_actioncomm.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_c_actioncomm.sql b/htdocs/install/mysql/data/llx_c_actioncomm.sql index 9a0d8c223b6..cb22ee70ce3 100644 --- a/htdocs/install/mysql/data/llx_c_actioncomm.sql +++ b/htdocs/install/mysql/data/llx_c_actioncomm.sql @@ -30,7 +30,7 @@ -- Types action comm -- -delete from llx_c_actioncomm where id in (1,2,3,4,5,8,9,10,30,31,40,50); +delete from llx_c_actioncomm where id in (1,2,3,4,5,6,8,9,10,11,30,31,40,50); -- Code used from 3.3+ when type of event is used insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 1,'AC_TEL','system','Phone call',NULL, 1, 2); insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 2,'AC_FAX','system','Send Fax',NULL, 1, 3); From 49f8ff57086ab16e7c22fab2dcdcbff1a20a7ef8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Feb 2021 12:18:09 +0100 Subject: [PATCH 39/39] FIX #16286 --- htdocs/core/tpl/extrafields_list_array_fields.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php index d2d77cf3b5c..bbc5ba3370b 100644 --- a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php @@ -1,6 +1,6 @@ '."\n"; +// This tpl file is included into the init part of pages, so before action. +// So no output must be done. // Protection to avoid direct call of template if (empty($conf) || !is_object($conf))