From c860c0dc4a72c35b38dfc5aee34ba968a1e1a13b Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Thu, 26 Nov 2020 11:47:45 +0100 Subject: [PATCH 001/356] Add default BOM --- htdocs/install/mysql/tables/llx_product.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 2431c884c62..a1ccf065ffa 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -100,5 +100,6 @@ create table llx_product desiredstock float DEFAULT 0, fk_unit integer DEFAULT NULL, price_autogen tinyint DEFAULT 0, + fk_default_bom integer DEFAULT NULL, fk_project integer DEFAULT NULL -- Used when product was generated by a project or is specifif to a project )ENGINE=innodb; From c2bd30a7e92445e10b6ffd0cc90b3121178d8816 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Thu, 26 Nov 2020 11:59:00 +0100 Subject: [PATCH 002/356] working progress --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 1 + htdocs/product/class/product.class.php | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) 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 c83755009ae..95d6d208145 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 @@ -29,6 +29,7 @@ -- Missing in v12 or lower +ALTER TABLE llx_product ADD COLUMN fk_default_bom integer DEFAULT NULL; ALTER TABLE llx_payment_salary MODIFY COLUMN ref varchar(30) NULL; ALTER TABLE llx_payment_various MODIFY COLUMN ref varchar(30) NULL; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 03d81d4fd64..40d63c4643f 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -248,6 +248,13 @@ class Product extends CommonObject */ public $finished; + /** + * fk_default_bom indicates the default bom + * + * @var int + */ + public $fk_default_bom; + /** * We must manage lot/batch number, sell-by date and so on : '1':yes '0':no * @@ -996,6 +1003,7 @@ class Product extends CommonObject $sql .= ", tobuy = ".(int) $this->status_buy; $sql .= ", tobatch = ".((empty($this->status_batch) || $this->status_batch < 0) ? '0' : (int) $this->status_batch); $sql .= ", finished = ".((!isset($this->finished) || $this->finished < 0 || $this->finished == '') ? "null" : (int) $this->finished); + $sql .= ", fk_default_bom = ".((!isset($this->fk_default_bom) || $this->fk_default_bom < 0 || $this->fk_default_bom == '') ? "null" : (int) $this->fk_default_bom); $sql .= ", net_measure = ".($this->net_measure != '' ? "'".$this->db->escape($this->net_measure)."'" : 'null'); $sql .= ", net_measure_units = ".($this->net_measure_units != '' ? "'".$this->db->escape($this->net_measure_units)."'" : 'null'); $sql .= ", weight = ".($this->weight != '' ? "'".$this->db->escape($this->weight)."'" : 'null'); @@ -2046,7 +2054,7 @@ class Product extends CommonObject $sql .= " price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell,"; $sql .= " tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, net_measure, net_measure_units, weight, weight_units,"; $sql .= " length, length_units, width, width_units, height, height_units,"; - $sql .= " surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; + $sql .= " surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,fk_default_bom,"; $sql .= " accountancy_code_buy, accountancy_code_buy_intra, accountancy_code_buy_export,"; $sql .= " accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp,"; $sql .= " datec, tms, import_key, entity, desiredstock, tobatch, fk_unit,"; @@ -2107,8 +2115,10 @@ class Product extends CommonObject $this->localtax2_tx = $obj->localtax2_tx; $this->localtax1_type = $obj->localtax1_type; $this->localtax2_type = $obj->localtax2_type; - + $this->finished = $obj->finished; + $this->fk_default_bom = $obj->fk_default_bom; + $this->duration = $obj->duration; $this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration) - 1); $this->duration_unit = substr($obj->duration, -1); From 5b40950f500f5a2de2e3a7bc58c8f12b42bd70af Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Thu, 26 Nov 2020 12:45:06 +0100 Subject: [PATCH 003/356] Update card.php add on card --- htdocs/product/card.php | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 6fdfb82e354..5fed4bc4ca1 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -17,7 +17,7 @@ * Copyright (C) 2016 Meziane Sof * Copyright (C) 2017 Josep Lluís Amador * Copyright (C) 2019 Frédéric France - * Copyright (C) 2019-2020 Thibault FOUCART + * Copyright (C) 2019-2020 Thibault FOUCART * Copyright (C) 2020 Pierre Ardoin * * This program is free software; you can redistribute it and/or modify @@ -59,6 +59,7 @@ if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/command if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; +if (!empty($conf->bom->enabled)) require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; // Load translation files required by the page $langs->loadLangs(array('products', 'other')); @@ -454,6 +455,13 @@ if (empty($reshook)) $object->finished = null; } + $fk_default_bom = GETPOST('fk_default_bom', 'int'); + if ($fk_default_bom >= 0) { + $object->fk_default_bom = $fk_default_bom; + } else { + $object->fk_default_bom = null; + } + $units = GETPOST('units', 'int'); if ($units > 0) { $object->fk_unit = $units; @@ -1567,6 +1575,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print $formproduct->selectProductNature('finished', $object->finished); print ''; + if ($conf->bom->enabled) { + print ''.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc")).''; + $bomkey = "Bom:bom/class/bom.class.php:0:t.status=1 AND t.fk_product=".$object->id; + print $form->selectForForms($bomkey, 'fk_default_bom', $object->fk_default_bom, 1); + print ''; + } + // Brut Weight print ''.$langs->trans("Weight").''; print ' '; @@ -2059,6 +2074,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print $object->getLibFinished(); print ''; + if ($conf->bom->enabled) { + print ''.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc")).''; + if ($object->fk_default_bom) { + $bom_static = new BOM($db); + $bom_static->fetch($object->fk_default_bom); + print $bom_static->getNomUrl(1); + } + print ''; + } + // Brut Weight print ''.$langs->trans("Weight").''; if ($object->weight != '') From 5329a1792e37bec9098f73b072860a629bd40cf5 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 2 Apr 2021 13:48:27 +0200 Subject: [PATCH 004/356] NEW add action trigger for member excluded --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 3 +++ 1 file changed, 3 insertions(+) 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 af32340170e..60005979239 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 @@ -359,3 +359,6 @@ ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_user_signature FOREIGN KEY (f UPDATE llx_propal SET fk_user_signature = fk_user_cloture WHERE fk_user_signature IS NULL AND fk_user_cloture IS NOT NULL; UPDATE llx_propal SET date_signature = date_cloture WHERE date_signature IS NULL AND date_cloture IS NOT NULL; + +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_EXCLUDE','Member excluded','Executed when a member is excluted','member',26); + From cacc785305cbc3824c2dbfd7526fe04c7c89f5cb Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 2 Apr 2021 13:48:51 +0200 Subject: [PATCH 005/356] Update 13.0.0-14.0.0.sql --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 60005979239..34a2ffa74fb 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 @@ -360,5 +360,5 @@ ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_user_signature FOREIGN KEY (f UPDATE llx_propal SET fk_user_signature = fk_user_cloture WHERE fk_user_signature IS NULL AND fk_user_cloture IS NOT NULL; UPDATE llx_propal SET date_signature = date_cloture WHERE date_signature IS NULL AND date_cloture IS NOT NULL; -INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_EXCLUDE','Member excluded','Executed when a member is excluted','member',26); +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_EXCLUDE','Member excluded','Executed when a member is excluded','member',26); From 8675484d9065a43b4438bd3b74305647cd27eca3 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Apr 2021 10:25:29 +0200 Subject: [PATCH 006/356] Update llx_c_action_trigger.sql --- htdocs/install/mysql/data/llx_c_action_trigger.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index 34cef4c94d4..a0391f5d841 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -90,6 +90,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION_DELETE','Member subscribtion deleted','Executed when a member subscribtion is deleted','member',24); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_RESILIATE','Member resiliated','Executed when a member is resiliated','member',25); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',26); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_EXCLUDE','Member excluded','Executed when a member is excluded','member',27); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',30); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_BILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',32); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',33); From 52bad238ff8c8fd95202bb5b1259a0792c664eb4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Apr 2021 10:25:44 +0200 Subject: [PATCH 007/356] Update 13.0.0-14.0.0.sql --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 34a2ffa74fb..5886e3cf33d 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 @@ -360,5 +360,5 @@ ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_user_signature FOREIGN KEY (f UPDATE llx_propal SET fk_user_signature = fk_user_cloture WHERE fk_user_signature IS NULL AND fk_user_cloture IS NOT NULL; UPDATE llx_propal SET date_signature = date_cloture WHERE date_signature IS NULL AND date_cloture IS NOT NULL; -INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_EXCLUDE','Member excluded','Executed when a member is excluded','member',26); +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_EXCLUDE','Member excluded','Executed when a member is excluded','member',27); From 09ab9308065677ff55d55093d3bb8e187c77e942 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Mon, 17 May 2021 18:31:19 +0200 Subject: [PATCH 008/356] sale_representative_order_invoice_list --- htdocs/commande/list.php | 55 ++++++++++++++++++++++++++++++++++ htdocs/compta/facture/list.php | 55 ++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 3747b2107b2..af6fa6e5bf5 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -187,6 +187,7 @@ $arrayfields = array( 'c.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>105), 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115), + 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1), 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120), 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125), 'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130), @@ -1172,6 +1173,9 @@ if ($resql) { print ''; print ''; } + if (!empty($arrayfields['sale_representative']['checked'])) { + print ''; + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook @@ -1329,6 +1333,9 @@ if ($resql) { if (!empty($arrayfields['u.login']['checked'])) { print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); } + if (!empty($arrayfields['sale_representative']['checked'])) { + print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -1685,6 +1692,54 @@ if ($resql) { } } + if (!empty($arrayfields['sale_representative']['checked'])) { + // Sales representatives + print ''; + if ($obj->socid > 0) { + $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); + if ($listsalesrepresentatives < 0) { + dol_print_error($db); + } + $nbofsalesrepresentative = count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 6) { + // We print only number + print $nbofsalesrepresentative; + } elseif ($nbofsalesrepresentative > 0) { + $userstatic = new User($db); + $j = 0; + foreach ($listsalesrepresentatives as $val) { + $userstatic->id = $val['id']; + $userstatic->lastname = $val['lastname']; + $userstatic->firstname = $val['firstname']; + $userstatic->email = $val['email']; + $userstatic->statut = $val['statut']; + $userstatic->entity = $val['entity']; + $userstatic->photo = $val['photo']; + $userstatic->login = $val['login']; + $userstatic->office_phone = $val['office_phone']; + $userstatic->office_fax = $val['office_fax']; + $userstatic->user_mobile = $val['user_mobile']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; + //print '
': + print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); + $j++; + if ($j < $nbofsalesrepresentative) { + print ' '; + } + //print '
'; + } + } + //else print $langs->trans("NoSalesRepresentativeAffected"); + } else { + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 14b0383fa8d..ad8ead936be 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -228,6 +228,7 @@ $arrayfields = array( 'dynamount_payed'=>array('label'=>"Received", 'checked'=>0, 'position'=>140), 'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), // Not enabled by default because slow 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>165), + 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1), 'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>170), 'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>171), 'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>180), @@ -1234,6 +1235,9 @@ if ($resql) { print ''; print ''; } + if (!empty($arrayfields['sale_representative']['checked'])) { + print ''; + } if (!empty($arrayfields['f.retained_warranty']['checked'])) { print ''; print ''; @@ -1426,6 +1430,9 @@ if ($resql) { if (!empty($arrayfields['u.login']['checked'])) { print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); } + if (!empty($arrayfields['sale_representative']['checked'])) { + print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); + } if (!empty($arrayfields['f.retained_warranty']['checked'])) { print_liste_field_titre($arrayfields['f.retained_warranty']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder); } @@ -1894,6 +1901,54 @@ if ($resql) { } } + if (!empty($arrayfields['sale_representative']['checked'])) { + // Sales representatives + print ''; + if ($obj->socid > 0) { + $listsalesrepresentatives = $thirdpartystatic->getSalesRepresentatives($user); + if ($listsalesrepresentatives < 0) { + dol_print_error($db); + } + $nbofsalesrepresentative = count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 6) { + // We print only number + print $nbofsalesrepresentative; + } elseif ($nbofsalesrepresentative > 0) { + $userstatic = new User($db); + $j = 0; + foreach ($listsalesrepresentatives as $val) { + $userstatic->id = $val['id']; + $userstatic->lastname = $val['lastname']; + $userstatic->firstname = $val['firstname']; + $userstatic->email = $val['email']; + $userstatic->statut = $val['statut']; + $userstatic->entity = $val['entity']; + $userstatic->photo = $val['photo']; + $userstatic->login = $val['login']; + $userstatic->office_phone = $val['office_phone']; + $userstatic->office_fax = $val['office_fax']; + $userstatic->user_mobile = $val['user_mobile']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; + //print '
': + print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); + $j++; + if ($j < $nbofsalesrepresentative) { + print ' '; + } + //print '
'; + } + } + //else print $langs->trans("NoSalesRepresentativeAffected"); + } else { + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['f.retained_warranty']['checked'])) { print ''.(!empty($obj->retained_warranty) ?price($obj->retained_warranty).'%' : ' ').''; } From 70a062e2c1da3ed83f59e249ac74554eee95ff6a Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Mon, 17 May 2021 23:59:42 +0200 Subject: [PATCH 009/356] change position --- htdocs/commande/list.php | 2 +- htdocs/compta/facture/list.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 4f68c1d9014..72f5528ec31 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -187,7 +187,7 @@ $arrayfields = array( 'c.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>105), 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115), - 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1), + 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'position'=>116), 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120), 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125), 'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130), diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 6cb2d05a157..c8175300b16 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -228,7 +228,7 @@ $arrayfields = array( 'dynamount_payed'=>array('label'=>"Received", 'checked'=>0, 'position'=>140), 'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), // Not enabled by default because slow 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>165), - 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1), + 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'position'=>166), 'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>170), 'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>171), 'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>180), From c02e3eed6b227123f883ecd607e935dce5d8fcd1 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Tue, 18 May 2021 18:45:07 +0200 Subject: [PATCH 010/356] checked --- htdocs/commande/list.php | 2 +- htdocs/compta/facture/list.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 72f5528ec31..153250534fd 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -187,7 +187,7 @@ $arrayfields = array( 'c.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>105), 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115), - 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'position'=>116), + 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116), 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120), 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125), 'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130), diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index c8175300b16..9eab570f31b 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -228,7 +228,7 @@ $arrayfields = array( 'dynamount_payed'=>array('label'=>"Received", 'checked'=>0, 'position'=>140), 'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), // Not enabled by default because slow 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>165), - 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'position'=>166), + 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>166), 'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>170), 'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>171), 'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>180), From 62bc6e9e1f383db48d7dc7351f1a90fc227c8cc2 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 20 May 2021 13:15:32 +0200 Subject: [PATCH 011/356] on going --- htdocs/compta/facture/list.php | 23 +++++++++++++--- htdocs/core/class/html.form.class.php | 39 ++++++++++++++++----------- htdocs/langs/en_US/bills.lang | 3 ++- 3 files changed, 46 insertions(+), 19 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 282aad95d89..6bf02d5d580 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -363,7 +363,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } -if ($massaction == 'makepayment') { +if ($massaction == 'makepayment_confirm') { $arrayofselected = is_array($toselect) ? $toselect : array(); $loc = dol_buildpath('/compta/paiement.php', 2).'?action=create&facids='.implode(',', $arrayofselected); @@ -948,8 +948,10 @@ if ($resql) { 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), - //'makepayment'=>$langs->trans("InvoicePaymentsLimits"), TODO Blank page when using this ); + if ($user->rights->facture->paiement) { + $arrayofmassactions['makepayment'] = $langs->trans("RegisterPaymentAndClasiffiedPayed"); + } if ($conf->prelevement->enabled && !empty($user->rights->prelevement->bons->creer)) { $langs->load("withdrawals"); $arrayofmassactions['withdrawrequest'] = $langs->trans("MakeWithdrawRequest"); @@ -961,7 +963,7 @@ if ($resql) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } } - if (in_array($massaction, array('presend', 'predelete'))) { + if (in_array($massaction, array('presend', 'predelete' ,'makepayment'))) { $arrayofmassactions = array(); } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); @@ -997,6 +999,21 @@ if ($resql) { $trackid = 'inv'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + if ($massaction=='makepayment') { + $formconfirm = ''; + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'date', 'name' => 'datepaiment', 'label' => $langs->trans("Date")), + array('type' => 'other', 'name' => 'paiementid', 'label' => $langs->trans("PaymentMode"), 'value' => $form->select_types_paiements(GETPOST('search_paymentmode'), 'paiementid', '', 2, 0, 1, 0, 1, '', 1)), + array('type' => 'other', 'name' => 'bankid', 'label' => $langs->trans("Date"), 'value'=>$form->select_comptes('', 'bankid', 0, '', 0, '', 0, '', 1)), + //array('type' => 'other', 'name' => 'invoicesid', 'label' => '', 'value'=>''), + ); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('RegisterPaymentAndClasiffiedPayed'), $langs->trans('RegisterPaymentAndClasiffiedPayed', $object->ref), 'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1); + print $formconfirm; + } + if ($sall) { foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 57bbbe3a029..763a3da6c57 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3914,13 +3914,16 @@ class Form * @param int $maxlength Max length of label * @param int $active Active or not, -1 = all * @param string $morecss Add more CSS on select tag + * @param int $nooutput 1=Return string, do not send to output * @return void */ - public function select_types_paiements($selected = '', $htmlname = 'paiementtype', $filtertype = '', $format = 0, $empty = 1, $noadmininfo = 0, $maxlength = 0, $active = 1, $morecss = '') + public function select_types_paiements($selected = '', $htmlname = 'paiementtype', $filtertype = '', $format = 0, $empty = 1, $noadmininfo = 0, $maxlength = 0, $active = 1, $morecss = '', $nooutput = 0) { // phpcs:enable global $langs, $user, $conf; + $out = ''; + dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); $filterarray = array(); @@ -3939,9 +3942,9 @@ class Form $selected = $conf->global->MAIN_DEFAULT_PAYMENT_TYPE_ID; } - print ''; if ($empty) { - print ''; + $out .= ''; } foreach ($this->cache_types_paiements as $id => $arraytypes) { // If not good status @@ -3960,25 +3963,25 @@ class Form } if ($format == 0) { - print ''; + $out .= $value ? $value : ' '; + $out .= ''; } - print ''; + $out .= ''; if ($user->admin && !$noadmininfo) { - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } + $out .= ajax_combobox('select'.$htmlname); + + if (empty($nooutput)) { + print $out; + } else { + return $out; } - print ajax_combobox('select'.$htmlname); } diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 940da4e35b4..1ccdd162719 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -589,4 +589,5 @@ FacParentLine=Invoice Line Parent SituationTotalRayToRest=Remainder to pay without taxe PDFSituationTitle=Situation n° %d SituationTotalProgress=Total progress %d %% -SearchUnpaidInvoicesWithDueDate=Search unpaid invoices with a due date = %s \ No newline at end of file +SearchUnpaidInvoicesWithDueDate=Search unpaid invoices with a due date = %s +RegisterPaymentAndClasiffiedPayed=Enter payment and Classify 'Paid' From 7c6ac86d3209d5822672ae7efd58e6cdcc137ef2 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 20 May 2021 13:41:23 +0200 Subject: [PATCH 012/356] ongoing --- htdocs/compta/facture/list.php | 54 ++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 6bf02d5d580..067a7cb959a 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -363,13 +363,53 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } -if ($massaction == 'makepayment_confirm') { +if ($action == 'makepayment_confirm') { + /*require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; $arrayofselected = is_array($toselect) ? $toselect : array(); + if (!empty($invoices_id)) { + $bankid=GETPOST('bankid','int'); + $paiementid=GETPOST('paiementid','int'); + $paiementdate=dol_mktime(12,0,0,GETPOST('datepaimentmonth','int'),GETPOST('datepaimentday','int'),GETPOST('datepaimentyear','year')); + foreach ($arrayofselected as $toselectid) { + $facture = new Facture($db); + $result = $facture->fetch($invoice_id); + if ($result < 0) { + setEventMessage($facture->error, 'errors'); + } else { + if (empty($facture->paye)) { - $loc = dol_buildpath('/compta/paiement.php', 2).'?action=create&facids='.implode(',', $arrayofselected); - - header('Location: '.$loc); - exit; + $paiementAmount = $facture->getSommePaiement(); + $totalcreditnotes = $facture->getSumCreditNotesUsed(); + $totaldeposits = $facture->getSumDepositsUsed(); + $totalpay = $paiementAmount + $totalcreditnotes + $totaldeposits; + $remaintopay = price2num($facture->total_ttc - $totalpay); + if ($remaintopay!=0) { + $resultBank = $facture->setBankAccount($bankid); + if ($resultBank < 0) { + setEventMessage($facture->error, 'errors'); + } else { + $paiement = new Paiement($this->db); + $paiement->datepaye = $paiementdate; + $paiement->amounts[$facture->id] = $remaintopay; // Array with all payments dispatching with invoice id + $paiement->multicurrency_amounts[$facture->id] = $remaintopay; + $paiement->paiementid = $paiementid; + $paiement_id = $paiement->create($user, 1, $facture->thirdparty); + if ($paiement_id < 0) { + setEventMessage($facture->ref . ' ' . $paiement->error, 'errors'); + } else { + $result = $paiement->addPaymentToBank($user, 'payment', '', $bankid, '', ''); + if ($result < 0) { + setEventMessages($facture->ref . ' ' . $paiement->error, $paiement->errors, 'errors'); + } + } + } + } + } else { + setEventMessage($facture->ref.' Total 0 € Pas de réglement enregistré', 'errors'); + } + } + } + }*/ } elseif ($massaction == 'withdrawrequest') { $langs->load("withdrawals"); @@ -985,7 +1025,9 @@ if ($resql) { } print ''; print ''; - print ''; + if (!in_array($massaction, array('presend', 'predelete' ,'makepayment'))) { + print ''; + } print ''; print ''; print ''; From 4d7b09ff2ae7bde4a4caa3a6935b5552663523fb Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 20 May 2021 14:00:43 +0200 Subject: [PATCH 013/356] done --- htdocs/compta/facture/list.php | 37 ++++++++++++++++++++++------------ htdocs/langs/en_US/bills.lang | 4 +++- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 067a7cb959a..677d92e8765 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -363,21 +363,22 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } -if ($action == 'makepayment_confirm') { - /*require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; +if ($action == 'makepayment_confirm' && $user->rights->facture->paiement) { + require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; $arrayofselected = is_array($toselect) ? $toselect : array(); - if (!empty($invoices_id)) { - $bankid=GETPOST('bankid','int'); - $paiementid=GETPOST('paiementid','int'); - $paiementdate=dol_mktime(12,0,0,GETPOST('datepaimentmonth','int'),GETPOST('datepaimentday','int'),GETPOST('datepaimentyear','year')); + if (!empty($arrayofselected)) { + $bankid=GETPOST('bankid', 'int'); + $paiementid=GETPOST('paiementid', 'int'); + $paiementdate=dol_mktime(12, 0, 0, GETPOST('datepaimentmonth', 'int'), GETPOST('datepaimentday', 'int'), GETPOST('datepaimentyear', 'year')); foreach ($arrayofselected as $toselectid) { + $errorpayment=0; $facture = new Facture($db); - $result = $facture->fetch($invoice_id); + $result = $facture->fetch($toselectid); if ($result < 0) { setEventMessage($facture->error, 'errors'); + $errorpayment++; } else { - if (empty($facture->paye)) { - + if ($facture->type != Facture::TYPE_CREDIT_NOTE && $facture->statut == 1 && $facture->paye == 0) { $paiementAmount = $facture->getSommePaiement(); $totalcreditnotes = $facture->getSumCreditNotesUsed(); $totaldeposits = $facture->getSumDepositsUsed(); @@ -387,8 +388,9 @@ if ($action == 'makepayment_confirm') { $resultBank = $facture->setBankAccount($bankid); if ($resultBank < 0) { setEventMessage($facture->error, 'errors'); + $errorpayment++; } else { - $paiement = new Paiement($this->db); + $paiement = new Paiement($db); $paiement->datepaye = $paiementdate; $paiement->amounts[$facture->id] = $remaintopay; // Array with all payments dispatching with invoice id $paiement->multicurrency_amounts[$facture->id] = $remaintopay; @@ -396,20 +398,29 @@ if ($action == 'makepayment_confirm') { $paiement_id = $paiement->create($user, 1, $facture->thirdparty); if ($paiement_id < 0) { setEventMessage($facture->ref . ' ' . $paiement->error, 'errors'); + $errorpayment++; } else { $result = $paiement->addPaymentToBank($user, 'payment', '', $bankid, '', ''); if ($result < 0) { setEventMessages($facture->ref . ' ' . $paiement->error, $paiement->errors, 'errors'); + $errorpayment++; } } } + } else { + setEventMessage($langs->trans('NoPaymentAvailable', $facture->ref), 'warnings'); + $errorpayment++; } } else { - setEventMessage($facture->ref.' Total 0 € Pas de réglement enregistré', 'errors'); + setEventMessage($langs->trans('NoPaymentAvailable', $facture->ref), 'warnings'); + $errorpayment++; } } + if (empty($errorpayment)) { + setEventMessage($langs->trans('RegisterPaymentAndClasiffiedPayedDone', $facture->ref)); + } } - }*/ + } } elseif ($massaction == 'withdrawrequest') { $langs->load("withdrawals"); @@ -1048,7 +1059,7 @@ if ($resql) { // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), array('type' => 'date', 'name' => 'datepaiment', 'label' => $langs->trans("Date")), - array('type' => 'other', 'name' => 'paiementid', 'label' => $langs->trans("PaymentMode"), 'value' => $form->select_types_paiements(GETPOST('search_paymentmode'), 'paiementid', '', 2, 0, 1, 0, 1, '', 1)), + array('type' => 'other', 'name' => 'paiementid', 'label' => $langs->trans("PaymentMode"), 'value' => $form->select_types_paiements(GETPOST('search_paymentmode'), 'paiementid', '', 0, 0, 1, 0, 1, '', 1)), array('type' => 'other', 'name' => 'bankid', 'label' => $langs->trans("Date"), 'value'=>$form->select_comptes('', 'bankid', 0, '', 0, '', 0, '', 1)), //array('type' => 'other', 'name' => 'invoicesid', 'label' => '', 'value'=>''), ); diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 1ccdd162719..a43d56217b4 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -590,4 +590,6 @@ SituationTotalRayToRest=Remainder to pay without taxe PDFSituationTitle=Situation n° %d SituationTotalProgress=Total progress %d %% SearchUnpaidInvoicesWithDueDate=Search unpaid invoices with a due date = %s -RegisterPaymentAndClasiffiedPayed=Enter payment and Classify 'Paid' +RegisterPaymentAndClasiffiedPayed=Enter payment and classify 'Paid' +NoPaymentAvailable=No payment available for %s +RegisterPaymentAndClasiffiedPayedDone=Payment registered and classify 'Paid' done for invoice %s From d70bbe29b54e7055043f51f72a47bfc84af90b78 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 20 May 2021 14:03:18 +0200 Subject: [PATCH 014/356] fix --- htdocs/compta/facture/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index e17e56e4378..850c012a5e7 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1036,7 +1036,7 @@ if ($resql) { } print ''; print ''; - if (!in_array($massaction, array('presend', 'predelete' ,'makepayment'))) { + if (!in_array($massaction, array('makepayment'))) { print ''; } print ''; From a344ae89f22bb6c9a9be0d1699a8623d5207d15b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 16 Jul 2021 15:02:23 +0200 Subject: [PATCH 015/356] Fix changelog --- ChangeLog | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48ba5daa562..f439186f5ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,27 +2,6 @@ English Dolibarr ChangeLog -------------------------------------------------------------- -***** ChangeLog for 13.0.4 compared to 13.0.2 ***** - -FIX: Allow disabling of a module (not a dangerous action) even if there is problem with token (due to bugged modules). -FIX: 13.0 - fatal - missing inclusion of ajax.lib.php for calling `ajax_autocompleter()` -FIX: #17919 pictures in docs. -FIX: #18006 -FIX: Accountancy - if we define a date start, automatic binding try to continue to solve old binding -FIX: Accoutancy Limit date payment not registered on purchases operations -FIX: Can't edit replacement invoice -FIX: deposit can create credit note in payment conf -FIX: division by zero on create -FIX: holiday: balances not updated correctly with pgsql because of case sensitivity field -FIX: holiday: status filter parameter has been renamed but not in links it was used -FIX: List and Create Companies Left Menus -FIX: method exists -FIX: need to add payment sum to getlibstatus function in object linked block -FIX: permission to close a proposal when using advanced permissions -FIX: Problem of z-index with popup and top menu -FIX: same thing on supplier orders -FIX: Status of invoice when making a replacement invoice -FIX: update contact birthday alert ***** ChangeLog for 14.0.0 compared to 13.0.0 ***** @@ -249,6 +228,29 @@ Following changes may create regressions for some external modules, but were nec * Removed constant MAIN_COUNTRIES_IN_EEC. You can now set if country is in Europe or not from the dictionary of countries. +***** ChangeLog for 13.0.4 compared to 13.0.3 ***** + +FIX: Allow disabling of a module (not a dangerous action) even if there is problem with token (due to bugged modules). +FIX: 13.0 - fatal - missing inclusion of ajax.lib.php for calling `ajax_autocompleter()` +FIX: #17919 pictures in docs. +FIX: #18006 +FIX: Accountancy - if we define a date start, automatic binding try to continue to solve old binding +FIX: Accoutancy Limit date payment not registered on purchases operations +FIX: Can't edit replacement invoice +FIX: deposit can create credit note in payment conf +FIX: division by zero on create +FIX: holiday: balances not updated correctly with pgsql because of case sensitivity field +FIX: holiday: status filter parameter has been renamed but not in links it was used +FIX: List and Create Companies Left Menus +FIX: method exists +FIX: need to add payment sum to getlibstatus function in object linked block +FIX: permission to close a proposal when using advanced permissions +FIX: Problem of z-index with popup and top menu +FIX: same thing on supplier orders +FIX: Status of invoice when making a replacement invoice +FIX: update contact birthday alert + + ***** ChangeLog for 13.0.3 compared to 13.0.2 ***** FIX: 13.0 warning - missing quotes around 'label' From 284627b693413a8251f11981bd407060b1d162c2 Mon Sep 17 00:00:00 2001 From: trekmorris <78349579+trekmorris@users.noreply.github.com> Date: Fri, 16 Jul 2021 23:55:29 +0800 Subject: [PATCH 016/356] Update opensurvey.lang manually This file is not auto sync from transifex . So update it manually . --- htdocs/langs/zh_TW/opensurvey.lang | 120 ++++++++++++++--------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/htdocs/langs/zh_TW/opensurvey.lang b/htdocs/langs/zh_TW/opensurvey.lang index 51a4283c721..ff927bfc863 100644 --- a/htdocs/langs/zh_TW/opensurvey.lang +++ b/htdocs/langs/zh_TW/opensurvey.lang @@ -1,61 +1,61 @@ # Dolibarr language file - Source file is en_US - opensurvey -Survey=Poll -Surveys=Polls -OrganizeYourMeetingEasily=Organize your meetings and polls easily. First select the type of poll... -NewSurvey=New poll -OpenSurveyArea=Polls area -AddACommentForPoll=You can add a comment into poll... -AddComment=Add comment -CreatePoll=Create poll -PollTitle=Poll title -ToReceiveEMailForEachVote=Receive an email for each vote -TypeDate=Type date -TypeClassic=Type standard -OpenSurveyStep2=Select your dates among the free days (grey). The selected days are green. You can unselect a day previously selected by clicking again on it -RemoveAllDays=Remove all days -CopyHoursOfFirstDay=Copy hours of first day -RemoveAllHours=Remove all hours -SelectedDays=Selected days -TheBestChoice=The best choice currently is -TheBestChoices=The best choices currently are -with=with -OpenSurveyHowTo=If you agree to vote in this poll, you have to give your name, choose the values that fit best for you and validate with the plus button at the end of the line. -CommentsOfVoters=Comments of voters -ConfirmRemovalOfPoll=Are you sure you want to remove this poll (and all votes) -RemovePoll=Remove poll -UrlForSurvey=URL to communicate to get a direct access to poll -PollOnChoice=You are creating a poll to make a multi-choice for a poll. First enter all possible choices for your poll: -CreateSurveyDate=Create a date poll -CreateSurveyStandard=Create a standard poll -CheckBox=Simple checkbox -YesNoList=List (empty/yes/no) -PourContreList=List (empty/for/against) -AddNewColumn=Add new column -TitleChoice=Choice label -ExportSpreadsheet=Export result spreadsheet -ExpireDate=極限日期 -NbOfSurveys=Number of polls -NbOfVoters=No. of voters -SurveyResults=Results -PollAdminDesc=You are allowed to change all vote lines of this poll with button "Edit". You can, as well, remove a column or a line with %s. You can also add a new column with %s. -5MoreChoices=5 more choices -Against=Against -YouAreInivitedToVote=You are invited to vote for this poll -VoteNameAlreadyExists=This name was already used for this poll -AddADate=Add a date -AddStartHour=Add start hour -AddEndHour=Add end hour -votes=vote(s) -NoCommentYet=No comments have been posted for this poll yet -CanComment=Voters can comment in the poll -CanSeeOthersVote=Voters can see other people's vote -SelectDayDesc=For each selected day, you can choose, or not, meeting hours in the following format:
- empty,
- "8h", "8H" or "8:00" to give a meeting's start hour,
- "8-11", "8h-11h", "8H-11H" or "8:00-11:00" to give a meeting's start and end hour,
- "8h15-11h15", "8H15-11H15" or "8:15-11:15" for the same thing but with minutes. -BackToCurrentMonth=Back to current month -ErrorOpenSurveyFillFirstSection=You haven't filled the first section of the poll creation -ErrorOpenSurveyOneChoice=Enter at least one choice -ErrorInsertingComment=There was an error while inserting your comment -MoreChoices=Enter more choices for the voters -SurveyExpiredInfo=The poll has been closed or voting delay has expired. -EmailSomeoneVoted=%s has filled a line.\nYou can find your poll at the link: \n%s -ShowSurvey=Show survey -UserMustBeSameThanUserUsedToVote=You must have voted and use the same user name that the one used to vote, to post a comment +Survey=調查 +Surveys=調查 +OrganizeYourMeetingEasily=輕鬆組織會議和調查。首先選擇調查的類型... +NewSurvey=新調查 +OpenSurveyArea=調查區 +AddACommentForPoll=您可以在調查中加入評論... +AddComment=增加評論 +CreatePoll=建立調查 +PollTitle=調查標題 +ToReceiveEMailForEachVote=每次投票都會收到一封電子郵件 +TypeDate=日期類型 +TypeClassic=標準類型 +OpenSurveyStep2=在空閒日中選擇日期(灰色)。所選的日期為綠色。您可以通過再次點擊來取消先前選擇的日期 +RemoveAllDays=全部刪除 +CopyHoursOfFirstDay=複制第一天的時間 +RemoveAllHours=刪除所有時間 +SelectedDays=已選擇的日子 +TheBestChoice=目前最好的選擇是 +TheBestChoices=目前最好的選擇是 +with=與 +OpenSurveyHowTo=如果您同意在此次調查中投票,則必須給出自己的名字,選擇最適合您的值,並使用該行末尾的加號按鈕進行驗證。 +CommentsOfVoters=投票人的評論 +ConfirmRemovalOfPoll=您確定要刪除此調查(以及所有投票)嗎? +RemovePoll=刪除調查 +UrlForSurvey=調查的直接網址 +PollOnChoice=您正在建立多項選擇的調查。首先為您的調查輸入所有可能的選擇: +CreateSurveyDate=建立日期調查 +CreateSurveyStandard=建立標準調查 +CheckBox=簡易勾選框 +YesNoList=清單(空/是/否) +PourContreList=清單(空/支持/反對) +AddNewColumn=增加新欄位 +TitleChoice=選擇標籤 +ExportSpreadsheet=匯出結果表格 +ExpireDate=調查截止日 +NbOfSurveys=投票次數 +NbOfVoters=投票人數 +SurveyResults=結果 +PollAdminDesc=您可以使用“編輯”按鈕更改此民意調查的所有投票行。您也可以使用%s刪除列或行。您也可以使用%s增加新列。 +5MoreChoices=再多5個選項 +Against=反對 +YouAreInivitedToVote=您被邀請參加此項調查 +VoteNameAlreadyExists=此名稱已用於此調查 +AddADate=增加日期 +AddStartHour=增加開始時間 +AddEndHour=增加結束時間 +votes=投票 +NoCommentYet=尚未有此調查的評論 +CanComment=投票者可以在調查中發表評論 +CanSeeOthersVote=投票者可以看到其他人的投票 +SelectDayDesc=對於每個選定的日期,您可以依照以下格式選擇是否選擇開會時間:
-空的
-“ 8h”,“ 8H”或“ 8:00”指定會議的開始時間,
-“ 8-11”,“ 8h-11h”,“ 8H-11H”或“ 8:00-11:00”給出會議的開始和結束時間,
-同樣的用“ 8h15-11h15”,“ 8H15-11H15”或“ 8:15-11:15”表示,但要加上分鐘。 +BackToCurrentMonth=回到目前月份 +ErrorOpenSurveyFillFirstSection=您尚未填寫建立調查的第一部分 +ErrorOpenSurveyOneChoice=輸入至少一個選項 +ErrorInsertingComment=插入您的評論時出錯 +MoreChoices=為投票者輸入更多選項 +SurveyExpiredInfo=投票已關閉或投票已到期。 +EmailSomeoneVoted=%s已填滿一行。\n您可以在以下連結找到您的調查:\n%s +ShowSurvey=顯示調查 +UserMustBeSameThanUserUsedToVote=您必須已投票並使用與投票時相同的用戶名來發表評論 From b309af0ab8745a77cafb4f92196e32ad4a80ab1b Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 19 Jul 2021 13:43:48 +0200 Subject: [PATCH 017/356] First push new scan quanty inventory --- htdocs/core/class/html.formother.class.php | 17 ++++-- htdocs/langs/en_US/stocks.lang | 4 +- htdocs/product/inventory/inventory.php | 69 ++++++++++++++++++++-- 3 files changed, 79 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 991e3cb37cc..93aee37987f 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -63,7 +63,7 @@ class FormOther * @param string $jstoexecuteonadd Name of javascript function to call * @return string HTML component */ - public function getHTMLScannerForm($jstoexecuteonadd = 'barcodscannerjs') + public function getHTMLScannerForm($jstoexecuteonadd = 'barcodescannerjs') { global $langs; @@ -73,9 +73,9 @@ class FormOther $out .= '
'; $out .= '
Barcode scanner tool...

'; - $out .= ' Autodetect if we scan a product barcode or a lot/serial barcode
'; - $out .= ' Scan a product barcode
'; - $out .= ' Scan a product lot or serial number
'; + $out .= ' Autodetect if we scan a product barcode or a lot/serial barcode
'; + $out .= ' Scan a product barcode
'; + $out .= ' Scan a product lot or serial number
'; $out .= $langs->trans("QtyToAddAfterBarcodeScan").'
'; $out .= ''; @@ -88,7 +88,7 @@ class FormOther */ $out .= '
'; $out .= '
'; - $out .= ''; + $out .= ''; $out .= ''; $out .= '
'; @@ -96,6 +96,13 @@ class FormOther // TODO Add call of javascript $jstoexecuteonadd so each scan will add qty into the inventory page + an ajax save. + $out .= ''; + $out .= '
'; $out .= '
'; diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index efa5257498c..2f6bbafca4c 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -255,4 +255,6 @@ MakeMovementsAndClose=Generate movements and close AutofillWithExpected=Fill real quantity with expected quantity ShowAllBatchByDefault=By default, show batch details on product "stock" tab CollapseBatchDetailHelp=You can set batch detail default display in stocks module configuration -FieldCannotBeNegative=Field "%s" cannot be negative \ No newline at end of file +FieldCannotBeNegative=Field "%s" cannot be negative +ErrorWrongBarcodemode=Unknown Barcode mode +ProductDoesNotExist=Product does not exist diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 85cd0932f46..ffdd26c6803 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -449,7 +449,7 @@ if ($object->id > 0) { print dol_get_fiche_end(); - print '
'; + print ''; print ''; print ''; print ''; @@ -537,6 +537,63 @@ if ($object->id > 0) { // Popup for mass barcode scanning if ($action == 'updatebyscaning') { + print ''; include DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $formother = new FormOther($db); print $formother->getHTMLScannerForm(); @@ -639,15 +696,15 @@ if ($object->id > 0) { } print ''; - print ''; + print ''; print $warehouse_static->getNomUrl(1); print ''; - print ''; + print ''; print $product_static->getNomUrl(1); print ''; if ($conf->productbatch->enabled) { - print ''; + print ''; print $obj->batch; print ''; } @@ -667,6 +724,8 @@ if ($object->id > 0) { print ''; print ''.img_delete().''; print ''; + $qty_tmp = GETPOST("id_".$obj->rowid."_input_tmp") && price2num(GETPOST("id_".$obj->rowid."_input_tmp", 'MS')) >= 0 ? GETPOST("id_".$obj->rowid."_input_tmp") : $qty_view; + print ''; } else { print $obj->qty_view; $totalfound += $obj->qty_view; @@ -685,7 +744,7 @@ if ($object->id > 0) { print ''; if ($object->status == $object::STATUS_VALIDATED) { - print '
'; + print '
'; } print ''; From 8fdd9deb16fec24b8e23450364e90313bd58d31c Mon Sep 17 00:00:00 2001 From: atm-florian Date: Mon, 19 Jul 2021 14:06:56 +0200 Subject: [PATCH 018/356] FIX: datepickers cloned using jquery are not working --- htdocs/fourn/js/lib_dispatch.js.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/js/lib_dispatch.js.php b/htdocs/fourn/js/lib_dispatch.js.php index b4090e8a34d..c6d39038f78 100644 --- a/htdocs/fourn/js/lib_dispatch.js.php +++ b/htdocs/fourn/js/lib_dispatch.js.php @@ -53,7 +53,9 @@ function addDispatchLine(index, type, mode) mode = mode || 'qtymissing' console.log("fourn/js/lib_dispatch.js.php Split line type="+type+" index="+index+" mode="+mode); - var $row = $("tr[name='"+type+'_0_'+index+"']").clone(true); // clone first batch line to jQuery object + var $row0 = $("tr[name='"+type+'_0_'+index+"']"); + var $dpopt = $row0.find('.hasDatepicker').first().datepicker('option', 'all'); // get current datepicker options to apply the same to the cloned datepickers + var $row = $row0.clone(true); // clone first batch line to jQuery object var nbrTrs = $("tr[name^='"+type+"_'][name$='_"+index+"']").length; // position of line for batch var qtyOrdered = parseFloat($("#qty_ordered_0_"+index).val()); // Qty ordered is same for all rows var qty = parseFloat($("#qty_"+(nbrTrs - 1)+"_"+index).val()); @@ -81,6 +83,18 @@ function addDispatchLine(index, type, mode) { //replace tr suffix nbr $row.html($row.html().replace(/_0_/g,"_"+nbrTrs+"_")); + + // jquery's deep clone is incompatible with date pickers (the clone shares data with the original) + // so we destroy and rebuild the new date pickers + setTimeout(() => { + $row.find('.hasDatepicker').each((i, dp) => { + $(dp).removeData() + .removeClass('hasDatepicker'); + $(dp).next('img.ui-datepicker-trigger').remove(); + $(dp).datepicker($dpopt); + }); + }, 0); + //create new select2 to avoid duplicate id of cloned one $row.find("select[name='"+'entrepot_'+nbrTrs+'_'+index+"']").select2(); // TODO find solution to copy selected option to new select From 20f347cd4c69f4a0cb8596235294fa608893d672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josep=20Llu=C3=ADs?= Date: Tue, 20 Jul 2021 07:07:01 +0200 Subject: [PATCH 019/356] Add missing line product variables Add missing line product variables: product_tobatch and product_barcode --- htdocs/fourn/class/fournisseur.commande.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index f315661b90c..e938b729f80 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2021 Josep Lluís Amador * * 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 @@ -460,7 +461,7 @@ class CommandeFournisseur extends CommonOrder $sql .= " l.vat_src_code, l.tva_tx, l.remise_percent, l.subprice,"; $sql .= " l.localtax1_tx, l. localtax2_tx, l.localtax1_type, l. localtax2_type, l.total_localtax1, l.total_localtax2,"; $sql .= " l.total_ht, l.total_tva, l.total_ttc, l.special_code, l.fk_parent_line, l.rang,"; - $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.description as product_desc,"; + $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.description as product_desc, p.tobatch as product_tobatch, p.barcode as product_barcode,"; $sql .= " l.fk_unit,"; $sql .= " l.date_start, l.date_end,"; $sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc'; @@ -516,6 +517,8 @@ class CommandeFournisseur extends CommonOrder $line->libelle = $objp->product_label; // deprecated $line->product_label = $objp->product_label; $line->product_desc = $objp->product_desc; + $line->product_tobatch = $objp->product_tobatch; + $line->product_barcode = $objp->product_barcode; $line->ref = $objp->product_ref; // Ref of product $line->product_ref = $objp->product_ref; // Ref of product From dd9eb282303e97948d2716faafb36dce9418d9fa Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 20 Jul 2021 14:43:36 +0200 Subject: [PATCH 020/356] Barcode scanner tool update --- htdocs/core/class/html.formother.class.php | 4 - htdocs/langs/en_US/stocks.lang | 3 + htdocs/product/inventory/inventory.php | 159 ++++++++++++++------- 3 files changed, 109 insertions(+), 57 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 93aee37987f..5f00ed6877b 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -92,10 +92,6 @@ class FormOther $out .= ''; $out .= '
'; - $out .= ''.$langs->trans("FeatureNotYetAvailable").''; - - // TODO Add call of javascript $jstoexecuteonadd so each scan will add qty into the inventory page + an ajax save. - $out .= ''; + tabproduct.forEach(product => { + if(product.Qty!=0){ + console.log("We change #"+product.Id+"_input to match input in scanner box"); + $("#"+product.Id+"_input")[0].value = product.Qty*barcodeproductqty; + } + }) + document.forms["formrecord"].submit(); + } + }'; + print ''; + } include DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $formother = new FormOther($db); print $formother->getHTMLScannerForm(); } + //Call method to undo changes in real qty + print ''; print '
'; //print '
'; @@ -722,9 +774,10 @@ if ($object->id > 0) { print ''; print ''; print ''; + print '  '; print ''.img_delete().''; print ''; - $qty_tmp = GETPOST("id_".$obj->rowid."_input_tmp") && price2num(GETPOST("id_".$obj->rowid."_input_tmp", 'MS')) >= 0 ? GETPOST("id_".$obj->rowid."_input_tmp") : $qty_view; + $qty_tmp = price2num(GETPOST("id_".$obj->rowid."_input_tmp", 'MS')) >= 0 ? GETPOST("id_".$obj->rowid."_input_tmp") : $qty_view; print ''; } else { print $obj->qty_view; From 60f0eeaea2e6a7e0c52f0a87ea463b2b197feb7e Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 20 Jul 2021 15:06:33 +0200 Subject: [PATCH 021/356] update inventory to be jquerry --- htdocs/product/inventory/inventory.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index a44e004f2e7..01968855836 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -549,17 +549,13 @@ if ($object->id > 0) { var tabproduct = []; $(".expectedqty").each(function(){ id = this.id; - warehouse = $("#"+id+"_warehouse")[0].firstChild.lastChild.data; - - productbarcode = $("#"+id+"_product")[0].firstChild.title; + warehouse = $("#"+id+"_warehouse").children().first().text(); + productbarcode = $("#"+id+"_product").children().first().attr("title"); productbarcode = productbarcode.split("
"); productbarcode = productbarcode.filter(barcode => barcode.includes("'.$langs->trans('BarCode').'"))[0]; productbarcode = productbarcode.slice(productbarcode.indexOf(" ")+5); - productbatchcode = $("#"+id+"_batch")[0].firstChild; - if(productbatchcode != null){ - productbatchcode = productbatchcode.data; - } + productbatchcode = $("#"+id+"_batch").text(); if(barcodemode != "barcodeforproduct"){ tabproduct.forEach(product=>{ if(product.Batch == productbatchcode){ @@ -626,7 +622,7 @@ if ($object->id > 0) { tabproduct.forEach(product => { if(product.Qty!=0){ console.log("We change #"+product.Id+"_input to match input in scanner box"); - $("#"+product.Id+"_input")[0].value = product.Qty*barcodeproductqty; + $("#"+product.Id+"_input").val(product.Qty*barcodeproductqty); } }) document.forms["formrecord"].submit(); From 4d6b63dbed10f3df56ceda40d0a0abf4334b971d Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Tue, 20 Jul 2021 16:14:47 +0200 Subject: [PATCH 022/356] FIX #18181 FIX #18181 --- htdocs/core/class/notify.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 6b32799bc89..044115f1568 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -687,7 +687,7 @@ class Notify break; case 'BILL_PAYED': $link = ''.$newref.''; - $dir_output = $$conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice'); + $dir_output = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice'); $object_type = 'facture'; $mesg = $langs->transnoentitiesnoconv("EMailTextInvoicePayed", $link); break; From 922354f36616288ea69d066206d4c775b4c43e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 20 Jul 2021 18:19:27 +0200 Subject: [PATCH 023/356] Update projects.php --- htdocs/projet/ajax/projects.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/ajax/projects.php b/htdocs/projet/ajax/projects.php index 0036ae64353..a852ab6bad8 100644 --- a/htdocs/projet/ajax/projects.php +++ b/htdocs/projet/ajax/projects.php @@ -63,7 +63,7 @@ if (!GETPOST('mode', 'aZ09') || GETPOST('mode', 'aZ09') != 'gettasks') { // Mode to get list of tasks if (GETPOST('mode', 'aZ09') == 'gettasks') { $formproject = new FormProjets($db); - $formproject->selectTasks((!empty($$socid) ? $socid : -1), 0, 'taskid', 24, 1, '1', 1, 0, 0, 'maxwidth500', GETPOST('projectid', 'int'), ''); + $formproject->selectTasks((!empty($socid) ? $socid : -1), 0, 'taskid', 24, 1, '1', 1, 0, 0, 'maxwidth500', GETPOST('projectid', 'int'), ''); return; } From 71b95f3511af58f340924750a7bc4dced327a577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 20 Jul 2021 20:54:27 +0200 Subject: [PATCH 024/356] fix php8 warnings --- htdocs/core/class/html.form.class.php | 52 ++++++++++++++------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 178404da973..060b98bd156 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4464,7 +4464,7 @@ class Form $sql .= " WHERE 1=1"; if ($status != 2) { $sql .= " AND status = ".(int) $status; - } + }isset($objecttmp->ismultientitymanaged) && if ($filtre) { $sql .= " AND ".$filtre; } @@ -6974,13 +6974,15 @@ class Form // Search data $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX.$objecttmp->table_element." as t"; - if (isset($objecttmp->ismultientitymanaged) && !is_numeric($objecttmp->ismultientitymanaged)) { - $tmparray = explode('@', $objecttmp->ismultientitymanaged); - $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$tmparray[1].' as parenttable ON parenttable.rowid = t.'.$tmparray[0]; - } - if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') { - if (!$user->rights->societe->client->voir && !$user->socid) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (isset($objecttmp->ismultientitymanaged)) { + if (!is_numeric($objecttmp->ismultientitymanaged)) { + $tmparray = explode('@', $objecttmp->ismultientitymanaged); + $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$tmparray[1].' as parenttable ON parenttable.rowid = t.'.$tmparray[0]; + } + if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') { + if (!$user->rights->societe->client->voir && !$user->socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } } } @@ -6991,27 +6993,29 @@ class Form $sql .= $hookmanager->resPrint; } else { $sql .= " WHERE 1=1"; - if (isset($objecttmp->ismultientitymanaged) && $objecttmp->ismultientitymanaged == 1) { - $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; - } - if (isset($objecttmp->ismultientitymanaged) && !is_numeric($objecttmp->ismultientitymanaged)) { - $sql .= ' AND parenttable.entity = t.'.$tmparray[0]; - } - if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { - if ($objecttmp->element == 'societe') { - $sql .= " AND t.rowid = ".$user->socid; - } else { - $sql .= " AND t.fk_soc = ".$user->socid; + if (isset($objecttmp->ismultientitymanaged)) { + if ($objecttmp->ismultientitymanaged == 1) { + $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; + } + if (!is_numeric($objecttmp->ismultientitymanaged)) { + $sql .= ' AND parenttable.entity = t.'.$tmparray[0]; + } + if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { + if ($objecttmp->element == 'societe') { + $sql .= " AND t.rowid = ".$user->socid; + } else { + $sql .= " AND t.fk_soc = ".$user->socid; + } + } + if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') { + if (!$user->rights->societe->client->voir && !$user->socid) { + $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; + } } } if ($searchkey != '') { $sql .= natural_search(explode(',', $fieldstoshow), $searchkey); } - if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') { - if (!$user->rights->societe->client->voir && !$user->socid) { - $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; - } - } if ($objecttmp->filter) { // Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" /*if (! DolibarrApi::_checkFilters($objecttmp->filter)) { From 828e65c7243bb39836317f1230865a5a800be90b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 20 Jul 2021 20:56:01 +0200 Subject: [PATCH 025/356] Update html.form.class.php --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 060b98bd156..25e8c3c8913 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4464,7 +4464,7 @@ class Form $sql .= " WHERE 1=1"; if ($status != 2) { $sql .= " AND status = ".(int) $status; - }isset($objecttmp->ismultientitymanaged) && + } if ($filtre) { $sql .= " AND ".$filtre; } From cea35bd208f6a86da65d82fa014b2c3b480fd800 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Jul 2021 22:14:11 +0200 Subject: [PATCH 026/356] Fix pass was lost on error --- htdocs/install/default.css | 3 +++ htdocs/install/fileconf.php | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/install/default.css b/htdocs/install/default.css index 731ac4131b4..85a2f4703c2 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -415,3 +415,6 @@ a.button:hover { vertical-align: text-bottom; } +.text-security { + -webkit-text-security: disc; +} diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 42c8d3459fe..6a4ddc4b79a 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -476,13 +476,13 @@ if (!empty($force_install_noedit)) { - 0 && !empty($force_install_databaserootlogin)) { print ' disabled'; } ?> @@ -556,10 +556,10 @@ if (!empty($force_install_noedit)) { autocomplete="off" id="db_pass_root" name="db_pass_root" - class="needroot" + class="needroot text-security" value=" Date: Tue, 20 Jul 2021 22:42:23 +0200 Subject: [PATCH 027/356] Fix Improper Authorization Check reported by Ahsan Aziz. --- htdocs/user/card.php | 4 ++-- htdocs/user/class/user.class.php | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 152c39f79ac..996425c0694 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -314,8 +314,8 @@ if (empty($reshook)) { $id = $object->create($user); if ($id > 0) { - if (GETPOST('password')) { - $object->setPassword($user, GETPOST('password')); + if (GETPOST('password', 'none')) { + $object->setPassword($user, GETPOST('password','none')); } if (!empty($conf->categorie->enabled)) { // Categories association diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 74137537e74..6d8ff911feb 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1280,6 +1280,10 @@ class User extends CommonObject $langs->load("errors"); $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")); return -1; + } elseif (preg_match('/[,@<>"\']/', $this->login)) { + $langs->load("errors"); + $this->error = $langs->trans("ErrorBadCharIntoLoginName"); + return -1; } $this->datec = dol_now(); @@ -1669,6 +1673,10 @@ class User extends CommonObject $langs->load("errors"); $this->error = $langs->trans("ErrorFieldRequired", 'Login'); return -1; + } elseif (preg_match('/[,@<>"\']/', $this->login)) { + $langs->load("errors"); + $this->error = $langs->trans("ErrorBadCharIntoLoginName"); + return -1; } $this->db->begin(); From e25171b9f545a8044dc462b66306380cc028e0fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Jul 2021 23:03:19 +0200 Subject: [PATCH 028/356] Fix phpcs --- htdocs/install/fileconf.php | 2 +- htdocs/user/card.php | 2 +- htdocs/user/class/user.class.php | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 6a4ddc4b79a..369d2b93605 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -559,7 +559,7 @@ if (!empty($force_install_noedit)) { class="needroot text-security" value="create($user); if ($id > 0) { if (GETPOST('password', 'none')) { - $object->setPassword($user, GETPOST('password','none')); + $object->setPassword($user, GETPOST('password', 'none')); } if (!empty($conf->categorie->enabled)) { // Categories association diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 6d8ff911feb..b1bc23463fb 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1281,9 +1281,9 @@ class User extends CommonObject $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")); return -1; } elseif (preg_match('/[,@<>"\']/', $this->login)) { - $langs->load("errors"); - $this->error = $langs->trans("ErrorBadCharIntoLoginName"); - return -1; + $langs->load("errors"); + $this->error = $langs->trans("ErrorBadCharIntoLoginName"); + return -1; } $this->datec = dol_now(); @@ -1674,9 +1674,9 @@ class User extends CommonObject $this->error = $langs->trans("ErrorFieldRequired", 'Login'); return -1; } elseif (preg_match('/[,@<>"\']/', $this->login)) { - $langs->load("errors"); - $this->error = $langs->trans("ErrorBadCharIntoLoginName"); - return -1; + $langs->load("errors"); + $this->error = $langs->trans("ErrorBadCharIntoLoginName"); + return -1; } $this->db->begin(); From 0e18bd4be1c8debf3482a723b14c70442d564802 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Jul 2021 23:15:31 +0200 Subject: [PATCH 029/356] Fix #hunter2cd3fc73-65a1-4615-9143-9e7febd81a15 --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 99cfe360f9f..4dff3426ac9 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -461,7 +461,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->gl // Array of action code where CSRFCHECK with token will be forced (so token must be provided on url request) $arrayofactiontoforcetokencheck = array( 'activate', 'add', 'addtimespent', 'update', 'install', - 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_purge', 'confirm_reject_check', + 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_purge', 'confirm_reject_check', 'confirm_deletedir', 'delete', 'deletefilter', 'deleteoperation', 'deleteprof', 'deletepayment', 'disable', 'doprev', 'donext', 'dvprev', 'dvnext', 'enable', 'setpricelevel' From 08e06f9789e9a550bc79f6bbbbd6230da20fd28f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Jul 2021 23:28:57 +0200 Subject: [PATCH 030/356] Fix #hunter2c606116-f212-49e0-967c-11f8666be43b --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 4dff3426ac9..2bd3f3192e5 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -461,7 +461,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->gl // Array of action code where CSRFCHECK with token will be forced (so token must be provided on url request) $arrayofactiontoforcetokencheck = array( 'activate', 'add', 'addtimespent', 'update', 'install', - 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_purge', 'confirm_reject_check', 'confirm_deletedir', + 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_purge', 'confirm_reject_check', 'confirm_delete', 'confirm_deletedir', 'delete', 'deletefilter', 'deleteoperation', 'deleteprof', 'deletepayment', 'disable', 'doprev', 'donext', 'dvprev', 'dvnext', 'enable', 'setpricelevel' From dc7ff07517ce9d165afed9e74f876bc684ea4042 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Jul 2021 23:54:22 +0200 Subject: [PATCH 031/356] Fix #huntr7144bb4b-338f-45f0-a70e-088ef1f4c037 --- htdocs/langs/en_US/main.lang | 3 ++- htdocs/main.inc.php | 14 +++++++++----- htdocs/user/card.php | 4 ++-- htdocs/user/group/perms.php | 12 ++++++------ 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 94c851bf346..ddd60a9b68e 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1137,4 +1137,5 @@ CopiedToClipboard=Copied to clipboard InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into consideration. ConfirmCancel=Are you sure you want to cancel EmailMsgID=Email MsgID -Forthcoming=Forthcoming \ No newline at end of file +Forthcoming=Forthcoming +Currently=Currently \ No newline at end of file diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 4dff3426ac9..2bd95197a2a 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -460,11 +460,15 @@ if (!defined('NOTOKENRENEWAL')) { if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) || defined('CSRFCHECK_WITH_TOKEN')) { // Array of action code where CSRFCHECK with token will be forced (so token must be provided on url request) $arrayofactiontoforcetokencheck = array( - 'activate', 'add', 'addtimespent', 'update', 'install', - 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_purge', 'confirm_reject_check', 'confirm_deletedir', - 'delete', 'deletefilter', 'deleteoperation', 'deleteprof', 'deletepayment', 'disable', - 'doprev', 'donext', 'dvprev', 'dvnext', - 'enable', 'setpricelevel' + 'activate', 'add', 'addrights', 'addtimespent', + 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_purge', 'confirm_reject_check', 'confirm_deletedir', + 'delete', 'deletefilter', 'deleteoperation', 'deleteprof', 'deletepayment', 'delrights', + 'disable', + 'doprev', 'donext', 'dvprev', 'dvnext', + 'enable', + 'install', + 'setpricelevel', + 'update' ); $sensitiveget = false; if (in_array(GETPOST('action', 'aZ09'), $arrayofactiontoforcetokencheck)) { diff --git a/htdocs/user/card.php b/htdocs/user/card.php index c74a6fa729c..cb7aa69949c 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1437,7 +1437,7 @@ if ($action == 'create' || $action == 'adduserldap') { } // Employee - print ''.$langs->trans("Employee").''; + print ''.$langs->trans("Employee").''; print 'employee ? ' checked="checked"' : '').'>'; //print yn($object->employee); print ''."\n"; @@ -1803,7 +1803,7 @@ if ($action == 'create' || $action == 'adduserldap') { print dol_print_date($object->datepreviouslogin, "dayhour").' ('.$langs->trans("Previous").'), '; } if ($object->datelastlogin) { - print dol_print_date($object->datelastlogin, "dayhour").' ('.$langs->trans("Current").')'; + print dol_print_date($object->datelastlogin, "dayhour").' ('.$langs->trans("Currently").')'; } print ''; print "\n"; diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 618d705bfcf..9fc4426ecac 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -235,9 +235,9 @@ if ($object->id > 0) { print ''.$langs->trans("Module").''; if ($caneditperms) { print ''; - print ''.$langs->trans("All").""; + print ''.$langs->trans("All").""; print '/'; - print ''.$langs->trans("None").""; + print ''.$langs->trans("None").""; print ''; } print ' '; @@ -286,9 +286,9 @@ if ($object->id > 0) { print ''; if ($caneditperms) { print ''; - print 'module.'">'.$langs->trans("All").""; + print 'module.'&token='.newToken().'">'.$langs->trans("All").""; print '/'; - print 'module.'">'.$langs->trans("None").""; + print 'module.'&token='.newToken().'">'.$langs->trans("None").""; print ''; } else { print ' '; @@ -326,7 +326,7 @@ if ($object->id > 0) { } else { // Do not own permission if ($caneditperms) { - print 'id.'">'; + print 'id.'&token='.newToken().'">'; //print img_edit_add($langs->trans("Add")); print img_picto($langs->trans("Add"), 'switch_off'); print ''; @@ -336,7 +336,7 @@ if ($object->id > 0) { } else { // Do not own permission if ($caneditperms) { - print 'id.'">'; + print 'id.'&token='.newToken().'">'; //print img_edit_add($langs->trans("Add")); print img_picto($langs->trans("Add"), 'switch_off'); print ''; From c2f1781fae61f105632bd7f0dd0343f8dc95738b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Jul 2021 00:14:03 +0200 Subject: [PATCH 032/356] Fix #huntr5bb5a52-3b1c-40ad-9c64-61735f886736 --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2bd95197a2a..d1423009c44 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -461,7 +461,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->gl // Array of action code where CSRFCHECK with token will be forced (so token must be provided on url request) $arrayofactiontoforcetokencheck = array( 'activate', 'add', 'addrights', 'addtimespent', - 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_purge', 'confirm_reject_check', 'confirm_deletedir', + 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_purge', 'confirm_reject_check', 'confirm_deletedir', 'confirm_deletefile', 'delete', 'deletefilter', 'deleteoperation', 'deleteprof', 'deletepayment', 'delrights', 'disable', 'doprev', 'donext', 'dvprev', 'dvnext', From e4bb5ed00877849b24e7d657e7ec4dd05d72be2a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Jul 2021 00:35:08 +0200 Subject: [PATCH 033/356] Fix phpcs --- htdocs/install/fileconf.php | 2 +- htdocs/main.inc.php | 18 +++++++++--------- htdocs/user/class/user.class.php | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 369d2b93605..42ea5e423af 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -559,7 +559,7 @@ if (!empty($force_install_noedit)) { class="needroot text-security" value="global->MAIN_SECURITY_CSRF_WITH_TOKEN)) || defined('CSRFCHECK_WITH_TOKEN')) { // Array of action code where CSRFCHECK with token will be forced (so token must be provided on url request) $arrayofactiontoforcetokencheck = array( - 'activate', 'add', 'addrights', 'addtimespent', - 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_purge', 'confirm_reject_check', 'confirm_deletedir', 'confirm_deletefile', - 'delete', 'deletefilter', 'deleteoperation', 'deleteprof', 'deletepayment', 'delrights', - 'disable', - 'doprev', 'donext', 'dvprev', 'dvnext', - 'enable', - 'install', - 'setpricelevel', - 'update' + 'activate', 'add', 'addrights', 'addtimespent', + 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_purge', 'confirm_reject_check', 'confirm_deletedir', 'confirm_deletefile', + 'delete', 'deletefilter', 'deleteoperation', 'deleteprof', 'deletepayment', 'delrights', + 'disable', + 'doprev', 'donext', 'dvprev', 'dvnext', + 'enable', + 'install', + 'setpricelevel', + 'update' ); $sensitiveget = false; if (in_array(GETPOST('action', 'aZ09'), $arrayofactiontoforcetokencheck)) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index b1bc23463fb..816d3dc3e27 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1281,9 +1281,9 @@ class User extends CommonObject $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")); return -1; } elseif (preg_match('/[,@<>"\']/', $this->login)) { - $langs->load("errors"); - $this->error = $langs->trans("ErrorBadCharIntoLoginName"); - return -1; + $langs->load("errors"); + $this->error = $langs->trans("ErrorBadCharIntoLoginName"); + return -1; } $this->datec = dol_now(); @@ -1674,9 +1674,9 @@ class User extends CommonObject $this->error = $langs->trans("ErrorFieldRequired", 'Login'); return -1; } elseif (preg_match('/[,@<>"\']/', $this->login)) { - $langs->load("errors"); - $this->error = $langs->trans("ErrorBadCharIntoLoginName"); - return -1; + $langs->load("errors"); + $this->error = $langs->trans("ErrorBadCharIntoLoginName"); + return -1; } $this->db->begin(); From dbed6bc0da64d23df249189b27d20e7a63d56ad4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Jul 2021 01:18:48 +0200 Subject: [PATCH 034/356] Fix #yogosha6678 --- htdocs/install/check.php | 2 +- htdocs/main.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 35efe1f36b2..99e9e38c958 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -100,7 +100,7 @@ print "
\n"; // Check PHP support for $_GET and $_POST if (!isset($_GET["testget"]) && !isset($_POST["testpost"])) { // We must keep $_GET and $_POST here print 'Warning '.$langs->trans("PHPSupportPOSTGETKo"); - print ' ('.$langs->trans("Recheck").')'; + print ' ('.$langs->trans("Recheck").')'; print "
\n"; $checksok = 0; } else { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index a30f02f7fba..cc9ff9e6297 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -80,7 +80,7 @@ function realCharForNumericEntities($matches) * Warning: Such a protection can't be enough. It is not reliable as it will always be possible to bypass this. Good protection can * only be guaranted by escaping data during output. * - * @param string $val Value brut found int $_GET, $_POST or PHP_SELF + * @param string $val Brut value found into $_GET, $_POST or PHP_SELF * @param string $type 0=POST, 1=GET, 2=PHP_SELF, 3=GET without sql reserved keywords (the less tolerant test) * @return int >0 if there is an injection, 0 if none */ From 23f708c0d4e39341cac703e3710330cca3364148 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Jul 2021 01:27:14 +0200 Subject: [PATCH 035/356] Fix phpcs --- htdocs/main.inc.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index cc9ff9e6297..2ceb2175799 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -460,15 +460,15 @@ if (!defined('NOTOKENRENEWAL')) { if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) || defined('CSRFCHECK_WITH_TOKEN')) { // Array of action code where CSRFCHECK with token will be forced (so token must be provided on url request) $arrayofactiontoforcetokencheck = array( - 'activate', 'add', 'addrights', 'addtimespent', - 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_purge', 'confirm_reject_check', 'confirm_deletedir', 'confirm_deletefile', - 'delete', 'deletefilter', 'deleteoperation', 'deleteprof', 'deletepayment', 'delrights', - 'disable', - 'doprev', 'donext', 'dvprev', 'dvnext', - 'enable', - 'install', - 'setpricelevel', - 'update' + 'activate', 'add', 'addrights', 'addtimespent', + 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_purge', 'confirm_reject_check', 'confirm_deletedir', 'confirm_deletefile', + 'delete', 'deletefilter', 'deleteoperation', 'deleteprof', 'deletepayment', 'delrights', + 'disable', + 'doprev', 'donext', 'dvprev', 'dvnext', + 'enable', + 'install', + 'setpricelevel', + 'update' ); $sensitiveget = false; if (in_array(GETPOST('action', 'aZ09'), $arrayofactiontoforcetokencheck)) { From 062c39c40da01cf1a69be2f1c4212df6a459f0b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Jul 2021 01:40:45 +0200 Subject: [PATCH 036/356] Fix html entities when we should not --- htdocs/comm/action/class/actioncomm.class.php | 2 +- htdocs/core/js/lib_notification.js.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 7fd294b89b2..c6c0d277edd 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2340,7 +2340,7 @@ class ActionComm extends CommonObject $sendContent = make_substitutions($langs->trans($arraymessage->content), $substitutionarray); //Topic - $sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->trans('EventReminder')); + $sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->transnoentities('EventReminder')); // Recipient $recipient = new User($this->db); diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index 616463b944d..ee41555119a 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -131,8 +131,8 @@ function check_events() { if (value.type == 'agenda') { - url = '' + value.id_agenda; - title = 'trans('EventReminder')) ?>'; + url = '' + value.id_agenda; + title = 'transnoentities('EventReminder')) ?>'; } var extra = { icon: '', From f2dc3be051c9fc07b08d6b56a3a33c550d2bb2ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 21 Jul 2021 08:40:07 +0200 Subject: [PATCH 037/356] add categories tickets migration --- htdocs/install/check.php | 42 ++++++++++--------- .../install/mysql/migration/14.0.0-15.0.0.sql | 15 ++++++- 2 files changed, 36 insertions(+), 21 deletions(-) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 35efe1f36b2..6c339b4e202 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -411,26 +411,28 @@ if (!file_exists($conffile)) { if (GETPOST('allowupgrade')) { $allowupgrade = true; } - $migrationscript = array(array('from'=>'3.0.0', 'to'=>'3.1.0'), - array('from'=>'3.1.0', 'to'=>'3.2.0'), - array('from'=>'3.2.0', 'to'=>'3.3.0'), - array('from'=>'3.3.0', 'to'=>'3.4.0'), - array('from'=>'3.4.0', 'to'=>'3.5.0'), - array('from'=>'3.5.0', 'to'=>'3.6.0'), - array('from'=>'3.6.0', 'to'=>'3.7.0'), - array('from'=>'3.7.0', 'to'=>'3.8.0'), - array('from'=>'3.8.0', 'to'=>'3.9.0'), - array('from'=>'3.9.0', 'to'=>'4.0.0'), - array('from'=>'4.0.0', 'to'=>'5.0.0'), - array('from'=>'5.0.0', 'to'=>'6.0.0'), - array('from'=>'6.0.0', 'to'=>'7.0.0'), - array('from'=>'7.0.0', 'to'=>'8.0.0'), - array('from'=>'8.0.0', 'to'=>'9.0.0'), - array('from'=>'9.0.0', 'to'=>'10.0.0'), - array('from'=>'10.0.0', 'to'=>'11.0.0'), - array('from'=>'11.0.0', 'to'=>'12.0.0'), - array('from'=>'12.0.0', 'to'=>'13.0.0'), - array('from'=>'13.0.0', 'to'=>'14.0.0') + $migrationscript = array( + array('from'=>'3.0.0', 'to'=>'3.1.0'), + array('from'=>'3.1.0', 'to'=>'3.2.0'), + array('from'=>'3.2.0', 'to'=>'3.3.0'), + array('from'=>'3.3.0', 'to'=>'3.4.0'), + array('from'=>'3.4.0', 'to'=>'3.5.0'), + array('from'=>'3.5.0', 'to'=>'3.6.0'), + array('from'=>'3.6.0', 'to'=>'3.7.0'), + array('from'=>'3.7.0', 'to'=>'3.8.0'), + array('from'=>'3.8.0', 'to'=>'3.9.0'), + array('from'=>'3.9.0', 'to'=>'4.0.0'), + array('from'=>'4.0.0', 'to'=>'5.0.0'), + array('from'=>'5.0.0', 'to'=>'6.0.0'), + array('from'=>'6.0.0', 'to'=>'7.0.0'), + array('from'=>'7.0.0', 'to'=>'8.0.0'), + array('from'=>'8.0.0', 'to'=>'9.0.0'), + array('from'=>'9.0.0', 'to'=>'10.0.0'), + array('from'=>'10.0.0', 'to'=>'11.0.0'), + array('from'=>'11.0.0', 'to'=>'12.0.0'), + array('from'=>'12.0.0', 'to'=>'13.0.0'), + array('from'=>'13.0.0', 'to'=>'14.0.0'), + array('from'=>'14.0.0', 'to'=>'15.0.0'), ); $count = 0; diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 95de2ab7ba6..6652fb5dbf5 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -26,7 +26,7 @@ -- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; -- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; -- Note: fields with type BLOB/TEXT can't have default value. --- To rebuild sequence for postgresql after insert by forcing id autoincrement fields: +-- To rebuild sequence for postgresql after insert by forcing id autoincrement fields: -- -- VPGSQL8.2 SELECT dol_util_rebuild_sequences(); @@ -37,3 +37,16 @@ -- v15 +CREATE TABLE llx_categorie_ticket +( + fk_categorie integer NOT NULL, + fk_ticket integer NOT NULL, + import_key varchar(14) +) ENGINE=innodb; + +ALTER TABLE llx_categorie_ticket ADD PRIMARY KEY pk_categorie_ticket (fk_categorie, fk_ticket); +ALTER TABLE llx_categorie_ticket ADD INDEX idx_categorie_ticket_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_ticket ADD INDEX idx_categorie_ticket_fk_ticket (fk_ticket); + +ALTER TABLE llx_categorie_ticket ADD CONSTRAINT fk_categorie_ticket_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_ticket ADD CONSTRAINT fk_categorie_ticket_ticket_rowid FOREIGN KEY (fk_ticket) REFERENCES llx_ticket (rowid); From ee1e6c27804f0c0d9eeda7e965ecd6909c95fd3e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 21 Jul 2021 14:52:37 +0200 Subject: [PATCH 038/356] fix: bad setEventMessages input --- htdocs/product/stock/massstockmove.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 4e35d3832e5..6ea1e179a66 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -209,7 +209,7 @@ if ($action == 'createmovements') if ($result1 < 0) { $error++; - setEventMessages($product->errors, $product->errorss, 'errors'); + setEventMessages($product->error, $product->errors, 'errors'); } // Add stock @@ -225,7 +225,7 @@ if ($action == 'createmovements') if ($result2 < 0) { $error++; - setEventMessages($product->errors, $product->errorss, 'errors'); + setEventMessages($product->error, $product->errors, 'errors'); } } else { $arraybatchinfo = $product->loadBatchInfo($batch); @@ -256,7 +256,7 @@ if ($action == 'createmovements') if ($result1 < 0) { $error++; - setEventMessages($product->errors, $product->errorss, 'errors'); + setEventMessages($product->error, $product->errors, 'errors'); } // Add stock @@ -275,7 +275,7 @@ if ($action == 'createmovements') if ($result2 < 0) { $error++; - setEventMessages($product->errors, $product->errorss, 'errors'); + setEventMessages($product->error, $product->errors, 'errors'); } } } else { From 8eafbf9101236f50fd672b43e3d8f1b7649ff090 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 21 Jul 2021 17:00:57 +0200 Subject: [PATCH 039/356] add column into export invoice --- htdocs/core/modules/modFacture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 475c8fc5996..bb044900acd 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -273,7 +273,7 @@ class modFacture extends DolibarrModules $this->export_TypeFields_array[$r] = array( 's.rowid'=>'Numeric', 's.nom'=>'Text', 'ps.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text', - 'f.rowid'=>'Numeric', 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date", + 'f.rowid'=>'Numeric', 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date", 'f.fk_mode_reglement'=>'Numeric', 'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric', 'f.close_code'=>'Text', 'f.close_note'=>'Text', 'none.rest'=>"NumericCompute", 'f.note_private'=>"Text", 'f.note_public'=>"Text", 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text', From 5e6c942caf7592e6ab8a15d5995ecf88278ab797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 22 Jul 2021 09:22:42 +0200 Subject: [PATCH 040/356] notify class indent --- htdocs/core/class/notify.class.php | 20 +++++++++---------- ..._50_modNotification_Notification.class.php | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 6b32799bc89..a3bc85cb4e1 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -65,7 +65,7 @@ class Notify // Les codes actions sont definis dans la table llx_notify_def // codes actions supported are - // @todo defined also into interface_50_modNotificiation_Notificiation.class.php + // @todo defined also into interface_50_modNotificiation_Notification.class.php public $arrayofnotifsupported = array( 'BILL_VALIDATE', 'BILL_PAYED', @@ -80,8 +80,8 @@ class Notify 'SHIPPING_VALIDATE', 'EXPENSE_REPORT_VALIDATE', 'EXPENSE_REPORT_APPROVE', - 'HOLIDAY_VALIDATE', - 'HOLIDAY_APPROVE', + 'HOLIDAY_VALIDATE', + 'HOLIDAY_APPROVE', 'ACTION_CREATE' ); @@ -546,7 +546,7 @@ class Notify $object_type = 'holiday'; $labeltouse = $conf->global->HOLIDAY_APPROVE_TEMPLATE; $mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayApproved", $link); - break; + break; case 'ACTION_CREATE': $link = ''.$newref.''; $dir_output = $conf->agenda->dir_output; @@ -567,10 +567,10 @@ class Notify $subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs); $message = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs); } else { - $message = $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification", $application, $mysoc->name)."\n"; - $message .= $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n"; - $message .= "\n"; - $message .= $mesg; + $message = $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification", $application, $mysoc->name)."\n"; + $message .= $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n"; + $message .= "\n"; + $message .= $mesg; } $ref = dol_sanitizeFileName($newref); @@ -687,7 +687,7 @@ class Notify break; case 'BILL_PAYED': $link = ''.$newref.''; - $dir_output = $$conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice'); + $dir_output = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice'); $object_type = 'facture'; $mesg = $langs->transnoentitiesnoconv("EMailTextInvoicePayed", $link); break; @@ -782,7 +782,7 @@ class Notify $dir_output = $conf->holiday->dir_output; $object_type = 'holiday'; $mesg = $langs->transnoentitiesnoconv("EMailTextHolidayApproved", $link); - break; + break; case 'ACTION_CREATE': $link = ''.$newref.''; $dir_output = $conf->agenda->dir_output; diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index 7d315f142a7..e2b359809dd 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceNotification extends DolibarrTriggers { - // @todo Defined also into notify.class.php) + // @todo Defined also into notify.class.php public $listofmanagedevents = array( 'BILL_VALIDATE', 'BILL_PAYED', From 44fa70c7c742fec714a6917c7cfa1b51143496df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 22 Jul 2021 09:24:14 +0200 Subject: [PATCH 041/356] notify class indent --- htdocs/core/class/notify.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index a3bc85cb4e1..2e0a71460ba 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -65,7 +65,7 @@ class Notify // Les codes actions sont definis dans la table llx_notify_def // codes actions supported are - // @todo defined also into interface_50_modNotificiation_Notification.class.php + // @todo defined also into interface_50_modNotification_Notification.class.php public $arrayofnotifsupported = array( 'BILL_VALIDATE', 'BILL_PAYED', From 6cfd8c6f24392093da804f44799852be3b63ebd2 Mon Sep 17 00:00:00 2001 From: netdrag Date: Thu, 22 Jul 2021 18:38:22 +0200 Subject: [PATCH 042/356] Order Supplier Email Sender Extension Extended the advanced options to specify an email address for the order supplier. Useful if you operate under a brand, but order under a different. --- htdocs/core/tpl/card_presend.tpl.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index c741fb213c2..2c7af954892 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -137,7 +137,14 @@ if ($action == 'presend') { $formmail->fromname = ''; $formmail->fromtype = 'special'; } + if ($object->element === 'order_supplier' && !empty($conf->global->ORDER_SUPPLIER_EMAIL_SENDER)) { + $formmail->frommail = $conf->global->ORDER_SUPPLIER_EMAIL_SENDER; + $formmail->fromname = ''; + $formmail->fromtype = 'special'; + } + + $formmail->trackid = $trackid; if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) { // If bit 2 is set include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; From 4c505619e3b4779ab3f222c308596906638e65eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Jul 2021 00:02:14 +0200 Subject: [PATCH 043/356] FIX look and field v14 --- htdocs/contrat/card.php | 13 ++- htdocs/core/lib/company.lib.php | 17 ++-- .../modules/barcode/modules_barcode.class.php | 2 +- .../product/mod_codeproduct_elephant.php | 2 +- .../modules/product/modules_product.class.php | 3 +- .../modules/societe/modules_societe.class.php | 3 +- htdocs/holiday/class/holiday.class.php | 6 +- htdocs/holiday/list.php | 10 +- .../modulebuilder/template/myobject_list.php | 17 ++-- htdocs/product/admin/product.php | 17 +++- .../class/recruitmentjobposition.class.php | 6 +- .../recruitmentjobposition_list.php | 96 +++++++++++++------ htdocs/ticket/list.php | 2 +- 13 files changed, 122 insertions(+), 72 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 32edf9a1558..d5187c6a040 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1003,7 +1003,7 @@ if ($action == 'create') { $soc->fetch($socid); } - if (GETPOST('origin') && GETPOST('originid')) { + if (GETPOST('origin') && GETPOST('originid', 'int')) { // Parse element/subelement (ex: project_task) $regs = array(); $element = $subelement = GETPOST('origin'); @@ -1013,7 +1013,7 @@ if ($action == 'create') { } if ($element == 'project') { - $projectid = GETPOST('originid'); + $projectid = GETPOST('originid', 'int'); } else { // For compatibility if ($element == 'order' || $element == 'commande') { @@ -1094,7 +1094,8 @@ if ($action == 'create') { print ''; } else { print ''; - print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300'); + print img_picto('', 'company', 'class="pictofixedwidth"'); + print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500'); print ' '; print ''; } @@ -1121,11 +1122,13 @@ if ($action == 'create') { // Commercial suivi print ''.$langs->trans("TypeContact_contrat_internal_SALESREPFOLL").''; + print img_picto('', 'user', 'class="pictofixedwidth"'); print $form->select_dolusers(GETPOST("commercial_suivi_id") ?GETPOST("commercial_suivi_id") : $user->id, 'commercial_suivi_id', 1, ''); print ''; // Commercial signature print ''.$langs->trans("TypeContact_contrat_internal_SALESREPSIGN").''; + print img_picto('', 'user', 'class="pictofixedwidth"'); print $form->select_dolusers(GETPOST("commercial_signature_id") ?GETPOST("commercial_signature_id") : $user->id, 'commercial_signature_id', 1, ''); print ''; @@ -1686,7 +1689,7 @@ if ($action == 'create') { $colspan++; } - // Ligne dates prevues + // Line dates planed print ''; print ''; print $langs->trans("DateStartPlanned").' '; @@ -1786,7 +1789,7 @@ if ($action == 'create') { print ''; print ''; - print ''; + print ''; print ''; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php index e0141348568..fef12717e3b 100644 --- a/htdocs/core/modules/product/modules_product.class.php +++ b/htdocs/core/modules/product/modules_product.class.php @@ -193,7 +193,8 @@ abstract class ModeleProductCode { global $conf; - $langs->load("admin"); + $langs->loadLangs(array("admin", "companies")); + $strikestart = ''; $strikeend = ''; if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) { diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php index 28d0120da72..09f6cb9c29d 100644 --- a/htdocs/core/modules/societe/modules_societe.class.php +++ b/htdocs/core/modules/societe/modules_societe.class.php @@ -198,7 +198,8 @@ abstract class ModeleThirdPartyCode { global $conf; - $langs->load("admin"); + $langs->loadLangs(array("admin", "companies")); + $strikestart = ''; $strikeend = ''; if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) { diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 82229198185..1513eb6ea96 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1296,11 +1296,11 @@ class Holiday extends CommonObject * * @param int $selected Id of preselected status * @param string $htmlname Name of HTML select field + * @param string $morecss More CSS on select component * @return string Show select of status */ - public function selectStatutCP($selected = '', $htmlname = 'select_statut') + public function selectStatutCP($selected = '', $htmlname = 'select_statut', $morecss = 'minwidth125') { - global $langs; // Liste des statuts @@ -1308,7 +1308,7 @@ class Holiday extends CommonObject $nb = count($name) + 1; // Select HTML - $out = ''."\n"; $out .= ''."\n"; // Boucle des statuts diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index ab57a497e8e..e7a09abea6e 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -636,7 +636,7 @@ if ($resql) { // Create date if (!empty($arrayfields['cp.date_create']['checked'])) { - print ''; @@ -644,7 +644,7 @@ if ($resql) { // Create date if (!empty($arrayfields['cp.tms']['checked'])) { - print ''; @@ -652,8 +652,8 @@ if ($resql) { // Status if (!empty($arrayfields['cp.statut']['checked'])) { - print ''; } @@ -781,7 +781,7 @@ if ($resql) { } } if (!empty($arrayfields['cp.fk_type']['checked'])) { - print ''; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 4633a69e6dd..1e319e18ec2 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -327,22 +327,21 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $objec $sql .= $hookmanager->resPrint; /* If a group by is required -$sql.= " GROUP BY "; -foreach($object->fields as $key => $val) -{ - $sql.='t.'.$key.', '; +$sql .= " GROUP BY "; +foreach($object->fields as $key => $val) { + $sql .= 't.'.$key.', '; } // Add fields from extrafields -if (! empty($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); } } // Add where from hooks -$parameters=array(); -$reshook=$hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook -$sql.=$hookmanager->resPrint; -$sql=preg_replace('/,\s*$/','', $sql); +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; +$sql = preg_replace('/,\s*$/', '', $sql); */ $sql .= $db->order($sortfield, $sortorder); diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 5a83c685e0f..fa75a20277f 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -295,13 +295,14 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); print load_fiche_titre($langs->trans("ProductCodeChecker"), '', ''); +print '
'; print '
'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline - 1]->getLibStatut(4).''.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline - 1]->getLibStatut(4).''; if ($user->socid == 0) { if ($object->statut > 0 && $action != 'activateline' && $action != 'unactivateline') { diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index cb710c19875..7d261f2d5ab 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1948,7 +1948,9 @@ function show_subsidiaries($conf, $langs, $db, $object) $socstatic = new Societe($db); print load_fiche_titre($langs->trans("Subsidiaries"), '', ''); - print "\n".''."\n"; + + print "\n".'
'."\n"; + print '
'."\n"; print ''; print ''; @@ -1976,17 +1978,17 @@ function show_subsidiaries($conf, $langs, $db, $object) print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; @@ -1994,6 +1996,7 @@ function show_subsidiaries($conf, $langs, $db, $object) $i++; } print "\n
'.$langs->trans("Company").''.$langs->trans("Address").''.$langs->trans("Zip").'
'; + print ''; print $socstatic->getNomUrl(1); print ''.$obj->address.''.$obj->zip.''.$obj->town.''.$obj->code_client.''.dol_escape_htmltag($obj->address).''.$obj->zip.''.$obj->town.''.$obj->code_client.''; - print ''; + print ''; print img_edit(); print '
\n"; + print ''."\n"; } print "
\n"; diff --git a/htdocs/core/modules/barcode/modules_barcode.class.php b/htdocs/core/modules/barcode/modules_barcode.class.php index 99fc8ed366d..01a00405452 100644 --- a/htdocs/core/modules/barcode/modules_barcode.class.php +++ b/htdocs/core/modules/barcode/modules_barcode.class.php @@ -138,7 +138,7 @@ abstract class ModeleNumRefBarCode { global $conf; - $langs->load("admin"); + $langs->loadLangs(array("admin", "companies")); $s = ''; $s .= $langs->trans("Name").': '.$this->name.'
'; diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index 5936476e079..0b03bd9b6a4 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -118,7 +118,7 @@ class mod_codeproduct_elephant extends ModeleProductCode $texte .= '
'.$langs->trans("Mask").' ('.$langs->trans("ProductCodeModel").'):'.$form->textwithpicto('', $tooltip, 1, 1).'   
'; + print ''; print ''; $formother->select_year($search_year_create, 'search_year_create', 1, $min_year, 0); print ''; + print ''; print ''; $formother->select_year($search_year_update, 'search_year_update', 1, $min_year, 0); print ''; - $object->selectStatutCP($search_status, 'search_status'); + print ''; + $object->selectStatutCP($search_status, 'search_status', 'minwidth125'); print ''; + print ''; $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); print empty($typeleaves[$obj->fk_type]['label']) ? $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type) : $labeltypeleavetoshow; print '
'."\n"; print ''."\n"; print ' '; print ' '; print ' '; print ' '; -print ' '; +print ' '; print "\n"; foreach ($dirproduct as $dirroot) { @@ -333,7 +334,7 @@ foreach ($dirproduct as $dirroot) { print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; + print ''."\n"; if (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) && $conf->global->PRODUCT_CODEPRODUCT_ADDON == $file) { print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'.$modCodeProduct->name.''.$modCodeProduct->info($langs).''.$modCodeProduct->getExample($langs).''.$modCodeProduct->getExample($langs).''."\n"; @@ -366,6 +367,7 @@ foreach ($dirproduct as $dirroot) { } } print '
'; +print '
'; // Module to build doc $def = array(); @@ -390,13 +392,14 @@ print '
'; print load_fiche_titre($langs->trans("ProductDocumentTemplates"), '', ''); +print '
'; print ''; print ''; print ''; print ''; print '\n"; print '\n"; -print ''; +print ''; print ''; print "\n"; @@ -499,6 +502,8 @@ foreach ($dirmodels as $reldir) { } print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'; +print '
'; + print "
"; /* @@ -517,6 +522,7 @@ print ''; print load_fiche_titre($langs->trans("ProductOtherConf"), '', ''); +print '
'; print ''; print ''; print ''."\n"; @@ -611,6 +617,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU } print '
'.$langs->trans("Parameters").'
'; +print '
'; print '
'; print ''; @@ -620,6 +627,7 @@ print '
'; print load_fiche_titre($langs->trans("UserInterface"), '', ''); +print '
'; print ''; print ''; print ''."\n"; @@ -671,7 +679,7 @@ print $form->selectarray( 0, 0, '', - 'maxwidth400', + 'minwidth100imp maxwidth400', 1 ); print ''; @@ -772,6 +780,7 @@ if (!empty($conf->global->PRODUCT_CANVAS_ABILITY)) { } print '
'.$langs->trans("Parameters").'
'; +print '
'; print '
'; print ''; diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 2f180bcc8ec..892ba4121e9 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -101,13 +101,13 @@ class RecruitmentJobPosition extends CommonObject public $fields = array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'comment'=>"Id"), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>5, 'notnull'=>1, 'default'=>'1', 'index'=>1), - 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), + 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object", 'css'=>'nowraponall'), 'label' => array('type'=>'varchar(255)', 'label'=>'JobLabel', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth500', 'csslist'=>'tdoverflowmax300', 'showoncombobox'=>'2', 'autofocusoncreate'=>1), 'qty' => array('type'=>'integer', 'label'=>'NbOfEmployeesExpected', 'enabled'=>'1', 'position'=>45, 'notnull'=>1, 'visible'=>1, 'default'=>'1', 'isameasure'=>'1', 'css'=>'maxwidth75imp'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500', 'picto'=>'project'), - 'fk_user_recruiter' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'ResponsibleOfRecruitement', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>1, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax150'), + 'fk_user_recruiter' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'ResponsibleOfRecruitement', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>1, 'foreignkey'=>'user.rowid', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150', 'picto'=>'user'), 'email_recruiter' => array('type'=>'varchar(255)', 'label'=>'EmailRecruiter', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>-1, 'help'=>'ToUseAGenericEmail', 'picto'=>'email'), - 'fk_user_supervisor' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'FutureManager', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'user.rowid',), + 'fk_user_supervisor' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'FutureManager', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'user.rowid', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150', 'picto'=>'user'), 'fk_establishment' => array('type'=>'integer:Establishment:hrm/class/establishment.class.php', 'label'=>'Establishment', 'enabled'=>'$conf->hrm->enabled', 'position'=>56, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'establishment.rowid',), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'WorkPlace', 'enabled'=>'1', 'position'=>57, 'notnull'=>-1, 'visible'=>-1, 'css'=>'maxwidth500', 'index'=>1, 'help'=>"IfJobIsLocatedAtAPartner", 'picto'=>'company'), 'date_planned' => array('type'=>'date', 'label'=>'DateExpected', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,), diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index 7ccad1de16a..3398a47dca3 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -103,8 +103,9 @@ $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 or if we click on clear filters +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -123,6 +124,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // Default sort order (if not yet defined by previous GETPOST) if (!$sortfield) { + reset($object->fields); // Reset is required to avoid key() to return null. $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. } if (!$sortorder) { @@ -146,17 +148,18 @@ foreach ($object->fields as $key => $val) { } } -// Definition of fields for list +// Definition of array of fields for columns $arrayfields = array(); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { - $visible = dol_eval($val['visible'], 1); + $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($visible < 0) ? 0 : 1), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), - 'position'=>$val['position'] + 'position'=>$val['position'], + 'help'=> isset($val['help']) ? $val['help'] : '' ); } } @@ -164,7 +167,7 @@ foreach ($object->fields as $key => $val) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); -$arrayfields['nbapplications'] = array('label'=>'Applications', 'checked'=>1, 'enabled'=>1, 'position'=>90); +$arrayfields['nbapplications'] = array('type'=>'integer', 'label'=>'Applications', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right'); $arrayfields = dol_sort_array($arrayfields, 'position'); $permissiontoread = $user->rights->recruitment->recruitmentjobposition->read; @@ -184,7 +187,8 @@ $result = restrictedArea($user, 'recruitment', 0, 'recruitment_recruitmentjobpos */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -238,13 +242,11 @@ $title = $langs->trans('ListOfPositionsToBeFilled'); // Build and execute select // -------------------------------------------------------------------- $sql = 'SELECT '; -foreach ($object->fields as $key => $val) { - $sql .= 't.'.$key.', '; -} +$sql .= $object->getFieldList('t'); // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.', ' : ''); } } // Add fields from hooks @@ -258,24 +260,42 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc O if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; } +// Add table from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; if ($object->ismultientitymanaged == 1) { $sql .= " WHERE t.entity IN (".getEntity($object->element).")"; } else { $sql .= " WHERE 1 = 1"; } foreach ($search as $key => $val) { - if ($key == 'status' && $search[$key] == -1) { - continue; - } - $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if (strpos($object->fields[$key]['type'], 'integer:') === 0) { - if ($search[$key] == '-1') { - $search[$key] = ''; + if (array_key_exists($key, $object->fields)) { + if ($key == 'status' && $search[$key] == -1) { + continue; + } + $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); + if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { + if ($search[$key] == '-1' || $search[$key] === '0') { + $search[$key] = ''; + } + $mode_search = 2; + } + if ($search[$key] != '') { + $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); + } + } else { + if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { + $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); + if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { + if (preg_match('/_dtstart$/', $key)) { + $sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; + } + if (preg_match('/_dtend$/', $key)) { + $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; + } + } } - $mode_search = 2; - } - if ($search[$key] != '') { - $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); } } if ($search_all) { @@ -372,6 +392,10 @@ if ($optioncss != '') { } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +// Add $param from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook +$param .= $hookmanager->resPrint; // List of mass actions available $arrayofmassactions = array( @@ -449,30 +473,38 @@ print ''; foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['css']) ? '' : $val['css']); + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { print ''; } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + // Fields from hook $parameters = array('arrayfields'=>$arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -492,14 +524,14 @@ print ''."\n"; // -------------------------------------------------------------------- print ''; foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['css']) ? '' : $val['css']); + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { @@ -513,7 +545,7 @@ $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['nbapplications']['checked'])) { - print ''; + print ''; } // Action column print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; @@ -561,7 +593,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; } - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') { + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; @@ -570,6 +602,8 @@ while ($i < ($limit ? min($num, $limit) : $num)) { print ''; if ($key == 'status') { print $object->getLibStatut(5); + } elseif ($key == 'rowid') { + print $object->showOutputField($val, $key, $object->id, ''); } else { print $object->showOutputField($val, $key, $object->$key, ''); } @@ -602,7 +636,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } // Action column print ''; } elseif ($key == "fk_soc") { print ''; From 38b34b1f19f4f7b17229b6246f75e068dd9cd98b Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Fri, 23 Jul 2021 12:25:59 +0200 Subject: [PATCH 044/356] Update llx_20_c_departements.sql Panama --- .../mysql/data/llx_20_c_departements.sql | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 27a9f8dd1f5..fecaf87befe 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -766,16 +766,16 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc -- Panama - 10 Provinces (id country=178) -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES ('PA-1', 17801, '', 0, '', 'Bocas del Toro'); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES ('PA-2', 17801, '', 0, '', 'Coclé'); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES ('PA-3', 17801, '', 0, '', 'Colón'); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES ('PA-4', 17801, '', 0, '', 'Chiriquí'); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES ('PA-5', 17801, '', 0, '', 'Darién'); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES ('PA-6', 17801, '', 0, '', 'Herrera'); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES ('PA-7', 17801, '', 0, '', 'Los Santos'); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES ('PA-8', 17801, '', 0, '', 'Panamá'); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES ('PA-9', 17801, '', 0, '', 'Veraguas'); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES ('PA-13', 17801, '', 0, '', 'Panamá Oeste'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-1', '', 0, '', 'Bocas del Toro'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-2', '', 0, '', 'Coclé'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-3', '', 0, '', 'Colón'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-4', '', 0, '', 'Chiriquí'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-5', '', 0, '', 'Darién'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-6', '', 0, '', 'Herrera'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-7', '', 0, '', 'Los Santos'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-8', '', 0, '', 'Panamá'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-9', '', 0, '', 'Veraguas'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-13', '', 0, '', 'Panamá Oeste'); -- Provinces Peru (id country=181) From 8920590e28bdcbd5676af14449f5706c4bf6670c Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Fri, 23 Jul 2021 12:48:25 +0200 Subject: [PATCH 045/356] Update llx_00_c_country.sql MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Singapour --> Singapore Iles Aland --> Åland Island Samoa américaines --> American Samoa Antarctique --> Antarctica Antigua-et-Barbuda --> Antigua and Barbuda Azerbaïdjan --> Azerbaijan --- htdocs/install/mysql/data/llx_00_c_country.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index ac8eba73a28..4465756f00a 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -57,19 +57,19 @@ INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (25 INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (26,'SA','SAU','Saudi Arabia',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (27,'MC','MCO','Monaco',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (28,'AU','AUS','Australia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (29,'SG','SGP','Singapour',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (29,'SG','SGP','Singapore',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (30,'AF','AFG','Afghanistan',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (31,'AX','ALA','Iles Aland',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (31,'AX','ALA','Åland Island',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (32,'AL','ALB','Albania',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (33,'AS','ASM','Samoa américaines',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (33,'AS','ASM','American Samoa',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (34,'AD','AND','Andorra',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (35,'AO','AGO','Angola',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (36,'AI','AIA','Anguilla',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (37,'AQ','ATA','Antarctique',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (38,'AG','ATG','Antigua-et-Barbuda',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (37,'AQ','ATA','Antarctica',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (38,'AG','ATG','Antigua and Barbuda',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (39,'AM','ARM','Armenia',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (41,'AT','AUT','Austria',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (42,'AZ','AZE','Azerbaïdjan',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (42,'AZ','AZE','Azerbaijan',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (43,'BS','BHS','Bahamas',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (44,'BH','BHR','Bahreïn',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (45,'BD','BGD','Bangladesh',1,0); From e93a362a0d585374260be696f91420d922672d4e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 23 Jul 2021 18:33:18 +0200 Subject: [PATCH 046/356] fix: since be62c2f7 commit selectlist from formconfirm were behind the form confirm --- htdocs/core/class/html.form.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1213c070acc..56316475ab7 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1182,7 +1182,7 @@ class Form // mode 1 $urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&filter='.urlencode($filter).($showtype ? '&showtype='.urlencode($showtype) : ''); $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); - $out .= ''; + $out .= ''; if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : '; elseif ($hidelabel > 1) { $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; @@ -6052,7 +6052,7 @@ class Form $urloption = 'htmlname='.$htmlname.'&outjson=1&objectdesc='.$objectdesc.'&filter='.urlencode($objecttmp->filter); // Activate the auto complete using ajax call. $out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array()); - $out .= ''; + $out .= ''; if ($placeholder) $placeholder = ' placeholder="'.$placeholder.'"'; $out .= ''; } From 5524320fbcee6db99a092a8d20a9cadbd88d8bbb Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 23 Jul 2021 17:46:44 +0000 Subject: [PATCH 047/356] Fixing style errors. --- htdocs/core/tpl/card_presend.tpl.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 2c7af954892..143d8d5536c 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -137,14 +137,14 @@ if ($action == 'presend') { $formmail->fromname = ''; $formmail->fromtype = 'special'; } - if ($object->element === 'order_supplier' && !empty($conf->global->ORDER_SUPPLIER_EMAIL_SENDER)) { - $formmail->frommail = $conf->global->ORDER_SUPPLIER_EMAIL_SENDER; - $formmail->fromname = ''; - $formmail->fromtype = 'special'; - } + if ($object->element === 'order_supplier' && !empty($conf->global->ORDER_SUPPLIER_EMAIL_SENDER)) { + $formmail->frommail = $conf->global->ORDER_SUPPLIER_EMAIL_SENDER; + $formmail->fromname = ''; + $formmail->fromtype = 'special'; + } + + - - $formmail->trackid = $trackid; if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) { // If bit 2 is set include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; From 5453e3b3b26b406377590f646b01e7bedb3fefc0 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 25 Jul 2021 08:35:03 +0200 Subject: [PATCH 048/356] Security --- htdocs/expensereport/class/paymentexpensereport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index a453b810e6a..6e3e8d34137 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -169,7 +169,7 @@ class PaymentExpenseReport extends CommonObject $sql .= " VALUES ($this->fk_expensereport, '".$this->db->idate($now)."',"; $sql .= " '".$this->db->idate($this->datepaid)."',"; $sql .= " ".price2num($totalamount).","; - $sql .= " ".$this->fk_typepayment.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note_public)."', ".$user->id.","; + $sql .= " ".((int) $this->fk_typepayment).", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note_public)."', ".((int) $user->id).","; $sql .= " 0)"; dol_syslog(get_class($this)."::create", LOG_DEBUG); From 467ecb4a64e7568e5681e16c20fd5f5b79ecaa9c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 25 Jul 2021 21:21:09 +0200 Subject: [PATCH 049/356] ChangeLog --- ChangeLog | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index f439186f5ca..5b296aa88e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,7 +7,7 @@ English Dolibarr ChangeLog For users: ---------- -NEW: Module Recruitement to follow application to job positions is now stable. +NEW: Module Recruitment to follow application to job positions is now stable. NEW: Feature to make Stock Inventories NEW: Several security issues after a second private bug hunting campaign. NEW: A lot of fix into english text after a small proofreading campaign (still not perfect, but really better) @@ -50,7 +50,7 @@ NEW: Make public bookmarks editable by admin users only NEW: If main logo not defined, can use the squarred logo on login page NEW: The manifest file can use the squared image if available NEW: Enhance the multicurrency rate editor -NEW: Normalyse Type company field with ajax combobox +NEW: Normalise Type company field with ajax combobox NEW: preload product description on selection for customer propal/order/invoice NEW: Search usergroups & resources NEW: Setup Page for module creation with module builder enhancement #FoundationFunding @@ -67,14 +67,15 @@ NEW: #16378 more E-Mail Contact substitution Values for better salutation NEW: option to keep the "Automatically create the payment" checkbox empty on the tax creation page Accountancy -NEW: Accountancy - Add FEC import -NEW: Accountancy - Add a confirmation form with options on export -NEW: Accountancy - Add select date from/to in already bind customer and supplier list -NEW: Accountancy - Format FEC - Add new field DateLimitReglmt -NEW: Accountancy - In ledger & journals, show link on bank transaction -NEW: Accountancy - Possibility to filter on journals in balance -NEW: Accountancy - Add a page to list subledger accounts -NEW: Multiselect ledger account code filter on book keeping list +NEW: Add FEC import +NEW: Add a confirmation form with options on export (for notified export and validate operations) +NEW: Add select date from/to in already bind customer and supplier list +NEW: FEC / FEC2 export - Add new field DateLimitReglmt +NEW: In ledger & journals, show link on bank transaction +NEW: Possibility to filter on journals in balance +NEW: Add a page to list subledger accounts +NEW: Multiselect journal code filter on journal / balance / ledger +NEW: Add first step to close fiscal year Agenda NEW: add support for Friday as a non working day @@ -93,7 +94,7 @@ NEW: can filter files in ECM/GED on status Shared / Not shared NEW: add a check to avoid an invoice date in the future NEW: add the total of margin in invoice list NEW: can set a percentage when creating an invoice from another object -NEW: Support down payment on supplier invoice (& somes ajustments) +NEW: Support down payment on supplier invoice (& some adjustments) Margin NEW: add the total of margin in invoice list @@ -162,7 +163,7 @@ NEW: Add a security center page with all information and advices related to the NEW: Add a performance center page with all information and advices related to the performance of your instance Modules -NEW: Module Recruitement is now stable +NEW: Module Recruitment is now stable NEW: start new experimental module Event Organization Management NEW: start new experimental module Partnership Management NEW: start new experimental module Knowledge Management @@ -171,11 +172,14 @@ NEW: Check update availability for externals modules using a button on module pa Module SimplePOS is deprecated - TakePOS is recommended for the future new Options -NEW: add option CONTRACT_ALLOW_EXTERNAL_DOWNLOAD to make generated doc automatically shared -NEW: add option SUPPLIER_PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD to make generated doc automatically shared -NEW: add option MAIN_SECURITY_ANTI_SSRF_SERVER_IP to define list of IPs that are local IPs -NEW: add option SOCIETE_DISABLE_WORKFORCE to hide staff field -NEW: add constant MAIN_BUGTRACK_URL to set a custom url to redirect to when clicking on link "declare a bug" +NEW: add option CONTRACT_ALLOW_EXTERNAL_DOWNLOAD to make generated doc automatically shared +NEW: add option SUPPLIER_PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD to make generated doc automatically shared +NEW: add option MAIN_SECURITY_ANTI_SSRF_SERVER_IP to define list of IPs that are local IPs +NEW: add option SOCIETE_DISABLE_WORKFORCE to hide staff field +NEW: add constant MAIN_BUGTRACK_URL to set a custom url to redirect to when clicking on link "declare a bug" +NEW: add constant ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY to manage binding with accountancy account declared on thirdparty card +NEW: add constant MAIN_PRODUCT_PERENTITY_SHARED to manage some informations (Accounting account) when product is shared on several entities +NEW: add constant MAIN_COMPANY_PERENTITY_SHARED to manage some informations (Accounting account) when company is shared on several entities For developers: @@ -209,7 +213,7 @@ NEW: hook printFieldListTitle for cabyprodserv.php NEW: hook to allow external modules to add their own shortlist of recent objects NEW: SQL-altering hooks in the turnover by product report NEW: add form confirm hook on company card -NEW: add hook addSectionECMAuto method to add custom diretory into ECM auto files +NEW: add hook addSectionECMAuto method to add custom directory into ECM auto files WARNING: @@ -224,7 +228,7 @@ Following changes may create regressions for some external modules, but were nec * If your database is PostgreSQL, you must use version 9.1.0 or more (Dolibarr need the SQL function CONCAT) * If your database is MySQL or MariaDB, you need at least version 5.1 * Function set_price_level() has been renamed into setPriceLevel() to follow camelcase rules -* removed deprecated subtituion key __REFCLIENT__ (replaced with __REF_CLIENT__) +* removed deprecated substitution key __REFCLIENT__ (replaced with __REF_CLIENT__) * Removed constant MAIN_COUNTRIES_IN_EEC. You can now set if country is in Europe or not from the dictionary of countries. From 84e5773de855909a6df12eb7015c59ef8210d514 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 25 Jul 2021 22:37:20 +0200 Subject: [PATCH 050/356] FIX: Accountancy - Search date on journal --- htdocs/accountancy/bookkeeping/list.php | 32 ++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index a70bb710937..e329a7979f4 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -366,42 +366,42 @@ if (empty($reshook)) { if (!empty($search_date_creation_start)) { $filter['t.date_creation>='] = $search_date_creation_start; $tmp = dol_getdate($search_date_creation_start); - $param .= '&date_creation_startmonth='.urlencode($tmp['mon']).'&date_creation_startday='.urlencode($tmp['mday']).'&date_creation_startyear='.urlencode($tmp['year']); + $param .= '&search_date_creation_startmonth='.urlencode($tmp['mon']).'&search_date_creation_startday='.urlencode($tmp['mday']).'&search_date_creation_startyear='.urlencode($tmp['year']); } if (!empty($search_date_creation_end)) { $filter['t.date_creation<='] = $search_date_creation_end; $tmp = dol_getdate($search_date_creation_end); - $param .= '&date_creation_endmonth='.urlencode($tmp['mon']).'&date_creation_endday='.urlencode($tmp['mday']).'&date_creation_endyear='.urlencode($tmp['year']); + $param .= '&search_date_creation_endmonth='.urlencode($tmp['mon']).'&search_date_creation_endday='.urlencode($tmp['mday']).'&search_date_creation_endyear='.urlencode($tmp['year']); } if (!empty($search_date_modification_start)) { $filter['t.tms>='] = $search_date_modification_start; $tmp = dol_getdate($search_date_modification_start); - $param .= '&date_modification_startmonth='.urlencode($tmp['mon']).'&date_modification_startday='.urlencode($tmp['mday']).'&date_modification_startyear='.urlencode($tmp['year']); + $param .= '&search_date_modification_startmonth='.urlencode($tmp['mon']).'&search_date_modification_startday='.urlencode($tmp['mday']).'&search_date_modification_startyear='.urlencode($tmp['year']); } if (!empty($search_date_modification_end)) { $filter['t.tms<='] = $search_date_modification_end; $tmp = dol_getdate($search_date_modification_end); - $param .= '&date_modification_endmonth='.urlencode($tmp['mon']).'&date_modification_endday='.urlencode($tmp['mday']).'&date_modification_endyear='.urlencode($tmp['year']); + $param .= '&search_date_modification_endmonth='.urlencode($tmp['mon']).'&search_date_modification_endday='.urlencode($tmp['mday']).'&search_date_modification_endyear='.urlencode($tmp['year']); } if (!empty($search_date_export_start)) { $filter['t.date_export>='] = $search_date_export_start; $tmp = dol_getdate($search_date_export_start); - $param .= '&date_export_startmonth='.urlencode($tmp['mon']).'&date_export_startday='.urlencode($tmp['mday']).'&date_export_startyear='.urlencode($tmp['year']); + $param .= '&search_date_export_startmonth='.urlencode($tmp['mon']).'&search_date_export_startday='.urlencode($tmp['mday']).'&search_date_export_startyear='.urlencode($tmp['year']); } if (!empty($search_date_export_end)) { $filter['t.date_export<='] = $search_date_export_end; $tmp = dol_getdate($search_date_export_end); - $param .= '&date_export_endmonth='.urlencode($tmp['mon']).'&date_export_endday='.urlencode($tmp['mday']).'&date_export_endyear='.urlencode($tmp['year']); + $param .= '&search_date_export_endmonth='.urlencode($tmp['mon']).'&search_date_export_endday='.urlencode($tmp['mday']).'&search_date_export_endyear='.urlencode($tmp['year']); } if (!empty($search_date_validation_start)) { $filter['t.date_validated>='] = $search_date_validation_start; $tmp = dol_getdate($search_date_validation_start); - $param .= '&date_validation_startmonth='.urlencode($tmp['mon']).'&date_validation_startday='.urlencode($tmp['mday']).'&date_validation_startyear='.urlencode($tmp['year']); + $param .= '&search_date_validation_startmonth='.urlencode($tmp['mon']).'&search_date_validation_startday='.urlencode($tmp['mday']).'&search_date_validation_startyear='.urlencode($tmp['year']); } if (!empty($search_date_validation_end)) { $filter['t.date_validated<='] = $search_date_validation_end; $tmp = dol_getdate($search_date_validation_end); - $param .= '&date_validation_endmonth='.urlencode($tmp['mon']).'&date_validation_endday='.urlencode($tmp['mday']).'&date_validation_endyear='.urlencode($tmp['year']); + $param .= '&search_date_validation_endmonth='.urlencode($tmp['mon']).'&search_date_validation_endday='.urlencode($tmp['mday']).'&search_date_validation_endyear='.urlencode($tmp['year']); } if (!empty($search_debit)) { $filter['t.debit'] = $search_debit; @@ -904,10 +904,10 @@ print $hookmanager->resPrint; if (!empty($arrayfields['t.date_creation']['checked'])) { print ''; } @@ -915,10 +915,10 @@ if (!empty($arrayfields['t.date_creation']['checked'])) { if (!empty($arrayfields['t.tms']['checked'])) { print ''; } @@ -926,10 +926,10 @@ if (!empty($arrayfields['t.tms']['checked'])) { if (!empty($arrayfields['t.date_export']['checked'])) { print ''; } @@ -937,10 +937,10 @@ if (!empty($arrayfields['t.date_export']['checked'])) { if (!empty($arrayfields['t.date_validated']['checked'])) { print ''; } From 505543e18e3d6ca331492c9d862fcdf7decb038a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Jul 2021 00:37:47 +0200 Subject: [PATCH 051/356] Fix #yogosha6704 --- htdocs/comm/action/list.php | 2 +- htdocs/core/class/html.formactions.class.php | 2 +- htdocs/core/lib/agenda.lib.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index e95cc3366c5..9c587a934e2 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -47,7 +47,7 @@ $massaction = GETPOST('massaction', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search $resourceid = GETPOST("search_resourceid", "int") ?GETPOST("search_resourceid", "int") : GETPOST("resourceid", "int"); $pid = GETPOST("search_projectid", 'int', 3) ?GETPOST("search_projectid", 'int', 3) : GETPOST("projectid", 'int', 3); -$search_status = (GETPOST("search_status", 'alpha') != '') ?GETPOST("search_status", 'alpha') : GETPOST("status", 'alpha'); +$search_status = (GETPOST("search_status", 'aZ09') != '') ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); $type = GETPOST('search_type', 'alphanohtml') ?GETPOST('search_type', 'alphanohtml') : GETPOST('type', 'alphanohtml'); $optioncss = GETPOST('optioncss', 'alpha'); $year = GETPOST("year", 'int'); diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 992efb79bbf..09c94485d11 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -97,7 +97,7 @@ class FormActions function select_status() { var defaultvalue = $('#select' + htmlname).val(); var percentage = $('input[name=percentage]'); - var selected = '".(isset($selected) ? $selected : '')."'; + var selected = '".(isset($selected) ? dol_escape_js($selected) : '')."'; var value = (selected>0?selected:(defaultvalue>=0?defaultvalue:'')); percentage.val(value); diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index ae96f59d407..9796c49cf59 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -61,13 +61,13 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh // Filters //print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; if ($massaction != 'predelete' && $massaction != 'preaffecttag') { // When $massaction == 'predelete', action may be already output to 'delete' by the mass action system. print ''; } - print ''; + print ''; if ($canedit) { print '
'; From bbd84fd13ec2241348d31246125f286c364192d2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 26 Jul 2021 04:08:05 +0200 Subject: [PATCH 052/356] FIX: Missing column Date validation in ledger & subledger --- .../accountancy/bookkeeping/listbyaccount.php | 56 ++++++++++++++++- .../bookkeeping/listbysubaccount.php | 63 ++++++++++++++++--- 2 files changed, 108 insertions(+), 11 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 98c3f14191b..c8364c35ee5 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -2,7 +2,7 @@ /* Copyright (C) 2016 Neil Orley * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2020 Florian Henry - * Copyright (C) 2013-2020 Alexandre Spangaro + * Copyright (C) 2013-2021 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -56,6 +56,14 @@ $search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int'); $search_date_export_endday = GETPOST('search_date_export_endday', 'int'); $search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear); $search_date_export_end = dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear); +$search_date_validation_startyear = GETPOST('search_date_validation_startyear', 'int'); +$search_date_validation_startmonth = GETPOST('search_date_validation_startmonth', 'int'); +$search_date_validation_startday = GETPOST('search_date_validation_startday', 'int'); +$search_date_validation_endyear = GETPOST('search_date_validation_endyear', 'int'); +$search_date_validation_endmonth = GETPOST('search_date_validation_endmonth', 'int'); +$search_date_validation_endday = GETPOST('search_date_validation_endday', 'int'); +$search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear); +$search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear); $search_accountancy_code = GETPOST("search_accountancy_code"); $search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha'); @@ -81,7 +89,7 @@ if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_ } // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -144,6 +152,7 @@ $arrayfields = array( 't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1), + 't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1), ); if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) { @@ -221,6 +230,14 @@ if (empty($reshook)) { $search_date_export_endyear = ''; $search_date_export_endmonth = ''; $search_date_export_endday = ''; + $search_date_validation_start = ''; + $search_date_validation_end = ''; + $search_date_validation_startyear = ''; + $search_date_validation_startmonth = ''; + $search_date_validation_startday = ''; + $search_date_validation_endyear = ''; + $search_date_validation_endmonth = ''; + $search_date_validation_endday = ''; $search_debit = ''; $search_credit = ''; $search_lettering_code = ''; @@ -301,6 +318,14 @@ if (empty($reshook)) { $filter['t.date_export<='] = $search_date_export_end; $param .= '&search_date_export_endmonth='.$search_date_export_endmonth.'&search_date_export_endday='.$search_date_export_endday.'&search_date_export_endyear='.$search_date_export_endyear; } + if (!empty($search_date_validation_start)) { + $filter['t.date_validated>='] = $search_date_validation_start; + $param .= '&search_date_validation_startmonth='.$search_date_validation_startmonth.'&search_date_validation_startday='.$search_date_validation_startday.'&search_date_validation_startyear='.$search_date_validation_startyear; + } + if (!empty($search_date_validation_end)) { + $filter['t.date_validated<='] = $search_date_validation_end; + $param .= '&search_date_validation_endmonth='.$search_date_validation_endmonth.'&search_date_validation_endday='.$search_date_validation_endday.'&search_date_validation_endyear='.$search_date_validation_endyear; + } } if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) { @@ -564,6 +589,17 @@ if (!empty($arrayfields['t.date_export']['checked'])) { print '
'; print ''; } +// Date validation +if (!empty($arrayfields['t.date_validated']['checked'])) { + print '
'; +} // Fields from hook $parameters = array('arrayfields'=>$arrayfields); @@ -605,6 +641,9 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) { if (!empty($arrayfields['t.date_export']['checked'])) { print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center '); } +if (!empty($arrayfields['t.date_validated']['checked'])) { + print_liste_field_titre($arrayfields['t.date_validated']['label'], $_SERVER['PHP_SELF'], "t.date_validated", "", $param, '', $sortfield, $sortorder, 'center '); +} // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook @@ -635,7 +674,7 @@ while ($i < min($num, $limit)) { // Is it a break ? if ($accountg != $displayed_account_number || !isset($displayed_account_number)) { $colnumber = 5; - $colnumberend = 7; + $colnumberend = 8; if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { $colnumber--; @@ -643,6 +682,9 @@ while ($i < min($num, $limit)) { if (empty($arrayfields['t.date_export']['checked'])) { $colnumber--; } + if (empty($arrayfields['t.date_validated']['checked'])) { + $colnumber--; + } $colspan = $totalarray['nbfield'] - $colnumber; $colspanend = $totalarray['nbfield'] - $colnumberend; @@ -845,6 +887,14 @@ while ($i < min($num, $limit)) { } } + // Validated operation date + if (!empty($arrayfields['t.date_validated']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php index 20899c693c6..d2e036b1f60 100644 --- a/htdocs/accountancy/bookkeeping/listbysubaccount.php +++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php @@ -2,8 +2,8 @@ /* Copyright (C) 2016 Neil Orley * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2020 Florian Henry - * Copyright (C) 2013-2020 Alexandre Spangaro - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2013-2021 Alexandre Spangaro + * Copyright (C) 2018-2020 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 @@ -46,7 +46,7 @@ $search_date_endyear = GETPOST('search_date_endyear', 'int'); $search_date_endmonth = GETPOST('search_date_endmonth', 'int'); $search_date_endday = GETPOST('search_date_endday', 'int'); $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); -$search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear); +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); $search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); $search_date_export_startyear = GETPOST('search_date_export_startyear', 'int'); $search_date_export_startmonth = GETPOST('search_date_export_startmonth', 'int'); @@ -55,7 +55,15 @@ $search_date_export_endyear = GETPOST('search_date_export_endyear', 'int'); $search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int'); $search_date_export_endday = GETPOST('search_date_export_endday', 'int'); $search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear); -$search_date_export_end = dol_mktime(0, 0, 0, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear); +$search_date_export_end = dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear); +$search_date_validation_startyear = GETPOST('search_date_validation_startyear', 'int'); +$search_date_validation_startmonth = GETPOST('search_date_validation_startmonth', 'int'); +$search_date_validation_startday = GETPOST('search_date_validation_startday', 'int'); +$search_date_validation_endyear = GETPOST('search_date_validation_endyear', 'int'); +$search_date_validation_endmonth = GETPOST('search_date_validation_endmonth', 'int'); +$search_date_validation_endday = GETPOST('search_date_validation_endday', 'int'); +$search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear); +$search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear); $search_accountancy_code = GETPOST("search_accountancy_code"); $search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha'); @@ -144,6 +152,7 @@ $arrayfields = array( 't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1), + 't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1), ); if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) { @@ -221,6 +230,14 @@ if (empty($reshook)) { $search_date_export_endyear = ''; $search_date_export_endmonth = ''; $search_date_export_endday = ''; + $search_date_validation_start = ''; + $search_date_validation_end = ''; + $search_date_validation_startyear = ''; + $search_date_validation_startmonth = ''; + $search_date_validation_startday = ''; + $search_date_validation_endyear = ''; + $search_date_validation_endmonth = ''; + $search_date_validation_endday = ''; $search_debit = ''; $search_credit = ''; $search_lettering_code = ''; @@ -301,6 +318,14 @@ if (empty($reshook)) { $filter['t.date_export<='] = $search_date_export_end; $param .= '&search_date_export_endmonth='.$search_date_export_endmonth.'&search_date_export_endday='.$search_date_export_endday.'&search_date_export_endyear='.$search_date_export_endyear; } + if (!empty($search_date_validation_start)) { + $filter['t.date_validated>='] = $search_date_validation_start; + $param .= '&search_date_validation_startmonth='.$search_date_validation_startmonth.'&search_date_validation_startday='.$search_date_validation_startday.'&search_date_validation_startyear='.$search_date_validation_startyear; + } + if (!empty($search_date_validation_end)) { + $filter['t.date_validated<='] = $search_date_validation_end; + $param .= '&search_date_validation_endmonth='.$search_date_validation_endmonth.'&search_date_validation_endday='.$search_date_validation_endday.'&search_date_validation_endyear='.$search_date_validation_endyear; + } } if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) { @@ -373,7 +398,6 @@ $title_page = $langs->trans("Operations").' - '.$langs->trans("VueByAccountAccou llxHeader('', $title_page); - // List $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { @@ -448,7 +472,6 @@ print ''; print ''; - $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { @@ -568,6 +591,17 @@ if (!empty($arrayfields['t.date_export']['checked'])) { print ''; print ''; } +// Date validation +if (!empty($arrayfields['t.date_validated']['checked'])) { + print ''; +} // Fields from hook $parameters = array('arrayfields'=>$arrayfields); @@ -609,6 +643,9 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) { if (!empty($arrayfields['t.date_export']['checked'])) { print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center '); } +if (!empty($arrayfields['t.date_validated']['checked'])) { + print_liste_field_titre($arrayfields['t.date_validated']['label'], $_SERVER['PHP_SELF'], "t.date_validated", "", $param, '', $sortfield, $sortorder, 'center '); +} // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook @@ -639,7 +676,7 @@ while ($i < min($num, $limit)) { // Is it a break ? if ($accountg != $displayed_account_number || !isset($displayed_account_number)) { $colnumber = 5; - $colnumberend = 7; + $colnumberend = 8; if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { $colnumber--; @@ -647,10 +684,12 @@ while ($i < min($num, $limit)) { if (empty($arrayfields['t.date_export']['checked'])) { $colnumber--; } + if (empty($arrayfields['t.date_validated']['checked'])) { + $colnumber--; + } $colspan = $totalarray['nbfield'] - $colnumber; $colspanend = $totalarray['nbfield'] - $colnumberend; - // Show a subtotal by accounting account if (isset($displayed_account_number)) { print ''; @@ -859,6 +898,14 @@ while ($i < min($num, $limit)) { } } + // Validated operation date + if (!empty($arrayfields['t.date_validated']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook From 183d413b4529418a74920bb11f95077cf05f8750 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 26 Jul 2021 04:42:35 +0200 Subject: [PATCH 053/356] FIX: Accountancy - Rules to delete & modify transaction not applied in ledger & subledger --- htdocs/accountancy/bookkeeping/card.php | 4 ++-- htdocs/accountancy/bookkeeping/list.php | 2 +- htdocs/accountancy/bookkeeping/listbyaccount.php | 8 +++++--- htdocs/accountancy/bookkeeping/listbysubaccount.php | 8 +++++--- htdocs/accountancy/class/bookkeeping.class.php | 1 + 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 4c7194b2255..3e74cd0c212 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -683,7 +683,7 @@ if ($action == 'create') { print ''; print ''; - if (empty($line->date_export) || empty($line->date_validation)) { + if (empty($line->date_export) && empty($line->date_validation)) { print ''; print ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index a70bb710937..ebc91ae54c7 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1243,7 +1243,7 @@ while ($i < min($num, $limit)) { // Action column print ''; diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php index 20899c693c6..434867112f9 100644 --- a/htdocs/accountancy/bookkeeping/listbysubaccount.php +++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php @@ -866,12 +866,14 @@ while ($i < min($num, $limit)) { // Action column print ''; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 6bd39f4e227..aeaa42154d8 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1506,6 +1506,7 @@ class BookKeeping extends CommonObject $sql = "DELETE"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql .= " WHERE piece_num = ".(int) $piecenum; + $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion $sql .= " AND entity IN (".getEntity('accountancy').")"; $resql = $this->db->query($sql); From 35862cebfa10256e29b70255048ad164e908d4a4 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 26 Jul 2021 04:49:56 +0200 Subject: [PATCH 054/356] Fix card presentation --- htdocs/accountancy/bookkeeping/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 3e74cd0c212..c156a388735 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -637,6 +637,8 @@ if ($action == 'create') { print_liste_field_titre("Credit", "", "", "", "", 'class="right"'); if (empty($object->date_validation)) { print_liste_field_titre("Action", "", "", "", "", 'width="60" class="center"'); + } else { + print_liste_field_titre(""); } print "\n"; @@ -683,8 +685,8 @@ if ($action == 'create') { print ''; print ''; + print ''; if (!$i) $totalarray['nbfield']++; } - } else { + } elseif ($action !== 'createtime') { print ''; } From b5dde982d52c54e1b5a311c485ab2e2f41331239 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 26 Jul 2021 10:32:51 +0200 Subject: [PATCH 056/356] Fix #18185 : for v13 --- htdocs/societe/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 5dceee7751d..04ad5a32fcc 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -482,7 +482,7 @@ if ($search_type_thirdparty && $search_type_thirdparty != '-1') $sql .= natural_ if (!empty($search_staff) && $search_staff != '-1') $sql .= natural_search("s.fk_effectif", $search_staff, 2); if ($search_level) $sql .= natural_search("s.fk_prospectlevel", join(',', $search_level), 3); if ($search_parent_name) $sql .= natural_search("s2.nom", $search_parent_name); -if ($search_stcomm != '' && $search_stcomm != -2) $sql .= natural_search("s.fk_stcomm", $search_stcomm, 2); +if ($search_stcomm != '' && $search_stcomm != -2) $sql .= natural_search("s.fk_stcomm", $search_stcomm, 1); if ($search_import_key) $sql .= natural_search("s.import_key", $search_import_key); // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; From a08b63d5616ed86ea6c584d2e7eb034d64941a64 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 26 Jul 2021 14:29:42 +0200 Subject: [PATCH 057/356] Fix for php 8 --- htdocs/adherents/type_translation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php index 7435fc440ed..6c8f273ae77 100644 --- a/htdocs/adherents/type_translation.php +++ b/htdocs/adherents/type_translation.php @@ -157,7 +157,7 @@ $form = new Form($db); $formadmin = new FormAdmin($db); $head = member_type_prepare_head($object); -$titre = $langs->trans("MemberType".$object->type); +$titre = $langs->trans("MemberType".$object->id); // Calculate $cnt_trans $cnt_trans = 0; From cfdcad0077950e85cad569a104e09e9bfb34bf4d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 26 Jul 2021 14:30:38 +0200 Subject: [PATCH 058/356] Update type.php --- htdocs/adherents/type.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 033592a9afc..526bb6cfa8a 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -43,6 +43,8 @@ $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); +$sall = GETPOST("filter", "alpha"); +$filter = GETPOST("sall", 'alpha'); $search_lastname = GETPOST('search_lastname', 'alpha'); $search_login = GETPOST('search_login', 'alpha'); $search_email = GETPOST('search_email', 'alpha'); From a181469ff86beba460c9b64f5275562dae3c289b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 26 Jul 2021 14:34:45 +0200 Subject: [PATCH 059/356] Update type.php --- htdocs/adherents/type.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 526bb6cfa8a..10560d38648 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -43,8 +43,8 @@ $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); -$sall = GETPOST("filter", "alpha"); -$filter = GETPOST("sall", 'alpha'); +$sall = GETPOST("sall", "alpha"); +$filter = GETPOST("filter", 'alpha'); $search_lastname = GETPOST('search_lastname', 'alpha'); $search_login = GETPOST('search_login', 'alpha'); $search_email = GETPOST('search_email', 'alpha'); From d4434859391558b3d5955b6cc6e29967a35027fc Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 26 Jul 2021 14:52:24 +0200 Subject: [PATCH 060/356] Update extrafields_edit.tpl.php --- htdocs/core/tpl/extrafields_edit.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_edit.tpl.php b/htdocs/core/tpl/extrafields_edit.tpl.php index 5915fb8a633..573c81d8daa 100644 --- a/htdocs/core/tpl/extrafields_edit.tpl.php +++ b/htdocs/core/tpl/extrafields_edit.tpl.php @@ -43,7 +43,7 @@ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, print $hookmanager->resPrint; if (empty($reshook)) { $params = array(); - $params['cols'] = $parameters['colspanvalue']; + $params['cols'] =isset($parameters[ 'colspanvalue' ]) ? $parameters[ 'colspanvalue' ] : null; print $object->showOptionals($extrafields, 'edit', $params); } From 026e61f1eccc35b36e78a2ff94748c327f66c1f8 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 26 Jul 2021 14:53:06 +0200 Subject: [PATCH 061/356] Update extrafields_edit.tpl.php --- htdocs/core/tpl/extrafields_edit.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_edit.tpl.php b/htdocs/core/tpl/extrafields_edit.tpl.php index 573c81d8daa..4f35aa86bca 100644 --- a/htdocs/core/tpl/extrafields_edit.tpl.php +++ b/htdocs/core/tpl/extrafields_edit.tpl.php @@ -43,7 +43,7 @@ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, print $hookmanager->resPrint; if (empty($reshook)) { $params = array(); - $params['cols'] =isset($parameters[ 'colspanvalue' ]) ? $parameters[ 'colspanvalue' ] : null; + $params['cols'] =isset($parameters['colspanvalue']) ? $parameters['colspanvalue'] : null; print $object->showOptionals($extrafields, 'edit', $params); } From b0e2ef4a6ca30572e8d90c6117c2e1778b59da27 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 26 Jul 2021 14:53:18 +0200 Subject: [PATCH 062/356] Update extrafields_edit.tpl.php --- htdocs/core/tpl/extrafields_edit.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_edit.tpl.php b/htdocs/core/tpl/extrafields_edit.tpl.php index 4f35aa86bca..6d6b6aa8836 100644 --- a/htdocs/core/tpl/extrafields_edit.tpl.php +++ b/htdocs/core/tpl/extrafields_edit.tpl.php @@ -43,7 +43,7 @@ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, print $hookmanager->resPrint; if (empty($reshook)) { $params = array(); - $params['cols'] =isset($parameters['colspanvalue']) ? $parameters['colspanvalue'] : null; + $params['cols'] = isset($parameters['colspanvalue']) ? $parameters['colspanvalue'] : null; print $object->showOptionals($extrafields, 'edit', $params); } From 4fa72f7dfe733cbc746070f6c70cebb37d6eb7b6 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 26 Jul 2021 15:04:43 +0200 Subject: [PATCH 063/356] fix for php8 --- htdocs/societe/index.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index f5a4392a0c0..cd7c1613857 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -250,7 +250,9 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA $thirdpartycateggraph .= ''; $thirdpartycateggraph .= '
'; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); - } elseif (strpos($val['type'], 'integer:') === 0) { - print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth150', 1); - } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) { + } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { + print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); + } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) { print ''; + } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { + print '
'; + print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; } print '
'.$langs->trans("Applications").''.$langs->trans("Applications").''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; if (in_array($object->id, $arrayofselected)) { $selected = 1; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 84ea65fef71..6a65efc8bac 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -798,7 +798,7 @@ foreach ($object->fields as $key => $val) { if (!empty($search[$key])) { $selectedarray = array_values($search[$key]); } - print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth100 maxwidth150', 1, 0, '', '', ''); + print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth100imp maxwidth150', 1, 0, '', '', ''); print ''; print '
'; - print $form->selectDate($search_date_creation_start, 'date_creation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); + print $form->selectDate($search_date_creation_start, 'search_date_creation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); print '
'; print '
'; - print $form->selectDate($search_date_creation_end, 'date_creation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); + print $form->selectDate($search_date_creation_end, 'search_date_creation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); print '
'; print '
'; print '
'; - print $form->selectDate($search_date_modification_start, 'date_modification_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); + print $form->selectDate($search_date_modification_start, 'search_date_modification_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); print '
'; print '
'; - print $form->selectDate($search_date_modification_end, 'date_modification_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); + print $form->selectDate($search_date_modification_end, 'search_date_modification_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); print '
'; print '
'; print '
'; - print $form->selectDate($search_date_export_start, 'date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); + print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); print '
'; print '
'; - print $form->selectDate($search_date_export_end, 'date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); + print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); print '
'; print '
'; print '
'; - print $form->selectDate($search_date_validation_start, 'date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); + print $form->selectDate($search_date_validation_start, 'search_date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); print '
'; print '
'; - print $form->selectDate($search_date_validation_end, 'date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); + print $form->selectDate($search_date_validation_end, 'search_date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); print '
'; print '
'; + print '
'; + print $form->selectDate($search_date_validation_start, 'search_date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); + print '
'; + print '
'; + print $form->selectDate($search_date_validation_end, 'search_date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); + print '
'; + print '
'.dol_print_date($line->date_validation, 'dayhour').''; + print '
'; + print $form->selectDate($search_date_validation_start, 'search_date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); + print '
'; + print '
'; + print $form->selectDate($search_date_validation_end, 'search_date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); + print '
'; + print '
'.dol_print_date($line->date_validation, 'dayhour').''.price($line->debit).''.price($line->credit).''; print 'id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">'; print img_edit('', 0, 'class="marginrightonly"'); @@ -713,7 +713,7 @@ if ($action == 'create') { setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_debit, $total_credit)), 'warnings'); } - if (empty($object->date_export) || empty($object->date_validation)) { + if (empty($object->date_export) && empty($object->date_validation)) { if ($action == "" || $action == 'add') { print '
'; - if (empty($line->date_export) || empty($line->date_validation)) { + if (empty($line->date_export) && empty($line->date_validation)) { if ($user->rights->accounting->mouvements->creer) { print '' . img_edit() . ''; } diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 98c3f14191b..63ecc2d420b 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -852,12 +852,14 @@ while ($i < min($num, $limit)) { // Action column print ''; - if (empty($line->date_export)) { + if (empty($line->date_export) && empty($line->date_validation)) { if ($user->rights->accounting->mouvements->creer) { - print ''.img_edit().''; + print '' . img_edit() . ''; } + } + if (empty($line->date_validation)) { if ($user->rights->accounting->mouvements->supprimer) { - print '   '.img_delete().''; + print ''.img_delete().''; } } print ''; - if (empty($line->date_export)) { + if (empty($line->date_export) && empty($line->date_validation)) { if ($user->rights->accounting->mouvements->creer) { - print ''.img_edit().''; + print '' . img_edit() . ''; } + } + if (empty($line->date_validation)) { if ($user->rights->accounting->mouvements->supprimer) { - print '   '.img_delete().''; + print ''.img_delete().''; } } print '
'.price($line->debit).''.price($line->credit).''; if (empty($line->date_export) && empty($line->date_validation)) { - print ''; print 'id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">'; print img_edit('', 0, 'class="marginrightonly"'); print '  '; From a7cef1aa1595a768353a6d7980f7437eaecd1f49 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 26 Jul 2021 10:20:11 +0200 Subject: [PATCH 055/356] FIX: cannot add time spend when column ref is not displayed --- htdocs/projet/tasks/time.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 3b2e36d34c6..2a4b1d6aeee 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1374,7 +1374,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print '
'; $thirdpartycateggraph .= '
'; -} +} else { +$thirdpartycateggraph = ''; +} /* From 986dc9c8578680d65253564b5e3756833544709d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 26 Jul 2021 13:06:42 +0000 Subject: [PATCH 064/356] Fixing style errors. --- htdocs/societe/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index cd7c1613857..e7d3ba09db8 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -251,8 +251,8 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA $thirdpartycateggraph .= ''; $thirdpartycateggraph .= '
'; } else { -$thirdpartycateggraph = ''; -} + $thirdpartycateggraph = ''; +} /* From dc30052d3e9e18f6581a13baf5c6e3c81555aed1 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 26 Jul 2021 15:07:52 +0200 Subject: [PATCH 065/356] fix for php 8 --- 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 a8879ad64f5..410dbd827fe 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10204,7 +10204,7 @@ function newToken() */ function currentToken() { - return $_SESSION['token']; + return isset($_SESSION['token']) ? $_SESSION['token'] : null; } /** From 36ba5c6a71ee9c3e85a4c97fc77f57416272744a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 26 Jul 2021 15:22:50 +0200 Subject: [PATCH 066/356] Fix for php8 --- htdocs/core/actions_massactions.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index cd8a3817602..cf412223838 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1473,7 +1473,7 @@ if (!$error && ($action == 'affecttag' && $confirm == 'yes') && $permissiontoadd $parameters['toselect'] = $toselect; $parameters['uploaddir'] = $uploaddir; $parameters['massaction'] = $massaction; -$parameters['diroutputmassaction'] = $diroutputmassaction; +$parameters['diroutputmassaction'] = isset($diroutputmassaction) ? $diroutputmassaction : null; $reshook = $hookmanager->executeHooks('doMassActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { From f83f02e4e226330b43b72ca2816bc2bda3a36c0f Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 26 Jul 2021 15:24:58 +0200 Subject: [PATCH 067/356] Fix for php8 --- htdocs/adherents/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index d669270b565..f7c4d5e4d36 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -175,7 +175,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array('socid'=>$socid); +$parameters = array('socid'=>isset($socid) ? $socid : null); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); From 76f0bac703cdb843c07dab05d813a9b66083e74d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 26 Jul 2021 15:29:46 +0200 Subject: [PATCH 068/356] Fix subscription list --- htdocs/adherents/subscription/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index d3d84cb3624..5c422b4df89 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -496,7 +496,7 @@ while ($i < min($num, $limit)) { $adherent->gender = $obj->gender; $adherent->morphy = $obj->morphy; $adherent->email = $obj->email; - $adherent->typeid = $obj->type; + $adherent->typeid = $obj->fk_type; $adherent->datefin = $db->jdate($obj->datef); $typeid = ($obj->fk_type > 0 ? $obj->fk_type : $adherent->typeid); From 3cb56d3ec6b593062fdea14e686a6ffe1d1b06ef Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 26 Jul 2021 15:35:31 +0200 Subject: [PATCH 069/356] Fix for php8 --- htdocs/core/tpl/massactions_pre.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 4b8680e11bb..f9c74dd7085 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -197,7 +197,7 @@ if ($massaction == 'presend') { // Allow Pre-Mass-Action hook (eg for confirmation dialog) $parameters = array( 'toselect' => $toselect, - 'uploaddir' => $uploaddir + 'uploaddir' => isset($uploaddir) ? $uploaddir : null ); $reshook = $hookmanager->executeHooks('doPreMassActions', $parameters, $object, $action); From 053d72c30693c31d93784d8ff66f301450f26cb1 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 26 Jul 2021 15:37:36 +0200 Subject: [PATCH 070/356] fix for php8 --- htdocs/adherents/subscription/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index d3d84cb3624..70b63e9d938 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -115,7 +115,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array('socid'=>$socid); +$parameters = array('socid'=>isset($socid) ? $socid : null); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); From 54c151916ddaca133200a593a9879aef7943f4d9 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 26 Jul 2021 15:42:43 +0200 Subject: [PATCH 071/356] Fix for php 8 --- htdocs/core/menus/standard/eldy.lib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index c192d5e6ac6..2f36290c8d4 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1732,11 +1732,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $titleboth = $langs->trans("LeadsOrProjects"); $titlenew = $langs->trans("NewLeadOrProject"); // Leads and opportunities by default - if ($conf->global->PROJECT_USE_OPPORTUNITIES == 0) { + if (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 0) { $titleboth = $langs->trans("Projects"); $titlenew = $langs->trans("NewProject"); } - if ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only + if (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only $titleboth = $langs->trans("Leads"); $titlenew = $langs->trans("NewLead"); } @@ -1745,13 +1745,13 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/projet/index.php?leftmenu=projects".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titleboth, 0, $user->rights->projet->lire, '', $mainmenu, 'projects', 0, '', '', '', img_picto('', 'project', 'class="pictofixedwidth"')); $newmenu->add("/projet/card.php?leftmenu=projects&action=create".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titlenew, 1, $user->rights->projet->creer); - if ($conf->global->PROJECT_USE_OPPORTUNITIES == 0) { + if (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 0) { $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : '').'&search_status=99', $langs->trans("List"), 1, $showmode, '', 'project', 'list'); - } elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 1) { + } elseif (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 1) { $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list'); $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99&search_opp_status=openedopp&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode); $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_opp_status=notopenedopp&search_status=99&contextpage=project', $langs->trans("ListOpenProjects"), 2, $showmode); - } elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only + } elseif (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99', $langs->trans("List"), 2, $showmode); } From a7f55f4778ebe778515edd7baeab2699d912b7f4 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 26 Jul 2021 15:43:57 +0200 Subject: [PATCH 072/356] fix: Expense report line, on update qty can be decimal --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index e1e5fb34f2a..07d3e018390 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2314,7 +2314,7 @@ if ($action == 'create') // Quantity print ''; - print ''; + print ''; print ''; //print ''.$langs->trans('AmountHT').''; From a386cf5e89e00af31a868896fe8548bce3499380 Mon Sep 17 00:00:00 2001 From: Robin Date: Tue, 27 Jul 2021 09:09:42 +0200 Subject: [PATCH 073/356] add hook product stat --- htdocs/product/stats/card.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index e899cee797f..de6b96332b6 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -58,6 +58,9 @@ $fieldvalue = (!empty($id) ? $id : $ref); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('productstatscard', 'globalcard')); + $tmp = dol_getdate(dol_now()); $currentyear = $tmp['year']; if (empty($search_year)) $search_year = $currentyear; From d2dc2bfde2568c9ce3853b3afd3d1b1d9e820b4e Mon Sep 17 00:00:00 2001 From: Robin Date: Tue, 27 Jul 2021 09:13:50 +0200 Subject: [PATCH 074/356] add hook product composition --- htdocs/product/composition/card.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 8459fa3e479..4bbcb7d6e27 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -50,6 +50,9 @@ $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('productcompositioncard', 'globalcard')); + $object = new Product($db); $objectid = 0; if ($id > 0 || !empty($ref)) From bc8be62809ef129ea41763d97f23bb5bdea4e75f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 27 Jul 2021 10:26:51 +0200 Subject: [PATCH 075/356] Update dolreceiptprinter.class.php --- htdocs/core/class/dolreceiptprinter.class.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 45c87401416..a3ddb3d7c7f 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -680,9 +680,7 @@ class dolReceiptPrinter extends Printer foreach ($object->lines as $line) { $total_localtax1 += $line->total_localtax1; } - foreach ($vatarray as $vatkey => $vatvalue) { - $this->printer->text(str_pad(price($total_localtax1), 10, ' ', STR_PAD_LEFT)."\n"); - } + $this->printer->text(str_pad(price($total_localtax1), 10, ' ', STR_PAD_LEFT)."\n"); break; case 'DOL_PRINT_OBJECT_TAX2': //var_dump($object); @@ -690,9 +688,7 @@ class dolReceiptPrinter extends Printer foreach ($object->lines as $line) { $total_localtax2 += $line->total_localtax2; } - foreach ($vatarray as $vatkey => $vatvalue) { - $this->printer->text(str_pad(price($total_localtax2), 10, ' ', STR_PAD_LEFT)."\n"); - } + $this->printer->text(str_pad(price($total_localtax2), 10, ' ', STR_PAD_LEFT)."\n"); break; case 'DOL_PRINT_OBJECT_TOTAL': $title = $langs->trans('TotalHT'); From f4fd4d8e7d1b1e9549cbd3a882208f0dbca196d7 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 27 Jul 2021 12:09:04 +0200 Subject: [PATCH 076/356] new: ref fourn and ref customer same size as ref product --- htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 6 ++++-- htdocs/install/mysql/tables/llx_product_customer_price.sql | 2 +- .../install/mysql/tables/llx_product_fournisseur_price.sql | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 95de2ab7ba6..8eaf1767b8a 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -33,7 +33,9 @@ -- Missing in v14 or lower - - -- v15 +ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN ref_fourn varchar(128); +ALTER TABLE llx_product_customer_price MODIFY COLUMN ref_customer varchar(128); + + diff --git a/htdocs/install/mysql/tables/llx_product_customer_price.sql b/htdocs/install/mysql/tables/llx_product_customer_price.sql index f0d5edf9c2f..361a42a5b54 100644 --- a/htdocs/install/mysql/tables/llx_product_customer_price.sql +++ b/htdocs/install/mysql/tables/llx_product_customer_price.sql @@ -28,7 +28,7 @@ create table llx_product_customer_price tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_product integer NOT NULL, fk_soc integer NOT NULL, - ref_customer varchar(30), + ref_customer varchar(128), price double(24,8) DEFAULT 0, price_ttc double(24,8) DEFAULT 0, price_min double(24,8) DEFAULT 0, diff --git a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql index 4e1d75dd1dd..2a01df30e4b 100644 --- a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql +++ b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql @@ -27,7 +27,7 @@ create table llx_product_fournisseur_price tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_product integer, fk_soc integer, - ref_fourn varchar(30), + ref_fourn varchar(128), desc_fourn text, fk_availability integer, price double(24,8) DEFAULT 0, -- price without tax for quantity From faf50a5aaaed98343a78d0320f95bf7652b661b2 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Tue, 27 Jul 2021 15:06:28 +0200 Subject: [PATCH 077/356] add agenda auto creation on supplier_order cancellation --- .../interface_50_modAgenda_ActionsAuto.class.php | 15 +++++++++++++++ htdocs/fourn/commande/card.php | 16 ++++++++++++++-- htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 2 ++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 8e23c258d88..8e6f34383b4 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -556,6 +556,21 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg .= $langs->trans("Reason") . ': '.$object->refuse_note; } + $object->sendtoid = 0; + } elseif ($action == 'ORDER_SUPPLIER_CANCEL') { + // Load translation files required by the page + $langs->loadLangs(array("agenda", "other", "orders", "main")); + + if (empty($object->actionmsg2)) { + $object->actionmsg2 = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref); + } + $object->actionmsg = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref); + + if (!empty($object->cancel_note)) { + $object->actionmsg .= '
'; + $object->actionmsg .= $langs->trans("Reason") . ': '.$object->cancel_note; + } + $object->sendtoid = 0; } elseif ($action == 'ORDER_SUPPLIER_SUBMIT') { // Load translation files required by the page diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index cc0f67e4b4e..ed379b2783a 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1089,6 +1089,9 @@ if (empty($reshook)) { } if ($action == 'confirm_cancel' && $confirm == 'yes' && $usercanorder) { + if (GETPOST('cancel_note')) { + $object->cancel_note = GETPOST('cancel_note'); + } $result = $object->cancel($user); if ($result > 0) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); @@ -1903,9 +1906,18 @@ if ($action == 'create') { $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("DenyingThisOrder"), $langs->trans("ConfirmDenyingThisOrder", $object->ref), "confirm_refuse", $formquestion, 0, 1); } - // Confirmation de l'annulation + // Confirmation of cancellation if ($action == 'cancel') { - $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("Cancel"), $langs->trans("ConfirmCancelThisOrder", $object->ref), "confirm_cancel", '', 0, 1); + $formquestion = array( + array( + 'type' => 'text', + 'name' => 'cancel_note', + 'label' => $langs->trans("Reason"), + 'value' => '', + 'morecss' => 'minwidth300' + ) + ); + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("Cancel"), $langs->trans("ConfirmCancelThisOrder", $object->ref), "confirm_cancel", $formquestion, 0, 1); } // Confirmation de l'envoi de la commande diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 95de2ab7ba6..e319c6116f0 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -36,4 +36,6 @@ -- v15 +-- add action trigger +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('ORDER_SUPPLIER_CANCEL','Supplier order request canceled','Executed when a supplier order is canceled','order_supplier',13); From 8b118670c38316c89319691b4a7ba89b4913aaf7 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Tue, 27 Jul 2021 15:11:13 +0200 Subject: [PATCH 078/356] fix agenda item refuse --- htdocs/fourn/commande/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index ed379b2783a..b43447529b5 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1892,13 +1892,13 @@ if ($action == 'create') { $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("ApproveThisOrder"), $text, "confirm_".$action, $formquestion, 1, 1, 240); } - // Confirmation de la desapprobation + // Confirmation of disapproval if ($action == 'refuse') { $formquestion = array( array( 'type' => 'text', 'name' => 'refuse_note', - 'label' => $langs->trans("MotifCP"), + 'label' => $langs->trans("Reason"), 'value' => '', 'morecss' => 'minwidth300' ) From cefbcf03f6a43eef6ae58e142bacfe34599c425f Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Tue, 27 Jul 2021 16:18:06 +0200 Subject: [PATCH 079/356] fix cancel on makeorder (supplier_order) --- htdocs/fourn/commande/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index cc0f67e4b4e..d5d704c4573 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -983,7 +983,9 @@ if (empty($reshook)) { if ($action == 'commande') { $methodecommande = GETPOST('methodecommande', 'int'); - if ($methodecommande <= 0) { + if ($cancel) { + $action = ''; + } elseif ($methodecommande <= 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("OrderMode")), null, 'errors'); $action = 'makeorder'; } From d9529f260052b8d159d936bdb8d5ba6c3df38957 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Tue, 27 Jul 2021 16:37:34 +0200 Subject: [PATCH 080/356] save makeorder comment to agenda item --- .../triggers/interface_50_modAgenda_ActionsAuto.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 8e23c258d88..fcc51c21df9 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -566,6 +566,11 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->actionmsg = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref)); + if (!empty($object->context['comments'])) { + $object->actionmsg .= '
'; + $object->actionmsg .= $langs->trans("Comment") . ': '.$object->context['comments']; + } + $object->sendtoid = 0; } elseif ($action == 'ORDER_SUPPLIER_RECEIVE') { // Load translation files required by the page From 51cfeddaaf0902887e7aae39a086a9e29df85ba2 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Tue, 27 Jul 2021 16:51:14 +0200 Subject: [PATCH 081/356] add cancel button to `classifyreception` form on supplier_orders --- htdocs/fourn/commande/card.php | 50 ++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index cc0f67e4b4e..d39c90b56da 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1059,32 +1059,36 @@ if (empty($reshook)) { // Set status of reception (complete, partial, ...) if ($action == 'livraison' && $usercanreceived) { - $db->begin(); + if ($cancel) { + $action = ''; + } else { + $db->begin(); - if (GETPOST("type") != '') { - $date_liv = dol_mktime(GETPOST('rehour'), GETPOST('remin'), GETPOST('resec'), GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); + if (GETPOST("type") != '') { + $date_liv = dol_mktime(GETPOST('rehour'), GETPOST('remin'), GETPOST('resec'), GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); - $result = $object->Livraison($user, $date_liv, GETPOST("type"), GETPOST("comment")); // GETPOST("type") is 'tot', 'par', 'nev', 'can' - if ($result > 0) { - $langs->load("deliveries"); - setEventMessages($langs->trans("DeliveryStateSaved"), null); - $action = ''; - } elseif ($result == -3) { - $error++; - setEventMessages($object->error, $object->errors, 'errors'); + $result = $object->Livraison($user, $date_liv, GETPOST("type"), GETPOST("comment")); // GETPOST("type") is 'tot', 'par', 'nev', 'can' + if ($result > 0) { + $langs->load("deliveries"); + setEventMessages($langs->trans("DeliveryStateSaved"), null); + $action = ''; + } elseif ($result == -3) { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } else { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } } else { $error++; - setEventMessages($object->error, $object->errors, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Delivery")), null, 'errors'); } - } else { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Delivery")), null, 'errors'); - } - if (!$error) { - $db->commit(); - } else { - $db->rollback(); + if (!$error) { + $db->commit(); + } else { + $db->rollback(); + } } } @@ -2640,7 +2644,11 @@ if ($action == 'create') { print ''; print ''.$langs->trans("Comment").''; - print ''; + print ''; + print ''; + print '     '; + print ''; + print ''; print "\n"; print "\n"; print "
"; From 6038ef6bba40059787a8af84faba3dc67e021ef6 Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Tue, 27 Jul 2021 12:28:18 -0500 Subject: [PATCH 082/356] Add filter select company Add filter with name alias and tva intra --- htdocs/core/class/html.form.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 178404da973..9ef0f3ee235 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1332,7 +1332,7 @@ class Form } // We search companies - $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur"; + $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.tva_intra, s.client, s.fournisseur, s.code_client, s.code_fournisseur"; if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) { $sql .= ", s.address, s.zip, s.town"; $sql .= ", dictp.code as country_code"; @@ -1384,6 +1384,7 @@ class Form $sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; } $sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'"; + $sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'"; $sql .= ")"; } $sql .= $this->db->order("nom", "ASC"); From 3e3751e16185c30b73ea20fc012813a524954a14 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Tue, 27 Jul 2021 22:13:19 +0200 Subject: [PATCH 083/356] Add url field #18212 --- htdocs/install/mysql/tables/llx_adherent.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index 787a2b15bd7..1d3a784dd74 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -48,6 +48,7 @@ create table llx_adherent state_id integer, country integer, email varchar(255), + url varchar(255) NULL, socialnetworks text DEFAULT NULL, -- json with socialnetworks skype varchar(255), -- deprecated From 42252abc07fb7a73050af8cc14205bbd96150e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 28 Jul 2021 10:14:57 +0200 Subject: [PATCH 084/356] remove debug --- htdocs/accountancy/admin/index.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 5f40022518b..9bb9fe3220c 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -93,7 +93,6 @@ if ($action == 'update') { foreach ($list as $constname) { $constvalue = GETPOST($constname, 'alpha'); - var_dump($constname); if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { $error++; } From 67cc58079763f6792673b70868ee5e3041199883 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 28 Jul 2021 10:45:47 +0200 Subject: [PATCH 085/356] Fix: Bad rights on inventory module --- htdocs/core/modules/modStock.class.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index c9379fb25d6..3494cb684dc 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2021 Ferran Marcet * * 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 @@ -148,19 +149,19 @@ class modStock extends DolibarrModules $this->rights[4][4] = 'mouvement'; $this->rights[4][5] = 'creer'; + $this->rights[5][0] = 1011; + $this->rights[5][1] = 'inventoryReadPermission'; // Permission label + $this->rights[5][3] = 0; // Permission by default for new user (0/1) + $this->rights[5][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[5][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + + $this->rights[6][0] = 1012; + $this->rights[6][1] = 'inventoryCreatePermission'; // Permission label + $this->rights[6][3] = 0; // Permission by default for new user (0/1) + $this->rights[6][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[6][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - $this->rights[5][0] = 1011; - $this->rights[5][1] = 'inventoryReadPermission'; // Permission label - $this->rights[5][3] = 0; // Permission by default for new user (0/1) - $this->rights[5][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[5][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - - $this->rights[6][0] = 1012; - $this->rights[6][1] = 'inventoryCreatePermission'; // Permission label - $this->rights[6][3] = 0; // Permission by default for new user (0/1) - $this->rights[6][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[6][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[8][0] = 1014; $this->rights[8][1] = 'inventoryValidatePermission'; // Permission label $this->rights[8][3] = 0; // Permission by default for new user (0/1) From 0cd8527c3523672383172d41f94d45ba0fca4468 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Wed, 28 Jul 2021 11:01:38 +0200 Subject: [PATCH 086/356] longer field for project ref on create and edit --- htdocs/projet/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 3c2d5b02829..ec1a0fee47c 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -511,7 +511,7 @@ if ($action == 'create' && $user->rights->projet->creer) { // Ref $suggestedref = (GETPOST("ref") ? GETPOST("ref") : $defaultref); - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print ' '.$form->textwithpicto('', $langs->trans("YouCanCompleteRef", $suggestedref)); print ''; @@ -796,7 +796,7 @@ if ($action == 'create' && $user->rights->projet->creer) { // Ref $suggestedref = $object->ref; print ''.$langs->trans("Ref").''; - print ''; + print ''; print ' '.$form->textwithpicto('', $langs->trans("YouCanCompleteRef", $suggestedref)); print ''; From 84d221988f777bced8372e3f486d6217e79658d8 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 28 Jul 2021 11:17:07 +0200 Subject: [PATCH 087/356] fix: add hook addMoreActionButton product price --- htdocs/product/price.php | 45 +++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index aad0311502d..bb46839e588 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1108,34 +1108,41 @@ print dol_get_fiche_end(); /* * Action bar */ + + if (!$action || $action == 'delete' || $action == 'showlog_customer_price' || $action == 'showlog_default_price' || $action == 'add_customer_price' || $action == 'activate_price_by_qty' || $action == 'disable_price_by_qty') { print "\n".'
'."\n"; - if ($object->isVariant()) { - if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''; - } - } else { - if (empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { - if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''; - } - } - if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been + if (empty($reshook)) { + if ($object->isVariant()) { if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''; + print ''; } - } - - if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { - if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''; + } else { + if (empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { + if ($user->rights->produit->creer || $user->rights->service->creer) { + print ''; + } } - if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''; + if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + if ($user->rights->produit->creer || $user->rights->service->creer) { + print ''; + } + } + + if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { + if ($user->rights->produit->creer || $user->rights->service->creer) { + print ''; + } + + if ($user->rights->produit->creer || $user->rights->service->creer) { + print ''; + } } } } From 2980cd9ab2e9cf1e2fa68b78fdf22ea5784d340d Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 28 Jul 2021 11:19:21 +0200 Subject: [PATCH 088/356] Fix: Price level on company list not filtering --- htdocs/societe/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 5935ac43b70..85da1594179 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -94,7 +94,7 @@ $search_categ_cus = trim(GETPOST("search_categ_cus", 'int')); $search_categ_sup = trim(GETPOST("search_categ_sup", 'int')); $search_country = GETPOST("search_country", 'intcomma'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); -$search_price_level = GETPOST('search_prive_level', 'int'); +$search_price_level = GETPOST('search_price_level', 'int'); $search_staff = GETPOST("search_staff", 'int'); $search_status = GETPOST("search_status", 'int'); $search_type = GETPOST('search_type', 'alpha'); @@ -356,7 +356,7 @@ if (empty($reshook)) { $search_idprof6 = ''; $search_vat = ''; $search_type = ''; - $search_prive_level = ''; + $search_price_level = ''; $search_type_thirdparty = ''; $search_staff = ''; $search_status = -1; @@ -639,8 +639,8 @@ if ($search_status != '' && $search_status >= 0) { if (!empty($conf->barcode->enabled) && $search_barcode) { $sql .= natural_search("s.barcode", $search_barcode); } -if ($search_prive_level && $search_prive_level != '-1') { - $sql .= natural_search("s.price_level", $search_prive_level, 2); +if ($search_price_level && $search_price_level != '-1') { + $sql .= natural_search("s.price_level", $search_price_level, 2); } if ($search_type_thirdparty && $search_type_thirdparty > 0) { $sql .= natural_search("s.fk_typent", $search_type_thirdparty, 2); @@ -813,8 +813,8 @@ if ($search_idprof6 != '') { if ($search_vat != '') { $param .= '&search_vat='.urlencode($search_vat); } -if ($search_prive_level != '') { - $param .= '&search_prive_level='.urlencode($search_prive_level); +if ($search_price_level != '') { + $param .= '&search_price_level='.urlencode($search_price_level); } if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); @@ -1094,7 +1094,7 @@ if (!empty($arrayfields['typent.code']['checked'])) { // Multiprice level if (!empty($arrayfields['s.price_level']['checked'])) { print ''; - print ''; + print ''; print ''; } // Staff From aae64eee1e1dda07a69f7efb6aa5f0ca74c37971 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 28 Jul 2021 11:48:38 +0200 Subject: [PATCH 089/356] Fix: Not correct redirect link on lots --- htdocs/product/stock/productlot_list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 58e5bd055f1..78a18ca960b 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018-2021 Ferran Marcet * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -299,7 +299,7 @@ if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; - header("Location: ".dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$id); + header("Location: ".DOL_URL_ROOT.'/product/stock/productlot_card.php?id='.$id); exit; } From 712f0b897d66047a3d5d37f90d1ab15896f77129 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 28 Jul 2021 12:02:45 +0200 Subject: [PATCH 090/356] FIX: Accountancy - Debug Export Sage50 / CIEL Compta / CIEL Compta Evo (Format XIMPORT) --- .../class/accountancyexport.class.php | 35 ++++++++++++------- htdocs/accountancy/tpl/export_journal.tpl.php | 6 ++-- htdocs/langs/en_US/accountancy.lang | 2 +- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 6ef54ea3029..aa3e24ab545 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Pierre-Henry Favre - * Copyright (C) 2016-2020 Alexandre Spangaro + * Copyright (C) 2016-2021 Alexandre Spangaro * Copyright (C) 2013-2017 Olivier Geffroy * Copyright (C) 2017 Elarifr. Ari Elbaz * Copyright (C) 2017-2019 Frédéric France @@ -439,33 +439,42 @@ class AccountancyExport } /** - * Export format : CIEL + * Export format : CIEL (Format XIMPORT) + * Format since 2003 compatible CIEL version > 2002 / Sage50 + * + * Help : https://sage50c.online-help.sage.fr/aide-technique/ + * In sage software | Use menu : "Exchange" > "Importing entries..." + * + * If you want to force filename to "XIMPORT.TXT" for automatically import file present in a directory : + * use constant ACCOUNTING_EXPORT_XIMPORT_FORCE_FILENAME * * @param array $TData data * @return void */ public function exportCiel(&$TData) { - global $conf; - $end_line = "\r\n"; $i = 1; - $date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd + foreach ($TData as $data) { - $code_compta = $data->numero_compte; - if (!empty($data->subledger_account)) - $code_compta = $data->subledger_account; + $code_compta = length_accountg($data->numero_compte); + if (!empty($data->subledger_account)) { + $code_compta = length_accounta($data->subledger_account); + } + + $date_creation = dol_print_date($data->date_creation, '%Y%m%d'); + $date_document = dol_print_date($data->doc_date, '%Y%m%d'); $Tab = array(); - $Tab['num_ecriture'] = str_pad($i, 5); + $Tab['num_ecriture'] = str_pad($data->piece_num, 5); $Tab['code_journal'] = str_pad($data->code_journal, 2); - $Tab['date_ecriture'] = $date_ecriture; - $Tab['date_ope'] = dol_print_date($data->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE); - $Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12); + $Tab['date_ecriture'] = $date_creation; + $Tab['date_ope'] = $date_document; + $Tab['num_piece'] = str_pad(self::trunc($data->doc_ref, 12), 12); $Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11); $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).dol_string_unaccent($data->label_operation), 25), 25); - $Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT); + $Tab['montant'] = str_pad(price2fec(abs($data->montant)), 13, ' ', STR_PAD_LEFT); $Tab['type_montant'] = str_pad($data->sens, 1); $Tab['vide'] = str_repeat(' ', 18); $Tab['intitule_compte'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 34), 34); diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index fb957db2233..c53ec1197f9 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -58,9 +58,9 @@ if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$ $endaccountingperiod = dol_print_date(dol_get_last_day($tmparray['year'], $tmparray['mon']), 'dayxcard'); $completefilename = $siren."FEC".$endaccountingperiod.".txt"; -} -else -{ +} elseif ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$EXPORT_TYPE_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; } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index fea7bf9d0ef..bf58e28e4f6 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -311,7 +311,7 @@ Modelcsv_normal=Classic export Modelcsv_CEGID=Export for CEGID Expert Comptabilité Modelcsv_COALA=Export for Sage Coala Modelcsv_bob50=Export for Sage BOB 50 -Modelcsv_ciel=Export for Sage Ciel Compta or Compta Evolution +Modelcsv_ciel=Export for Sage50, Ciel Compta or Compta Evo. (Format XIMPORT) Modelcsv_quadratus=Export for Quadratus QuadraCompta Modelcsv_ebp=Export for EBP Modelcsv_cogilog=Export for Cogilog From 95ecbb89407e07b8469cdef34cbd45bbce575ccc Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 28 Jul 2021 12:05:46 +0200 Subject: [PATCH 091/356] FIX: add include missing file '/core/actions_dellink.inc.php' in project card --- htdocs/projet/card.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 3c2d5b02829..00c5bb781b2 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -89,6 +89,8 @@ $socid = GETPOST('socid', 'int'); //if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. restrictedArea($user, 'projet', $object->id, 'projet&project'); +$permissiondellink = $user->rights->projet->creer; // Used by the include of actions_dellink.inc.php + /* * Actions @@ -121,6 +123,8 @@ if (empty($reshook)) { $action = ''; } + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once + if ($action == 'add' && $user->rights->projet->creer) { $error = 0; if (!GETPOST('ref')) { From 2cd7513936efe2d46b3716f03c788be62d4349de Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 28 Jul 2021 12:18:35 +0200 Subject: [PATCH 092/356] NEW: add link to a element by ref --- htdocs/core/actions_dellink.inc.php | 31 ++++++++++++++++++++++++--- htdocs/core/class/html.form.class.php | 17 ++++++++++++++- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/htdocs/core/actions_dellink.inc.php b/htdocs/core/actions_dellink.inc.php index a7ac035506f..60ca4af7409 100644 --- a/htdocs/core/actions_dellink.inc.php +++ b/htdocs/core/actions_dellink.inc.php @@ -27,17 +27,42 @@ // $permissiondellink must be defined $dellinkid = GETPOST('dellinkid', 'int'); +$addlink = GETPOST('addlink','alpha'); $addlinkid = GETPOST('idtolinkto', 'int'); +$addlinkref = GETPOST('reftolinkto','alpha'); +$cancellink = GETPOST('cancel','alpha'); // Link invoice to order -if ($action == 'addlink' && !empty($permissiondellink) && !GETPOST('cancel', 'alpha') && $id > 0 && $addlinkid > 0) { +if ($action == 'addlink' && !empty($permissiondellink) && !$cancellink && $id > 0 && $addlinkid > 0) { $object->fetch($id); $object->fetch_thirdparty(); - $result = $object->add_object_linked(GETPOST('addlink', 'alpha'), $addlinkid); + $result = $object->add_object_linked($addlink, $addlinkid); +} + +// Link by reference +if ($action == 'addlinkbyref' && ! empty($permissiondellink) && !$cancellink && $id > 0 && !empty($addlinkref) && !empty($conf->global->MAIN_LINK_BY_REF_IN_LINKTO)) { + $element_prop = getElementProperties($addlink); + if (is_array($element_prop)) { + dol_include_once('/' . $element_prop['classpath'] . '/' . $element_prop['classfile'] . '.class.php'); + + $objecttmp = new $element_prop['classname']($db); + $ret = $objecttmp->fetch(0, $addlinkref); + if ($ret > 0) { + $object->fetch($id); + $object->fetch_thirdparty(); + $result = $object->add_object_linked($addlink, $objecttmp->id); + if (isset($_POST['reftolinkto'])) unset($_POST['reftolinkto']); + } elseif ($ret < 0) { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + } else { + $langs->load('errors'); + setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors'); + } + } } // Delete link -if ($action == 'dellink' && !empty($permissiondellink) && !GETPOST('cancel', 'alpha') && $dellinkid > 0) { +if ($action == 'dellink' && !empty($permissiondellink) && !$cancellink && $dellinkid > 0) { $result = $object->deleteObjectLinked(0, '', 0, '', $dellinkid); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9ef0f3ee235..a6280a7c9f5 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7971,6 +7971,21 @@ class Form if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { print '
use_javascript_ajax) ? '' : ' style="display:none"').'>'; + + if (!empty($conf->global->MAIN_LINK_BY_REF_IN_LINKTO)) { + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
' . $langs->trans("Ref") . '  
'; + print '
'; + } + $sql = $possiblelink['sql']; $resqllist = $this->db->query($sql); @@ -8028,7 +8043,7 @@ class Form print '
'; //$linktoelem.=($linktoelem?'   ':''); - if ($num > 0) { + if ($num > 0 || !empty($conf->global->MAIN_LINK_BY_REF_IN_LINKTO)) { $linktoelemlist .= '
  • '.$langs->trans($possiblelink['label']).' ('.$num.')
  • '; // } else $linktoelem.=$langs->trans($possiblelink['label']); } else { From b4ccb1b3551b089437555ebe7ea73e56837b8f11 Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 28 Jul 2021 12:29:17 +0200 Subject: [PATCH 093/356] Corrections stickler-ci --- htdocs/core/actions_dellink.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/actions_dellink.inc.php b/htdocs/core/actions_dellink.inc.php index 60ca4af7409..fbecacce515 100644 --- a/htdocs/core/actions_dellink.inc.php +++ b/htdocs/core/actions_dellink.inc.php @@ -27,10 +27,10 @@ // $permissiondellink must be defined $dellinkid = GETPOST('dellinkid', 'int'); -$addlink = GETPOST('addlink','alpha'); +$addlink = GETPOST('addlink', 'alpha'); $addlinkid = GETPOST('idtolinkto', 'int'); -$addlinkref = GETPOST('reftolinkto','alpha'); -$cancellink = GETPOST('cancel','alpha'); +$addlinkref = GETPOST('reftolinkto', 'alpha'); +$cancellink = GETPOST('cancel', 'alpha'); // Link invoice to order if ($action == 'addlink' && !empty($permissiondellink) && !$cancellink && $id > 0 && $addlinkid > 0) { From 7acebd28ca0196f3a720e8226e8e08e95e3e4a2b Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 28 Jul 2021 14:08:53 +0200 Subject: [PATCH 094/356] Add information --- htdocs/accountancy/class/accountancyexport.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index aa3e24ab545..009a4c3cb74 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -441,6 +441,7 @@ class AccountancyExport /** * Export format : CIEL (Format XIMPORT) * Format since 2003 compatible CIEL version > 2002 / Sage50 + * Last review for this format : 2021/07/28 Alexandre Spangaro (aspangaro@open-dsi.fr) * * Help : https://sage50c.online-help.sage.fr/aide-technique/ * In sage software | Use menu : "Exchange" > "Importing entries..." From 2054cca6e5606e00869f06c12f76b6890a6215fd Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Wed, 28 Jul 2021 15:14:18 +0200 Subject: [PATCH 095/356] FIX #18267 --- htdocs/bom/bom_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 76f16c838be..2cd7492395d 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -297,7 +297,7 @@ $sql .= $object->getFieldList('t'); // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.', ' : ''); + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.' ' : ''); } } // Add fields from hooks From df8f09985797a38747e939545012ec1e13ab7fc7 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 28 Jul 2021 15:57:12 +0200 Subject: [PATCH 096/356] Fix a bug in ecm for v14 --- 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 110d80b45d1..2b8a2d15aff 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1182,7 +1182,7 @@ class FormFile ); $reshook = $hookmanager->executeHooks('showFilesList', $parameters, $object); - if (isset($reshook) && $reshook != '') { // null or '' for bypass + if (!empty($reshook)) { // null or '' for bypass return $reshook; } else { if (!is_object($form)) { From f8563ace0d9bb81ebb89f7302f88450bc242777a Mon Sep 17 00:00:00 2001 From: laurantines Date: Wed, 28 Jul 2021 16:14:38 +0200 Subject: [PATCH 097/356] Fix opp statusbrequires even if PROJECT_USE_OPPORTUNITIES off If I modify a project and do not have PROJECT_USE_OPPORTUNITIES enabled, I cannot change the project budget. I get the error message that ErrorOppStatusRequiredIfAmount. However, I do not have the opportunities enabled and it does not make sense for that message to appear when I have not added any opportunities. --- htdocs/projet/card.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 00c5bb781b2..4ee23fd632b 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -136,9 +136,11 @@ if (empty($reshook)) { $error++; } - if (GETPOST('opp_amount') != '' && !(GETPOST('opp_status') > 0)) { - $error++; - setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors'); + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (GETPOST('opp_amount') != '' && !(GETPOST('opp_status') > 0)) { + $error++; + setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors'); + } } // Create with status validated immediatly @@ -274,9 +276,11 @@ if (empty($reshook)) { } } - if ($object->opp_amount && ($object->opp_status <= 0)) { - $error++; - setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors'); + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if ($object->opp_amount && ($object->opp_status <= 0)) { + $error++; + setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors'); + } } if (!$error) { From cd63ede35a6c3db0ada94c096949abb0da1ddd09 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 28 Jul 2021 16:46:57 +0200 Subject: [PATCH 098/356] Correctif date --- htdocs/accountancy/class/accountancyexport.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 009a4c3cb74..7cd1a153183 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -464,14 +464,14 @@ class AccountancyExport $code_compta = length_accounta($data->subledger_account); } - $date_creation = dol_print_date($data->date_creation, '%Y%m%d'); - $date_document = dol_print_date($data->doc_date, '%Y%m%d'); + $date_document = dol_print_date($data->doc_date, '%Y%m%d'); + $date_echeance = dol_print_date($data->date_lim_reglement, '%Y%m%d'); $Tab = array(); $Tab['num_ecriture'] = str_pad($data->piece_num, 5); $Tab['code_journal'] = str_pad($data->code_journal, 2); - $Tab['date_ecriture'] = $date_creation; - $Tab['date_ope'] = $date_document; + $Tab['date_ecriture'] = str_pad($date_document, 8, ' ', STR_PAD_LEFT); + $Tab['date_echeance'] = str_pad($date_echeance, 8, ' ', STR_PAD_LEFT); $Tab['num_piece'] = str_pad(self::trunc($data->doc_ref, 12), 12); $Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11); $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).dol_string_unaccent($data->label_operation), 25), 25); From 20add7d3fcbc0b9189ae2197880c09dd56601f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josep=20Llu=C3=ADs?= Date: Wed, 28 Jul 2021 18:02:55 +0200 Subject: [PATCH 099/356] FIX totalDayAll hours in tasks The extra days hours were not considered in total hours --- htdocs/core/js/timesheet.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/js/timesheet.js b/htdocs/core/js/timesheet.js index 0c8c9ff3245..e9e66787aa0 100644 --- a/htdocs/core/js/timesheet.js +++ b/htdocs/core/js/timesheet.js @@ -1,5 +1,6 @@ /* Copyright (C) 2014 delcroip * Copyright (C) 2015-2017 Laurent Destailleur + * Copyright (C) 2021 Josep Lluís Amador * * 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 @@ -257,7 +258,7 @@ function updateTotal(days,mode) result=parseTime(jQuery('.totalDay'+stringdays).text(),taskTime); if (result >= 0) { - totalhour = totalhour + taskTime.getHours(); + totalhour = totalhour + taskTime.getHours() + result*24; totalmin = totalmin + taskTime.getMinutes(); } } From 99e256a4172c535a70a756389cb972787740ce38 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 28 Jul 2021 18:22:26 +0200 Subject: [PATCH 100/356] Update functions.lib.php --- 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 410dbd827fe..a6c62ba2a47 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10204,7 +10204,7 @@ function newToken() */ function currentToken() { - return isset($_SESSION['token']) ? $_SESSION['token'] : null; + return isset($_SESSION['token']) ? $_SESSION['token'] : ''; } /** From ae5d17815f03a80c9ef21ac4917c1ff0db852e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 27 Jul 2021 10:26:51 +0200 Subject: [PATCH 101/356] Update dolreceiptprinter.class.php --- htdocs/core/class/dolreceiptprinter.class.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 45c87401416..a3ddb3d7c7f 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -680,9 +680,7 @@ class dolReceiptPrinter extends Printer foreach ($object->lines as $line) { $total_localtax1 += $line->total_localtax1; } - foreach ($vatarray as $vatkey => $vatvalue) { - $this->printer->text(str_pad(price($total_localtax1), 10, ' ', STR_PAD_LEFT)."\n"); - } + $this->printer->text(str_pad(price($total_localtax1), 10, ' ', STR_PAD_LEFT)."\n"); break; case 'DOL_PRINT_OBJECT_TAX2': //var_dump($object); @@ -690,9 +688,7 @@ class dolReceiptPrinter extends Printer foreach ($object->lines as $line) { $total_localtax2 += $line->total_localtax2; } - foreach ($vatarray as $vatkey => $vatvalue) { - $this->printer->text(str_pad(price($total_localtax2), 10, ' ', STR_PAD_LEFT)."\n"); - } + $this->printer->text(str_pad(price($total_localtax2), 10, ' ', STR_PAD_LEFT)."\n"); break; case 'DOL_PRINT_OBJECT_TOTAL': $title = $langs->trans('TotalHT'); From e7af8e9d5ea7d825bea0d58d6e1d816388d0dd73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josep=20Llu=C3=ADs?= Date: Wed, 28 Jul 2021 18:02:55 +0200 Subject: [PATCH 102/356] FIX totalDayAll hours in tasks The extra days hours were not considered in total hours --- htdocs/core/js/timesheet.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/js/timesheet.js b/htdocs/core/js/timesheet.js index 0c8c9ff3245..e9e66787aa0 100644 --- a/htdocs/core/js/timesheet.js +++ b/htdocs/core/js/timesheet.js @@ -1,5 +1,6 @@ /* Copyright (C) 2014 delcroip * Copyright (C) 2015-2017 Laurent Destailleur + * Copyright (C) 2021 Josep Lluís Amador * * 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 @@ -257,7 +258,7 @@ function updateTotal(days,mode) result=parseTime(jQuery('.totalDay'+stringdays).text(),taskTime); if (result >= 0) { - totalhour = totalhour + taskTime.getHours(); + totalhour = totalhour + taskTime.getHours() + result*24; totalmin = totalmin + taskTime.getMinutes(); } } From f6d03fe28ef943906d824b3aaf8db11abf2af9d2 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Wed, 28 Jul 2021 21:45:11 +0200 Subject: [PATCH 103/356] Fix update product lot --- htdocs/product/stock/class/productlot.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 52322cf4697..360978ac736 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -402,7 +402,7 @@ class Productlot extends CommonObject $sql .= ' sellby = '.(!isset($this->sellby) || dol_strlen($this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null').','; $sql .= ' eol_date = '.(!isset($this->eol_date) || dol_strlen($this->eol_date) != 0 ? "'".$this->db->idate($this->eol_date)."'" : 'null').','; $sql .= ' manufacturing_date = '.(!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) != 0 ? "'".$this->db->idate($this->manufacturing_date)."'" : 'null').','; - $sql .= ' scrapping_date = '.(!isset($this->destruction_date) || dol_strlen($this->destruction_date) != 0 ? "'".$this->db->idate($this->destruction_date)."'" : 'null').','; + $sql .= ' scrapping_date = '.(!isset($this->scrapping_date) || dol_strlen($this->scrapping_date) != 0 ? "'".$this->db->idate($this->scrapping_date)."'" : 'null').','; //$sql .= ' commissionning_date = '.(!isset($this->first_use_date) || dol_strlen($this->first_use_date) != 0 ? "'".$this->db->idate($this->first_use_date)."'" : 'null').','; //$sql .= ' qc_frequency = '.(!isset($this->qc_frequency) || dol_strlen($this->qc_frequency) != 0 ? "'".$this->db->escape($this->qc_frequency)."'" : 'null').','; $sql .= ' datec = '.(!isset($this->datec) || dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').','; From fdd0ab8461c46556b0fcc11e3aae539eb3401589 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Wed, 28 Jul 2021 23:56:44 +0200 Subject: [PATCH 104/356] FIX $conf->task used but it does not exist, use $conf->projet instead --- .../modules/project/task/doc/doc_generic_task_odt.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 566c7f07a2e..638ab70bb84 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -524,8 +524,8 @@ class doc_generic_task_odt extends ModelePDFTask //print "conf->societe->dir_temp=".$conf->societe->dir_temp; dol_mkdir($conf->projet->dir_temp); - if (!is_writable($conf->task->dir_temp)) { - $this->error = "Failed to write in temp directory ".$conf->task->dir_temp; + if (!is_writable($conf->projet->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->projet->dir_temp; dol_syslog('Error in write_file: '.$this->error, LOG_ERR); return -1; } From 262dd1600b67fec20c028e4021c12456951e3549 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 29 Jul 2021 06:23:12 +0200 Subject: [PATCH 105/356] FIX: Invoice - Missing button to reopen an abandoned situation invoice --- htdocs/compta/facture/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 519f40c254a..fe5d5c3ab0a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5206,7 +5206,8 @@ elseif ($id > 0 || !empty($ref)) // Reopen a standard paid invoice if ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) || ($object->type == Facture::TYPE_CREDIT_NOTE && empty($discount->id)) - || ($object->type == Facture::TYPE_DEPOSIT && empty($discount->id))) + || ($object->type == Facture::TYPE_DEPOSIT && empty($discount->id)) + || ($object->type == Facture::TYPE_SITUATION && empty($discount->id))) && ($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || $usercanreopen)) // A paid invoice (partially or completely) { From 8d87bdcf7e86bac4f9305bf54df547e0eeadb9b2 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 29 Jul 2021 08:18:55 +0200 Subject: [PATCH 106/356] add sql data for fresh install --- htdocs/install/mysql/data/llx_c_action_trigger.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index 45503449492..38f4b57a72e 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -67,6 +67,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_SUBMIT','Supplier order request submited','Executed when a supplier order is approved','order_supplier',13); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_RECEIVE','Supplier order request received','Executed when a supplier order is received','order_supplier',13); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CANCEL','Supplier order request canceled','Executed when a supplier order is canceled','order_supplier',13); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_SENTBYMAIL','Supplier order sent by mail','Executed when a supplier order is sent by mail','order_supplier',14); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CLASSIFY_BILLED','Supplier order set billed','Executed when a supplier order is set as billed','order_supplier',14); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_DELETE','Supplier order deleted','Executed when a supplier order is deleted','order_supplier',14); From da482018d217d7cfe149b0e91630a3d1718d82b7 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 29 Jul 2021 10:51:51 +0200 Subject: [PATCH 107/356] Fix for php 8 --- htdocs/core/class/CMailFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 5683c8e6a07..33db393bbc6 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1628,7 +1628,7 @@ class CMailFile * @return array array of email => name * @see getValidAddress() */ - public function getArrayAddress($address) + public static function getArrayAddress($address) { global $conf; From b5c30126cb646ad10eed29d364e05daef976c443 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 29 Jul 2021 14:49:41 +0200 Subject: [PATCH 108/356] extend the hook `getElementList` to make $ids in the hooked function --- htdocs/projet/class/project.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index a570e8ed7bb..4f52dd48057 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -744,7 +744,8 @@ class Project extends CommonObject 'datefieldname' => $datefieldname, 'dates' => $dates, 'datee' => $datee, - 'fk_projet' => $projectkey + 'fk_projet' => $projectkey, + 'ids' => $ids, ); $reshook = $hookmanager->executeHooks('getElementList', $parameters, $object, $action); if ($reshook > 0) { From ae5bb956accb6dc81c266f8c90f2806b955db178 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 29 Jul 2021 17:18:05 +0200 Subject: [PATCH 109/356] fix invoice in stand registration pb --- htdocs/core/class/commonobject.class.php | 6 +- htdocs/core/class/html.form.class.php | 4 + .../conferenceorbooth_card.php | 45 +++++- .../conferenceorbooth_list.php | 2 - .../conferenceorboothattendee_card.php | 10 +- .../tpl/linkedobjectblock.tpl.php | 47 +++++++ htdocs/langs/en_US/eventorganization.lang | 2 + htdocs/public/payment/paymentok.php | 9 +- htdocs/public/project/suggestbooth.php | 130 ++++++++++-------- 9 files changed, 191 insertions(+), 64 deletions(-) create mode 100644 htdocs/eventorganization/tpl/linkedobjectblock.tpl.php diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ceac7015065..36df3b1a7b9 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3791,7 +3791,6 @@ abstract class CommonObject } elseif ($objecttype == 'contact') { $module = 'societe'; } - // Set classfile $classfile = strtolower($subelement); $classname = ucfirst($subelement); @@ -3823,6 +3822,11 @@ abstract class CommonObject $classfile = 'conferenceorboothattendee'; $classname = 'ConferenceOrBoothAttendee'; $module = 'eventorganization'; + } elseif ($objecttype == 'conferenceorbooth') { + $classpath = 'eventorganization/class'; + $classfile = 'conferenceorbooth'; + $classname = 'ConferenceOrBooth'; + $module = 'eventorganization'; } // Here $module, $classfile and $classname are set diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 816e0a79225..d548c7d91e1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7642,6 +7642,10 @@ class Form $tplpath = 'expensereport'; } elseif ($objecttype == 'subscription') { $tplpath = 'adherents'; + } elseif ($objecttype == 'conferenceorbooth') { + $tplpath = 'eventorganization'; + } elseif ($objecttype == 'conferenceorboothattendee') { + $tplpath = 'eventorganization'; } global $linkedObjectBlock; diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index f983994c4ec..6ae9ab9664b 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -330,7 +330,15 @@ if (!empty($withproject)) { print ""; print ''.$langs->trans("EventOrganizationICSLink").''; - print ''; + // Define $urlwithroot + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; + + // Show message + $message = 'global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...'); + $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').''; + print $message; print ""; print ''; @@ -496,6 +504,41 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $keyforbreak='pubregister'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + $object->fetchObjectLinked(); + + + if (is_array($object->linkedObjects) && count($object->linkedObjects)>0 && array_key_exists("facture", $object->linkedObjects)) { + foreach ($object->linkedObjects["facture"] as $fac) { + /** + * @var $fac Facture + */ + if (empty($fac->paye)) { + $key = 'paymentlink_'.$fac->id; + print ''; + print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePayment", $langs->transnoentitiesnoconv('Online')) . ' '. $fac->ref.'
    '; + print ''; + + print ''; + $sourcetouse = 'boothlocation'; + $reftouse = $fac->id; + $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse.'&booth='.$object->id; + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { + $redirection .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical + } else { + $redirection .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; + } + } + print ''; + print ''; + print ''; + } + } + } //var_dump($object); // Other attributes. Fields from hook formObjectOptions and Extrafields. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 0b1221006a8..ab595e8b86e 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -421,8 +421,6 @@ if ($projectid > 0) { $message = 'global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...'); $message .= "&project=".$projectid.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').''; - $message .= '
    '; - $message .= '
    '; print $message; print ""; diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index c5f3a91b10e..fe5ea292e8b 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -336,7 +336,15 @@ if (!empty($withproject)) { print ""; print ''.$langs->trans("EventOrganizationICSLink").''; - print ''; + // Define $urlwithroot + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; + + // Show message + $message = 'global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...'); + $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').''; + print $message; print ""; print ''; diff --git a/htdocs/eventorganization/tpl/linkedobjectblock.tpl.php b/htdocs/eventorganization/tpl/linkedobjectblock.tpl.php new file mode 100644 index 00000000000..f67e086a575 --- /dev/null +++ b/htdocs/eventorganization/tpl/linkedobjectblock.tpl.php @@ -0,0 +1,47 @@ + + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2014 Marcos García + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Protection to avoid direct call of template +if (empty($conf) || !is_object($conf)) { + print "Error, template page can't be called as URL"; + exit; +} + +echo "\n"; + +global $user; + +$langs = $GLOBALS['langs']; +$linkedObjectBlock = $GLOBALS['linkedObjectBlock']; +$langs->load("eventorganization"); + +$total = 0; +foreach ($linkedObjectBlock as $key => $objectlink) { + echo ''; + echo '' . $langs->trans(get_class($objectlink)) . ''; + echo ''.$objectlink->getNomUrl(1).''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + echo ''; +} + +echo "\n"; diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index f361e6bc192..67a242e640a 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -119,6 +119,8 @@ EventType = Event type LabelOfBooth=Booth label LabelOfconference=Conference label ConferenceIsNotConfirmed=Subcription not available, conference is not confirmed yet +DateMustBeBeforeThan=%s must be before %s +DateMustBeAfterThan=%s must be after %s # # Vote page diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 2f566d4bb31..4db8a62a625 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1031,6 +1031,8 @@ if ($ispaymentok) { if ($resultattendee < 0) { setEventMessages(null, $attendeetovalidate->errors, "errors"); } else { + $attendeetovalidate->amount=$FinalPaymentAmt; + $attendeetovalidate->update($user); $attendeetovalidate->validate($user); // Sending mail @@ -1051,8 +1053,9 @@ if ($ispaymentok) { $arraydefaultmessage = null; $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; + if (!empty($labeltouse)) { - $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); + $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, ''); } if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { @@ -1066,7 +1069,7 @@ if ($ispaymentok) { $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); - $sendto = $thirdparty->email; + $sendto = $attendeetovalidate->email; $from = $conf->global->MAILING_EMAIL_FROM; $urlback = $_SERVER["REQUEST_URI"]; @@ -1233,7 +1236,7 @@ if ($ispaymentok) { $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; if (!empty($labeltouse)) { - $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); + $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, ''); } if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index 3ab8e165c7e..c695ea9cec1 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -81,9 +81,8 @@ $email = GETPOST("email"); $societe = GETPOST("societe"); $label = GETPOST("label"); $note = GETPOST("note"); -$datestart = GETPOST("datestart"); -$dateend = GETPOST("dateend"); - +$datestart = dol_mktime(0, 0, 0, GETPOST('datestartmonth', 'int'), GETPOST('datestartday', 'int'), GETPOST('datestartyear', 'int')); +$dateend = dol_mktime(23, 59, 59, GETPOST('dateendmonth', 'int'), GETPOST('dateendday', 'int'), GETPOST('dateendyear', 'int')); $id = GETPOST('id'); $project = new Project($db); @@ -225,13 +224,19 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Note"))."
    \n"; } - if (!GETPOST("datestart")) { + if (empty($datestart)) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateStart"))."
    \n"; + } elseif ($datestart < $project->date_start) { + $error++; + $errmsg .= $langs->trans("DateMustBeAfterThan", $langs->transnoentitiesnoconv("DateStart"), dol_print_date($project->date_start))."
    \n"; } - if (!GETPOST("dateend")) { + if (empty($dateend)) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd"))."
    \n"; + } elseif ($dateend > dol_mktime(23, 59, 59, dol_print_date($project->date_end, '%m'), dol_print_date($project->date_end, '%d'), dol_print_date($project->date_end, '%Y'))) { + $error++; + $errmsg .= $langs->trans("DateMustBeBeforeThan", $langs->transnoentitiesnoconv("DateEnd"), dol_print_date($project->date_end))."
    \n"; } if (!GETPOST("email")) { $error++; @@ -376,7 +381,7 @@ if (empty($reshook) && $action == 'add') { $conforbooth->fk_project = $project->id; $conforbooth->note = $note; $conforbooth->fk_action = $eventtype; - $conforbooth->datep =$datestart; + $conforbooth->datep = $datestart; $conforbooth->datep2 = $dateend; $conforbooth->datec = dol_now(); $conforbooth->tms = dol_now(); @@ -423,7 +428,7 @@ if (empty($reshook) && $action == 'add') { $error++; } else { $db->commit(); - $facture->add_object_linked($contact->element, $contact->id); + $facture->add_object_linked($conforbooth->element, $conforbooth->id); } } @@ -436,7 +441,7 @@ if (empty($reshook) && $action == 'add') { $contact->errors = $facture->errors; $error++; } - if (!$error) { + /*if (!$error) { $valid = true; $sourcetouse = 'boothlocation'; $reftouse = $facture->id; @@ -450,54 +455,12 @@ if (empty($reshook) && $action == 'add') { } Header("Location: ".$redirection); exit; - } + }*/ } } else { // If no price has been set for the booth, we confirm it as suggested and we update $conforbooth->status = ConferenceOrBooth::STATUS_SUGGESTED; $conforbooth->update($user); - // Sending mail - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - // Set output language - $outputlangs = new Translate('', $conf); - $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); - // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); - // Get email content from template - $arraydefaultmessage = null; - - $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH; - if (!empty($labeltouse)) { - $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, ''); - } - - if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { - $subject = $arraydefaultmessage->topic; - $msg = $arraydefaultmessage->content; - } - - $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); - complete_substitutions_array($substitutionarray, $outputlangs, $object); - - $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); - $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); - - $sendto = $thirdparty->email; - $from = $conf->global->MAILING_EMAIL_FROM; - $urlback = $_SERVER["REQUEST_URI"]; - - $ishtml = dol_textishtml($texttosend); // May contain urls - - $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); - - $result = $mailfile->sendfile(); - if ($result) { - dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); - } else { - dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); - } } } } @@ -505,6 +468,50 @@ if (empty($reshook) && $action == 'add') { } if (!$error) { $db->commit(); + + // Sending mail + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + // Set output language + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "members")); + // Get email content from template + $arraydefaultmessage = null; + + $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH; + if (!empty($labeltouse)) { + $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, ''); + } + + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { + $subject = $arraydefaultmessage->topic; + $msg = $arraydefaultmessage->content; + } + + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + + $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); + $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); + + $sendto = $thirdparty->email; + $from = $conf->global->MAILING_EMAIL_FROM; + $urlback = $_SERVER["REQUEST_URI"]; + + $ishtml = dol_textishtml($texttosend); // May contain urls + + $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); + + $result = $mailfile->sendfile(); + if ($result) { + dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); + } else { + dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); + } + $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$id.'&securekey='.$securekeyurl; Header("Location: ".$redirection); @@ -630,12 +637,23 @@ print '*'."\n"; print ''."\n"; // Start Date -print ''.$langs->trans("DateStart").'*'."\n"; -print ''."\n"; +print ''.$langs->trans("DateStart").'*'; +if (!empty($project->date_start)) { + print '('.$langs->trans('Min'). ' '.dol_print_date($project->date_start).')'; +} +print ''."\n"; +print ''; +print $form->selectDate((empty($datestart)?$project->date_start:$datestart), 'datestart'); +print ''."\n"; // End Date -print ''.$langs->trans("DateEnd").'*'."\n"; -print ''."\n"; - +print ''.$langs->trans("DateEnd").'*'; +if (!empty($project->date_end)) { + print '('.$langs->trans('Max'). ' '.dol_print_date($project->date_end).')'; +} +print ''."\n"; +print ''; +print $form->selectDate(empty($dateend)?$project->date_end:$dateend, 'dateend'); +print ''."\n"; print "\n"; From 78646d10bb80f5b94ccaf7475ff6a544822d5b09 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 29 Jul 2021 17:26:17 +0200 Subject: [PATCH 110/356] tpl object linked --- .../tpl/linkedobjectblock.tpl.php | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/htdocs/eventorganization/tpl/linkedobjectblock.tpl.php b/htdocs/eventorganization/tpl/linkedobjectblock.tpl.php index f67e086a575..f2bb6f0c3ae 100644 --- a/htdocs/eventorganization/tpl/linkedobjectblock.tpl.php +++ b/htdocs/eventorganization/tpl/linkedobjectblock.tpl.php @@ -36,10 +36,24 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo ''; echo '' . $langs->trans(get_class($objectlink)) . ''; echo ''.$objectlink->getNomUrl(1).''; - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + if (get_class($objectlink)=='ConferenceOrBooth') { + print dol_trunc($objectlink->label, 20); + } + print ''; + echo ''; + if (get_class($objectlink)=='ConferenceOrBoothAttendee') { + print dol_print_date($objectlink->date_subscription); + } else { + print dol_print_date($objectlink->datep); + } + print ''; + echo ''; + if (get_class($objectlink)=='ConferenceOrBoothAttendee') { + print price($objectlink->amount); + } + print ''; + echo ''.$objectlink->getLibStatut(3).''; echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; echo ''; } From 12b2ba64eb7a8a2dd5f6b84c0d692e1bdf0e040b Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 29 Jul 2021 17:49:37 +0200 Subject: [PATCH 111/356] Fix right check on thirdparty set on ticket card --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index aaf5b29a985..08d9330a4c6 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -449,7 +449,7 @@ if (empty($reshook)) { } // Set parent company - if ($action == 'set_thirdparty' && $user->rights->societe->creer) { + if ($action == 'set_thirdparty' && $user->rights->ticket->write) { if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { $result = $object->setCustomer(GETPOST('editcustomer', 'int')); $url = 'card.php?action=view&track_id=' . GETPOST('track_id', 'alpha'); From 6f3080c67c1e1bb5678e4f3cbc1b488568ae8b82 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 29 Jul 2021 19:24:12 +0200 Subject: [PATCH 112/356] send mail from ConfOrBooth list to attendees or santd company --- htdocs/core/class/html.formmail.class.php | 2 +- .../conferenceorbooth_contact.php | 10 +- .../conferenceorbooth_document.php | 11 +- .../conferenceorbooth_list.php | 15 +- .../conferenceorboothattendee_list.php | 10 +- .../core/actions_massactions_mail.inc.php | 315 ++++++++++++++++++ .../tpl/massactions_mail_pre.tpl.php | 130 ++++++++ .../mysql/data/llx_c_email_templates.sql | 12 +- htdocs/langs/fr_FR/eventorganization.lang | 4 +- 9 files changed, 492 insertions(+), 17 deletions(-) create mode 100644 htdocs/eventorganization/core/actions_massactions_mail.inc.php create mode 100644 htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 06b6a18b870..9da814f3369 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1255,7 +1255,7 @@ class FormMail extends Form */ public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '') { - global $conf; + global $conf, $langs; $ret = new ModelMail(); diff --git a/htdocs/eventorganization/conferenceorbooth_contact.php b/htdocs/eventorganization/conferenceorbooth_contact.php index 4906a4e05e3..8595da92652 100644 --- a/htdocs/eventorganization/conferenceorbooth_contact.php +++ b/htdocs/eventorganization/conferenceorbooth_contact.php @@ -309,7 +309,15 @@ if (!empty($withproject)) { print ""; print ''.$langs->trans("EventOrganizationICSLink").''; - print ''; + // Define $urlwithroot + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; + + // Show message + $message = 'global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...'); + $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').''; + print $message; print ""; print ''; diff --git a/htdocs/eventorganization/conferenceorbooth_document.php b/htdocs/eventorganization/conferenceorbooth_document.php index fc3673d618f..8b064c12b72 100644 --- a/htdocs/eventorganization/conferenceorbooth_document.php +++ b/htdocs/eventorganization/conferenceorbooth_document.php @@ -266,8 +266,15 @@ if (!empty($withproject)) { print ""; print ''.$langs->trans("EventOrganizationICSLink").''; - print ''; - //TODO fill with ics + // Define $urlwithroot + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; + + // Show message + $message = 'global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...'); + $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').''; + print $message; print ""; print ''; diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index ab595e8b86e..270c87fb15c 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -173,7 +173,10 @@ if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } -if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' + && $massaction != 'presend_attendees' + && $massaction != 'confirm_presend' + && $massaction != 'confirm_presend_attendees') { $massaction = ''; } @@ -211,6 +214,7 @@ if (empty($reshook)) { $objectclass = 'ConferenceOrBooth'; $objectlabel = 'ConferenceOrBooth'; $uploaddir = $conf->eventorganization->dir_output; + include DOL_DOCUMENT_ROOT.'/eventorganization/core/actions_massactions_mail.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -581,12 +585,13 @@ $arrayofmassactions = array( //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"), //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), + 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' - '.$langs->trans("ConferenceOrBooth"), + 'presend_attendees'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' - '.$langs->trans("Attendees"), ); if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'presend_attendees', 'predelete'))) { $arrayofmassactions = array(); } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); @@ -610,9 +615,11 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort $topicmail = "SendConferenceOrBoothRef"; $modelmail = "conferenceorbooth"; $objecttmp = new ConferenceOrBooth($db); -$trackid = 'xxxx'.$object->id; +$trackid = 'conferenceorbooth_'.$object->id; +include DOL_DOCUMENT_ROOT.'/eventorganization/tpl/massactions_mail_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + if ($search_all) { foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 658640d5834..e8e86a2641a 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -499,7 +499,15 @@ if ($confOrBooth->id > 0) { print ""; print ''.$langs->trans("EventOrganizationICSLink").''; - print ''; + // Define $urlwithroot + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; + + // Show message + $message = 'global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...'); + $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').''; + print $message; print ""; print ''; diff --git a/htdocs/eventorganization/core/actions_massactions_mail.inc.php b/htdocs/eventorganization/core/actions_massactions_mail.inc.php new file mode 100644 index 00000000000..483a1e5bc84 --- /dev/null +++ b/htdocs/eventorganization/core/actions_massactions_mail.inc.php @@ -0,0 +1,315 @@ + + * Copyright (C) 2018-2021 Nicolas ZABOURI + * Copyright (C) 2018 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2019-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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see https://www.gnu.org/ + */ + +/** + * \file htdocs/core/actions_massactions.inc.php + * \brief Code for actions done with massaction button (send by email, merge pdf, delete, ...) + */ + + +// $massaction must be defined +// $objectclass and $objectlabel must be defined +// $parameters, $object, $action must be defined for the hook. + +// $permissiontoread, $permissiontoadd, $permissiontodelete, $permissiontoclose may be defined +// $uploaddir may be defined (example to $conf->projet->dir_output."/";) +// $toselect may be defined +// $diroutputmassaction may be defined + + +// Protection +if (empty($objectclass) || empty($uploaddir)) { + dol_print_error(null, 'include of actions_massactions.inc.php is done but var $objectclass or $uploaddir was not defined'); + exit; +} + +// For backward compatibility +if (!empty($permtoread) && empty($permissiontoread)) { + $permissiontoread = $permtoread; +} +if (!empty($permtocreate) && empty($permissiontoadd)) { + $permissiontoadd = $permtocreate; +} +if (!empty($permtodelete) && empty($permissiontodelete)) { + $permissiontodelete = $permtodelete; +} + + +// Mass actions. Controls on number of lines checked. +$maxformassaction = (empty($conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS) ? 1000 : $conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS); +if (!empty($massaction) && is_array($toselect) && count($toselect) < 1) { + $error++; + setEventMessages($langs->trans("NoRecordSelected"), null, "warnings"); +} +if (!$error && is_array($toselect) && count($toselect) > $maxformassaction) { + setEventMessages($langs->trans('TooManyRecordForMassAction', $maxformassaction), null, 'errors'); + $error++; +} + +if (!$error && $massaction == 'confirm_presend_attendees' && !GETPOST('sendmail')) { // If we do not choose button send (for example when we change template or limit), we must not send email, but keep on send email form + $massaction = 'presend_attendees'; +} +if (!$error && $massaction == 'confirm_presend_attendees') { + $resaction = ''; + $nbsent = 0; + $nbignored = 0; + $langs->load("mails"); + include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + + $listofobjectid = array(); + + $listofobjectref = array(); + $oneemailperrecipient = (GETPOST('oneemailperrecipient') == 'on' ? 1 : 0); + + if (!$error) { + require_once DOL_DOCUMENT_ROOT . '/eventorganization/class/conferenceorboothattendee.class.php'; + $attendee = new ConferenceOrBoothAttendee($db); + $listofselectedid = array(); + $listofselectedref = array(); + $objecttmp = new $objectclass($db); + + foreach ($toselect as $toselectid) { + $result = $objecttmp->fetch($toselectid); + if ($result > 0) { + $attendees = $attendee->fetchAll('', '', 0, 0, array('t.fk_actioncomm' => $objecttmp->id)); + if (is_array($attendees) && count($attendees) > 0) { + foreach ($attendees as $attmail) { + if (!empty($attmail->email)) { + $attmail->fetch_thirdparty(); + $listofselectedid[$attmail->email] = $attmail; + $listofselectedref[$attmail->email] = $objecttmp; + } + } + } + } + } + } + + // Check mandatory parameters + if (GETPOST('fromtype', 'alpha') === 'user' && empty($user->email)) { + $error++; + setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings'); + $massaction = 'presend_attendees'; + } + + $receiver = $_POST['receiver']; + if (!is_array($receiver)) { + if (empty($receiver) || $receiver == '-1') { + $receiver = array(); + } else { + $receiver = array($receiver); + } + } + if (!trim($_POST['sendto']) && count($receiver) == 0 && count($listofselectedid) == 1) { // if only one recipient, receiver is mandatory + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Recipient")), null, 'warnings'); + $massaction = 'presend_attendees'; + } + + if (!GETPOST('subject', 'restricthtml')) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTopic")), null, 'warnings'); + $massaction = 'presend_attendees'; + } + + if (!$error) { + $objecttmp->fetch_thirdparty(); + foreach ($listofselectedid as $email => $attendees) { + $sendto = ''; + $sendtocc = ''; + $sendtobcc = ''; + $sendtoid = array(); + + // Define $sendto + $sendto = $attendees->thirdparty->name . '<' . trim($attendees->email) . '>'; + + // Define $sendtocc + $receivercc = $_POST['receivercc']; + if (!is_array($receivercc)) { + if ($receivercc == '-1') { + $receivercc = array(); + } else { + $receivercc = array($receivercc); + } + } + $tmparray = array(); + if (trim($_POST['sendtocc'])) { + $tmparray[] = trim($_POST['sendtocc']); + } + $sendtocc = implode(',', $tmparray); + + + $langs->load("commercial"); + + $reg = array(); + $fromtype = GETPOST('fromtype'); + if ($fromtype === 'user') { + $from = $user->getFullName($langs) . ' <' . $user->email . '>'; + } elseif ($fromtype === 'company') { + $from = $conf->global->MAIN_INFO_SOCIETE_NOM . ' <' . $conf->global->MAIN_INFO_SOCIETE_MAIL . '>'; + } elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { + $tmp = explode(',', $user->email_aliases); + $from = trim($tmp[($reg[1] - 1)]); + } elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) { + $tmp = explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES); + $from = trim($tmp[($reg[1] - 1)]); + } elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) { + $sql = 'SELECT rowid, label, email FROM ' . MAIN_DB_PREFIX . 'c_email_senderprofile WHERE rowid = ' . (int) $reg[1]; + $resql = $db->query($sql); + $obj = $db->fetch_object($resql); + if ($obj) { + $from = $obj->label . ' <' . $obj->email . '>'; + } + } else { + $from = $_POST['fromname'] . ' <' . $_POST['frommail'] . '>'; + } + + $replyto = $from; + $subject = GETPOST('subject', 'restricthtml'); + $message = GETPOST('message', 'restricthtml'); + + $sendtobcc = GETPOST('sendtoccc'); + + // $objecttmp is a real object or an empty object if we choose to send one email per thirdparty instead of one per object + // Make substitution in email content + $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $attendees); + + if (!empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) { + $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot . DOL_URL_ROOT; + $url_link = $urlwithroot . '/public/agenda/agendaexport.php?format=ical' . ($conf->entity > 1 ? "&entity=" . $conf->entity : ""); + $url_link .= '&exportkey=' . ($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...'); + $url_link .= "&project=" . $listofselectedref[$email]->fk_project . '&module=' . urlencode('@eventorganization') . '&status=' . ConferenceOrBooth::STATUS_CONFIRMED; + $html_link = '' . $langs->trans('DownloadICSLink') . ''; + } + $substitutionarray['__EVENTORGANIZATION_ICS_LINK__'] = $html_link; + $substitutionarray['__EVENTORGANIZATION_URL_LINK__'] = $url_link; + $substitutionarray['__CHECK_READ__'] = ''; + + $parameters = array('mode' => 'formemail'); + + if (!empty($listofobjectref)) { + $parameters['listofobjectref'] = $listofobjectref; + } + + complete_substitutions_array($substitutionarray, $langs, $attendees, $parameters); + + $subjectreplaced = make_substitutions($subject, $substitutionarray); + $messagereplaced = make_substitutions($message, $substitutionarray); + + + if (empty($sendcontext)) { + $sendcontext = 'standard'; + } + + // Send mail (substitutionarray must be done just before this) + require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subjectreplaced, $sendto, $from, $messagereplaced, array(), array(), array(), $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', "attendees_".$attendees->id, '', $sendcontext); + if ($mailfile->error) { + $resaction .= '
    ' . $mailfile->error . '
    '; + } else { + $result = $mailfile->sendfile(); + if ($result) { + $resaction .= $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)) . '
    '; // Must not contain " + $error = 0; + + dol_syslog("Try to insert email event into agenda for objid=" . $attendees->id . " => objectobj=" . get_class($attendees)); + + $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; + if ($message) { + if ($sendtocc) { + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + } + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subjectreplaced); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $messagereplaced); + } + $actionmsg2 = ''; + + $objectobj2 = $listofselectedref[$email]; + // Initialisation donnees + $objectobj2->actionmsg = $actionmsg; // Long text + $objectobj2->actionmsg2 = $actionmsg2; // Short text + $objectobj2->fk_element = $objectobj2->id; + $objectobj2->elementtype = $objectobj2->element; + + $triggername = 'CONFERENCEORBOOTHATTENDEE_SENTBYMAIL'; + if (!empty($triggername)) { + // Call trigger + $result = $objectobj2->call_trigger($triggername, $user); + if ($result < 0) { + $error++; + } + // End call triggers + + if ($error) { + setEventMessages($db->lasterror(), $objectobj2->errors, 'errors'); + dol_syslog("Error in trigger " . $triggername . ' ' . $db->lasterror(), LOG_ERR); + } + } + + $nbsent++; // Nb of object sent + } else { + $langs->load("other"); + if ($mailfile->error) { + $resaction .= $langs->trans('ErrorFailedToSendMail', $from, $sendto); + $resaction .= '
    ' . $mailfile->error . '
    '; + } elseif (!empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { + $resaction .= '
    No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS
    '; + } else { + $resaction .= $langs->trans('ErrorFailedToSendMail', $from, $sendto) . '
    (unhandled error)
    '; + } + } + } + } + } + $resaction .= ($resaction ? '
    ' : $resaction); + $resaction .= '' . $langs->trans("ResultOfMailSending") . ':
    ' . "\n"; + $resaction .= $langs->trans("NbSelected") . ': ' . count($toselect) . "\n
    "; + $resaction .= $langs->trans("NbIgnored") . ': ' . ($nbignored ? $nbignored : 0) . "\n
    "; + $resaction .= $langs->trans("NbSent") . ': ' . ($nbsent ? $nbsent : 0) . "\n
    "; + + if ($nbsent) { + $action = ''; // Do not show form post if there was at least one successfull sent + //setEventMessages($langs->trans("EMailSentToNRecipients", $nbsent.'/'.count($toselect)), null, 'mesgs'); + setEventMessages($langs->trans("EMailSentForNElements", $nbsent . '/' . count($toselect)), null, 'mesgs'); + setEventMessages($resaction, null, 'mesgs'); + } else { + //setEventMessages($langs->trans("EMailSentToNRecipients", 0), null, 'warnings'); // May be object has no generated PDF file + setEventMessages($resaction, null, 'warnings'); + } + + $action = 'list'; + $massaction = ''; +} + + + +$parameters['toselect'] = $toselect; +$parameters['uploaddir'] = $uploaddir; +$parameters['massaction'] = $massaction; +$parameters['diroutputmassaction'] = isset($diroutputmassaction) ? $diroutputmassaction : null; + +$reshook = $hookmanager->executeHooks('doMassActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} diff --git a/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php b/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php new file mode 100644 index 00000000000..17c78babfea --- /dev/null +++ b/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php @@ -0,0 +1,130 @@ + + * Copyright (C) 2013-2014 Laurent Destailleur + * Copyright (C) 2015 Marcos García + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see https://www.gnu.org/ + */ + +// Following var must be set: +// $arrayofselected = array of id selected +// $object +// $objecttmp=new Propal($db); +// $topicmail="SendSupplierProposalRef"; +// $modelmail="supplier_proposal_send"; +// $trackid='ord'.$object->id; + +if ($massaction == 'presend_attendees') { + $langs->load("mails"); + require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; + $attendee = new ConferenceOrBoothAttendee($db); + $listofselectedid = array(); + $listofselectedref = array(); + + if (!GETPOST('cancel', 'alpha')) { + foreach ($arrayofselected as $toselectid) { + $result = $objecttmp->fetch($toselectid); + if ($result > 0) { + $attendees = $attendee->fetchAll('', '', 0, 0, array('t.fk_actioncomm'=>$objecttmp->id)); + if (is_array($attendees) && count($attendees)>0) { + foreach ($attendees as $attmail) { + if (!empty($attmail->email)) { + $listofselectedid[$attmail->email] = $attmail->id; + $listofselectedref[$attmail->id][$toselectid] = $objecttmp->ref; + } + } + } + } + } + } + + print ''; + print ''; + + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + + print dol_get_fiche_head(null, '', ''); + + // Cree l'objet formulaire mail + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + $formmail->withform = -1; + $formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); + + if ($formmail->fromtype === 'user') { + $formmail->fromid = $user->id; + } + $formmail->trackid = $trackid; + if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) { // If bit 2 is set + include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); + } + $formmail->withfrom = 1; + $liste = $langs->trans("AllRecipientSelected", count($listofselectedid)); + $formmail->withtoreadonly = 1; + + $formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : ((GETPOST('oneemailperrecipient') == 'on') ? 1 : -1); + + $formmail->withto = empty($liste) ? (GETPOST('sendto', 'alpha') ?GETPOST('sendto', 'alpha') : array()) : $liste; + $formmail->withtofree = empty($liste) ? 1 : 0; + $formmail->withtocc = 1; + $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; + $formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REF_CLIENT__'); + $formmail->withfile = 0; + // $formmail->withfile = 2; Not yet supported in mass action + $formmail->withmaindocfile = 0; // Add a checkbox "Attach also main document" + $formmail->withbody = 1; + $formmail->withdeliveryreceipt = 1; + $formmail->withcancel = 1; + + // Make substitution in email content + $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object); + + $substitutionarray['__EMAIL__'] = $sendto; + $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; + $substitutionarray['__PERSONALIZED__'] = ''; // deprecated + $substitutionarray['__CONTACTCIVNAME__'] = ''; + + $parameters = array( + 'mode' => 'formemail' + ); + complete_substitutions_array($substitutionarray, $langs, $object, $parameters); + + // Tableau des substitutions + $formmail->substit = $substitutionarray; + + // Tableau des parametres complementaires du post + $formmail->param['action'] = $action; + $formmail->param['models'] = $modelmail; + $formmail->param['models_id'] = empty(GETPOST('modelmailselected', 'int'))?$conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES:GETPOST('modelmailselected', 'int'); + $formmail->param['id'] = join(',', $arrayofselected); + // $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; + if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedid) > $conf->global->MAILING_LIMIT_SENDBYWEB) { + $langs->load("errors"); + print img_warning().' '.$langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB); + print ' - '.$langs->trans("GoBack").''; + $arrayofmassactions = array(); + } else { + print $formmail->get_form(); + } + + print dol_get_fiche_end(); +} +// Allow Pre-Mass-Action hook (eg for confirmation dialog) +$parameters = array( + 'toselect' => $toselect, + 'uploaddir' => isset($uploaddir) ? $uploaddir : null +); diff --git a/htdocs/install/mysql/data/llx_c_email_templates.sql b/htdocs/install/mysql/data/llx_c_email_templates.sql index e2b1cd65077..393875dd40f 100644 --- a/htdocs/install/mysql/data/llx_c_email_templates.sql +++ b/htdocs/install/mysql/data/llx_c_email_templates.sql @@ -35,9 +35,9 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0,'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'$conf->recruitment->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,

    \n\n__(YourCandidatureAnswerMessage)__
    __ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__\n

    \n__(Sincerely)__
    __USER_SIGNATURE__',null, 0); -- Event organization -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, 'EventOrganizationEmailAskConf', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__ __THIRDPARTY_NAME__,

    __(ThisIsContentOfYourOrganizationEventConfRequestWasReceived)__

    __ONLINE_PAYMENT_TEXT_AND_URL__


    __(Sincerely)__
    __USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, 'EventOrganizationEmailAskBooth', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__ __THIRDPARTY_NAME__,

    __(ThisIsContentOfYourOrganizationEventBoothRequestWasReceived)__

    __ONLINE_PAYMENT_TEXT_AND_URL__


    __(Sincerely)__
    __USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, 'EventOrganizationEmailSubsBooth', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsBooth)__', '__(Hello)__ __THIRDPARTY_NAME__,

    __(ThisIsContentOfYourOrganizationEventBoothSubscriptionWasReceived)__

    __ONLINE_PAYMENT_TEXT_AND_URL__


    __(Sincerely)__
    __USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, 'EventOrganizationEmailSubsEvent', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsEvent)__', '__(Hello)__ __THIRDPARTY_NAME__,

    __(ThisIsContentOfYourOrganizationEventEventSubscriptionWasReceived)__

    __(Sincerely)__

    __MYCOMPANY_NAME__
    __USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, 'EventOrganizationMassEmailAttendees', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__ __THIRDPARTY_NAME__,

    __(ThisIsContentOfYourOrganizationEventBulkMailToAttendees)__

    __(Sincerely)__
    __USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, 'EventOrganizationMassEmailSpeakers', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__,

    __(ThisIsContentOfYourOrganizationEventBulkMailToSpeakers)__

    __(Sincerely)__
    __USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__ __THIRDPARTY_NAME__,

    __(ThisIsContentOfYourOrganizationEventConfRequestWasReceived)__

    __ONLINE_PAYMENT_TEXT_AND_URL__


    __(Sincerely)__
    __USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskBooth)', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__ __THIRDPARTY_NAME__,

    __(ThisIsContentOfYourOrganizationEventBoothRequestWasReceived)__

    __ONLINE_PAYMENT_TEXT_AND_URL__


    __(Sincerely)__
    __USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsBooth)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsBooth)__', '__(Hello)__ __THIRDPARTY_NAME__,

    __(ThisIsContentOfYourOrganizationEventBoothSubscriptionWasReceived)__

    __ONLINE_PAYMENT_TEXT_AND_URL__


    __(Sincerely)__
    __USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsEvent)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsEvent)__', '__(Hello)__ __THIRDPARTY_NAME__,

    __(ThisIsContentOfYourOrganizationEventEventSubscriptionWasReceived)__

    __(Sincerely)__

    __MYCOMPANY_NAME__
    __USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__ __THIRDPARTY_NAME__,

    __(ThisIsContentOfYourOrganizationEventBulkMailToAttendees)__

    __(Sincerely)__
    __USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__,

    __(ThisIsContentOfYourOrganizationEventBulkMailToSpeakers)__

    __(Sincerely)__
    __USER_SIGNATURE__', null, '1', null); diff --git a/htdocs/langs/fr_FR/eventorganization.lang b/htdocs/langs/fr_FR/eventorganization.lang index 7ef2977adc3..ef7de0fd710 100644 --- a/htdocs/langs/fr_FR/eventorganization.lang +++ b/htdocs/langs/fr_FR/eventorganization.lang @@ -40,8 +40,8 @@ EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF = Modèle de courriel à envoyer aprè EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH = Modèle de courriel à envoyer après avoir reçu une suggestion d'un stand. EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH = Modèle de courriel à envoyer après paiement d'une inscription à un stand. EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT = Modèle de courriel à envoyer après paiement d'une inscription à un événement. -EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER = Modèle de courriel pour action de masse aux participants -EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES = Modèle de courriel pour action de masse aux intervenants +EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER = Modèle de courriel pour action de masse aux intervenants +EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES = Modèle de courriel pour action de masse aux participants EVENTORGANIZATION_FILTERATTENDEES_CAT = Filtrer la liste de sélection des tiers dans la fiche/le formulaire de création des participants avec/selon la catégorie EVENTORGANIZATION_FILTERATTENDEES_TYPE = Filtrer la liste de sélection des tiers dans la fiche/le formulaire de création des participants avec le type de client From f02dee2e2128e07b5f11082fcc8eb307085cf941 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Jul 2021 23:47:59 +0200 Subject: [PATCH 113/356] Fix test on missing install.lock --- htdocs/admin/system/security.php | 13 ++++++++++++- htdocs/langs/en_US/admin.lang | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 032a23a68c8..79690032901 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; // Load translation files required by the page -$langs->loadLangs(array("install", "other", "admin")); +$langs->loadLangs(array("install", "other", "admin", "errors")); if (!$user->admin) { accessforbidden(); @@ -198,6 +198,7 @@ if (empty($fileswithwritepermission)) { } } print '
    '; +print '
    '; print ''.$langs->trans("PermissionsOnFile", $conffile).': '; // $conffile is defined into filefunc.inc.php $perms = fileperms($dolibarr_main_document_root.'/'.$conffile); @@ -219,6 +220,16 @@ if ($perms) { print img_warning().' '.$langs->trans("FailedToReadFile", $conffile); } print '
    '; +print '
    '; + +$installlock = DOL_DATA_ROOT.'/install.lock'; +print ''.$langs->trans("DolibarrSetup").': '; +if (file_exists($installlock)) { + print img_picto('', 'tick').' '.$langs->trans("InstallAndUpgradeLockedBy", $installlock); +} else { + print img_warning().' '.$langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT); +} +print '
    '; // File conf.php diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index aca631eef99..76f5c18b70b 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2148,4 +2148,5 @@ RandomlySelectedIfSeveral=Randomly selected if several pictures are available DatabasePasswordObfuscated=Database password is obfuscated in conf file DatabasePasswordNotObfuscated=Database password is NOT obfuscated in conf file APIsAreNotEnabled=APIs modules are not enabled -YouShouldSetThisToOff=You should set this to 0 or off \ No newline at end of file +YouShouldSetThisToOff=You should set this to 0 or off +InstallAndUpgradeLockedBy=Install and upgrades are locked by the file %s \ No newline at end of file From 9954a0e4bb654dae4cfe40ced290e3ad8c48cb01 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Jul 2021 00:40:06 +0200 Subject: [PATCH 114/356] Fix status of tickets --- htdocs/langs/en_US/ticket.lang | 8 +++++--- htdocs/ticket/card.php | 20 ++++++++++++++++---- htdocs/ticket/class/ticket.class.php | 27 ++++++++++++++------------- 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 3c074688b8e..0b54b1d5fa8 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -66,7 +66,7 @@ NeedMoreInformation=Waiting for reporter feedback NeedMoreInformationShort=Waiting for feedback Answered=Answered Waiting=Waiting -Closed=Closed +SolvedClosed=Solved Deleted=Deleted # Dict @@ -186,9 +186,11 @@ TicketSeverity=Severity ShowTicket=See ticket RelatedTickets=Related tickets TicketAddIntervention=Create intervention -CloseTicket=Close ticket -CloseATicket=Close a ticket +CloseTicket=Close|Solve ticket +AbandonTicket=Abandon ticket +CloseATicket=Close|Solve a ticket ConfirmCloseAticket=Confirm ticket closing +ConfirmAbandonTicket=Do you confirm the closing of the ticket to status 'Abandonned' ConfirmDeleteTicket=Please confirm ticket deleting TicketDeletedSuccess=Ticket deleted with success TicketMarkedAsClosed=Ticket marked as closed diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 5faa7b201b7..cbdb0f7a6df 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -426,10 +426,10 @@ if (empty($reshook)) { } } - if ($action == "confirm_close" && GETPOST('confirm', 'alpha') == 'yes' && $user->rights->ticket->write) { + if (($action == "confirm_close" || $action == "confirm_abandon") && GETPOST('confirm', 'alpha') == 'yes' && $user->rights->ticket->write) { $object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')); - if ($object->close($user)) { + if ($object->close($user, ($action == "confirm_abandon" ? 1 : 0))) { setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs'); $url = 'card.php?action=view&track_id='.GETPOST('track_id', 'alpha'); @@ -749,7 +749,7 @@ if ($action == 'create' || $action == 'presend') { print ''; print ''; */ -} elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen' +} elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $action == 'abandon' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen' || $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') { if ($res > 0) { // or for unauthorized internals users @@ -764,6 +764,13 @@ if ($action == 'create' || $action == 'presend') { print '
    '; } } + // Confirmation abandon + if ($action == 'abandon') { + print $form->formconfirm($url_page_current."?track_id=".$object->track_id, $langs->trans("AbandonTicket"), $langs->trans("ConfirmAbandonTicket"), "confirm_abandon", '', '', 1); + if ($ret == 'html') { + print '
    '; + } + } // Confirmation delete if ($action == 'delete') { print $form->formconfirm($url_page_current."?track_id=".$object->track_id, $langs->trans("Delete"), $langs->trans("ConfirmDeleteTicket"), "confirm_delete_ticket", '', '', 1); @@ -1296,8 +1303,13 @@ if ($action == 'create' || $action == 'presend') { print ''; } + // Abadon ticket if statut is read + if ($object->fk_statut > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ticket->write) { + print ''; + } + // Re-open ticket - if (!$user->socid && $object->fk_statut == Ticket::STATUS_CLOSED && !$user->socid) { + if (!$user->socid && ($object->fk_statut == Ticket::STATUS_CLOSED || $object->fk_statut == Ticket::STATUS_CANCELED) && !$user->socid) { print ''; } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 89f239db6c6..b67d7922d97 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -218,8 +218,8 @@ class Ticket extends CommonObject const STATUS_IN_PROGRESS = 3; const STATUS_NEED_MORE_INFO = 5; const STATUS_WAITING = 7; // on hold - const STATUS_CLOSED = 8; - const STATUS_CANCELED = 9; + const STATUS_CLOSED = 8; // Closed - Solved + const STATUS_CANCELED = 9; // Closed - Not solved /** @@ -272,8 +272,8 @@ class Ticket extends CommonObject 'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,), 'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'), 'progress' => array('type'=>'varchar(100)', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>1), - 'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>1, 'position'=>550, 'notnull'=>1), - 'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted')), + //'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>1, 'position'=>550, 'notnull'=>1), + 'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'SolvedClosed', 9 => 'Deleted')), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900), ); // END MODULEBUILDER PROPERTIES @@ -295,7 +295,7 @@ class Ticket extends CommonObject self::STATUS_IN_PROGRESS => 'InProgress', self::STATUS_WAITING => 'OnHold', self::STATUS_NEED_MORE_INFO => 'NeedMoreInformationShort', - self::STATUS_CLOSED => 'Closed', + self::STATUS_CLOSED => 'SolvedClosed', self::STATUS_CANCELED => 'Canceled' ); $this->statuts = array( @@ -305,7 +305,7 @@ class Ticket extends CommonObject self::STATUS_IN_PROGRESS => 'InProgress', self::STATUS_WAITING => 'OnHold', self::STATUS_NEED_MORE_INFO => 'NeedMoreInformation', - self::STATUS_CLOSED => 'Closed', + self::STATUS_CLOSED => 'SolvedClosed', self::STATUS_CANCELED => 'Canceled' ); } @@ -1747,21 +1747,22 @@ class Ticket extends CommonObject /** * Close a ticket * - * @param User $user User that close - * @return int <0 if KO, >0 if OK + * @param User $user User that close + * @param int $mode 0=Close solved, 1=Close abandonned + * @return int <0 if KO, >0 if OK */ - public function close(User $user) + public function close(User $user, $mode = 0) { global $conf, $langs; - if ($this->fk_statut != Ticket::STATUS_CLOSED) { // not closed + if ($this->fk_statut != Ticket::STATUS_CLOSED && $this->fk_statut != Ticket::STATUS_CANCELED) { // not closed $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; - $sql .= " SET fk_statut=".Ticket::STATUS_CLOSED.", progress=100, date_close='".$this->db->idate(dol_now())."'"; - $sql .= " WHERE rowid = ".$this->id; + $sql .= " SET fk_statut=".($mode ? Ticket::STATUS_CANCELED : Ticket::STATUS_CLOSED).", progress=100, date_close='".$this->db->idate(dol_now())."'"; + $sql .= " WHERE rowid = ".((int) $this->id); - dol_syslog(get_class($this)."::close sql=".$sql); + dol_syslog(get_class($this)."::close mode=".$mode); $resql = $this->db->query($sql); if ($resql) { $error = 0; From 0c3bf536f2e2b5aaa82d87185f9026139696cd72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Jul 2021 01:10:15 +0200 Subject: [PATCH 115/356] Fix field resolution --- htdocs/core/modules/modTicket.class.php | 16 +++++++++++--- htdocs/ticket/class/ticket.class.php | 4 +++- htdocs/ticket/list.php | 28 +++++++++++++++++-------- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 8b1a1dc8525..b78125753b2 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -122,8 +122,18 @@ class modTicket extends DolibarrModules } $this->dictionaries = array( 'langs' => 'ticket', - 'tabname' => array(MAIN_DB_PREFIX."c_ticket_type", MAIN_DB_PREFIX."c_ticket_severity", MAIN_DB_PREFIX."c_ticket_category", MAIN_DB_PREFIX."c_ticket_resolution"), - 'tablib' => array("TicketDictType", "TicketDictSeverity", "TicketDictCategory", "TicketDictResolution"), + 'tabname' => array( + MAIN_DB_PREFIX."c_ticket_type", + MAIN_DB_PREFIX."c_ticket_severity", + MAIN_DB_PREFIX."c_ticket_category", + MAIN_DB_PREFIX."c_ticket_resolution" + ), + 'tablib' => array( + "TicketDictType", + "TicketDictSeverity", + "TicketDictCategory", + "TicketDictResolution" + ), 'tabsql' => array( 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_type as f', 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f', @@ -135,7 +145,7 @@ class modTicket extends DolibarrModules 'tabfieldvalue' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public", "code,label,pos,use_default"), 'tabfieldinsert' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public", "code,label,pos,use_default"), 'tabrowid' => array("rowid", "rowid", "rowid", "rowid"), - 'tabcond' => array($conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled), + 'tabcond' => array($conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled && !empty($conf->global->TICKET_ENABLE_RESOLUTION)), 'tabhelp' => array( array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")), array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")), diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index b67d7922d97..1d449a57e17 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -272,7 +272,7 @@ class Ticket extends CommonObject 'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,), 'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'), 'progress' => array('type'=>'varchar(100)', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>1), - //'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>1, 'position'=>550, 'notnull'=>1), + 'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>'$conf->global->TICKET_ENABLE_RESOLUTION', 'position'=>550, 'notnull'=>1), 'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'SolvedClosed', 9 => 'Deleted')), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900), ); @@ -286,6 +286,8 @@ class Ticket extends CommonObject */ public function __construct($db) { + global $conf; + $this->db = $db; $this->statuts_short = array( diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 6a65efc8bac..5a55a1ab324 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -45,9 +45,9 @@ $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') : 'tickep#selectedfieldstlist'; // 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') +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $id = GETPOST('id', 'int'); $msg_id = GETPOST('msg_id', 'int'); @@ -73,8 +73,9 @@ $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 or if we click on clear filters +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -107,12 +108,16 @@ if (GETPOST('search_fk_status', 'alpha') == 'non_closed') { } // Initialize array of search criterias -$search_all = trim(GETPOSTISSET("search_all") ?GETPOSTISSET("search_all", 'alpha') : GETPOST('sall')); +$search_all = (GETPOSTISSET("search_all") ? GETPOST("search_all", 'alpha') : GETPOST('sall')); $search = array(); foreach ($object->fields as $key => $val) { - if (GETPOST('search_'.$key, 'alpha')) { + if (GETPOST('search_'.$key, 'alpha') !== '') { $search[$key] = GETPOST('search_'.$key, 'alpha'); } + if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { + $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int')); + $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int')); + } } // List of fields to search into when doing a "search in all" @@ -126,12 +131,19 @@ $fieldstosearchall['s.name_alias'] = "AliasNameShort"; $fieldstosearchall['s.zip'] = "Zip"; $fieldstosearchall['s.town'] = "Town"; -// Definition of fields for list +// Definition of array of fields for columns $arrayfields = array(); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { - $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']); + $visible = (int) dol_eval($val['visible'], 1); + $arrayfields['t.'.$key] = array( + 'label'=>$val['label'], + 'checked'=>(($visible < 0) ? 0 : 1), + 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), + 'position'=>$val['position'], + 'help'=> isset($val['help']) ? $val['help'] : '' + ); } } // Extra fields @@ -139,8 +151,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -//if ($socid > 0) $arrayfields['t.fk_soc']['enabled']=0; -//if ($projectid > 0) $arrayfields['t.fk_project']['enabled']=0; // Security check From 593e84906b93f09414b9aeb225bfbed395efe391 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Jul 2021 01:16:04 +0200 Subject: [PATCH 116/356] FIX bad closing div on error message --- htdocs/public/ticket/create_ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 1d0339f83f8..8f2657b9db6 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -390,7 +390,7 @@ if ($action != "infos_success") { print '
    '; print $langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketEmailNotificationFrom")).'
    '; print $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentities("Ticket")); - print '
    '; + print '
    '; } else { print '
    '.$langs->trans('TicketPublicInfoCreateTicket').'
    '; $formticket->showForm(0, 'edit', 1); From 047c575d613070117ec363ecf270d410ef364b56 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Jul 2021 01:42:52 +0200 Subject: [PATCH 117/356] Fix some errors on ticket module --- .../interface_50_modAgenda_ActionsAuto.class.php | 6 +++++- htdocs/public/ticket/create_ticket.php | 3 +-- htdocs/public/ticket/view.php | 6 ++++-- htdocs/ticket/card.php | 12 +++++++++--- htdocs/ticket/class/ticket.class.php | 2 +- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 8e23c258d88..d0597f617fb 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -936,7 +936,11 @@ class InterfaceActionsAuto extends DolibarrTriggers } } - $object->actionmsg = dol_concatdesc($langs->transnoentities("Author").': '.$user->login, $object->actionmsg); + if (!empty($user->login)) { + $object->actionmsg = dol_concatdesc($langs->transnoentities("Author").': '.$user->login, $object->actionmsg); + } elseif (isset($object->origin_email)) { + $object->actionmsg = dol_concatdesc($langs->transnoentities("Author").': '.$object->origin_email, $object->actionmsg); + } dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 8f2657b9db6..b911e7480d3 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -258,7 +258,7 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('add', 'alpha')) { $sendto = GETPOST('email', 'alpha'); - $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; + $from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; $replyto = $from; $sendtocc = ''; $deliveryreceipt = 0; @@ -298,7 +298,6 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('add', 'alpha')) { } $message_admin .= ''; - $message_admin .= ''; $message_admin .= '

    '.$langs->trans('Message').' :
    '.$object->message.'

    '; $message_admin .= '

    '.$langs->trans('SeeThisTicketIntomanagementInterface').'

    '; diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 3fec075160b..6485f9fcee2 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -262,8 +262,10 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a // Category print ''.$langs->trans("Category").''; - print img_picto('', 'category', 'class="pictofixedwidth"'); - print dol_escape_htmltag($object->dao->category_label); + if ($object->dao->category_label) { + print img_picto('', 'category', 'class="pictofixedwidth"'); + print dol_escape_htmltag($object->dao->category_label); + } print ''; // Severity diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index cbdb0f7a6df..bbb563a1486 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1126,15 +1126,21 @@ if ($action == 'create' || $action == 'presend') { } else { // Type print ''.$langs->trans("Type").''; - print $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code); + if (!empty($object->type_code)) { + print $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code); + } print ''; // Group print ''.$langs->trans("TicketCategory").''; - print $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code); + if (!empty($object->category_code)) { + print $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code); + } print ''; // Severity print ''.$langs->trans("TicketSeverity").''; - print $langs->getLabelFromKey($db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code); + if (!empty($object->severity_code)) { + print $langs->getLabelFromKey($db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code); + } print ''; } print ''; // End table actions diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 1d449a57e17..d29a4913b6b 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -461,7 +461,7 @@ class Ticket extends CommonObject $sql .= " ".(!isset($this->progress) ? '0' : "'".$this->db->escape($this->progress)."'").","; $sql .= " ".(!isset($this->timing) ? 'NULL' : "'".$this->db->escape($this->timing)."'").","; $sql .= " ".(!isset($this->type_code) ? 'NULL' : "'".$this->db->escape($this->type_code)."'").","; - $sql .= " ".(!isset($this->category_code) ? 'NULL' : "'".$this->db->escape($this->category_code)."'").","; + $sql .= " ".(empty($this->category_code) || $this->category_code == '-1' ? 'NULL' : "'".$this->db->escape($this->category_code)."'").","; $sql .= " ".(!isset($this->severity_code) ? 'NULL' : "'".$this->db->escape($this->severity_code)."'").","; $sql .= " ".(!isset($this->datec) || dol_strlen($this->datec) == 0 ? 'NULL' : "'".$this->db->idate($this->datec)."'").","; $sql .= " ".(!isset($this->date_read) || dol_strlen($this->date_read) == 0 ? 'NULL' : "'".$this->db->idate($this->date_read)."'").","; From 57d637ac713b5e2004614c683974e9701673c54d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Jul 2021 01:49:43 +0200 Subject: [PATCH 118/356] Fix set status of a ticket --- htdocs/ticket/class/actions_ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index b787a437899..d7d971b4edc 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -408,7 +408,7 @@ class ActionsTicket if ($status == 1) { $urlforbutton = $_SERVER['PHP_SELF'].'?track_id='.$object->track_id.'&action=mark_ticket_read'; // To set as read, we use a dedicated action } else { - $urlforbutton = $_SERVER['PHP_SELF'].'?track_id='.$object->track_id.'&action=set_status&token='.newToken().'&new_status='.$status; + $urlforbutton = $_SERVER['PHP_SELF'].'?track_id='.$object->track_id.'&action=confirm_set_status&token='.newToken().'&new_status='.$status; } print ''; From 8ea6fc3174e4e4d7fcd55bf3fe241ff5e7f85427 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 30 Jul 2021 09:38:29 +0200 Subject: [PATCH 119/356] fix: add hook management into product translation tab --- htdocs/product/traduction.php | 180 +++++++++++++++++++--------------- 1 file changed, 100 insertions(+), 80 deletions(-) diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index b2c3b0d0b2f..0cae81e36c7 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -62,98 +62,108 @@ if ($object->id > 0) { restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('producttranslationcard', 'globalcard')); + /* * Actions */ -// retour a l'affichage des traduction si annulation -if ($cancel == $langs->trans("Cancel")) { - $action = ''; +$parameters = array('id'=>$id, 'ref'=>$ref); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - -if ($action == 'delete' && GETPOST('langtodelete', 'alpha')) { - $object = new Product($db); - $object->fetch($id); - $object->delMultiLangs(GETPOST('langtodelete', 'alpha'), $user); - setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); - $action = ''; -} - -// Add translation -if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && ($user->rights->produit->creer || $user->rights->service->creer)) { - $object = new Product($db); - $object->fetch($id); - $current_lang = $langs->getDefaultLang(); - - // update de l'objet - if (GETPOST("forcelangprod") == $current_lang) { - $object->label = GETPOST("libelle"); - $object->description = dol_htmlcleanlastbr(GETPOST("desc", 'restricthtml')); - $object->other = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml')); - - $object->update($object->id, $user); - } else { - $object->multilangs[GETPOST("forcelangprod")]["label"] = GETPOST("libelle"); - $object->multilangs[GETPOST("forcelangprod")]["description"] = dol_htmlcleanlastbr(GETPOST("desc", 'restricthtml')); - $object->multilangs[GETPOST("forcelangprod")]["other"] = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml')); - } - - // save in database - if (GETPOST("forcelangprod")) { - $result = $object->setMultiLangs($user); - } else { - $object->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Language")); - $result = -1; - } - - if ($result > 0) { +if (empty($reshook)) { + // retour a l'affichage des traduction si annulation + if ($cancel == $langs->trans("Cancel")) { $action = ''; - } else { - $action = 'add'; - setEventMessages($object->error, $object->errors, 'errors'); } -} -// Edit translation -if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && ($user->rights->produit->creer || $user->rights->service->creer)) { - $object = new Product($db); - $object->fetch($id); - $current_lang = $langs->getDefaultLang(); + if ($action == 'delete' && GETPOST('langtodelete', 'alpha')) { + $object = new Product($db); + $object->fetch($id); + $object->delMultiLangs(GETPOST('langtodelete', 'alpha'), $user); + setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); + $action = ''; + } - foreach ($object->multilangs as $key => $value) { // enregistrement des nouvelles valeurs dans l'objet - if ($key == $current_lang) { - $object->label = GETPOST("libelle-".$key); - $object->description = dol_htmlcleanlastbr(GETPOST("desc-".$key, 'restricthtml')); - $object->other = dol_htmlcleanlastbr(GETPOST("other-".$key, 'restricthtml')); + // Add translation + if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && ($user->rights->produit->creer || $user->rights->service->creer)) { + $object = new Product($db); + $object->fetch($id); + $current_lang = $langs->getDefaultLang(); + + // update de l'objet + if (GETPOST("forcelangprod") == $current_lang) { + $object->label = GETPOST("libelle"); + $object->description = dol_htmlcleanlastbr(GETPOST("desc", 'restricthtml')); + $object->other = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml')); + + $object->update($object->id, $user); } else { - $object->multilangs[$key]["label"] = GETPOST("libelle-".$key); - $object->multilangs[$key]["description"] = dol_htmlcleanlastbr(GETPOST("desc-".$key, 'restricthtml')); - $object->multilangs[$key]["other"] = dol_htmlcleanlastbr(GETPOST("other-".$key, 'restricthtml')); + $object->multilangs[GETPOST("forcelangprod")]["label"] = GETPOST("libelle"); + $object->multilangs[GETPOST("forcelangprod")]["description"] = dol_htmlcleanlastbr(GETPOST("desc", 'restricthtml')); + $object->multilangs[GETPOST("forcelangprod")]["other"] = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml')); + } + + // save in database + if (GETPOST("forcelangprod")) { + $result = $object->setMultiLangs($user); + } else { + $object->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Language")); + $result = -1; + } + + if ($result > 0) { + $action = ''; + } else { + $action = 'add'; + setEventMessages($object->error, $object->errors, 'errors'); } } - $result = $object->setMultiLangs($user); - if ($result > 0) { - $action = ''; - } else { - $action = 'edit'; - setEventMessages($object->error, $object->errors, 'errors'); + // Edit translation + if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && ($user->rights->produit->creer || $user->rights->service->creer)) { + $object = new Product($db); + $object->fetch($id); + $current_lang = $langs->getDefaultLang(); + + foreach ($object->multilangs as $key => $value) { // enregistrement des nouvelles valeurs dans l'objet + if ($key == $current_lang) { + $object->label = GETPOST("libelle-" . $key); + $object->description = dol_htmlcleanlastbr(GETPOST("desc-" . $key, 'restricthtml')); + $object->other = dol_htmlcleanlastbr(GETPOST("other-" . $key, 'restricthtml')); + } else { + $object->multilangs[$key]["label"] = GETPOST("libelle-" . $key); + $object->multilangs[$key]["description"] = dol_htmlcleanlastbr(GETPOST("desc-" . $key, 'restricthtml')); + $object->multilangs[$key]["other"] = dol_htmlcleanlastbr(GETPOST("other-" . $key, 'restricthtml')); + } + } + + $result = $object->setMultiLangs($user); + if ($result > 0) { + $action = ''; + } else { + $action = 'edit'; + setEventMessages($object->error, $object->errors, 'errors'); + } } -} -// Delete translation -if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && ($user->rights->produit->creer || $user->rights->service->creer)) { - $object = new Product($db); - $object->fetch($id); - $langtodelete = GETPOST('langdel', 'alpha'); + // Delete translation + if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && ($user->rights->produit->creer || $user->rights->service->creer)) { + $object = new Product($db); + $object->fetch($id); + $langtodelete = GETPOST('langdel', 'alpha'); - $result = $object->delMultiLangs($langtodelete, $user); - if ($result > 0) { - $action = ''; - } else { - $action = 'edit'; - setEventMessages($object->error, $object->errors, 'errors'); + $result = $object->delMultiLangs($langtodelete, $user); + if ($result > 0) { + $action = ''; + } else { + $action = 'edit'; + setEventMessages($object->error, $object->errors, 'errors'); + } } } @@ -216,11 +226,15 @@ print dol_get_fiche_end(); */ print "\n".'
    '."\n"; -if ($action == '') { - if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''.$langs->trans("Add").''; - if ($cnt_trans > 0) { - print ''.$langs->trans("Update").''; +$parameters = array(); +$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been +if (empty($reshook)) { + if ($action == '') { + if ($user->rights->produit->creer || $user->rights->service->creer) { + print '' . $langs->trans("Add") . ''; + if ($cnt_trans > 0) { + print '' . $langs->trans("Update") . ''; + } } } } @@ -263,6 +277,9 @@ if ($action == 'edit') { } } + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print '
    '; print '
    '; @@ -334,6 +351,9 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service } print ''; + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print dol_get_fiche_end(); print '
    '; From 0102e733069872a5082b779ffbf1c86d65277f5c Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Fri, 30 Jul 2021 13:15:01 +0200 Subject: [PATCH 120/356] add hook 'menu_LeftMenuArray' to filter the leftmenu items --- htdocs/core/class/hookmanager.class.php | 1 + htdocs/core/menus/standard/eldy.lib.php | 28 ++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 5e24ee03fa4..4750e0924dd 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -193,6 +193,7 @@ class HookManager 'getFormatedSupplierRef', 'getIdProfUrl', 'getInputIdProf', + 'menu_LeftMenuItems', 'moveUploadedFile', 'moreHtmlStatus', 'pdf_build_address', diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index c192d5e6ac6..a54d5a7a358 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -688,9 +688,9 @@ function print_end_menu_array() * @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @return int Nb of menu entries */ -function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0) -{ - global $user, $conf, $langs, $dolibarr_main_db_name, $mysoc; +function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0) { + + global $user, $conf, $langs, $dolibarr_main_db_name, $mysoc, $hookmanager; //var_dump($tabMenu); @@ -1958,6 +1958,28 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM return 0; } + // Allow the $menu_array of the menu to be manipulated by modules + $parameters = array( + 'mainmenu' => $mainmenu, + ); + $hook_items = $menu_array; + $reshook = $hookmanager->executeHooks('menu_LeftMenuArray', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks + + if (is_numeric($reshook)) { + if ($reshook == 0 && !empty($hookmanager->results)) { + $menu_array[] = $hookmanager->results; // add + } elseif ($reshook == 1) { + $menu_array = $hookmanager->results; // replace + } + + // @todo Sort menu items by 'position' value +// $position = array(); +// foreach ($menu_array as $key => $row) { +// $position[$key] = $row['position']; +// } +// array_multisort($position, SORT_ASC, $menu_array); + } + // TODO Use the position property in menu_array to reorder the $menu_array //var_dump($menu_array); /*$new_menu_array = array(); From 3ceb451734a35aaa278a35e717241d4991817a18 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 30 Jul 2021 11:19:18 +0000 Subject: [PATCH 121/356] Fixing style errors. --- htdocs/core/menus/standard/eldy.lib.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index a54d5a7a358..8374b71ff96 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -688,7 +688,8 @@ function print_end_menu_array() * @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @return int Nb of menu entries */ -function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0) { +function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0) +{ global $user, $conf, $langs, $dolibarr_main_db_name, $mysoc, $hookmanager; @@ -1973,11 +1974,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // @todo Sort menu items by 'position' value -// $position = array(); -// foreach ($menu_array as $key => $row) { -// $position[$key] = $row['position']; -// } -// array_multisort($position, SORT_ASC, $menu_array); + // $position = array(); + // foreach ($menu_array as $key => $row) { + // $position[$key] = $row['position']; + // } + // array_multisort($position, SORT_ASC, $menu_array); } // TODO Use the position property in menu_array to reorder the $menu_array From 63898426d23559a690e4d623dba3c59cf461f1b0 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Fri, 30 Jul 2021 13:36:54 +0200 Subject: [PATCH 122/356] FIX: on admin/pdf.php (with javascript enabled) if you set some boolean confs then click on "save", all boolean values are reset --- htdocs/admin/pdf.php | 46 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index d5873e2a50e..cee63fd91fd 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -52,22 +52,22 @@ if ($cancel) { } if ($action == 'update') { - dolibarr_set_const($db, "MAIN_PDF_FORMAT", GETPOST("MAIN_PDF_FORMAT"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PDF_FORMAT')) dolibarr_set_const($db, "MAIN_PDF_FORMAT", GETPOST("MAIN_PDF_FORMAT"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", GETPOST("MAIN_PDF_MARGIN_LEFT"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", GETPOST("MAIN_PDF_MARGIN_TOP"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", GETPOST("MAIN_PDF_MARGIN_BOTTOM"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PDF_MARGIN_LEFT')) dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", GETPOST("MAIN_PDF_MARGIN_LEFT"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PDF_MARGIN_RIGHT')) dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", GETPOST("MAIN_PDF_MARGIN_TOP"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PDF_MARGIN_BOTTOM')) dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", GETPOST("MAIN_PDF_MARGIN_BOTTOM"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", GETPOST("MAIN_PROFID2_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", GETPOST("MAIN_PROFID3_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", GETPOST("MAIN_PROFID4_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PROFID1_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PROFID2_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", GETPOST("MAIN_PROFID2_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PROFID3_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", GETPOST("MAIN_PROFID3_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PROFID4_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", GETPOST("MAIN_PROFID4_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PROFID5_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PROFID6_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", GETPOST("MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", GETPOST("MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", GETPOST("MAIN_TVAINTRA_NOT_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_TVAINTRA_NOT_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", GETPOST("MAIN_TVAINTRA_NOT_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); if (!empty($conf->projet->enabled)) { if (GETPOST('PDF_SHOW_PROJECT_REF_OR_LABEL') == 'no') { @@ -82,20 +82,20 @@ if ($action == 'update') { } } - dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DESC"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_REF"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS')) dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_HIDE_DESC')) dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DESC"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_HIDE_REF')) dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_REF"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", GETPOST("MAIN_INVERT_SENDER_RECIPIENT"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", GETPOST("MAIN_PDF_USE_ISO_LOCATION"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_DOCUMENTS_LOGO_HEIGHT')) dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_INVERT_SENDER_RECIPIENT')) dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", GETPOST("MAIN_INVERT_SENDER_RECIPIENT"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PDF_USE_ISO_LOCATION')) dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", GETPOST("MAIN_PDF_USE_ISO_LOCATION"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_SECOND_TAX"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_THIRD_TAX"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PDF_MAIN_HIDE_SECOND_TAX')) dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_SECOND_TAX"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PDF_MAIN_HIDE_THIRD_TAX')) dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_THIRD_TAX"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "SHOW_SUBPRODUCT_REF_IN_PDF", GETPOST('SHOW_SUBPRODUCT_REF_IN_PDF', 'alpha'), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE')) dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('SHOW_SUBPRODUCT_REF_IN_PDF')) dolibarr_set_const($db, "SHOW_SUBPRODUCT_REF_IN_PDF", GETPOST('SHOW_SUBPRODUCT_REF_IN_PDF', 'alpha'), 'chaine', 0, '', $conf->entity); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); From 0d70c8189778ac9ca348573a9e2b2193304b452b Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 30 Jul 2021 15:16:38 +0200 Subject: [PATCH 123/356] ix error in website module -> sitemap --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index aa2b357a794..23be98a3b8c 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2326,7 +2326,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { $domainname = $objp->virtualhost; } if (! preg_match('/^http/i', $domainname)) { - $domainname .= 'https://'.$domainname; + $domainname = 'https://'.$domainname; } //$pathofpage = $dolibarr_main_url_root.'/'.$pageurl.'.php'; From 055a5c4ab6570c30ec0d83efe617362ff68f6e31 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Fri, 30 Jul 2021 15:19:05 +0200 Subject: [PATCH 124/356] fix hook name --- htdocs/core/class/hookmanager.class.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 4750e0924dd..45643e26e4c 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -193,7 +193,7 @@ class HookManager 'getFormatedSupplierRef', 'getIdProfUrl', 'getInputIdProf', - 'menu_LeftMenuItems', + 'menuLeftMenuItems', 'moveUploadedFile', 'moreHtmlStatus', 'pdf_build_address', diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 8374b71ff96..160a56ac740 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1964,7 +1964,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM 'mainmenu' => $mainmenu, ); $hook_items = $menu_array; - $reshook = $hookmanager->executeHooks('menu_LeftMenuArray', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('menuLeftMenuItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks if (is_numeric($reshook)) { if ($reshook == 0 && !empty($hookmanager->results)) { From f830a0f5e243dd40306d1db216c3fa5da16f2e7a Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 29 Jul 2021 17:32:06 +0200 Subject: [PATCH 125/356] fix `tomail` param in mail form usage --- htdocs/core/actions_sendmails.inc.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 83a823edeb2..3c8e4a5fe73 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -186,6 +186,11 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST $tmparray[] = trim($_POST['sendto']); } + if (trim($_POST['tomail'])) { + // Recipients are provided as free text + $tmparray[] = trim($_POST['tomail']); + } + if (count($receiver) > 0) { // Recipient was provided from combo list foreach ($receiver as $key => $val) { From 9c626bede47eb796c7bffba059891e493d9c6200 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Jul 2021 18:43:35 +0200 Subject: [PATCH 126/356] Fix dol_hash for sha256 --- htdocs/core/lib/security.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 598802ea574..d64069aa923 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -98,7 +98,7 @@ function dol_decode($chain, $key = '1') * If constant MAIN_SECURITY_SALT is defined, we use it as a salt (used only if hashing algorightm is something else than 'password_hash'). * * @param string $chain String to hash - * @param string $type Type of hash ('0':auto will use MAIN_SECURITY_HASH_ALGO else md5, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap with no salt, '5':sha256). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'. + * @param string $type Type of hash ('0':auto will use MAIN_SECURITY_HASH_ALGO else md5, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap with no salt, '5':sha256, '6':password_hash). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'. * @return string Hash of string * @see getRandomPassword() */ @@ -124,8 +124,10 @@ function dol_hash($chain, $type = '0') return md5($chain); } elseif ($type == '4' || $type == 'md5openldap') { return '{md5}'.base64_encode(mhash(MHASH_MD5, $chain)); // For OpenLdap with md5 (based on an unencrypted password in base) - } elseif ($type == '5') { + } elseif ($type == '5' || $type == 'sha256') { return hash('sha256', $chain); + } elseif ($type == '6' || $type == 'password_hash') { + return password_hash($chain, PASSWORD_DEFAULT); } elseif (!empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1') { return sha1($chain); } elseif (!empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1md5') { From 53391546547f5415bbe614784fcad80056847062 Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Fri, 30 Jul 2021 17:47:05 -0500 Subject: [PATCH 127/356] tva change too in facture --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f439186f5ca..685d1cd2510 100644 --- a/ChangeLog +++ b/ChangeLog @@ -219,7 +219,7 @@ Following changes may create regressions for some external modules, but were nec * The ICS value for direct debit or credit transfer is now stored on each bank account instead of into the global setup. * API /setup/shipment_methods has been replaced with API /setup/shipping_methods * Field "total" renamed into "total_ht" for table llx_facture, llx_facture_rec for better field name consistency -* Field "tva" renamed into "total_tva" for table llx_propal, llx_supplier_proposal, llx_commande, llx_commande_fournisseur for better field name consistency +* Field "tva" renamed into "total_tva" for llx_facture, table llx_propal, llx_supplier_proposal, llx_commande, llx_commande_fournisseur for better field name consistency * Field "total" renamed into "total_ttc" for table llx_propal, llx_supplier_proposal for better field name consistency * If your database is PostgreSQL, you must use version 9.1.0 or more (Dolibarr need the SQL function CONCAT) * If your database is MySQL or MariaDB, you need at least version 5.1 From 9811569b2be6d8ebe6876d1a302f237cff30e43d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Jul 2021 16:22:50 +0200 Subject: [PATCH 128/356] FIX #18289 #18294 --- htdocs/imports/emptyexample.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/imports/emptyexample.php b/htdocs/imports/emptyexample.php index a50a2fc9996..b919a3c4c3e 100644 --- a/htdocs/imports/emptyexample.php +++ b/htdocs/imports/emptyexample.php @@ -102,13 +102,13 @@ if ($attachment) { // List of targets fields -$headerlinefields = array(); -$contentlinevalues = array(); +$headerlinefields = array(); // Array of fields (label to show) +$contentlinevalues = array(); // Array of example values $i = 0; foreach ($fieldstarget as $code => $label) { $withoutstar = preg_replace('/\*/', '', $fieldstarget[$code]); $headerlinefields[] = $langs->transnoentities($withoutstar).($withoutstar != $fieldstarget[$code] ? '*' : '').' ('.$code.')'; - $contentlinevalues[] = $valuestarget[$code]; + $contentlinevalues[] = (isset($valuestarget[$code]) ? $valuestarget[$code] : ''); } //var_dump($headerlinefields); //var_dump($contentlinevalues); From af95169d1d0656dcb415757c2d87c8ba1f6972bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Jul 2021 16:54:18 +0200 Subject: [PATCH 129/356] Update actions_sendmails.inc.php --- htdocs/core/actions_sendmails.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 3c8e4a5fe73..e5c75a2e7c3 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -182,12 +182,12 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST $tmparray = array(); if (trim($_POST['sendto'])) { - // Recipients are provided into free text + // Recipients are provided into free text field $tmparray[] = trim($_POST['sendto']); } if (trim($_POST['tomail'])) { - // Recipients are provided as free text + // Recipients are provided into free hidden text field $tmparray[] = trim($_POST['tomail']); } From bd35d8626834daac53eee835e220dbbe1a2fada2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Jul 2021 17:20:48 +0200 Subject: [PATCH 130/356] Debug v14 --- htdocs/comm/mailing/cibles.php | 7 ++++--- htdocs/core/modules/mailings/contacts1.modules.php | 14 +++++++++----- htdocs/langs/en_US/mails.lang | 4 ++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 08e223ed89f..3f2cfc2974c 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2016 Laurent Destailleur + * Copyright (C) 2005-2021 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2014 Florian Henry * @@ -337,6 +337,7 @@ if ($object->fetch($id) >= 0) { if (is_resource($handle)) { while (($file = readdir($handle)) !== false) { if (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') { + $reg = array(); if (preg_match("/(.*)\.modules\.php$/i", $file, $reg)) { if ($reg[1] == 'example') { continue; @@ -534,9 +535,9 @@ if ($object->fetch($id) >= 0) { $morehtmlcenter = ''; if ($allowaddtarget) { - $morehtmlcenter = ''.$langs->trans("ToClearAllRecipientsClickHere").' id.'" class="button reposition">'.$langs->trans("TargetsReset").''; + $morehtmlcenter = ''.$langs->trans("ToClearAllRecipientsClickHere").' id.'" class="button reposition smallpaddingimp">'.$langs->trans("TargetsReset").''; } - $morehtmlcenter .= ' id.'">'.$langs->trans("Download").''; + $morehtmlcenter .= '   id.'">'.$langs->trans("Download").''; print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit); diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 4bd03593e09..6be129b8815 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -141,15 +141,19 @@ class mailing_contacts1 extends MailingTargets $resql = $this->db->query($sql); $s .= $langs->trans("PostOrFunction").': '; - $s .= ''; $s .= ''; if ($resql) { $num = $this->db->num_rows($resql); $i = 0; - while ($i < $num) { - $obj = $this->db->fetch_object($resql); - $s .= ''; - $i++; + if ($num > 0) { + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + $s .= ''; + $i++; + } + } else { + $s .= ''; } } else { dol_print_error($this->db); diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 24c86cc885a..1c0dd638eeb 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -162,8 +162,8 @@ AdvTgtDeleteFilter=Delete filter AdvTgtSaveFilter=Save filter AdvTgtCreateFilter=Create filter AdvTgtOrCreateNewFilter=Name of new filter -NoContactWithCategoryFound=No contact/address with a category found -NoContactLinkedToThirdpartieWithCategoryFound=No contact/address with a category found +NoContactWithCategoryFound=No category found linked to some contacts/addresses +NoContactLinkedToThirdpartieWithCategoryFound=No category found linked to some thirdparties OutGoingEmailSetup=Outgoing emails InGoingEmailSetup=Incoming emails OutGoingEmailSetupForEmailing=Outgoing emails (for module %s) From b67487b2ca544d1803642bf176d077f78e67c073 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Jul 2021 17:28:43 +0200 Subject: [PATCH 131/356] Fix reposition --- .../modules/mailings/contacts1.modules.php | 20 +++++++++---------- .../core/modules/mailings/pomme.modules.php | 12 +++++------ .../modules/mailings/thirdparties.modules.php | 8 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 6be129b8815..0ca62392c82 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -140,8 +140,8 @@ class mailing_contacts1 extends MailingTargets $sql .= " ORDER BY sp.poste"; $resql = $this->db->query($sql); - $s .= $langs->trans("PostOrFunction").': '; - $s .= ''; $s .= ''; if ($resql) { $num = $this->db->num_rows($resql); @@ -163,7 +163,7 @@ class mailing_contacts1 extends MailingTargets $s .= ' '; // Filter on contact category - $s .= $langs->trans("ContactCategoriesShort").': '; + $s .= $langs->trans("ContactCategoriesShort").' '; $sql = "SELECT c.label, count(distinct(sp.email)) AS nb"; $sql .= " FROM "; $sql .= " ".MAIN_DB_PREFIX."socpeople as sp,"; @@ -179,7 +179,7 @@ class mailing_contacts1 extends MailingTargets $sql .= " ORDER BY c.label"; $resql = $this->db->query($sql); - $s .= ''; $s .= ''; if ($resql) { $num = $this->db->num_rows($resql); @@ -201,8 +201,8 @@ class mailing_contacts1 extends MailingTargets $s .= '
    '; // Add prospect of a particular level - $s .= $langs->trans("NatureOfThirdParty").': '; - $s .= ''; $sql = "SELECT code, label"; $sql .= " FROM ".MAIN_DB_PREFIX."c_prospectlevel"; $sql .= " WHERE active > 0"; @@ -238,7 +238,7 @@ class mailing_contacts1 extends MailingTargets $s .= ' '; // Filter on thirdparty category - $s .= $langs->trans("CustomersProspectsCategoriesShort").': '; + $s .= $langs->trans("CustomersProspectsCategoriesShort").' '; $sql = "SELECT c.label, count(distinct(sp.email)) AS nb"; $sql .= " FROM "; $sql .= " ".MAIN_DB_PREFIX."socpeople as sp,"; @@ -254,7 +254,7 @@ class mailing_contacts1 extends MailingTargets $sql .= " ORDER BY c.label"; $resql = $this->db->query($sql); - $s .= ''; $s .= ''; if ($resql) { $num = $this->db->num_rows($resql); @@ -276,7 +276,7 @@ class mailing_contacts1 extends MailingTargets $s .= ' '; // Filter on thirdparty category - $s .= $langs->trans("SuppliersCategoriesShort").': '; + $s .= $langs->trans("SuppliersCategoriesShort").' '; $sql = "SELECT c.label, count(distinct(sp.email)) AS nb"; $sql .= " FROM "; $sql .= " ".MAIN_DB_PREFIX."socpeople as sp,"; @@ -292,7 +292,7 @@ class mailing_contacts1 extends MailingTargets $sql .= " ORDER BY c.label"; $resql = $this->db->query($sql); - $s .= ''; $s .= ''; if ($resql) { $num = $this->db->num_rows($resql); diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index a2a54c02c55..6880452a416 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -20,13 +20,13 @@ /** * \file htdocs/core/modules/mailings/pomme.modules.php * \ingroup mailing - * \brief File of class to offer a selector of emailing targets with Rule 'Pomme'. + * \brief File of class to offer a selector of emailing targets of users. */ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; /** - * Class to offer a selector of emailing targets with Rule 'Peche'. + * Class to offer a selector of emailing targets with Rule 'Pomme'. */ class mailing_pomme extends MailingTargets { @@ -119,16 +119,16 @@ class mailing_pomme extends MailingTargets $langs->load("users"); $s = ''; - $s .= $langs->trans("Status").': '; - $s .= ''; $s .= ''; $s .= ''; $s .= ''; $s .= ''; $s .= ' '; - $s .= $langs->trans("Employee").': '; - $s .= ''; $s .= ''; $s .= ''; $s .= ''; diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index f764c3f5f71..ae26dfc19fd 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -226,8 +226,8 @@ class mailing_thirdparties extends MailingTargets $langs->load("companies"); - $s = $langs->trans("Categories").': '; - $s .= ''; // Show categories $sql = "SELECT rowid, label, type, visible"; @@ -276,7 +276,7 @@ class mailing_thirdparties extends MailingTargets $s .= ' '; $s .= $langs->trans('ProspectCustomer'); - $s .= ': '; $s .= ''; if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { $s .= ''; @@ -292,7 +292,7 @@ class mailing_thirdparties extends MailingTargets $s .= ' '; $s .= $langs->trans("Status"); - $s .= ': '; $s .= ''; $s .= ''; $s .= ''; From 5256d6e046894a007664b002ef1b1be0ee94c973 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Jul 2021 17:34:41 +0200 Subject: [PATCH 132/356] css --- htdocs/accountancy/bookkeeping/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index ce91219c306..bc260c77ed3 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -576,7 +576,7 @@ if (!empty($sortfield)) { // Export into a file with format defined into setup (FEC, CSV, ...) // Must be after definition of $sql if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->export) { - // TODO Replace the fetchAll + ->export later that consume too much memory on large export with the query($sql) and loop on each line to export them. + // TODO Replace the fetchAll to get all ->line followed by call to ->export(). It consumew too much memory on large export. Replace this with the query($sql) and loop on each line to export them. $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', (empty($conf->global->ACCOUNTING_REEXPORT) ? 0 : 1)); if ($result < 0) { @@ -822,7 +822,7 @@ if (!empty($arrayfields['t.piece_num']['checked'])) { // Code journal if (!empty($arrayfields['t.code_journal']['checked'])) { print ''; - print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1); + print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'maxwidth150'); print ''; } // Date document @@ -865,7 +865,7 @@ if (!empty($arrayfields['t.subledger_account']['checked'])) { print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', $langs->trans('to'), 'maxwidth250', 'subledgeraccount'); print '
    '; } else { - print ''; + print ''; } print ''; } From 893bae0bd71baf4498390479d416c9e117ec9f65 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 2 Aug 2021 11:45:14 +0200 Subject: [PATCH 133/356] Update ChangeLog --- ChangeLog | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 35696c2fd0f..06a4d819576 100644 --- a/ChangeLog +++ b/ChangeLog @@ -235,11 +235,11 @@ Following changes may create regressions for some external modules, but were nec ***** ChangeLog for 13.0.4 compared to 13.0.3 ***** FIX: Allow disabling of a module (not a dangerous action) even if there is problem with token (due to bugged modules). -FIX: 13.0 - fatal - missing inclusion of ajax.lib.php for calling `ajax_autocompleter()` -FIX: #17919 pictures in docs. +FIX: 13.0 - fatal - missing inclusion of ajax.lib.php for calling 'ajax_autocompleter()' +FIX: #17919 pictures in docs FIX: #18006 FIX: Accountancy - if we define a date start, automatic binding try to continue to solve old binding -FIX: Accoutancy Limit date payment not registered on purchases operations +FIX: Accountancy - Limit date payment not registered on purchases operations FIX: Can't edit replacement invoice FIX: deposit can create credit note in payment conf FIX: division by zero on create @@ -343,7 +343,7 @@ FIX: File attachment on lots/batches FIX: handling $heightforinfotot when he's superior to a page height on Supplier Invoice FIX: hourglass and hide button to pay FIX: massaction validate invoice do not regenerate PDF -FIX: missing mp4 video mime +FIX: #16627 fix missing mp4 video mime FIX: picto on shipment to reset qty to 0. Some quantities were not reset. FIX: Protection to avoid #16504 FIX: rounding amount on card updating From b801188801a73b22ca3db7028d47196b31a66df8 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 2 Aug 2021 12:12:57 +0200 Subject: [PATCH 134/356] Update llx_c_actioncomm.sql --- .../install/mysql/data/llx_c_actioncomm.sql | 51 +++++++++++-------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_actioncomm.sql b/htdocs/install/mysql/data/llx_c_actioncomm.sql index 47197af644d..38f09ba23d0 100644 --- a/htdocs/install/mysql/data/llx_c_actioncomm.sql +++ b/htdocs/install/mysql/data/llx_c_actioncomm.sql @@ -5,6 +5,8 @@ -- Copyright (C) 2004 Guillaume Delecourt -- Copyright (C) 2005-2011 Regis Houssin -- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2021 Udo Tamm +-- -- -- 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 @@ -21,6 +23,9 @@ -- -- +-- +-- Do not put a comment at the end of the line, this file is parsed during the +-- install and all '--' symbols are removed. -- -- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors -- de l'install et tous les sigles '--' sont supprimés. @@ -31,25 +36,29 @@ -- 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); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 4,'AC_EMAIL','system','Send Email',NULL, 1, 4); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 5,'AC_RDV','system','Rendez-vous',NULL, 1, 1); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 6,'AC_EMAIL_IN','system','reception Email',NULL, 1, 4); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values (11,'AC_INT','system','Intervention on site',NULL, 1, 4); --- Code kept for backward compatibility < 3.3 ---insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 3,'AC_PROP','systemauto', 'Send commercial proposal by email','propal',0,10); ---insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 8,'AC_COM','systemauto','Send customer order by email','order', 0,8); ---insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 9,'AC_FAC','systemauto', 'Send customer invoice by email','invoice',0,6); ---insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 10,'AC_SHIP','systemauto', 'Send shipping by email','shipping',0,11); ---insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 30,'AC_SUP_ORD','systemauto','Send supplier order by email','order_supplier',0,9); ---insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 31,'AC_SUP_INV','systemauto','Send supplier invoice by email','invoice_supplier',0,7); --- Code used from 3.3+ when type of event is not used -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 40,'AC_OTH_AUTO','systemauto','Other (automatically inserted events)',NULL, 1, 20); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 50,'AC_OTH','system','Other (manually inserted events)',NULL, 1, 5); -INSERT INTO llx_c_actioncomm (id, code, type, libelle, module, active, position) VALUES ( 60,'AC_EO_ONLINECONF','module','Online/Virtual conference','conference@eventorganization', 1, 60); -INSERT INTO llx_c_actioncomm (id, code, type, libelle, module, active, position) VALUES ( 61,'AC_EO_INDOORCONF','module','Indoor conference','conference@eventorganization', 1, 61); -INSERT INTO llx_c_actioncomm (id, code, type, libelle, module, active, position) VALUES ( 62,'AC_EO_ONLINEBOOTH','module','Online/Virtual booth','booth@eventorganization', 1, 62); -INSERT INTO llx_c_actioncomm (id, code, type, libelle, module, active, position) VALUES ( 63,'AC_EO_INDOORBOOTH','module','Indoor booth','booth@eventorganization', 1, 63); +-- Code used from 3.3+ when type of event is used +insert into llx_c_actioncomm (id, code, libelle, type, module, active, position) values ( 1, 'AC_TEL', 'Phone call', 'system', NULL, 1, 2); +insert into llx_c_actioncomm (id, code, libelle, type, module, active, position) values ( 2, 'AC_FAX', 'Send Fax', 'system', NULL, 1, 3); +insert into llx_c_actioncomm (id, code, libelle, type, module, active, position) values ( 4, 'AC_EMAIL', 'Send Email', 'system', NULL, 1, 4); +insert into llx_c_actioncomm (id, code, libelle, type, module, active, position) values ( 5, 'AC_RDV', 'Rendez-vous', 'system', NULL, 1, 1); +insert into llx_c_actioncomm (id, code, libelle, type, module, active, position) values ( 6, 'AC_EMAIL_IN', 'reception Email', 'system', NULL, 1, 4); +insert into llx_c_actioncomm (id, code, libelle, type, module, active, position) values ( 11, 'AC_INT', 'Intervention on site', 'system', NULL, 1, 4); + +-- Code kept for backward compatibility < 3.3 +--insert into llx_c_actioncomm (id, code, libelle, type, module, active, position) values ( 3, 'AC_PROP', 'Send commercial proposal by email', 'systemauto', 'propal', 0, 10); +--insert into llx_c_actioncomm (id, code, libelle, type, module, active, position) values ( 8, 'AC_COM', 'Send customer order by email', 'systemauto', 'order', 0, 8); +--insert into llx_c_actioncomm (id, code, libelle, type, module, active, position) values ( 9, 'AC_FAC', 'Send customer invoice by email', 'systemauto', 'invoice', 0, 6); +--insert into llx_c_actioncomm (id, code, libelle, type, module, active, position) values ( 10, 'AC_SHIP', 'Send shipping by email', 'systemauto', 'shipping', 0, 11); +--insert into llx_c_actioncomm (id, code, libelle, type, module, active, position) values ( 30, 'AC_SUP_ORD', 'Send supplier order by email', 'systemauto', 'order_supplier', 0, 9); +--insert into llx_c_actioncomm (id, code, libelle, type, module, active, position) values ( 31, 'AC_SUP_INV', 'Send supplier invoice by email', 'systemauto', 'invoice_supplier', 0, 7); + +-- Code used from 3.3+ when type of event is not used + +insert into llx_c_actioncomm (id, code, libelle, type, module, active, position) values ( 40, 'AC_OTH_AUTO', 'Other (automatically inserted events)', 'systemauto', NULL, 1, 20); +insert into llx_c_actioncomm (id, code, libelle, type, module, active, position) values ( 50, 'AC_OTH', 'Other (manually inserted events)', 'systemauto', NULL, 1, 5); + +INSERT INTO llx_c_actioncomm (id, code, libelle, type, module, active, position) VALUES ( 60, 'AC_EO_ONLINECONF', 'Online/Virtual conference', 'module', 'conference@eventorganization', 1, 60); +INSERT INTO llx_c_actioncomm (id, code, libelle, type, module, active, position) VALUES ( 61, 'AC_EO_INDOORCONF', 'Indoor conference', 'module', 'conference@eventorganization', 1, 61); +INSERT INTO llx_c_actioncomm (id, code, libelle, type, module, active, position) VALUES ( 62, 'AC_EO_ONLINEBOOTH', 'Online/Virtual booth', 'module', 'booth@eventorganization', 1, 62); +INSERT INTO llx_c_actioncomm (id, code, libelle, type, module, active, position) VALUES ( 63, 'AC_EO_INDOORBOOTH', 'Indoor booth', 'module', 'booth@eventorganization', 1, 63); From 3acb304dd37295115673e214a9a349c4b717f61d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 2 Aug 2021 12:35:46 +0200 Subject: [PATCH 135/356] fix typo and translation --- htdocs/core/db/Database.interface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index 898421978db..9996d09f036 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -122,7 +122,7 @@ interface Database * List tables into a database * * @param string $database Name of database - * @param string $table Nmae of table filter ('xxx%') + * @param string $table Name of table filter ('xxx%') * @return array List of tables in an array */ public function DDLListTables($database, $table = ''); @@ -189,7 +189,7 @@ interface Database /** * Get last ID after an insert INSERT * - * @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql + * @param string $tab Table name concerned by insert. Not used under MySql but required for compatibility with Postgresql * @param string $fieldid Field name * @return int Id of row */ From 703217acd04acc594537549e51e0d3fdb39cb117 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 2 Aug 2021 12:39:45 +0200 Subject: [PATCH 136/356] backward --- htdocs/core/db/Database.interface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index 9996d09f036..898421978db 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -122,7 +122,7 @@ interface Database * List tables into a database * * @param string $database Name of database - * @param string $table Name of table filter ('xxx%') + * @param string $table Nmae of table filter ('xxx%') * @return array List of tables in an array */ public function DDLListTables($database, $table = ''); @@ -189,7 +189,7 @@ interface Database /** * Get last ID after an insert INSERT * - * @param string $tab Table name concerned by insert. Not used under MySql but required for compatibility with Postgresql + * @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql * @param string $fieldid Field name * @return int Id of row */ From 3c05cd075708ed9cb733ecd9f709ffbdb8a6bab7 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 2 Aug 2021 12:41:55 +0200 Subject: [PATCH 137/356] fix typo and translation --- htdocs/core/db/Database.interface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index 898421978db..9996d09f036 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -122,7 +122,7 @@ interface Database * List tables into a database * * @param string $database Name of database - * @param string $table Nmae of table filter ('xxx%') + * @param string $table Name of table filter ('xxx%') * @return array List of tables in an array */ public function DDLListTables($database, $table = ''); @@ -189,7 +189,7 @@ interface Database /** * Get last ID after an insert INSERT * - * @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql + * @param string $tab Table name concerned by insert. Not used under MySql but required for compatibility with Postgresql * @param string $fieldid Field name * @return int Id of row */ From 04fc2c0ce73c2019d552e781eb068ee1e1fd53e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Aug 2021 17:49:27 +0200 Subject: [PATCH 138/356] css --- htdocs/admin/paymentbybanktransfer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index 7cf522abc33..be5dc4e76e6 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -150,7 +150,7 @@ print ''; print ''; print ''; -print ''; +print ''; print ''; print ""; From 8077fae42e1458e45e7c800512fd9e4726ea0b43 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Aug 2021 17:56:58 +0200 Subject: [PATCH 139/356] Code comment --- htdocs/compta/facture/prelevement.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index f5ac0f19509..6fdc74a7539 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -148,12 +148,6 @@ if ($type == 'bank-transfer') { llxHeader('', $title, $helpurl); -/* *************************************************************************** */ -/* */ -/* Mode fiche */ -/* */ -/* *************************************************************************** */ - if ($object->id > 0) { $selleruserevenustamp = $mysoc->useRevenueStamp(); @@ -471,6 +465,7 @@ if ($object->id > 0) { print ""; print ''; + // IBAN of seller or supplier $title = 'CustomerIBAN'; if ($type == 'bank-transfer') { $title = 'SupplierIBAN'; From efda27000eaabc22649a3f5bc1a925e4226feb99 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Aug 2021 18:13:35 +0200 Subject: [PATCH 140/356] Fix set of date of rum signature --- .../societe/class/companybankaccount.class.php | 7 ++++--- htdocs/societe/paymentmodes.php | 16 ++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 6c52359979e..9b767cde34c 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -83,7 +83,7 @@ class CompanyBankAccount extends Account $now = dol_now(); $error = 0; // Correct default_rib to be sure to have always one default - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib where fk_soc = ".$this->socid." AND default_rib = 1 AND type = 'ban'"; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib where fk_soc = ".((int) $this->socid)." AND default_rib = 1 AND type = 'ban'"; $result = $this->db->query($sql); if ($result) { $numrows = $this->db->num_rows($result); @@ -96,7 +96,7 @@ class CompanyBankAccount extends Account } $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, type, datec)"; - $sql .= " VALUES (".$this->socid.", 'ban', '".$this->db->idate($now)."')"; + $sql .= " VALUES (".((int) $this->socid).", 'ban', '".$this->db->idate($now)."')"; $resql = $this->db->query($sql); if ($resql) { if ($this->db->affected_rows($resql)) { @@ -135,6 +135,7 @@ class CompanyBankAccount extends Account public function update(User $user = null, $notrigger = 0) { global $conf; + $error = 0; if (!$this->id) { @@ -160,7 +161,7 @@ class CompanyBankAccount extends Account $sql .= ",proprio = '".$this->db->escape($this->proprio)."'"; $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'"; $sql .= ",default_rib = ".((int) $this->default_rib); - if ($conf->prelevement->enabled) { + if (!empty($conf->prelevement->enabled)) { $sql .= ",frstrecur = '".$this->db->escape($this->frstrecur)."'"; $sql .= ",rum = '".$this->db->escape($this->rum)."'"; $sql .= ",date_rum = ".($this->date_rum ? "'".$this->db->idate($this->date_rum)."'" : "null"); diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 93c4fbc2202..97d92007885 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -161,9 +161,6 @@ if (empty($reshook)) { if (empty($companybankaccount->rum)) { $companybankaccount->rum = $prelevement->buildRumNumber($object->code_client, $companybankaccount->datec, $companybankaccount->id); } - if (empty($companybankaccount->date_rum)) { - $companybankaccount->date_rum = dol_now(); - } $result = $companybankaccount->update($user); if (!$result) { @@ -268,9 +265,9 @@ if (empty($reshook)) { $companybankaccount->domiciliation = GETPOST('domiciliation', 'alpha'); $companybankaccount->proprio = GETPOST('proprio', 'alpha'); $companybankaccount->owner_address = GETPOST('owner_address', 'alpha'); - $companybankaccount->frstrecur = GETPOST('frstrecur'); + $companybankaccount->frstrecur = GETPOST('frstrecur', 'alpha'); $companybankaccount->rum = GETPOST('rum', 'alpha'); - $companybankaccount->date_rum = dol_mktime(0, 0, 0, GETPOST('date_rummonth'), GETPOST('date_rumday'), GETPOST('date_rumyear')); + $companybankaccount->date_rum = dol_mktime(0, 0, 0, GETPOST('date_rummonth', 'int'), GETPOST('date_rumday', 'int'), GETPOST('date_rumyear', 'int')); $companybankaccount->datec = dol_now(); $companybankaccount->status = 1; @@ -300,7 +297,6 @@ if (empty($reshook)) { if (empty($companybankaccount->rum)) { $companybankaccount->rum = $prelevement->buildRumNumber($object->code_client, $companybankaccount->datec, $companybankaccount->id); - $companybankaccount->date_rum = dol_now(); } } @@ -1638,8 +1634,10 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) { print ''; print ''; + $date_rum = dol_mktime(0, 0, 0, GETPOST('date_rummonth'), GETPOST('date_rumday'), GETPOST('date_rumyear')); + print ''; - print ''; + print ''; print ''; print ''; + $date_rum = dol_mktime(0, 0, 0, GETPOST('date_rummonth'), GETPOST('date_rumday'), GETPOST('date_rumyear')); + print ''; - print ''; + print ''; print ''; print ''; -print ''; print ''; @@ -225,7 +225,11 @@ print ''; print ''; if ($nb) { if ($pricetowithdraw) { - print $langs->trans('BankToReceiveWithdraw').': '; + $title = print $langs->trans('BankToReceiveWithdraw').': '; + if ($type == 'bank-transfer') { + $title .= $langs->trans('BankToPayCreditTransfer').': '; + } + print $title; $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT, 'id_bankaccount', 0, "courant=1"); print ' - '; From 2deaac0fc4f8e689d9407605cf7f5e0487e83e5e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Aug 2021 18:34:38 +0200 Subject: [PATCH 142/356] Fix changelog --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5b296aa88e2..b54d8df615e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -228,8 +228,9 @@ Following changes may create regressions for some external modules, but were nec * If your database is PostgreSQL, you must use version 9.1.0 or more (Dolibarr need the SQL function CONCAT) * If your database is MySQL or MariaDB, you need at least version 5.1 * Function set_price_level() has been renamed into setPriceLevel() to follow camelcase rules -* removed deprecated substitution key __REFCLIENT__ (replaced with __REF_CLIENT__) +* Removed deprecated substitution key __REFCLIENT__ (replaced with __REF_CLIENT__) * Removed constant MAIN_COUNTRIES_IN_EEC. You can now set if country is in Europe or not from the dictionary of countries. +* v14 seems to work correctly on PHP v8 but it generates a lot of verbose warnings. Currently, v14 i snot yet officialy supported with PHP 8. ***** ChangeLog for 13.0.4 compared to 13.0.3 ***** From fc33d46c7731abb52e79fb489460f290e1fbcf69 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Mon, 2 Aug 2021 18:56:45 +0200 Subject: [PATCH 143/356] FIX: using Tulip, deposit mask doesn't get saved --- htdocs/admin/supplier_invoice.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index f307a5905b8..bc587845cda 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -59,8 +59,10 @@ $specimenthirdparty->initAsSpecimen(); if ($action == 'updateMask') { $maskconstinvoice = GETPOST('maskconstinvoice', 'alpha'); $maskconstcredit = GETPOST('maskconstcredit', 'alpha'); + $maskconstdeposit = GETPOST('maskconstdeposit', 'alpha'); $maskinvoice = GETPOST('maskinvoice', 'alpha'); $maskcredit = GETPOST('maskcredit', 'alpha'); + $maskdeposit = GETPOST('maskdeposit', 'alpha'); if ($maskconstinvoice) { $res = dolibarr_set_const($db, $maskconstinvoice, $maskinvoice, 'chaine', 0, '', $conf->entity); @@ -68,6 +70,9 @@ if ($action == 'updateMask') { if ($maskconstcredit) { $res = dolibarr_set_const($db, $maskconstcredit, $maskcredit, 'chaine', 0, '', $conf->entity); } + if ($maskconstdeposit) { + $res = dolibarr_set_const($db, $maskconstdeposit, $maskdeposit, 'chaine', 0, '', $conf->entity); + } if (!($res > 0)) { $error++; From 000c32c13735dedb826aa3d59f85171eac4ac545 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Aug 2021 20:20:52 +0200 Subject: [PATCH 144/356] FIx #18313 --- htdocs/variants/combinations.php | 9 ++++++--- htdocs/variants/list.php | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 0d9de5d857f..c29fc519258 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -30,10 +30,13 @@ $langs->loadLangs(array("products", "other")); $id = GETPOST('id', 'int'); $valueid = GETPOST('valueid', 'int'); $ref = GETPOST('ref', 'alpha'); -$weight_impact = GETPOST('weight_impact', 'alpha'); -$price_impact = GETPOST('price_impact', 'alpha'); +$weight_impact = price2num(GETPOST('weight_impact', 'alpha'), 2); $price_impact_percent = (bool) GETPOST('price_impact_percent'); - +if ($price_impact_percent) { + $price_impact = price2num(GETPOST('price_impact', 'alpha'), 2); +} else { + $price_impact = price2num(GETPOST('price_impact', 'alpha'), 'MU'); +} $level_price_impact = GETPOST('level_price_impact', 'array'); $level_price_impact_percent = GETPOST('level_price_impact_percent', 'array'); diff --git a/htdocs/variants/list.php b/htdocs/variants/list.php index dcf4fdcdb43..ecb42ba25e2 100644 --- a/htdocs/variants/list.php +++ b/htdocs/variants/list.php @@ -16,8 +16,8 @@ */ require '../main.inc.php'; -require DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php'; $action = GETPOST('action', 'aZ09'); $object = new ProductAttribute($db); From 2998c948844592056be74c7c9951379e8a04ba6c Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 3 Aug 2021 11:12:19 +0200 Subject: [PATCH 145/356] NEW : add constant PROPAL_NOT_BILLABLE --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3c0d8dd9a28..83f28af1d15 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2579,7 +2579,7 @@ if ($action == 'create') { } // Create an invoice and classify billed - if ($object->statut == Propal::STATUS_SIGNED) { + if ($object->statut == Propal::STATUS_SIGNED && empty($conf->global->PROPAL_NOT_BILLABLE)) { if (!empty($conf->facture->enabled) && $usercancreateinvoice) { print ''.$langs->trans("AddBill").''; } From 7a7287489d25584e09efef52f64b5a49f4892025 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 3 Aug 2021 11:24:21 +0200 Subject: [PATCH 146/356] NEW : add constant PROPAL_REOPEN_UNSIGNED_ONLY --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3c0d8dd9a28..802416f1626 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2529,7 +2529,7 @@ if ($action == 'create') { } // ReOpen - if (($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) && $usercanclose) { + if ( (( ! empty($conf->global->PROPAL_REOPEN_UNSIGNED_ONLY) && $object->statut == Propal::STATUS_NOTSIGNED) || (empty($conf->global->PROPAL_REOPEN_UNSIGNED_ONLY) && ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED))) && $usercanclose) { print 'global->MAIN_JUMP_TAG) ? '' : '#reopen').'"'; print '>'.$langs->trans('ReOpen').''; } From d1f9762ca9d9c3db6378b1eb4e2daef04ddb1d38 Mon Sep 17 00:00:00 2001 From: lainwir3d Date: Sat, 29 Aug 2020 13:15:55 +0200 Subject: [PATCH 147/356] CLOSE #18319 REST API - Shipment: Add 'close' action / endpoint / POST method. Allow "closing" a shipment through the REST API. --- .../expedition/class/api_shipments.class.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index 2a4b6765b4e..3b4070b138b 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -626,6 +626,53 @@ class Shipments extends DolibarrApi } */ + /** + * Close a shipment (Classify it as "Delivered") + * + * @param int $id Expedition ID + * @param int $notrigger Disabled triggers + * + * @url POST {id}/close + * + * @return int + */ + public function close($id, $notrigger = 0) + { + if (!DolibarrApiAccess::$user->rights->expedition->creer) { + throw new RestException(401); + } + + $result = $this->shipment->fetch($id); + if (!$result) { + throw new RestException(404, 'Shipment not found'); + } + + if (!DolibarrApi::_checkAccessToResource('expedition', $this->commande->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $result = $this->shipment->setClosed(); + if ($result == 0) { + throw new RestException(304, 'Error nothing done. May be object is already closed'); + } + if ($result < 0) { + throw new RestException(500, 'Error when closing Order: '.$this->commande->error); + } + + $result = $this->shipment->fetch($id); + if (!$result) { + throw new RestException(404, 'Shipment not found'); + } + + if (!DolibarrApi::_checkAccessToResource('expedition', $this->commande->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $this->shipment->fetchObjectLinked(); + + return $this->_cleanObjectDatas($this->shipment); + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas From d0c57dac3496df06a91d98297a9f105d91a8d0a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Aug 2021 15:02:09 +0200 Subject: [PATCH 148/356] FIx #18217 - Salary - link 'salary' of bank_url not managed --- .../accountancy/bookkeeping/listbyaccount.php | 37 ++++------ .../bookkeeping/listbysubaccount.php | 37 ++++------ htdocs/accountancy/journal/bankjournal.php | 69 +++++++++++++++---- htdocs/compta/bank/bankentries_list.php | 17 +++-- htdocs/compta/bank/class/account.class.php | 12 ++-- htdocs/core/menus/standard/eldy.lib.php | 6 +- htdocs/langs/en_US/accountancy.lang | 4 +- htdocs/salaries/class/paymentsalary.class.php | 44 ++++++++---- htdocs/salaries/class/salary.class.php | 6 ++ 9 files changed, 148 insertions(+), 84 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 522576350e7..27f23d36a74 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -509,10 +509,9 @@ $moreforfilter = ''; $moreforfilter .= '
    '; $moreforfilter .= $langs->trans('AccountAccounting').': '; $moreforfilter .= '
    '; -$moreforfilter .= $langs->trans('From').' '; -$moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, 'maxwidth200'); -$moreforfilter .= ' '.$langs->trans('to').' '; -$moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, 'maxwidth200'); +$moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200'); +$moreforfilter .= ' '; +$moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200'); $moreforfilter .= '
    '; $moreforfilter .= '
    '; @@ -671,23 +670,19 @@ while ($i < min($num, $limit)) { $accountg = length_accountg($line->numero_compte); //if (empty($accountg)) $accountg = '-'; + $colspan = 0; // colspan before field 'label of operation' + $colspanend = 3; // colspan after debit/credit + if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; } + if (!empty($arrayfields['t.date_validating']['checked'])) { $colspanend++; } + if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; } + // Is it a break ? if ($accountg != $displayed_account_number || !isset($displayed_account_number)) { - $colnumber = 5; - $colnumberend = 8; - - if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { - $colnumber--; - } - if (empty($arrayfields['t.date_export']['checked'])) { - $colnumber--; - } - if (empty($arrayfields['t.date_validated']['checked'])) { - $colnumber--; - } - - $colspan = $totalarray['nbfield'] - $colnumber; - $colspanend = $totalarray['nbfield'] - $colnumberend; // Show a subtotal by accounting account if (isset($displayed_account_number)) { print '
    '; @@ -926,9 +921,7 @@ while ($i < min($num, $limit)) { $i++; } -if ($num > 0) { - $colspan = $totalarray['nbfield'] - $colnumber; - $colspanend = $totalarray['nbfield'] - $colnumberend; +if ($num > 0 && $colspan > 0) { print ''; print ''; print ''; diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php index efc93f1b96c..5e83c729fb1 100644 --- a/htdocs/accountancy/bookkeeping/listbysubaccount.php +++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php @@ -511,10 +511,9 @@ $moreforfilter = ''; $moreforfilter .= '
    '; $moreforfilter .= $langs->trans('AccountAccounting').': '; $moreforfilter .= '
    '; -$moreforfilter .= $langs->trans('From').' '; -$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', 1, 'maxwidth200'); -$moreforfilter .= ' '.$langs->trans('to').' '; -$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', 1, 'maxwidth200'); +$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200'); +$moreforfilter .= ' '; +$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200'); $moreforfilter .= '
    '; $moreforfilter .= '
    '; @@ -673,23 +672,19 @@ while ($i < min($num, $limit)) { $accountg = length_accounta($line->subledger_account); //if (empty($accountg)) $accountg = '-'; + $colspan = 0; // colspan before field 'label of operation' + $colspanend = 3; // colspan after debit/credit + if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; } + if (!empty($arrayfields['t.date_validating']['checked'])) { $colspanend++; } + if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; } + // Is it a break ? if ($accountg != $displayed_account_number || !isset($displayed_account_number)) { - $colnumber = 5; - $colnumberend = 8; - - if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { - $colnumber--; - } - if (empty($arrayfields['t.date_export']['checked'])) { - $colnumber--; - } - if (empty($arrayfields['t.date_validated']['checked'])) { - $colnumber--; - } - - $colspan = $totalarray['nbfield'] - $colnumber; - $colspanend = $totalarray['nbfield'] - $colnumberend; // Show a subtotal by accounting account if (isset($displayed_account_number)) { print ''; @@ -937,9 +932,7 @@ while ($i < min($num, $limit)) { $i++; } -if ($num > 0) { - $colspan = $totalarray['nbfield'] - $colnumber; - $colspanend = $totalarray['nbfield'] - $colnumberend; +if ($num > 0 && $colspan > 0) { print ''; print ''; print ''; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 34e533974fc..bdda4583d54 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -177,7 +177,7 @@ $accountingjournalstatic->fetch($id_journal); $journal = $accountingjournalstatic->code; $journal_label = $accountingjournalstatic->label; - +//print $sql; dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG); $result = $db->query($sql); if ($result) { @@ -252,6 +252,7 @@ if ($result) { ); // Set accountancy code for user + // $obj->accountancy_code is the accountancy_code of table u=user but it is defined only if a link with type 'user' exists) $compta_user = (!empty($obj->accountancy_code) ? $obj->accountancy_code : ''); $tabuser[$obj->rowid] = array( @@ -277,7 +278,7 @@ if ($result) { $tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60); } - // Load of url links to the line into llx_bank + // Load of url links to the line into llx_bank (so load llx_bank_url) $links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) // By default @@ -287,7 +288,7 @@ if ($result) { // get_url may return -1 which is not traversable if (is_array($links) && count($links) > 0) { - // Now loop on each link of record in bank. + // Now loop on each link of record in bank (code similar to bankentries_list.php) foreach ($links as $key => $val) { if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) { // So we excluded 'company' and 'user' here. We want only payment lines @@ -302,6 +303,7 @@ if ($result) { } } + // Special case to ask later to add more request to get information for old links without company link. if ($links[$key]['type'] == 'withdraw') { $tabmoreinfo[$obj->rowid]['withdraw'] = 1; } @@ -401,6 +403,44 @@ if ($result) { $paymentsalstatic->label = $links[$key]['label']; $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsalstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentsalid"] = $paymentsalstatic->id; + + // This part of code is no more required. it is here to solve case where a link were missing (ith v14.0.0) and keep writing in accountancy complete. + // Note: A better way to fix this is to delete payement of salary and recreate it, or to fix the bookkeeping table manually after. + if (!empty($conf->global->ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USEr_ON_SALARY_BANK_PAYMENT)) { + $tmpsalary = new Salary($db); + $tmpsalary->fetch($paymentsalstatic->id); + $tmpsalary->fetch_user($tmpsalary->fk_user); + + $userstatic->id = $tmpsalary->user->id; + $userstatic->name = $tmpsalary->user->name; + $userstatic->email = $tmpsalary->user->email; + $userstatic->firstname = $tmpsalary->user->firstname; + $userstatic->lastname = $tmpsalary->user->lastname; + $userstatic->statut = $tmpsalary->user->statut; + $userstatic->accountancy_code = $tmpsalary->user->accountancy_code; + + if ($userstatic->id > 0) { + $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, 'accountancy', 0); + } else { + $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen + } + + if (empty($obj->typeop_user)) { // Add test to avoid to add amount twice if a link already exists also on user. + $compta_user = $userstatic->accountancy_code; + if ($compta_user) { + $tabtp[$obj->rowid][$compta_user] += $obj->amount; + $tabuser[$obj->rowid] = array( + 'id' => $userstatic->id, + 'name' => dolGetFirstLastname($userstatic->firstname, $userstatic->lastname), + 'lastname' => $userstatic->lastname, + 'firstname' => $userstatic->firstname, + 'email' => $userstatic->email, + 'accountancy_code' => $compta_user, + 'status' => $userstatic->statut + ); + } + } + } } elseif ($links[$key]['type'] == 'payment_expensereport') { $paymentexpensereportstatic->id = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= $paymentexpensereportstatic->getNomUrl(2); @@ -468,7 +508,7 @@ if ($result) { } } - // If no links were found to know the amount on thirdparty, we init it to account 'NotDefined'. + // If no links were found to know the amount on thirdparty/user, we init it to account 'NotDefined'. if (empty($tabtp[$obj->rowid])) { $tabtp[$obj->rowid]['NotDefined'] = $tabbq[$obj->rowid][$compta_bank]; } @@ -1162,9 +1202,9 @@ if (empty($action) || $action == 'view') { if ($tabtype[$key] == 'unknown') { // We will accept writing, but into a waiting account if (empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) || $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE == '-1') { - print ''.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').''; + print ''.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').''; } else { - print ''.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).''; // We will use a waiting account + print ''.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).''; // We will use a waiting account } } else { // We will refuse writing @@ -1187,7 +1227,7 @@ if (empty($action) || $action == 'view') { if ($tabtype[$key] == 'member') { $errorstring = 'MainAccountForSubscriptionPaymentNotDefined'; } - print ''.$langs->trans($errorstring).''; + print ''.$langs->trans($errorstring).''; } } else { print $accounttoshow; @@ -1196,7 +1236,7 @@ if (empty($action) || $action == 'view') { // Subledger account print ""; + print ""; + print '"; + print '"; + print '"; + print ""; } } diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 666621cbdd6..14aeee29d69 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1346,7 +1346,7 @@ if ($resql) { print ''; } + + // User assigned + print ''; + print ''; } if (!empty($conf->projet->enabled) && !$this->ispublic) { diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index f64b6e28fd1..9b5f937455e 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -188,7 +188,7 @@ if (empty($reshook)) { $object->email_from = $user->email; $notifyTiers = GETPOST("notify_tiers_at_create", 'alpha'); $object->notify_tiers_at_create = empty($notifyTiers) ? 0 : 1; - + $object->fk_user_assign = GETPOST("fk_user_assign", 'int'); $object->fk_project = $projectid; $id = $object->create($user); From 115b0e683129e363cd00f6506809331858958dc0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Aug 2021 15:07:16 +0200 Subject: [PATCH 152/356] Update api_shipments.class.php --- htdocs/expedition/class/api_shipments.class.php | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index 3b4070b138b..a92fd4f436a 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -530,14 +530,9 @@ class Shipments extends DolibarrApi if ($result < 0) { throw new RestException(500, 'Error when validating Shipment: '.$this->shipment->error); } + + // Reload shipment $result = $this->shipment->fetch($id); - if (!$result) { - throw new RestException(404, 'Shipment not found'); - } - - if (!DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } $this->shipment->fetchObjectLinked(); return $this->_cleanObjectDatas($this->shipment); @@ -659,14 +654,8 @@ class Shipments extends DolibarrApi throw new RestException(500, 'Error when closing Order: '.$this->commande->error); } + // Reload shipment $result = $this->shipment->fetch($id); - if (!$result) { - throw new RestException(404, 'Shipment not found'); - } - - if (!DolibarrApi::_checkAccessToResource('expedition', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } $this->shipment->fetchObjectLinked(); From 19f17ed1145685a625d2c7ab9c0bb742fb138f5e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 21 Jul 2021 14:52:37 +0200 Subject: [PATCH 153/356] fix: bad setEventMessages input --- htdocs/product/stock/massstockmove.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index f2432ea25af..9f3390d34af 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -209,7 +209,7 @@ if ($action == 'createmovements' && !empty($user->rights->stock->mouvement->cree ); if ($result1 < 0) { $error++; - setEventMessages($product->errors, $product->errorss, 'errors'); + setEventMessages($product->error, $product->errors, 'errors'); } // Add stock @@ -224,7 +224,7 @@ if ($action == 'createmovements' && !empty($user->rights->stock->mouvement->cree ); if ($result2 < 0) { $error++; - setEventMessages($product->errors, $product->errorss, 'errors'); + setEventMessages($product->error, $product->errors, 'errors'); } } else { $arraybatchinfo = $product->loadBatchInfo($batch); @@ -253,7 +253,7 @@ if ($action == 'createmovements' && !empty($user->rights->stock->mouvement->cree ); if ($result1 < 0) { $error++; - setEventMessages($product->errors, $product->errorss, 'errors'); + setEventMessages($product->error, $product->errors, 'errors'); } // Add stock @@ -271,7 +271,7 @@ if ($action == 'createmovements' && !empty($user->rights->stock->mouvement->cree ); if ($result2 < 0) { $error++; - setEventMessages($product->errors, $product->errorss, 'errors'); + setEventMessages($product->error, $product->errors, 'errors'); } } } else { From f00694470fab4a3b38ac415eb18c9b429048ec0e Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 3 Aug 2021 15:40:01 +0200 Subject: [PATCH 154/356] rename constant to PROPOSAL_ARE_NOT_BILLABLE --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 83f28af1d15..9b58b35c4a7 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2579,7 +2579,7 @@ if ($action == 'create') { } // Create an invoice and classify billed - if ($object->statut == Propal::STATUS_SIGNED && empty($conf->global->PROPAL_NOT_BILLABLE)) { + if ($object->statut == Propal::STATUS_SIGNED && empty($conf->global->PROPOSAL_ARE_NOT_BILLABLE)) { if (!empty($conf->facture->enabled) && $usercancreateinvoice) { print ''.$langs->trans("AddBill").''; } From 9ceab9b86b9adedd37ef6204b483fe969d82c484 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Aug 2021 15:47:00 +0200 Subject: [PATCH 155/356] Doc --- htdocs/product/class/productbatch.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index f10adee334e..4408afd9ff1 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2021 Laurent Destailleur * Copyright (C) 2013-2014 Cedric GROSS * * This program is free software; you can redistribute it and/or modify @@ -44,8 +44,8 @@ class Productbatch extends CommonObject public $tms = ''; public $fk_product_stock; - public $sellby = ''; - public $eatby = ''; + public $sellby = ''; // dlc + public $eatby = ''; // dmd/dluo public $batch = ''; public $qty; public $warehouseid; From 4873a91afc624486f856baa4ac09705cd9cbfbe9 Mon Sep 17 00:00:00 2001 From: lainwir3d Date: Tue, 3 Aug 2021 17:33:06 +0400 Subject: [PATCH 156/356] CLOSE #18326 Workflow: Close order on shipment closing. Allow an order to be closed automatically when all linked shipment have been closed and all products / items have been shipped. --- htdocs/admin/workflow.php | 10 ++++++++-- htdocs/core/modules/modWorkflow.class.php | 1 + .../interface_20_modWorkflow_WorkflowManager.class.php | 10 ++++++++-- htdocs/langs/en_US/workflow.lang | 1 + htdocs/langs/fr_FR/workflow.lang | 1 + 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 09156e08588..1b6fa5bebe7 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -91,15 +91,21 @@ $workflowcodes = array( ), // Automatic classification of order - 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array( + 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array( // when shipping validated 'family'=>'classify_order', 'position'=>40, 'enabled'=>(!empty($conf->expedition->enabled) && !empty($conf->commande->enabled)), 'picto'=>'order' ), - 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array( + 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED'=>array( // when shipping closed 'family'=>'classify_order', 'position'=>41, + 'enabled'=>(!empty($conf->expedition->enabled) && !empty($conf->commande->enabled)), + 'picto'=>'order' + ), + 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array( + 'family'=>'classify_order', + 'position'=>42, 'enabled'=>(!empty($conf->facture->enabled) && !empty($conf->commande->enabled)), 'picto'=>'order', 'warning'=>'' diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php index fbf7927ed1c..eaaf15d40a1 100644 --- a/htdocs/core/modules/modWorkflow.class.php +++ b/htdocs/core/modules/modWorkflow.class.php @@ -87,6 +87,7 @@ class modWorkflow extends DolibarrModules 0=>array('WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL', 0, 'current', 0), 1=>array('WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL', 'chaine', '1', 'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL', 0, 'current', 0), 2=>array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 0, 'current', 0), + 3=>array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED', 0, 'current', 0), 4=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 0, 'current', 0), 5=>array('WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 0, 'current', 0), 6=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0), diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 72a08d22494..c47965c7d52 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -256,10 +256,15 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } - if ($action == 'SHIPPING_VALIDATE') { + if (($action == 'SHIPPING_VALIDATE') || ($action == 'SHIPPING_CLOSED')) { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING)) { + if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) && + ( + (!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING) && ($action == 'SHIPPING_VALIDATE')) || + (!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED) && ($action == 'SHIPPING_CLOSED')) + ) + ) { $qtyshipped = array(); $qtyordred = array(); require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; @@ -318,6 +323,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } } + // classify billed reception if ($action == 'BILL_SUPPLIER_VALIDATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG); diff --git a/htdocs/langs/en_US/workflow.lang b/htdocs/langs/en_US/workflow.lang index 15fd8ef07c2..fafbc6e8d8a 100644 --- a/htdocs/langs/en_US/workflow.lang +++ b/htdocs/langs/en_US/workflow.lang @@ -13,6 +13,7 @@ descWORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL=Classify linked source proposal as b descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify linked source sales order as billed when customer invoice is validated (and if the amount of the invoice is the same as the total amount of the linked order) descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source sales order as billed when customer invoice is set to paid (and if the amount of the invoice is the same as the total amount of the linked order) descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING=Classify linked source sales order as shipped when a shipment is validated (and if the quantity shipped by all shipments is the same as in the order to update) +descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED=Classify linked source sales order as shipped when a shipment is closed (and if the quantity shipped by all shipments is the same as in the order to update) # Autoclassify purchase order descWORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL=Classify linked source vendor proposal as billed when vendor invoice is validated (and if the amount of the invoice is the same as the total amount of the linked proposal) descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER=Classify linked source purchase order as billed when vendor invoice is validated (and if the amount of the invoice is the same as the total amount of the linked order) diff --git a/htdocs/langs/fr_FR/workflow.lang b/htdocs/langs/fr_FR/workflow.lang index 2af480afa83..13fbbace793 100644 --- a/htdocs/langs/fr_FR/workflow.lang +++ b/htdocs/langs/fr_FR/workflow.lang @@ -13,6 +13,7 @@ descWORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL=Classer la/les proposition(s) commer descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classer la/les commande(s) client(s) source(s) facturée(s) à la validation de la facture client (et si le montant de la facture est le même que le montant total des commandes liées) descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classer la/les commande(s) client(s) source(s) à Facturée quand une facture client est passée à Payé (et si le montant de la facture est identique à la somme des commandes sources) descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING=Classer la commande source à expédiée à la validation d'une expédition (et si les quantités expédiées dans le bon d'expédition sont les même que dans la commande mise à jour) +descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED=Classer la commande source à expédiée à la cloture d'une expédition (et si les quantités expédiées dans le bon d'expédition sont les même que dans la commande mise à jour) # Autoclassify purchase order descWORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL=Classer la ou les proposition(s) commerciale(s) fournisseur sources facturées quand une facture fournisseur est validée (et si le montant de la facture est le même que le total des propositions sources liées) descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER=Classer la ou les commande(s) fournisseur(s) de source(s) à facturée(s) lorsque la facture fournisseur est validée (et si le montant de la facture est le même que le montant total des commandes liées) From 6e68bf10ef265f1d83c7610070a9dbeee478f5ac Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 3 Aug 2021 16:06:08 +0200 Subject: [PATCH 157/356] Update of card.php to change status --- htdocs/ticket/card.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 9b5f937455e..5d71ee4e393 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -188,7 +188,12 @@ if (empty($reshook)) { $object->email_from = $user->email; $notifyTiers = GETPOST("notify_tiers_at_create", 'alpha'); $object->notify_tiers_at_create = empty($notifyTiers) ? 0 : 1; - $object->fk_user_assign = GETPOST("fk_user_assign", 'int'); + $fk_user_assign = GETPOST("fk_user_assign", 'int'); + if (!empty($fk_user_assign)) { + $object->fk_user_assign = $fk_user_assign; + $object->fk_statut = $object::STATUS_ASSIGNED; + } + $object->fk_project = $projectid; $id = $object->create($user); From 1da9829d61bfa48aa6e0506f1e5a62db413bb799 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 3 Aug 2021 14:08:23 +0000 Subject: [PATCH 158/356] Fixing style errors. --- .../interface_20_modWorkflow_WorkflowManager.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index c47965c7d52..8235348f21f 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -259,10 +259,10 @@ class InterfaceWorkflowManager extends DolibarrTriggers if (($action == 'SHIPPING_VALIDATE') || ($action == 'SHIPPING_CLOSED')) { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) && + if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) && ( (!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING) && ($action == 'SHIPPING_VALIDATE')) || - (!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED) && ($action == 'SHIPPING_CLOSED')) + (!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED) && ($action == 'SHIPPING_CLOSED')) ) ) { $qtyshipped = array(); From 1a0eeaf701dc7ccf66792b1445eb09a21c693ccf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Aug 2021 16:35:47 +0200 Subject: [PATCH 159/356] Fix phpcs --- htdocs/expedition/class/api_shipments.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index a92fd4f436a..eaf66e59125 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -530,7 +530,7 @@ class Shipments extends DolibarrApi if ($result < 0) { throw new RestException(500, 'Error when validating Shipment: '.$this->shipment->error); } - + // Reload shipment $result = $this->shipment->fetch($id); From 1c981ccb9d137aa7324001bc9eee463464f722fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Aug 2021 17:03:34 +0200 Subject: [PATCH 160/356] Fix look and feel v14 --- htdocs/admin/paymentbybanktransfer.php | 22 ++++++++++++---------- htdocs/admin/prelevement.php | 20 +++++++++++--------- htdocs/compta/bank/line.php | 8 ++++---- htdocs/compta/prelevement/create.php | 7 ++++++- htdocs/core/class/html.form.class.php | 11 +++++++---- 5 files changed, 40 insertions(+), 28 deletions(-) diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index be5dc4e76e6..43ad8c15929 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -156,36 +156,38 @@ print ""; // Bank account (from Banks module) print ''; -print ''; /* Moved to bank account data // ICS print ''; -print ''; print ''; */ //User print ''; -print ''; print ''; /* //EntToEnd print ''; -print ''; +print ''; print ''; //USTRD print ''; -print ''; +print ''; print ''; */ @@ -195,7 +197,7 @@ print ''; +print ''; print ''; print '
    '.$langs->trans("Parameter").''.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("RUM").'
    '.$langs->trans("DateRUM").''.$form->selectDate(GETPOST('date_rum') ?GETPOST('date_rum') : $companybankaccount->date_rum, 'date_rum', 0, 0, 1, 'date_rum').'
    '.$form->selectDate($date_rum ? $date_rum : $companybankaccount->date_rum, 'date_rum', 0, 0, 1, 'date_rum', 1, 1).'
    '.$langs->trans("WithdrawMode").''; $tblArraychoice = array("FRST" => $langs->trans("FRST"), "RECUR" => $langs->trans("RECUR")); @@ -1800,8 +1798,10 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) { print '
    '.$langs->trans("RUM").'
    '.$langs->trans("RUMWillBeGenerated").'
    '.$langs->trans("DateRUM").''.$form->selectDate(GETPOST('date_rum'), 'date_rum', 0, 0, 1, 'date_rum').'
    '.$form->selectDate($date_rum, 'date_rum', 0, 0, 1, 'date_rum', 1, 1).'
    '.$langs->trans("WithdrawMode").''; $tblArraychoice = array("FRST" => $langs->trans("FRST"), "RECUR" => $langs->trans("RECUR")); From 61e3a57de701c2ecbe77095bd1fa466fbe31fbaf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Aug 2021 18:23:05 +0200 Subject: [PATCH 141/356] Fix label --- htdocs/compta/prelevement/create.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 6793fb0a893..937750648bb 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -206,7 +206,7 @@ print $nb; print '
    '.$langs->trans("AmountTotal").''; +print ''; print price($pricetowithdraw); print '
    '.$langs->trans("TotalForAccount").' '.$accountg.':'.price($sous_total_debit).'
    '.$langs->trans("TotalForAccount").' '.$accountg.':'.price($sous_total_debit).'"; - if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary', 'payment_various'))) { // Type of payment with subledger + if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary', 'payment_various'))) { // Type of payments that uses a subledger $accounttoshowsubledger = length_accounta($k); if ($accounttoshow != $accounttoshowsubledger) { if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined') { @@ -1205,14 +1245,14 @@ if (empty($action) || $action == 'view') { var_dump($tabbq[$key]);*/ //print ''.$langs->trans("ThirdpartyAccountNotDefined").''; if (!empty($tabcompany[$key]['code_compta'])) { - if (in_array($tabtype[$key], array('payment_various'))) { + if (in_array($tabtype[$key], array('payment_various', 'payment_salary'))) { // For such case, if subledger is not defined, we won't use subledger accounts. - print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").''; + print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").''; } else { - print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).''; + print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).''; } } else { - print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").''; + print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").''; } } else { print $accounttoshowsubledger; @@ -1220,10 +1260,15 @@ if (empty($action) || $action == 'view') { } } print "".$reflabel."'.$val["type_payment"]."'.($mt < 0 ? price(-$mt) : '')."'.($mt >= 0 ? price($mt) : '')."
    '; print $labeltoshow; // Already escaped - // Add links after description + // Add info about links after description $cachebankaccount = array(); foreach ($links as $key => $val) { print ''; @@ -1424,6 +1424,7 @@ if ($resql) { } elseif ($links[$key]['type'] == 'sc') { } elseif ($links[$key]['type'] == 'vat') { } elseif ($links[$key]['type'] == 'salary') { + // Information is already shown using the payment_salary link. No need of this link. } else { // Show link with label $links[$key]['label'] if (!empty($objp->label) && !empty($links[$key]['label'])) { @@ -1530,15 +1531,21 @@ if ($resql) { } if ($companylinked_id) { - // TODO Add a cache of loaded companies here + // TODO Add a cache of loaded companies here ? $companystatic->fetch($companylinked_id); print $companystatic->getNomUrl(1); } elseif ($userlinked_id && (($type_link == 'payment_salary' && !empty($user->rights->salaries->read)) || ($type_link == 'payment_sc' && !empty($user->rights->tax->charges->lire)))) { - // TODO Add a cache of loaded users here - $userstatic->fetch($userlinked_id); - print $userstatic->getNomUrl(1); + // Get object user from cache or load it + if (!empty($conf->cache['user'][$userlinked_id])) { + $tmpuser = $conf->cache['user'][$userlinked_id]; + } else { + $tmpuser = new User($db); + $tmpuser->fetch($userlinked_id); + $conf->cache['user'][$userlinked_id] = $tmpuser; + } + print $tmpuser->getNomUrl(1); } else { print ' '; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 8619ff25dae..ed61da3592e 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -399,9 +399,9 @@ class Account extends CommonObject /** * Add a link between bank line record and its source * - * @param int $line_id Id ecriture bancaire - * @param int $url_id Id parametre url - * @param string $url Url + * @param int $line_id Id of bank entry + * @param int $url_id Id of object related to link + * @param string $url Url (deprecated, we use now 'url_id' and 'type' instead) * @param string $label Link label * @param string $type Type of link ('payment', 'company', 'member', ...) * @return int <0 if KO, id line if OK @@ -412,13 +412,13 @@ class Account extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_url ("; $sql .= "fk_bank"; $sql .= ", url_id"; - $sql .= ", url"; + $sql .= ", url"; // deprecated $sql .= ", label"; $sql .= ", type"; $sql .= ") VALUES ("; $sql .= " ".((int) $line_id); - $sql .= ", '".$this->db->escape($url_id)."'"; - $sql .= ", '".$this->db->escape($url)."'"; + $sql .= ", ".((int) $url_id); + $sql .= ", '".$this->db->escape($url)."'"; // dperecated $sql .= ", '".$this->db->escape($label)."'"; $sql .= ", '".$this->db->escape($type)."'"; $sql .= ")"; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 2f36290c8d4..1fbd91cb623 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1344,15 +1344,15 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Accounting $newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->rights->accounting->mouvements->lire, '', $mainmenu, 'accountancy', 1, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); - // Balance - $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->rights->accounting->mouvements->lire); - // General Ledger $newmenu->add("/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->rights->accounting->mouvements->lire); // Journals $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Journals"), 1, $user->rights->accounting->mouvements->lire); + // Account Balance + $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->rights->accounting->mouvements->lire); + // Files if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index ec74c9361f5..771f0a83e7b 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -246,9 +246,9 @@ DescThirdPartyReport=Consult here the list of third-party customers and vendors ListAccounts=List of the accounting accounts UnknownAccountForThirdparty=Unknown third-party account. We will use %s UnknownAccountForThirdpartyBlocking=Unknown third-party account. Blocking error -ThirdpartyAccountNotDefinedOrThirdPartyUnknown=Third-party account not defined or third party unknown. We will use %s +ThirdpartyAccountNotDefinedOrThirdPartyUnknown=Subledger account not defined or third party or user unknown. We will use %s ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored=Third-party unknown and subledger not defined on the payment. We will keep the subledger account value empty. -ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking=Third-party account not defined or third party unknown. Blocking error. +ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking=Subledger account not defined or third party or user unknown. Blocking error. UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Unknown third-party account and waiting account not defined. Blocking error PaymentsNotLinkedToProduct=Payment not linked to any product / service OpeningBalance=Opening balance diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index e2b199780f0..76236bb88aa 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -477,7 +477,7 @@ class PaymentSalary extends CommonObject * All payment properties must have been set first like after a call to create(). * * @param User $user Object of user making payment - * @param string $mode 'payment_sc' + * @param string $mode 'payment_salary' * @param string $label Label to use in bank record * @param int $accountid Id of bank account to do link with * @param string $emetteur_nom Name of transmitter @@ -516,8 +516,8 @@ class PaymentSalary extends CommonObject $this->datev ); - // Mise a jour fk_bank dans llx_paiement. - // On connait ainsi le paiement qui a genere l'ecriture bancaire + // Update fk_bank into llx_paiement_salary. + // so we know the payment that was used to generated the bank entry. if ($bank_line_id > 0) { $result = $this->update_fk_bank($bank_line_id); if ($result <= 0) { @@ -525,9 +525,12 @@ class PaymentSalary extends CommonObject dol_print_error($this->db); } - // Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction + // Add link 'payment_salary' in bank_url between payment and bank transaction $url = ''; - if ($mode == 'payment_salary') $url = DOL_URL_ROOT.'/salaries/payment_salary/card.php?id='; + if ($mode == 'payment_salary') { + $url = DOL_URL_ROOT.'/salaries/payment_salary/card.php?id='; + } + if ($url) { $result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode); if ($result <= 0) { @@ -536,14 +539,31 @@ class PaymentSalary extends CommonObject } } - // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment) - $linkaddedforthirdparty = array(); + // Add link 'user' in bank_url between user and bank transaction foreach ($this->amounts as $key => $value) { - if ($mode == 'payment_salary') { - $salary = new Salary($this->db); - $salary->fetch($key); - $result = $acc->add_url_line($bank_line_id, $salary->id, DOL_URL_ROOT.'/salaries/card.php?id=', '('.$salary->label.')', 'salary'); - if ($result <= 0) dol_print_error($this->db); + if (!$error) { + if ($mode == 'payment_salary') { + $salary = new Salary($this->db); + $salary->fetch($key); + $salary->fetch_user($salary->fk_user); + + $fuser = $salary->user; + + if ($fuser->id > 0) { + $result = $acc->add_url_line( + $bank_line_id, + $fuser->id, + DOL_URL_ROOT.'/user/card.php?id=', + $fuser->getFullName($langs), + 'user' + ); + } + if ($result <= 0) { + $this->error = $this->db->lasterror(); + dol_syslog(get_class($this) . '::addPaymentToBank ' . $this->error); + $error++; + } + } } } } else { diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 35ceb8a1931..cc50c57ec84 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -88,6 +88,12 @@ class Salary extends CommonObject */ public $fk_user_modif; + /** + * @var user User + */ + public $user; + + const STATUS_UNPAID = 0; const STATUS_PAID = 1; From ce5acda635e62378a8495b4bd212e8d702017da8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Aug 2021 15:03:41 +0200 Subject: [PATCH 149/356] Fix phpcs --- htdocs/accountancy/class/accountancyexport.class.php | 4 ++-- htdocs/projet/tasks/time.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 5ac3ebcb37d..a96c672608a 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -488,8 +488,8 @@ class AccountancyExport foreach ($TData as $data) { $code_compta = length_accountg($data->numero_compte); if (!empty($data->subledger_account)) { - $code_compta = length_accounta($data->subledger_account); - } + $code_compta = length_accounta($data->subledger_account); + } $date_document = dol_print_date($data->doc_date, '%Y%m%d'); $date_echeance = dol_print_date($data->date_lim_reglement, '%Y%m%d'); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 1923bde17b2..0daf5439dc0 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1423,9 +1423,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { $totalarray['nbfield']++; } } - } elseif ($action !== 'createtime') { - print ''; - } + } elseif ($action !== 'createtime') { + print ''; + } // Task label if (!empty($arrayfields['t.task_label']['checked'])) { From 8b746b64a0601c4c15a6a18ff0d23326e079f98a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Aug 2021 15:04:29 +0200 Subject: [PATCH 150/356] Prepare 14.0.1 --- 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 8aa64da85f1..e55ca5b6e04 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -34,7 +34,7 @@ if (!defined('DOL_APPLICATION_TITLE')) { define('DOL_APPLICATION_TITLE', 'Dolibarr'); } if (!defined('DOL_VERSION')) { - define('DOL_VERSION', '14.0.0'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c + define('DOL_VERSION', '14.0.1'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c } if (!defined('EURO')) { From c8fd7ccbb67253e848b2470d26eb6e1532592c0b Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 3 Aug 2021 15:06:53 +0200 Subject: [PATCH 151/356] Close #18043 : fk_user_assign in create ticket --- htdocs/core/class/html.formticket.class.php | 8 ++++++++ htdocs/ticket/card.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 53ba83015b3..259e5a3a19a 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -436,6 +436,14 @@ class FormTicket print 'withnotifytiersatcreate ? ' checked="checked"' : '').'>'; print '
    '; + print $langs->trans("AssignedTo"); + print ''; + print $form->select_dolusers(GETPOST('fk_user_assign', 'int'), 'fk_user_assign', 1); + print '
    '.$langs->trans("BankToPayCreditTransfer").''; -$form->select_comptes($conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT, 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT', 0, "courant=1", 1); +print ''; +print img_picto('', 'bank_account', 'class="pictofixedwidth"'); +print $form->select_comptes($conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT, 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT', 0, "courant=1", 1, '', 0, 'minwidth200', 1); print '
    '.$langs->trans("ICS").''; +print ''; print '
    '.$langs->trans("ResponsibleUser").''; -print $form->select_dolusers($conf->global->PAYMENTBYBANKTRANSFER_USER, 'PAYMENTBYBANKTRANSFER_USER', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); +print ''; +print img_picto('', 'user', 'class="pictofixedwidth"'); +print $form->select_dolusers($conf->global->PAYMENTBYBANKTRANSFER_USER, 'PAYMENTBYBANKTRANSFER_USER', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'minwidth200 maxwidth500'); print '
    '.$langs->trans("END_TO_END").''; -print ''; +print '
    '.$langs->trans("USTRD").''; -print ''; +print '
    '; if (!$conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS) { $conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS = 0; } -print '
    '; print '
    '; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index c7de6d59896..01e3b6d4913 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -160,8 +160,9 @@ print ""; // Bank account (from Banks module) print ''.$langs->trans("BankToReceiveWithdraw").''; -print ''; -$form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT, 'PRELEVEMENT_ID_BANKACCOUNT', 0, "courant=1", 1); +print ''; +print img_picto('', 'bank_account', 'class="pictofixedwidth"'); +print $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT, 'PRELEVEMENT_ID_BANKACCOUNT', 0, "courant=1", 1, '', 0, 'minwidth200', 1); print ''; /* Moved to bank account data @@ -179,8 +180,9 @@ print ''; //User print ''.$langs->trans("ResponsibleUser").''; -print ''; -print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'PRELEVEMENT_USER', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); +print ''; +print img_picto('', 'user', 'class="pictofixedwidth"'); +print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'PRELEVEMENT_USER', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'minwidth200 maxwidth500'); print ''; print ''; @@ -189,8 +191,8 @@ print ''; $htmltext = $langs->trans("KeepThisEmptyInMostCases"); print $form->textwithpicto($langs->trans("END_TO_END"), $htmltext); print ''; -print ''; -print ''; +print ''; +print ''; print ''; //USTRD @@ -199,16 +201,16 @@ $htmltext = $langs->trans("KeepThisEmptyInMostCases"); print $form->textwithpicto($langs->trans("USTRD"), $htmltext); print ''; print ''; -print ''; +print ''; print ''; //ADDDAYS print ''.$langs->trans("ADDDAYS").''; -print ''; +print ''; if (empty($conf->global->PRELEVEMENT_ADDDAYS)) { $conf->global->PRELEVEMENT_ADDDAYS = 0; } -print ''; +print ''; print ''; print ''; diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 2c33085aa6d..05aed6a215e 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -624,21 +624,21 @@ if ($result) { print ''; - print '"; + print '"; if ($user->rights->banque->consolidate) { print ''; } else { - print ''; + print ''; } print ''; diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 937750648bb..be18099b6a8 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -67,6 +67,7 @@ $hookmanager->initHooks(array('directdebitcreatecard', 'globalcard')); /* * Actions */ + if (GETPOST('cancel', 'alpha')) { $massaction = ''; } @@ -165,7 +166,11 @@ llxHeader('', $langs->trans("NewStandingOrder")); if (prelevement_check_config($type) < 0) { $langs->load("errors"); - setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Withdraw")), null, 'errors'); + $modulenametoshow = "Withdraw"; + if ($type == 'bank-transfer') { + $modulenametoshow = "PaymentByBankTransfer"; + } + setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv($modulenametoshow)), null, 'errors'); } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9e46d55d6a8..4e9da790f28 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1952,15 +1952,12 @@ class Form } dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); + $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); $i = 0; if ($num) { - // Enhance with select2 - include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out .= ajax_combobox($htmlname); - // do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined $out .= ''; + + if ($num) { + // Enhance with select2 + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; + $out .= ajax_combobox($htmlname); + } } else { dol_print_error($this->db); } From 892ec3a66166fdecdf56d363e5c74b417805f07c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Aug 2021 17:06:07 +0200 Subject: [PATCH 161/356] Update card.php --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 5d71ee4e393..8a11ac23e23 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -189,7 +189,7 @@ if (empty($reshook)) { $notifyTiers = GETPOST("notify_tiers_at_create", 'alpha'); $object->notify_tiers_at_create = empty($notifyTiers) ? 0 : 1; $fk_user_assign = GETPOST("fk_user_assign", 'int'); - if (!empty($fk_user_assign)) { + if ($fk_user_assign > 0) { $object->fk_user_assign = $fk_user_assign; $object->fk_statut = $object::STATUS_ASSIGNED; } From 5ec3245119ef2a0de931d5361c15caa9bb65a72f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Aug 2021 17:15:55 +0200 Subject: [PATCH 162/356] Migration --- htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 28d484c7e99..35f5221e34f 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -35,6 +35,8 @@ -- v15 +ALTER TABLE llx_knowledgemanagement_knowledgerecord ADD lang varchar(6); + CREATE TABLE llx_categorie_ticket ( fk_categorie integer NOT NULL, From ea6cfeb0e84e7e968559dd0567fe0f9d6d7474de Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Aug 2021 19:21:18 +0200 Subject: [PATCH 163/356] NEW Increase size of params of action for emailcollector --- htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 2 ++ .../mysql/tables/llx_emailcollector_emailcollectoraction.sql | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 35f5221e34f..89546dd9bb6 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -35,6 +35,8 @@ -- v15 +ALTER TABLE llx_emailcollector_emailcollectoraction MODIFY COLUMN actionparam TEXT; + ALTER TABLE llx_knowledgemanagement_knowledgerecord ADD lang varchar(6); CREATE TABLE llx_categorie_ticket diff --git a/htdocs/install/mysql/tables/llx_emailcollector_emailcollectoraction.sql b/htdocs/install/mysql/tables/llx_emailcollector_emailcollectoraction.sql index c45a3dcd1c4..deda90cbdcd 100644 --- a/htdocs/install/mysql/tables/llx_emailcollector_emailcollectoraction.sql +++ b/htdocs/install/mysql/tables/llx_emailcollector_emailcollectoraction.sql @@ -19,7 +19,7 @@ CREATE TABLE llx_emailcollector_emailcollectoraction( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, fk_emailcollector INTEGER NOT NULL, type varchar(128) NOT NULL, - actionparam varchar(255) NULL, + actionparam text NULL, date_creation datetime NOT NULL, tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, From a571fab1773af3d38299cfa8a36a65c64ae1af8c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Aug 2021 23:54:36 +0200 Subject: [PATCH 164/356] css --- htdocs/comm/index.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 9d0d9f1befc..2fafb5636e2 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -182,7 +182,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { print ''; print ''; print ''; - print ''; + print ''; print ''; $i++; @@ -278,7 +278,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa print ''; print ''; print ''; - print ''; + print ''; print ''; $i++; @@ -375,7 +375,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { print ''; print ''; print ''; - print ''; + print ''; print ''; $i++; @@ -472,7 +472,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU print ''; print ''; print ''; - print ''; + print ''; print ''; $i++; @@ -862,7 +862,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { print ''; print ''; - print ''; + print ''; print ''; print ''; @@ -979,7 +979,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { print ''; print ''; - print ''; + print ''; print ''; print ''; From 5f5734e9af8b9f0669b050a2cb129e39b1a47007 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 00:09:33 +0200 Subject: [PATCH 165/356] css --- htdocs/admin/clicktodial.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 25ada4d2d89..d6525335ad8 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -134,7 +134,7 @@ if (!empty($conf->global->CLICKTODIAL_URL)) { print ''; print $langs->trans("LinkToTestClickToDial", $user->login).' : '; print ''; - print ''; + print ''; print ''; $setupcomplete = 1; @@ -149,7 +149,7 @@ if (!empty($conf->global->CLICKTODIAL_URL)) { } if ($setupcomplete) { - print $langs->trans("LinkToTest", $user->login).': '.dol_print_phone($phonefortest, '', 0, 0, 'AC_TEL'); + print $langs->trans("LinkToTest", $user->login).': '.dol_print_phone($phonefortest, '', 0, 0, 'AC_TEL', '', 1); } else { $langs->load("errors"); print '
    '.$langs->trans("WarningClickToDialUserSetupNotComplete").'
    '; From 6c19524fd76dbb4c88353f4dea74ce3eeec7edc0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 00:12:49 +0200 Subject: [PATCH 166/356] code comment --- htdocs/admin/clicktodial.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index d6525335ad8..9fd92f45faa 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -149,7 +149,7 @@ if (!empty($conf->global->CLICKTODIAL_URL)) { } if ($setupcomplete) { - print $langs->trans("LinkToTest", $user->login).': '.dol_print_phone($phonefortest, '', 0, 0, 'AC_TEL', '', 1); + print $langs->trans("LinkToTest", $user->login).':   '.dol_print_phone($phonefortest, '', 0, 0, 'AC_TEL', '', 'mobile'); } else { $langs->load("errors"); print '
    '.$langs->trans("WarningClickToDialUserSetupNotComplete").'
    '; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a6c62ba2a47..62f4006c1de 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2831,7 +2831,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor * @param int $socid Id of third party if known * @param string $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set) * @param string $separ Separation between numbers for a better visibility example : xx.xx.xx.xx.xx - * @param string $withpicto Show picto + * @param string $withpicto Show picto ('fax', 'phone', 'mobile') * @param string $titlealt Text to show on alt * @param int $adddivfloat Add div float around phone. * @return string Formated phone number From 26ba153169909456d381d28f7f824ac3a374a82c Mon Sep 17 00:00:00 2001 From: Daniel Mietchen Date: Wed, 4 Aug 2021 00:21:04 -0400 Subject: [PATCH 167/356] typo fix and copyedits --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7878f6270a7..834cc09236e 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ If you don't have time to install it yourself, you can try some commercial 'read ## UPGRADING -Dolibarr supports upgrading usually wihtout the need for any (commercial) support (depending on if you use any commercial extensions) and supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate! +Dolibarr supports upgrading, usually without the need for any (commercial) support (depending on if you use any commercial extensions). It supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate! - At first make a backup of your Dolibarr files & than [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr) - Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md). From 8c7b6e66662f7d3629208aeeecd21254b9362395 Mon Sep 17 00:00:00 2001 From: Daniel Mietchen Date: Wed, 4 Aug 2021 00:34:29 -0400 Subject: [PATCH 168/356] typo fixes --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 035387834bd..84deea18f00 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,7 +3,7 @@ *Please:* - *only keep the "Fix", "Close" or "New" section* - *follow the project [contributing guidelines](/.github/CONTRIBUTING.md)* -- *replace the bracket enclosed textswith meaningful informations* +- *replace the bracket enclosed texts with meaningful information* # Fix #[*issue_number Short description*] From 4958015e93ae519b81b0270c1399c57708de440e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 12:26:38 +0200 Subject: [PATCH 169/356] Fix token --- htdocs/admin/tools/dolibarr_export.php | 9 +++++++-- htdocs/admin/tools/dolibarr_import.php | 12 ++++++++++-- htdocs/admin/tools/export_files.php | 4 ++++ htdocs/admin/tools/listsessions.php | 11 ++++++++--- htdocs/admin/tools/purge.php | 13 +++++++++---- htdocs/admin/tools/update.php | 17 +++++++++++------ 6 files changed, 49 insertions(+), 17 deletions(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 428c80676a2..4f6977ffb41 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -136,7 +136,7 @@ $title = $langs->trans("Backup"); print load_fiche_titre($title, '', 'title_setup'); //print_barre_liste($langs->trans("Backup"), '', '', '', '', '', $langs->trans("BackupDesc",DOL_DATA_ROOT), 0, 0, 'title_setup'); -print '
    '; +print '
    '; print $langs->trans("BackupDesc", DOL_DATA_ROOT); print '
    '; print '
    '; @@ -147,8 +147,11 @@ print ''; print ''; print '
    1'; +print ''; print $langs->trans("BackupDesc3", $dolibarr_main_db_name).'
    '; //print $langs->trans("BackupDescY").'
    '; +print '
    '; + print '
    '; print '
    '; @@ -157,7 +160,7 @@ $title = $langs->trans("BackupDumpWizard"); print load_fiche_titre($title); -print '
    '.$langs->trans("Conciliation")."
    '.$form->textwithpicto($langs->trans("AccountStatement"), $langs->trans("InputReceiptNumber"))."'; if ($objp->rappro) { - print $langs->trans("AccountStatement").' rappro ? ' disabled' : '').'>'; + print 'rappro ? ' disabled' : '').'>'; print ''; } else { - print $langs->trans("AccountStatement").' rappro ? ' disabled' : '').'>'; + print 'rappro ? ' disabled' : '').'>'; } if ($objp->num_releve) { print '   ('.$langs->trans("AccountStatement").' '.$objp->num_releve.')'; } print ''.$objp->num_releve.' '.$objp->num_releve.'
    '.$propalstatic->getNomUrl(1).''.$companystatic->getNomUrl(1, 'customer').''.price((!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc)).''.price((!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc)).'
    '.$supplierproposalstatic->getNomUrl(1).''.$companystatic->getNomUrl(1, 'supplier').''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'
    '.$orderstatic->getNomUrl(1).''.$companystatic->getNomUrl(1, 'customer').''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'
    '.$supplierorderstatic->getNomUrl(1).''.$companystatic->getNomUrl(1, 'supplier').''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'
    '.$companystatic->getNomUrl(1, 'customer', 44).''.dol_print_date($db->jdate($obj->dp), 'day').''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''.$propalstatic->LibStatut($obj->fk_statut, 3).'
    '.$companystatic->getNomUrl(1, 'customer', 44).''.dol_print_date($db->jdate($obj->dv), 'day').''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''.$orderstatic->LibStatut($obj->fk_statut, $obj->billed, 3).'
    '; +print '
    '; print ''; print ''; // Amount - print ''; // Date From a84c9943684ded3ea6117d53b2aaa546fb9c3732 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 12:43:36 +0200 Subject: [PATCH 174/356] Fix no tooltip on link in error message --- htdocs/compta/prelevement/create.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 1956cb14516..4c36922e5f4 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -96,7 +96,7 @@ if (empty($reshook)) { $bank = new Account($db); $bank->fetch($conf->global->{$default_account}); if (empty($bank->ics) || empty($bank->ics_transfer)) { - $errormessage = str_replace('{url}', $bank->getNomUrl(1), $langs->trans("ErrorICSmissing", '{url}')); + $errormessage = str_replace('{url}', $bank->getNomUrl(1, '', '', -1, 1), $langs->trans("ErrorICSmissing", '{url}')); setEventMessages($errormessage, null, 'errors'); header("Location: ".DOL_URL_ROOT.'/compta/prelevement/create.php'); exit; From 2f3105d884fd941ab0d446f66c8a6f3a6982eb6e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 13:05:07 +0200 Subject: [PATCH 175/356] Add CSRF protection --- htdocs/admin/system/database-tables.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index 7535500e799..3d31c516858 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2021 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin @@ -21,9 +21,13 @@ /** * \file htdocs/admin/system/database-tables.php - * \brief Page with information on database tables + * \brief Page with information on database tables. Add also some maintenance action to convert tables. */ +if (! defined('CSRFCHECK_WITH_TOKEN')) { + define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET +} + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -126,14 +130,14 @@ if (!$base) { print ''; print ''; if (isset($obj->Engine) && $obj->Engine == "MyISAM") { - print ''; + print ''; } else { print ''; } print ''; print ''; @@ -145,7 +149,7 @@ if (!$base) { print ''; print ''; print ''; From bec87f5739d65826d2221570ba70df2481ef7d43 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 13:12:07 +0200 Subject: [PATCH 176/356] Fix translation ICS --- htdocs/compta/bank/card.php | 10 +++++----- htdocs/langs/en_US/withdrawals.lang | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index ea9f7799849..d1cc0413bfd 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -212,7 +212,7 @@ if (empty($reshook)) { $object->ics = trim(GETPOST("ics", 'alpha')); $object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha')); - $account_number = GETPOST('account_number', 'alpha'); + $account_number = GETPOST('account_number', 'alphanohtml'); if (empty($account_number) || $account_number == '-1') { $object->account_number = ''; } else { @@ -754,13 +754,13 @@ if ($action == 'create') { print ''; if ($conf->prelevement->enabled) { - print ''; + print ''; print ''; print ''; } if ($conf->paymentbybanktransfer->enabled) { - print ''; + print ''; print ''; print ''; } @@ -1053,12 +1053,12 @@ if ($action == 'create') { print ''; if ($conf->prelevement->enabled) { - print ''; + print ''; print ''; } if ($conf->paymentbybanktransfer->enabled) { - print ''; + print ''; print ''; } diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index 7d5b57f7da9..a3773a427a1 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -133,8 +133,7 @@ SEPARCUR=SEPA CUR SEPAFRST=SEPA FRST ExecutionDate=Execution date CreateForSepa=Create direct debit file -ICS=Creditor Identifier CI for direct debit -ICSTransfer=Creditor Identifier CI for bank transfer +ICS=Creditor Identifier - ICS END_TO_END="EndToEndId" SEPA XML tag - Unique id assigned per transaction USTRD="Unstructured" SEPA XML tag ADDDAYS=Add days to Execution Date From de228c568760e672d716c4d686dc89924fbb2e18 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 13:18:03 +0200 Subject: [PATCH 177/356] Fix bad link. Can't delete SEPA bank transfer request --- htdocs/compta/prelevement/card.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index a94d068603a..b03ed9d93e0 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -325,19 +325,19 @@ if ($id > 0 || $ref) { // Actions if ($action != 'settransmitted' && $action != 'setcredited') { - print "\n
    \n"; + print "\n".'
    '."\n"; if (empty($object->date_trans) && $user->rights->prelevement->bons->send) { - print "id."\">".$langs->trans("SetToStatusSent").""; + print ''.$langs->trans("SetToStatusSent").''; } if (!empty($object->date_trans) && $object->date_credit == 0) { - print "id."\">".$langs->trans("ClassCredited").""; + print ''.$langs->trans("ClassCredited").''; } - print "id."\">".$langs->trans("Delete").""; + print ''.$langs->trans("Delete").''; - print "
    "; + print '
    '; } @@ -413,7 +413,7 @@ if ($id > 0 || $ref) { print "
    '; @@ -434,7 +434,7 @@ if ($id > 0 || $ref) { if ($obj->statut == 2) { if ($user->rights->prelevement->bons->credit) { //print ''.$langs->trans("StandingOrderReject").''; - print ''.$langs->trans("StandingOrderReject").''; + print ''.$langs->trans("StandingOrderReject").''; } else { //print ''.$langs->trans("StandingOrderReject").''; } From 23ea8d2907671e27e2bf54d76258039e817585c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 13:22:24 +0200 Subject: [PATCH 178/356] Fix link into message --- htdocs/compta/prelevement/create.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 4c36922e5f4..6f045f3ca74 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -125,9 +125,13 @@ if (empty($reshook)) { } } else { if ($type != 'bank-transfer') { - setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null); + $texttoshow = $langs->trans("DirectDebitOrderCreated", '{s}'); + $texttoshow = str_replace('{s}', $bprev->getNomUrl(1), $texttoshow); + setEventMessages($texttoshow, null); } else { - setEventMessages($langs->trans("CreditTransferOrderCreated", $bprev->getNomUrl(1)), null); + $texttoshow = $langs->trans("CreditTransferOrderCreated", '{s}'); + $texttoshow = str_replace('{s}', $bprev->getNomUrl(1), $texttoshow); + setEventMessages($texttoshow, null); } header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$bprev->id); From a9ced1098ddff4a689e23fac59290b286a992316 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 13:51:54 +0200 Subject: [PATCH 179/356] Fix lang loaded --- htdocs/compta/prelevement/orders_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index 5c6f058bff1..3ca9ce32fbe 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.p require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page -$langs->loadLangs(array('banks', 'categories', 'widthdrawals')); +$langs->loadLangs(array('banks', 'categories', 'withdrawals')); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'directdebitcredittransferlist'; // To manage different context of search From 58ca982e5596ec618675818a58a6b86fe1426a9b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 14:01:57 +0200 Subject: [PATCH 180/356] Fix trans --- htdocs/commande/class/commande.class.php | 2 +- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 333d4e2ded6..65b446727e5 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -195,7 +195,7 @@ class Commande extends CommonOrder /** * @var int Date expected for delivery - * @see delivery_date + * @see $delivery_date * @deprecated */ public $date_livraison; diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 550ef976aba..dacdf57d3a8 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -114,7 +114,7 @@ class KnowledgeRecord extends CommonObject 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>3, 'csslist'=>'tdoverflow300'), //'url' => array('type'=>'varchar(255)', 'label'=>'URL', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflow200', 'help'=>'UrlForInfoPage'), 'fk_c_ticket_category' => array('type'=>'integer:CTicketCategory:ticket/class/cticketcategory.class.php', 'label'=>'GroupOfTicket', 'enabled'=>'$conf->ticket->enabled', 'position'=>512, 'notnull'=>0, 'visible'=>-1, 'help'=>'YouCanLinkArticleToATicketCategory'), - 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Valid'),), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated'),), ); public $rowid; public $ref; From 841176fdfd0515035e444ac4f5b033c27ff82ef4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 14:38:05 +0200 Subject: [PATCH 181/356] Fix set cookie with tag "secure" when https is forced. --- htdocs/main.inc.php | 2 +- htdocs/takepos/index.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e7fa5e33e39..49797b1e6e8 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -265,7 +265,7 @@ if (!empty($_POST["DOL_AUTOSET_COOKIE"])) { $cookiename = $tmpautoset[0]; $cookievalue = json_encode($cookiearrayvalue); //var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue); - setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', null, false, true); // keep cookie 1 year and add tag httponly + setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // keep cookie 1 year and add tag httponly if (empty($cookievalue)) { unset($_COOKIE[$cookiename]); } diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 1ddab39dcbe..e7b8b8af438 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -67,7 +67,7 @@ if ($_SESSION["takeposterminal"] == "") { if ($setterminal > 0) { $_SESSION["takeposterminal"] = $setterminal; - setcookie("takeposterminal", $setterminal, (time() + (86400 * 354)), '/', null, false, true); // Permanent takeposterminal var in a cookie + setcookie("takeposterminal", $setterminal, (time() + (86400 * 354)), '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Permanent takeposterminal var in a cookie } if ($setcurrency != "") { From c60927da61025442630295f011d6c89f859e8a1c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 15:16:51 +0200 Subject: [PATCH 182/356] Add missing security info --- htdocs/admin/system/security.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 79690032901..fe3c95d1d3e 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -88,10 +88,13 @@ if (function_exists('exec')) { } print '
    '; -print "PHP safe_mode = ".(ini_get('safe_mode') ? ini_get('safe_mode') : yn(0)).'   '.$langs->trans("Deprecated")." (removed in PHP 5.4)
    \n"; +print "PHP session.use_strict_mode = ".(ini_get('session.use_strict_mode') ? ini_get('session.use_strict_mode') : yn(0)).'   ('.$langs->trans("RecommendedValueIs", '1').")
    \n"; +print "PHP session.use_only_cookies = ".(ini_get('session.use_only_cookies') ? ini_get('session.use_only_cookies') : yn(0)).'   ('.$langs->trans("RecommendedValueIs", '1').")
    \n"; +print "PHP session.cookie_samesite = ".(ini_get('session.cookie_samesite') ? ini_get('session.cookie_samesite') : 'None').'   ('.$langs->trans("RecommendedValueIs", 'Strict').")
    \n"; print "PHP open_basedir = ".(ini_get('open_basedir') ? ini_get('open_basedir') : yn(0).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("ARestrictedPath").', '.$langs->transnoentitiesnoconv("Example").' '.$_SERVER["DOCUMENT_ROOT"]).')')."
    \n"; print "PHP allow_url_fopen = ".(ini_get('allow_url_fopen') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_fopen') : yn(0)).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")
    \n"; print "PHP allow_url_include = ".(ini_get('allow_url_include') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_include') : yn(0)).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")
    \n"; +print "PHP safe_mode = ".(ini_get('safe_mode') ? ini_get('safe_mode') : yn(0)).'   '.$langs->trans("Deprecated")." (removed in PHP 5.4)
    \n"; print "PHP disable_functions = "; $arrayoffunctionsdisabled = explode(',', ini_get('disable_functions')); $arrayoffunctionstodisable = explode(',', 'pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals'); From ba403dd33fa070406b5b162a3f5b875a7324a80b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 15:21:01 +0200 Subject: [PATCH 183/356] Add missing security info --- htdocs/admin/system/security.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index fe3c95d1d3e..b745ad75818 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -90,6 +90,7 @@ print '
    '; print "PHP session.use_strict_mode = ".(ini_get('session.use_strict_mode') ? ini_get('session.use_strict_mode') : yn(0)).'   ('.$langs->trans("RecommendedValueIs", '1').")
    \n"; print "PHP session.use_only_cookies = ".(ini_get('session.use_only_cookies') ? ini_get('session.use_only_cookies') : yn(0)).'   ('.$langs->trans("RecommendedValueIs", '1').")
    \n"; +print "PHP session.cookie_httponly = ".(ini_get('session.cookie_httponly') ? ini_get('session.cookie_httponly') : '').'   ('.$langs->trans("RecommendedValueIs", '1').")
    \n"; print "PHP session.cookie_samesite = ".(ini_get('session.cookie_samesite') ? ini_get('session.cookie_samesite') : 'None').'   ('.$langs->trans("RecommendedValueIs", 'Strict').")
    \n"; print "PHP open_basedir = ".(ini_get('open_basedir') ? ini_get('open_basedir') : yn(0).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("ARestrictedPath").', '.$langs->transnoentitiesnoconv("Example").' '.$_SERVER["DOCUMENT_ROOT"]).')')."
    \n"; print "PHP allow_url_fopen = ".(ini_get('allow_url_fopen') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_fopen') : yn(0)).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")
    \n"; From a5d11a1ccfed1da3591ae8c92715ca6a7871b85e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 15:46:00 +0200 Subject: [PATCH 184/356] Fix warning --- htdocs/admin/system/security.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index b745ad75818..1ca4b95856e 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -249,7 +249,7 @@ if (empty($dolibarr_main_prod)) { } print '
    '; -print '$dolibarr_nocsrfcheck: '.$dolibarr_nocsrfcheck; +print '$dolibarr_nocsrfcheck: '.(empty($dolibarr_nocsrfcheck) ? '0' : $dolibarr_nocsrfcheck); if (!empty($dolibarr_nocsrfcheck)) { print '   '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 0); } From 76038e692dad59196d9b8e4789a836c57c9dce4b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 20:07:12 +0200 Subject: [PATCH 185/356] NEW Use an ajax call for the clicktodial feature instead of href link. --- htdocs/core/js/lib_foot.js.php | 190 ++++++++++++++++------------- htdocs/core/lib/admin.lib.php | 2 + htdocs/core/lib/functions.lib.php | 15 ++- htdocs/core/lib/functions2.lib.php | 4 +- 4 files changed, 122 insertions(+), 89 deletions(-) diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 00f161a31ef..74a7f543bfc 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -102,8 +102,7 @@ print "});\n"; // Wrapper to manage dropdown if (!defined('JS_JQUERY_DISABLE_DROPDOWN')) { print "\n/* JS CODE TO ENABLE dropdown (hamburger, linkto, ...) */\n"; - print ' - jQuery(document).ready(function () { + print ' jQuery(document).ready(function () { var lastopendropdown = null; // Click onto the link "link to" or "hamburger", toggle dropdown @@ -171,21 +170,19 @@ if (!defined('JS_JQUERY_DISABLE_DROPDOWN')) { // Wrapper to manage document_preview if ($conf->browser->layout != 'phone') { print "\n/* JS CODE TO ENABLE document_preview */\n"; // Function document_preview is into header - print ' - jQuery(document).ready(function () { + print ' jQuery(document).ready(function () { jQuery(".documentpreview").click(function () { console.log("We click on preview for element with href="+$(this).attr(\'href\')+" mime="+$(this).attr(\'mime\')); document_preview($(this).attr(\'href\'), $(this).attr(\'mime\'), \''.dol_escape_js($langs->transnoentities("Preview")).'\'); return false; }); - }); - ' . "\n"; + });'."\n"; } // Code to manage reposition print "\n/* JS CODE TO ENABLE reposition management (does not work if a redirect is done after action of submission) */\n"; print ' - jQuery(document).ready(function() { + jQuery(document).ready(function() { /* If page_y set, we set scollbar with it */ page_y=getParameterByName(\'page_y\', 0); /* search in GET parameter */ if (page_y == 0) page_y = jQuery("#page_y").text(); /* search in POST parameter that is filed at bottom of page */ @@ -216,96 +213,123 @@ print ' } } }); - });'."\n"; + });'."\n"; -print "\n/* JS CODE TO ENABLE ClipBoard copy paste*/\n"; -print 'jQuery(\'.clipboardCPShowOnHover\').hover( - function() { - console.log("We hover a value with a copy paste feature"); - $(this).children(".clipboardCPButton, .clipboardCPText").show(); - }, - function() { - console.log("We hover out the value with a copy paste feature"); - $(this).children(".clipboardCPButton, .clipboardCPText").hide(); - } - );'; -print 'jQuery(\'.clipboardCPButton, .clipboardCPValueToPrint\').click(function() { - /* console.log(this.parentNode); */ - console.log("We click on a clipboardCPButton or clipboardCPValueToPrint class"); - if (window.getSelection) { - selection = window.getSelection(); +// Code to manage Copy To Clipboard click +print "\n/* JS CODE TO ENABLE ClipBoard copy paste */\n"; +print ' + jQuery(document).ready(function() { + jQuery(\'.clipboardCPShowOnHover\').hover( + function() { + console.log("We hover a value with a copy paste feature"); + $(this).children(".clipboardCPButton, .clipboardCPText").show(); + }, + function() { + console.log("We hover out the value with a copy paste feature"); + $(this).children(".clipboardCPButton, .clipboardCPText").hide(); + } + ); - range = document.createRange(); - range.selectNodeContents(this.parentNode.firstChild); + jQuery(\'.clipboardCPButton, .clipboardCPValueToPrint\').click(function() { + /* console.log(this.parentNode); */ + console.log("We click on a clipboardCPButton or clipboardCPValueToPrint class"); + if (window.getSelection) { + selection = window.getSelection(); - selection.removeAllRanges(); - selection.addRange( range ); - } - document.execCommand( \'copy\' ); - window.getSelection().removeAllRanges(); + range = document.createRange(); + range.selectNodeContents(this.parentNode.firstChild); - /* Show message */ - var lastchild = this.parentNode.lastChild; - var tmp = lastchild.innerHTML - lastchild.innerHTML = \''.dol_escape_js($langs->trans('CopiedToClipboard')).'\'; - setTimeout(() => { lastchild.innerHTML = tmp; }, 1000); - })'."\n"; + selection.removeAllRanges(); + selection.addRange( range ); + } + document.execCommand( \'copy\' ); + window.getSelection().removeAllRanges(); + + /* Show message */ + var lastchild = this.parentNode.lastChild; + var tmp = lastchild.innerHTML + lastchild.innerHTML = \''.dol_escape_js($langs->trans('CopiedToClipboard')).'\'; + setTimeout(() => { lastchild.innerHTML = tmp; }, 1000); + }); + });'."\n"; + +// Code to manage clicktodial +print "\n/* JS CODE TO ENABLE clicktodial call of an URL */\n"; +print ' + jQuery(document).ready(function() { + jQuery(".cssforclicktodial").click(function() { + event.preventDefault(); + console.log("We click on a cssforclicktodial class with url="+this.href); + $.ajax({ + url: this.href, + type: \'GET\', + data: { token: \''.newToken().'\' } + }).done(function(xhr, textStatus, errorThrown) { + /* do nothing */ + }).fail(function(xhr, textStatus, errorThrown) { + alert("Error: "+textStatus); + }); + return false; + }); + });'."\n"; +// Code to manage the confirm dialog box print "\n/* JS CODE TO ENABLE DIALOG CONFIRM POPUP ON ACTION BUTTON */\n"; -print '$( document ).ready(function() { - $(document).on("click", \'.butActionConfirm\', function(event) { - event.preventDefault(); +print ' + jQuery(document).ready(function() { + $(document).on("click", \'.butActionConfirm\', function(event) { + event.preventDefault(); - // I don\'t use jquery $(this).data(\'confirm-url\'); to get $(this).attr(\'data-confirm-url\'); because .data() can doesn\'t work with ajax - var confirmUrl = $(this).attr(\'data-confirm-url\'); - var confirmTitle = $(this).attr(\'data-confirm-title\'); - var confirmContent = $(this).attr(\'data-confirm-content\'); - var confirmActionBtnLabel = $(this).attr(\'data-confirm-action-btn-label\'); - var confirmCancelBtnLabel = $(this).attr(\'data-confirm-cancel-btn-label\'); - var confirmModal = $(this).attr(\'data-confirm-modal\'); - if(confirmModal == undefined){ confirmModal = false; } + // I don\'t use jquery $(this).data(\'confirm-url\'); to get $(this).attr(\'data-confirm-url\'); because .data() can doesn\'t work with ajax + var confirmUrl = $(this).attr(\'data-confirm-url\'); + var confirmTitle = $(this).attr(\'data-confirm-title\'); + var confirmContent = $(this).attr(\'data-confirm-content\'); + var confirmActionBtnLabel = $(this).attr(\'data-confirm-action-btn-label\'); + var confirmCancelBtnLabel = $(this).attr(\'data-confirm-cancel-btn-label\'); + var confirmModal = $(this).attr(\'data-confirm-modal\'); + if(confirmModal == undefined){ confirmModal = false; } - var confirmId = \'confirm-dialog-box\'; - if($(this).attr(\'id\') != undefined){ var confirmId = confirmId + "-" + $(this).attr(\'id\'); } - if($("#" + confirmId) != undefined) { $(\'#\' + confirmId).remove(); } + var confirmId = \'confirm-dialog-box\'; + if($(this).attr(\'id\') != undefined){ var confirmId = confirmId + "-" + $(this).attr(\'id\'); } + if($("#" + confirmId) != undefined) { $(\'#\' + confirmId).remove(); } - // Create modal box + // Create modal box - var $confirmBox = $(\'
    \', { - id: confirmId, - title: confirmTitle - }).appendTo(\'body\'); + var $confirmBox = $(\'
    \', { + id: confirmId, + title: confirmTitle + }).appendTo(\'body\'); - $confirmBox.dialog({ - autoOpen: true, - modal: confirmModal, - //width: Math.min($( window ).width() - 50, 1700), - width: \'auto\', - dialogClass: \'confirm-dialog-box\', - buttons: [ - { - text: confirmActionBtnLabel, - "class": \'ui-state-information\', - click: function () { - window.location.replace(confirmUrl); - } + $confirmBox.dialog({ + autoOpen: true, + modal: confirmModal, + //width: Math.min($( window ).width() - 50, 1700), + width: \'auto\', + dialogClass: \'confirm-dialog-box\', + buttons: [ + { + text: confirmActionBtnLabel, + "class": \'ui-state-information\', + click: function () { + window.location.replace(confirmUrl); + } + }, + { + text: confirmCancelBtnLabel, + "class": \'ui-state-information\', + click: function () { + $(this).dialog("close"); + } + } + ], + close: function( event, ui ) { + $(\'#\'+confirmBox).remove(); }, - { - text: confirmCancelBtnLabel, - "class": \'ui-state-information\', - click: function () { - $(this).dialog("close"); + open: function( event, ui ) { + $confirmBox.html(confirmContent); } - } - ], - close: function( event, ui ) { - $(\'#\'+confirmBox).remove(); - }, - open: function( event, ui ) { - $confirmBox.html(confirmContent); - } + }); }); }); -}); '."\n"; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index ae260171a0b..683b92fb8d9 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -123,6 +123,7 @@ function versioncompare($versionarray1, $versionarray2) * Return version PHP * * @return array Tableau de version (vermajeur,vermineur,autre) + * @see versioncompare() */ function versionphparray() { @@ -133,6 +134,7 @@ function versionphparray() * Return version Dolibarr * * @return array Tableau de version (vermajeur,vermineur,autre) + * @see versioncompare() */ function versiondolibarrarray() { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 62f4006c1de..899b3b0ffda 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3054,11 +3054,18 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli '__PASS__'=>$clicktodial_password); $url = make_substitutions($url, $substitarray); $newphonesav = $newphone; - $newphone = 'global->CLICKTODIAL_FORCENEWTARGET)) { - $newphone .= ' target="_blank"'; + if (empty($conf->global->CLICKTODIAL_DO_NOT_USE_AJAX_CALL)) { + // Default and recommended: New method using ajax without submiting a page making a javascript history.go(-1) back + $newphone = ''; + } else { + // Old method + $newphone = 'global->CLICKTODIAL_FORCENEWTARGET)) { + $newphone .= ' target="_blank"'; + } + $newphone .= '>'.$newphonesav.''; } - $newphone .= '>'.$newphonesav.''; } //if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 0035688c66f..d79f688391d 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1876,7 +1876,7 @@ function version_os($option = '') * Return PHP version * * @return string PHP version - * @see versionphparray() + * @see versionphparray(), versioncompare() */ function version_php() { @@ -1887,7 +1887,7 @@ function version_php() * Return Dolibarr version * * @return string Dolibarr version - * @see versiondolibarrarray() + * @see versiondolibarrarray(), versioncompare() */ function version_dolibarr() { From f6abeca2469b8f3fb765a96655209db5c5575bc2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 20:18:14 +0200 Subject: [PATCH 186/356] Fix example --- htdocs/admin/clicktodial.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 9fd92f45faa..09ba880dd33 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -101,8 +101,8 @@ print '
    '; print $langs->trans("ClickToDialUrlDesc").'
    '; print '
    '; print ''; -print $langs->trans("Example").':
    '; -print 'http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__
    '; +print $langs->trans("Examples").':
    '; +print 'https://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__
    '; print 'sip:__PHONETO__@my.sip.server'; print '
    '; From 965bdbb34260f0d4b27a13966b0464492b73d1ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 23:08:57 +0200 Subject: [PATCH 187/356] Trans --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 76f5c18b70b..d4047e654d3 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1780,7 +1780,7 @@ ClickToDialSetup=Click To Dial module setup ClickToDialUrlDesc=Url called when a click on phone picto is done. In URL, you can use tags
    __PHONETO__ that will be replaced with the phone number of person to call
    __PHONEFROM__ that will be replaced with phone number of calling person (yours)
    __LOGIN__ that will be replaced with clicktodial login (defined on user card)
    __PASS__ that will be replaced with clicktodial password (defined on user card). ClickToDialDesc=This module change phone numbers, when using a desktop computer, into clickable links. A click will call the number. This can be used to start the phone call when using a soft phone on your desktop or when using a CTI system based on SIP protocol for example. Note: When using a smartphone, phone numbers are always clickable. ClickToDialUseTelLink=Use just a link "tel:" on phone numbers -ClickToDialUseTelLinkDesc=Use this method if your users have a softphone or a software interface, installed on the same computer as the browser, and called when you click on a link starting with "tel:" in your browser. If you need link that start with "sip:" or a full server solution (no need of local software installation), you must set this to "No" and fill next field. +ClickToDialUseTelLinkDesc=Use this method if your users have a softphone or a software interface, installed on the same computer as the browser, and called when you click on a link starting with "tel:" in your browser. If you need a link that start with "sip:" or a full server solution (no need of local software installation), you must set this to "No" and fill the next field. ##### Point Of Sale (CashDesk) ##### CashDesk=Point of Sale CashDeskSetup=Point of Sales module setup From 0a31f3dc1a77ef4468360629382e3231a59f4594 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 23:11:59 +0200 Subject: [PATCH 188/356] FIX #18341 lang not loaded --- htdocs/admin/agenda_reminder.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index b3a85d1fe4b..2b2da673202 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -226,6 +226,7 @@ if (empty($conf->cron->enabled)) { // Get the max frequency of reminder if ($job->id > 0) { if ($job->status != $job::STATUS_ENABLED) { + $langs->load("cron"); print ''.$langs->trans("JobXMustBeEnabled", $langs->transnoentitiesnoconv("sendEmailsReminder")).''; } else { print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; From 5d717113be3586694ea199316c843363f9b8ca64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Aug 2021 11:20:43 +0200 Subject: [PATCH 189/356] Add language key --- htdocs/langs/en_US/languages.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 373fdf2eab5..e3b6bed94c8 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -2,6 +2,7 @@ Language_am_ET=Ethiopian Language_ar_AR=Arabic Language_ar_EG=Arabic (Egypt) +Language_ar_MA=Arabic (Moroco) Language_ar_SA=Arabic Language_ar_TN=Arabic (Tunisia) Language_ar_IQ=Arabic (Iraq) From 047bbbb298a1da8393f07e1385fb13042751b2a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Aug 2021 14:42:28 +0200 Subject: [PATCH 190/356] NEW Can set/unset the usual working day of the week --- htdocs/admin/holiday.php | 376 +++++++++++++++++------------ htdocs/core/ajax/constantonoff.php | 8 +- htdocs/core/js/lib_head.js.php | 23 +- htdocs/core/lib/ajax.lib.php | 15 +- htdocs/core/lib/date.lib.php | 12 +- htdocs/langs/en_US/holiday.lang | 1 + 6 files changed, 265 insertions(+), 170 deletions(-) diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index f6ac529466e..c9214742d13 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -274,147 +274,141 @@ print '
    '; print '
    '; -if ($conf->global->MAIN_FEATURES_LEVEL < 2) { - print dol_get_fiche_end(); - // End of page - llxFooter(); - $db->close(); - exit; -} - /* * Documents models for Holidays */ -print load_fiche_titre($langs->trans("TemplatePDFHolidays"), '', ''); +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { + print load_fiche_titre($langs->trans("TemplatePDFHolidays"), '', ''); -// Defined model definition table -$def = array(); -$sql = "SELECT nom"; -$sql .= " FROM ".MAIN_DB_PREFIX."document_model"; -$sql .= " WHERE type = '".$db->escape($type)."'"; -$sql .= " AND entity = ".$conf->entity; -$resql = $db->query($sql); -if ($resql) { - $i = 0; - $num_rows = $db->num_rows($resql); - while ($i < $num_rows) { - $array = $db->fetch_array($resql); - array_push($def, $array[0]); - $i++; + // Defined model definition table + $def = array(); + $sql = "SELECT nom"; + $sql .= " FROM ".MAIN_DB_PREFIX."document_model"; + $sql .= " WHERE type = '".$db->escape($type)."'"; + $sql .= " AND entity = ".$conf->entity; + $resql = $db->query($sql); + if ($resql) { + $i = 0; + $num_rows = $db->num_rows($resql); + while ($i < $num_rows) { + $array = $db->fetch_array($resql); + array_push($def, $array[0]); + $i++; + } + } else { + dol_print_error($db); } -} else { - dol_print_error($db); -} -print '
    '; -print '
    '; print $langs->trans("DatabaseName").' : '.$dolibarr_main_db_name.'
    '; @@ -554,8 +557,10 @@ print ''; print '
    2'; +print ''; print $langs->trans("BackupDesc2", DOL_DATA_ROOT).'
    '; print $langs->trans("BackupDescX").'

    '; +print '
    '; print '
    '; diff --git a/htdocs/admin/tools/dolibarr_import.php b/htdocs/admin/tools/dolibarr_import.php index 1fc0ca49221..29bfe5c12a4 100644 --- a/htdocs/admin/tools/dolibarr_import.php +++ b/htdocs/admin/tools/dolibarr_import.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2021 Laurent Destailleur * Copyright (C) 2006-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -22,6 +22,10 @@ * \brief Page to import database */ +if (! defined('CSRFCHECK_WITH_TOKEN')) { + define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET +} + require '../../main.inc.php'; // Load translation files required by the page @@ -72,7 +76,7 @@ jQuery(document).ready(function() { print load_fiche_titre($langs->trans("Restore"), '', 'title_setup'); -print '
    '; +print '
    '; print $langs->trans("RestoreDesc", DOL_DATA_ROOT); print '
    '; print '
    '; @@ -81,7 +85,9 @@ print '
    ';
    1 '; print $langs->trans("RestoreDesc2", DOL_DATA_ROOT).'

    '; +print ''; ?>
    @@ -90,7 +96,9 @@ print $langs->trans("RestoreDesc2", DOL_DATA_ROOT).'

    ';
    2 '; print $langs->trans("RestoreDesc3", $dolibarr_main_db_name).'

    '; +print ''; ?> trans("DatabaseName").' : '.$dolibarr_main_db_name.''; ?>

    diff --git a/htdocs/admin/tools/export_files.php b/htdocs/admin/tools/export_files.php index 34685676320..384b08e19cf 100644 --- a/htdocs/admin/tools/export_files.php +++ b/htdocs/admin/tools/export_files.php @@ -22,6 +22,10 @@ * \brief Page to export documents into a compressed file */ +if (! defined('CSRFCHECK_WITH_TOKEN')) { + define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET +} + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; diff --git a/htdocs/admin/tools/listsessions.php b/htdocs/admin/tools/listsessions.php index 61d2b1cea58..10a38fb59a1 100644 --- a/htdocs/admin/tools/listsessions.php +++ b/htdocs/admin/tools/listsessions.php @@ -22,9 +22,14 @@ * \brief List of PHP sessions */ +if (! defined('CSRFCHECK_WITH_TOKEN')) { + define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET +} + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; + // Load translation files required by the page $langs->loadLangs(array("companies", "install", "users", "other")); @@ -185,14 +190,14 @@ print '
    '; if (empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) { - print ''.$langs->trans("LockNewSessions").''; + print ''.$langs->trans("LockNewSessions").''; } else { - print ''.$langs->trans("UnlockNewSessions").''; + print ''.$langs->trans("UnlockNewSessions").''; } if ($savehandler == 'files') { if (count($listofsessions)) { - print ''.$langs->trans("PurgeSessions").''; + print ''.$langs->trans("PurgeSessions").''; } } diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php index e20b9c2b13a..09647549c8b 100644 --- a/htdocs/admin/tools/purge.php +++ b/htdocs/admin/tools/purge.php @@ -21,15 +21,15 @@ * \brief Page to purge files (temporary or not) */ +if (! defined('CSRFCHECK_WITH_TOKEN')) { + define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET +} + require '../../main.inc.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $langs->load("admin"); -if (!$user->admin) { - accessforbidden(); -} - $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $choice = GETPOST('choice', 'aZ09'); @@ -42,10 +42,15 @@ if (!empty($conf->syslog->enabled)) { $filelog = preg_replace('/DOL_DATA_ROOT/i', DOL_DATA_ROOT, $filelog); } +if (!$user->admin) { + accessforbidden(); +} + /* * Actions */ + if ($action == 'purge' && !preg_match('/^confirm/i', $choice) && ($choice != 'allfiles' || $confirm == 'yes')) { // Increase limit of time. Works only if we are not in safe mode $ExecTimeLimit = 600; diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php index 5a6ff94ce57..821bcd9e3f3 100644 --- a/htdocs/admin/tools/update.php +++ b/htdocs/admin/tools/update.php @@ -22,6 +22,10 @@ * \brief Page to make a Dolibarr online upgrade */ +if (! defined('CSRFCHECK_WITH_TOKEN')) { + define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET +} + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -100,7 +104,7 @@ if (function_exists('curl_init')) { print $langs->trans("LastStableVersion").' : '.$langs->trans("UpdateServerOffline").'
    '; } } else { - print $langs->trans("LastStableVersion").' : '.$langs->trans("Check").'
    '; + print $langs->trans("LastStableVersion").' : '.$langs->trans("Check").'
    '; } } @@ -113,14 +117,14 @@ print '
    '; print $langs->trans("ThisIsProcessToFollow").'
    '; print ''.$langs->trans("StepNb", 1).': '; $fullurl = ''.$urldolibarr.''; -print $langs->trans("DownloadPackageFromWebSite", $fullurl).'
    '; +print str_replace('{s}', $fullurl, $langs->trans("DownloadPackageFromWebSite", '{s}')).'
    '; print ''.$langs->trans("StepNb", 2).': '; -print $langs->trans("UnpackPackageInDolibarrRoot", $dolibarrroot).'
    '; +print str_replace('{s}', $dolibarrroot, $langs->trans("UnpackPackageInDolibarrRoot", '{s}')).'
    '; print ''.$langs->trans("StepNb", 3).': '; print $langs->trans("RemoveLock", $dolibarrdataroot.'/install.lock').'
    '; print ''.$langs->trans("StepNb", 4).': '; $fullurl = ''.DOL_URL_ROOT.'/install/'; -print $langs->trans("CallUpdatePage", $fullurl).'
    '; +print str_replace('{s}', $fullurl, $langs->trans("CallUpdatePage", '{s}')).'
    '; print ''.$langs->trans("StepNb", 5).': '; print $langs->trans("RestoreLock", $dolibarrdataroot.'/install.lock').'
    '; @@ -133,8 +137,9 @@ print '
    '; print $langs->trans("AddExtensionThemeModuleOrOther").'
    '; print '
    '; - -print $langs->trans("GoModuleSetupArea", DOL_URL_ROOT.'/admin/modules.php?mode=deploy', $langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Modules")); +$texttoshow = $langs->trans("GoModuleSetupArea", DOL_URL_ROOT.'/admin/modules.php?mode=deploy', '{s2}'); +$texttoshow = str_replace('{s2}', img_picto('', 'tools', 'class="pictofixedwidth"').$langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Modules"), $texttoshow); +print $texttoshow; // End of page llxFooter(); From 4dfc8bab93a5bef1ee226fb8496b953e1a0a15c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 12:28:13 +0200 Subject: [PATCH 170/356] Fix bad title --- htdocs/compta/prelevement/create.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index be18099b6a8..f2d232780c9 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -232,7 +232,7 @@ if ($nb) { if ($pricetowithdraw) { $title = print $langs->trans('BankToReceiveWithdraw').': '; if ($type == 'bank-transfer') { - $title .= $langs->trans('BankToPayCreditTransfer').': '; + $title = $langs->trans('BankToPayCreditTransfer').': '; } print $title; $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT, 'id_bankaccount', 0, "courant=1"); From 6dc8024d8702925cba437ace802216612ad1eb95 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 12:30:48 +0200 Subject: [PATCH 171/356] Fix title --- htdocs/compta/prelevement/create.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index f2d232780c9..72dfda2fe43 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -230,7 +230,7 @@ print ''; print ''; if ($nb) { if ($pricetowithdraw) { - $title = print $langs->trans('BankToReceiveWithdraw').': '; + $title = $langs->trans('BankToReceiveWithdraw').': '; if ($type == 'bank-transfer') { $title = $langs->trans('BankToPayCreditTransfer').': '; } From aaefb7b32495178fa9cafe172b20f107fc63f5bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 12:38:28 +0200 Subject: [PATCH 172/356] Fix css --- htdocs/compta/prelevement/create.php | 3 ++- htdocs/core/ajax/selectsearchbox.php | 6 +++--- htdocs/core/search_page.php | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 72dfda2fe43..92ccd5f7bce 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -235,7 +235,8 @@ if ($nb) { $title = $langs->trans('BankToPayCreditTransfer').': '; } print $title; - $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT, 'id_bankaccount', 0, "courant=1"); + print img_picto('', 'bank_account'); + print $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT, 'id_bankaccount', 0, "courant=1", 0, '', 0, '', 1); print ' - '; print $langs->trans('ExecutionDate').' '; diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 509d10e7858..1814b476d06 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -110,13 +110,13 @@ if (!empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUST } if (!empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->rights->supplier_proposal->lire) { - $arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_proposal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_supplier_proposal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_proposal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); } if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire)) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED)) { - $arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_supplier_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED)) { - $arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_supplier_invoice', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); } // Customer payments diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index 8581776a2d8..2b82501208a 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -20,7 +20,7 @@ /** * \file htdocs/core/search_page.php - * \brief File to return a page with search boxes + * \brief File to return a page with the complete search form (all search input fields) */ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language @@ -77,7 +77,7 @@ $hookmanager->initHooks(array('searchform')); // Define $searchform $searchform = ''; -if ($conf->use_javascript_ajax && 1 == 2) { // select2 is ko with jmobile +if ($conf->use_javascript_ajax && 1 == 2) { // select2 is not best with smartphone if (!is_object($form)) { $form = new Form($db); } From bf49309d581c13e26965da0a13dd1fc90ca7e663 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Aug 2021 12:41:27 +0200 Subject: [PATCH 173/356] Fix css --- htdocs/compta/prelevement/create.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 92ccd5f7bce..1956cb14516 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -440,7 +440,7 @@ if ($resql) { } print '
    '; + print ''; print price($obj->amount, 0, $langs, 0, 0, -1, $conf->currency); print ''.$obj->Engine.''.$langs->trans("Convert").' InnoDb'.$langs->trans("Convert").' InnoDb '; print $obj->Row_format; if (isset($obj->Row_format) && (in_array($obj->Row_format, array("Compact")))) { - print '
    '.$langs->trans("Convert").' Dynamic'; + print '
    '.$langs->trans("Convert").' Dynamic'; } print '
    '.$obj->Rows.''.$obj->Check_time.''.$obj->Collation; if (isset($obj->Collation) && (in_array($obj->Collation, array("utf8mb4_general_ci", "utf8mb4_unicode_ci", "latin1_swedish_ci")))) { - print '
    '.$langs->trans("Convert").' UTF8'; + print '
    '.$langs->trans("Convert").' UTF8'; } print '
    '.$langs->trans("ICS").'
    '.$langs->trans("ICS").' ('.$langs->trans("StandingOrder").')'.$object->ics.'
    '.$langs->trans("ICSTransfer").'
    '.$langs->trans("ICS").' ('.$langs->trans("BankTransfer").')'.$object->ics_transfer.'
    '.$langs->trans("ICS").'
    '.$langs->trans("ICS").' ('.$langs->trans("StandingOrder").')
    '.$langs->trans("ICSTransfer").'
    '.$langs->trans("ICS").' ('.$langs->trans("BankTransfer").')
    "; print $ligne->LibStatut($obj->statut, 2); print " "; - print ''; + print ''; print sprintf("%06s", $obj->rowid); print '
    '; -print ''; -print ''; -print ''; -print '\n"; -print '\n"; -print ''; -print ''; -print "\n"; + print '
    '; + print '
    '.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
    '; + print ''; + print ''; + print ''; + print '\n"; + print '\n"; + print ''; + print ''; + print "\n"; -clearstatcache(); + clearstatcache(); -foreach ($dirmodels as $reldir) { - foreach (array('', '/doc') as $valdir) { - $realpath = $reldir."core/modules/holiday".$valdir; - $dir = dol_buildpath($realpath); + foreach ($dirmodels as $reldir) { + foreach (array('', '/doc') as $valdir) { + $realpath = $reldir."core/modules/holiday".$valdir; + $dir = dol_buildpath($realpath); - if (is_dir($dir)) { - $handle = opendir($dir); - if (is_resource($handle)) { - while (($file = readdir($handle)) !== false) { - $filelist[] = $file; - } - closedir($handle); - arsort($filelist); + if (is_dir($dir)) { + $handle = opendir($dir); + if (is_resource($handle)) { + while (($file = readdir($handle)) !== false) { + $filelist[] = $file; + } + closedir($handle); + arsort($filelist); - foreach ($filelist as $file) { - if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { - $name = substr($file, 4, dol_strlen($file) - 16); - $classname = substr($file, 0, dol_strlen($file) - 12); + foreach ($filelist as $file) { + if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { + if (file_exists($dir.'/'.$file)) { + $name = substr($file, 4, dol_strlen($file) - 16); + $classname = substr($file, 0, dol_strlen($file) - 12); - require_once $dir.'/'.$file; - $module = new $classname($db); + require_once $dir.'/'.$file; + $module = new $classname($db); - $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { - $modulequalified = 0; - } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { - $modulequalified = 0; - } - - if ($modulequalified) { - print ''; - // Active - if (in_array($name, $def)) { - print ''; - } else { - print '"; + + // Active + if (in_array($name, $def)) { + print ''; + } else { + print '"; + } + + // Default + print ''; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip .= '
    '.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); + if ($module->type == 'pdf') { + $htmltooltip .= '
    '.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + } + $htmltooltip .= '
    '.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file; + + $htmltooltip .= '

    '.$langs->trans("FeaturesSupported").':'; + $htmltooltip .= '
    '.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); + $htmltooltip .= '
    '.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1); + $htmltooltip .= '
    '.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); + $htmltooltip .= '
    '.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); + $htmltooltip .= '
    '.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); + + + print ''; + + // Preview + print ''; + + print "\n"; } - - // Default - print ''; - - // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip .= '
    '.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); - if ($module->type == 'pdf') { - $htmltooltip .= '
    '.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; - } - $htmltooltip .= '
    '.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file; - - $htmltooltip .= '

    '.$langs->trans("FeaturesSupported").':'; - $htmltooltip .= '
    '.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); - $htmltooltip .= '
    '.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1); - $htmltooltip .= '
    '.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); - $htmltooltip .= '
    '.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); - $htmltooltip .= '
    '.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); - - - print ''; - - // Preview - print ''; - - print "\n"; } } } @@ -422,11 +416,11 @@ foreach ($dirmodels as $reldir) { } } } -} -print '
    '.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
    '; - print (empty($module->name) ? $name : $module->name); - print "\n"; - if (method_exists($module, 'info')) { - print $module->info($langs); - } else { - print $module->description; + $modulequalified = 1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + $modulequalified = 0; + } + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + $modulequalified = 0; } - print ''."\n"; - print ''; - print img_picto($langs->trans("Enabled"), 'switch_on'); - print ''; + if ($modulequalified) { + print '
    '; + print (empty($module->name) ? $name : $module->name); + print "\n"; + if (method_exists($module, 'info')) { + print $module->info($langs); + } else { + print $module->description; + } print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; - print "'."\n"; + print ''; + print img_picto($langs->trans("Enabled"), 'switch_on'); + print ''; + print ''."\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print "'; + if ($conf->global->HOLIDAY_ADDON_PDF == $name) { + print img_picto($langs->trans("Default"), 'on'); + } else { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + } + print ''; + print $form->textwithpicto('', $htmltooltip, 1, 0); + print ''; + if ($module->type == 'pdf') { + print ''.img_object($langs->trans("Preview"), 'pdf').''; + } else { + print img_object($langs->trans("PreviewNotAvailable"), 'generic'); + } + print '
    '; - if ($conf->global->HOLIDAY_ADDON_PDF == $name) { - print img_picto($langs->trans("Default"), 'on'); - } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; - } - print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); - print ''; - if ($module->type == 'pdf') { - print ''.img_object($langs->trans("Preview"), 'pdf').''; - } else { - print img_object($langs->trans("PreviewNotAvailable"), 'generic'); - } - print '
    '; -print '
    '; -print "
    "; + print ''; + print '
    '; + print "
    "; +} /* @@ -446,34 +440,118 @@ print ''.$langs->trans("Parameter").''; print ''.$langs->trans("Value").''; print "\n"; -$substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2); -$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
    '; -foreach ($substitutionarray as $key => $val) { - $htmltext .= $key.'
    '; +/*var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY); +var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY); +var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY); +var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY); +*/ +if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) { + $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY = 1; } -$htmltext .= '
    '; +if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) { + $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY = 1; +} +/* +var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY); +var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY); +var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY); +var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY); +*/ -print ''; -print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'

    '.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp'); -print '
    '; -$variablename = 'HOLIDAY_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { - print ''; +// Set working days +print ''; +print "".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Monday")).""; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY', array(), null, 0); } else { - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); + if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY)) { + print ''.img_picto($langs->trans("Enabled"), 'on').''; + } else { + print ''.img_picto($langs->trans("Disabled"), 'off').''; + } } -print ''."\n"; +print ""; +print ""; -//Use draft Watermark +// Set working days +print ''; +print "".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Friday")).""; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY', array(), null, 0); +} else { + if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY)) { + print ''.img_picto($langs->trans("Enabled"), 'on').''; + } else { + print ''.img_picto($langs->trans("Disabled"), 'off').''; + } +} +print ""; +print ""; -print ''; -print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
    '; -print ''; -print ''; -print ''."\n"; +// Set working days +print ''; +print "".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Saturday")).""; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', array(), null, 0, 0, 0, 2, 0, 1); +} else { + if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) { + print ''.img_picto($langs->trans("Enabled"), 'on').''; + } else { + print ''.img_picto($langs->trans("Disabled"), 'off').''; + } +} +print ""; +print ""; + +// Set working days +print ''; +print "".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Sunday")).""; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', array(), null, 0, 0, 0, 2, 0, 1); +} else { + if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) { + print ''.img_picto($langs->trans("Enabled"), 'on').''; + } else { + print ''.img_picto($langs->trans("Disabled"), 'off').''; + } +} +print ""; +print ""; + +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { + $substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2); + $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); + $htmltext = ''.$langs->trans("AvailableVariables").':
    '; + foreach ($substitutionarray as $key => $val) { + $htmltext .= $key.'
    '; + } + $htmltext .= '
    '; + + print ''; + print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'

    '.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp'); + print '
    '; + $variablename = 'HOLIDAY_FREE_TEXT'; + if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { + print ''; + } else { + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); + print $doleditor->Create(); + } + print ''."\n"; + + //Use draft Watermark + + print ''; + print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
    '; + print ''; + print ''; + print ''."\n"; +} print ''; print '
    '; diff --git a/htdocs/core/ajax/constantonoff.php b/htdocs/core/ajax/constantonoff.php index 60684c1520b..b8beec3111a 100644 --- a/htdocs/core/ajax/constantonoff.php +++ b/htdocs/core/ajax/constantonoff.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2011-2015 Regis Houssin + * Copyright (C) 2021 Laurent Destailleur * * 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 @@ -47,6 +48,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; $action = GETPOST('action', 'aZ09'); // set or del $name = GETPOST('name', 'alpha'); +$entity = GETPOST('entity', 'int'); +$value = ((GETPOST('value', 'int') || GETPOST('value', 'int') == '0') ? GETPOST('value', 'int') : 1); /* @@ -64,9 +67,6 @@ top_httphead(); // Registering the new value of constant if (!empty($action) && !empty($name)) { - $entity = GETPOST('entity', 'int'); - $value = (GETPOST('value') ?GETPOST('value') : 1); - if ($user->admin) { if ($action == 'set') { dolibarr_set_const($db, $name, $value, 'chaine', 0, '', $entity); diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index db63b1a75d4..0d5905b4351 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -549,20 +549,27 @@ function hideMessage(fieldId,message) { * @param int strict Strict * @param int forcereload Force reload * @param int userid User id + * @param int value Value to set * @param string token Token */ -function setConstant(url, code, input, entity, strict, forcereload, userid, token) { +function setConstant(url, code, input, entity, strict, forcereload, userid, token, value) { var saved_url = url; /* avoid undefined url */ $.post( url, { action: "set", name: code, entity: entity, - token: token + token: token, + value: value }, function() { /* handler for success of post */ - console.log("url request success forcereload="+forcereload); - $("#set_" + code).hide(); - $("#del_" + code).show(); + console.log("url request success forcereload="+forcereload+" value="+value); + if (value == 0) { + $("#set_" + code).show(); + $("#del_" + code).hide(); + } else { + $("#set_" + code).hide(); + $("#del_" + code).show(); + } $.each(input, function(type, data) { // Enable another element if (type == "disabled" && strict != 1) { @@ -610,7 +617,7 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke if (forcereload) { location.reload(); } - }).fail(function(error) { location.reload(); }); /* When it fails, we always force reload to have setEventErrorMEssage in session visible */ + }).fail(function(error) { location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */ } /* @@ -681,7 +688,7 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke if (forcereload) { location.reload(); } - }).fail(function(error) { location.reload(); }); /* When it fails, we always force reload to have setEventErrorMEssage in session visible */ + }).fail(function(error) { location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */ } /* @@ -716,7 +723,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton, text : yesButton, click : function() { if (action == "set") { - setConstant(url, code, input, entity, strict, 0, userid, token); + setConstant(url, code, input, entity, strict, 0, userid, token, 1); } else if (action == "del") { delConstant(url, code, input, entity, strict, 0, userid, token); } diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 99cf4e4f8d1..b59b40b8c9d 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -540,14 +540,15 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = * @param string $code Name of constant * @param array $input Array of complementary actions to do if success ("disabled"|"enabled'|'set'|'del') => CSS element to switch, 'alert' => message to show, ... Example: array('disabled'=>array(0=>'cssid')) * @param int $entity Entity. Current entity is used if null. - * @param int $revertonoff Revert on/off + * @param int $revertonoff 1=Revert on/off * @param int $strict Use only "disabled" with delConstant and "enabled" with setConstant * @param int $forcereload Force to reload page if we click/change value (this is supported only when there is no 'alert' option in input) * @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No left margin. Works for fontawesome picto only. * @param int $forcenoajax 1 = Force to use a ahref link instead of ajax code. + * @param int $setzeroinsteadofdel 1 = Set constantto '0' instead of deleting it * @return string */ -function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0) +function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0) { global $conf, $langs, $user; @@ -593,9 +594,13 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton; if (input.alert.del.noButton) noButton = input.alert.del.noButton; confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict, userid, token); - } else { - delConstant(url, code, input, entity, 0, '.$forcereload.', userid, token); - } + } else {'; + if (empty($setzeroinsteadofdel)) { + $out .=' delConstant(url, code, input, entity, 0, '.$forcereload.', userid, token);'; + } else { + $out .=' setConstant(url, code, input, entity, 0, '.$forcereload.', userid, token, 0);'; + } + $out .= ' } }); }); '."\n"; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index fe21071901a..8fe9352457b 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -668,15 +668,16 @@ function getGMTEasterDatetime($year) * * @param int $timestampStart Timestamp start (UTC with hour, min, sec = 0) * @param int $timestampEnd Timestamp end (UTC with hour, min, sec = 0) - * @param string $country_code Country code - * @param int $lastday Last day is included, 0: no, 1:yes + * @param string $country_code Country code + * @param int $lastday Last day is included, 0: no, 1:yes * @param int $includesaturday Include saturday as non working day (-1=use setup, 0=no, 1=yes) * @param int $includesunday Include sunday as non working day (-1=use setup, 0=no, 1=yes) * @param int $includefriday Include friday as non working day (-1=use setup, 0=no, 1=yes) - * @return int|string Number of non working days or error message string if error + * @param int $includemonday Include monday as non working day (-1=use setup, 0=no, 1=yes) + * @return int|string Number of non working days or error message string if error * @see num_between_day(), num_open_day() */ -function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', $lastday = 0, $includesaturday = -1, $includesunday = -1, $includefriday = -1) +function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', $lastday = 0, $includesaturday = -1, $includesunday = -1, $includefriday = -1, $includemonday = -1) { global $db, $conf, $mysoc; @@ -690,6 +691,9 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', if (empty($country_code)) { $country_code = $mysoc->country_code; } + if ($includemonday < 0) { + $includemonday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY : 0); + } if ($includefriday < 0) { $includefriday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY : 0); } diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 0e6b1d69b36..dfbd97cdbdc 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -133,3 +133,4 @@ WatermarkOnDraftHolidayCards=Watermarks on draft leave requests HolidaysToApprove=Holidays to approve NobodyHasPermissionToValidateHolidays=Nobody has permission to validate holidays HolidayBalanceMonthlyUpdate=Monthly update of holiday balance +XIsAUsualNonWorkingDay=%s is usualy a NON working day \ No newline at end of file From fca3980dce3b2a5fa0b07340155786158f49ff84 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Aug 2021 15:15:03 +0200 Subject: [PATCH 191/356] FIX Can't remove a permission of a group --- htdocs/user/group/perms.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 9fc4426ecac..3ccbcf94d05 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -315,7 +315,7 @@ if ($object->id > 0) { if (in_array($obj->id, $permsgroupbyentity[$entity])) { // Own permission by group if ($caneditperms) { - print 'id.'">'; + print 'id.'&token='.newToken().'">'; //print img_edit_remove($langs->trans("Remove")); print img_picto($langs->trans("Remove"), 'switch_on'); print ''; From 591b8acd513eb75483e336f8a1c871bbf20b1853 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Aug 2021 15:57:51 +0200 Subject: [PATCH 192/356] FIX show info of company into user dropdown --- htdocs/main.inc.php | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2ceb2175799..e4677499bd6 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2015,27 +2015,25 @@ function top_menu_user($hideloginname = 0, $urllogout = '') $dropdownBody .= ' '.$langs->trans("ShowCompanyInfos").''; $dropdownBody .= '
    '; - if (!empty($conf->global->MAIN_INFO_SIREN)) { - $dropdownBody .= '
    '.$langs->transcountry("ProfId1Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIREN).''; + if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') { + $dropdownBody .= '
    '.$langs->transcountry("ProfId1", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIREN).''; } - if (!empty($conf->global->MAIN_INFO_SIRET)) { - $dropdownBody .= '
    '.$langs->transcountry("ProfId2Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIRET).''; + if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') { + $dropdownBody .= '
    '.$langs->transcountry("ProfId2", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIRET).''; } - if (!empty($conf->global->MAIN_INFO_APE)) { - $dropdownBody .= '
    '.$langs->transcountry("ProfId3Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_APE).''; + if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') { + $dropdownBody .= '
    '.$langs->transcountry("ProfId3", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_APE).''; } - if (!empty($conf->global->MAIN_INFO_RCS)) { - $dropdownBody .= '
    '.$langs->transcountry("ProfId4Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_RCS).''; + if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') { + $dropdownBody .= '
    '.$langs->transcountry("ProfId4", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_RCS).''; } - if (!empty($conf->global->MAIN_INFO_PROFID5)) { - $dropdownBody .= '
    '.$langs->transcountry("ProfId5Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID5).''; + if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') { + $dropdownBody .= '
    '.$langs->transcountry("ProfId5", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID5).''; } - if (!empty($conf->global->MAIN_INFO_PROFID6)) { - $dropdownBody .= '
    '.$langs->transcountry("ProfId6Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID6).''; - } - if (!empty($conf->global->MAIN_INFO_TVAINTRA)) { - $dropdownBody .= '
    '.$langs->trans("VATIntraShort").': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_TVAINTRA).''; + if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') { + $dropdownBody .= '
    '.$langs->transcountry("ProfId6", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID6).''; } + $dropdownBody .= '
    '.$langs->trans("VATIntraShort").': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_TVAINTRA).''; $dropdownBody .= '
    '; From 6b20b32f07852c990367a3830c23d5d6a746af51 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 5 Aug 2021 16:31:21 +0200 Subject: [PATCH 193/356] Fix lang error on hrm/index.php --- htdocs/hrm/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index fe2c42b0d1b..8a294a47e2c 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -234,7 +234,7 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) { print ''; print ''.$holidaystatic->getNomUrl(1).''; print ''.$userstatic->getNomUrl(-1, 'leave').''; - print ''.dol_escape_htmltag($typeleaves[$obj->fk_type]['label']).''; + print ''.dol_escape_htmltag($langs->trans($typeleaves[$obj->fk_type]['code'])).''; $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; From d249ffd5adf97f9498ffba3840bf8e1d0d9cc925 Mon Sep 17 00:00:00 2001 From: Erik van Berkum Date: Fri, 6 Aug 2021 13:40:19 +0900 Subject: [PATCH 194/356] Fix: Change French word to English in English array. --- htdocs/mrp/class/mo.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index ee4b64471c3..df5dcba60ad 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -118,7 +118,7 @@ class Mo extends CommonObject 'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>1010), - 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '9'=>'Canceled')), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '9'=>'Canceled')), ); public $rowid; public $ref; From 80c63cae5e6ddaffead1a5c8c14346b7bed22c36 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Fri, 6 Aug 2021 08:32:40 +0200 Subject: [PATCH 195/356] add GETPOST to 'target' value on new bookmarks -> allows to set default value --- htdocs/bookmarks/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 1094eabf0c6..8ac05863ed0 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -40,7 +40,7 @@ $action = GETPOST("action", "alpha"); $title = (string) GETPOST("title", "alpha"); $url = (string) GETPOST("url", "alpha"); $urlsource = GETPOST("urlsource", "alpha"); -$target = GETPOST("target", "alpha"); +$target = GETPOST("target", "int"); $userid = GETPOST("userid", "int"); $position = GETPOST("position", "int"); $backtopage = GETPOST('backtopage', 'alpha'); @@ -169,7 +169,7 @@ if ($action == 'create') { // Target print ''.$langs->trans("BehaviourOnClick").''; $liste = array(0=>$langs->trans("ReplaceWindow"), 1=>$langs->trans("OpenANewWindow")); - print $form->selectarray('target', $liste, 1); + print $form->selectarray('target', $liste, GETPOST('target', 'int')); print ''.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").''; // Owner From 470eec7f5086723e5f7a1bb723db1fb018dc1206 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Aug 2021 11:32:39 +0200 Subject: [PATCH 196/356] Remove (hide) not used field "deductible" on social contributions. --- htdocs/admin/dict.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 1bfc3611439..6835ce82e60 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -202,7 +202,7 @@ $tabsql[3] = "SELECT r.rowid as rowid, r.code_region as state_code, r.nom as lib $tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite FROM ".MAIN_DB_PREFIX."c_country AS c"; $tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c"; $tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a"; -$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1"; +$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1"; $tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid"; $tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c"; $tabsql[10] = "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; @@ -294,7 +294,7 @@ $tabfield[3] = "code,libelle,country_id,country"; $tabfield[4] = "code,label"; $tabfield[5] = "code,label"; $tabfield[6] = "code,libelle,type,color,position"; -$tabfield[7] = "code,libelle,country,accountancy_code,deductible"; +$tabfield[7] = "code,libelle,country,accountancy_code"; $tabfield[8] = "code,libelle,country_id,country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : ''); $tabfield[9] = "code,label,unicode"; $tabfield[10] = "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; @@ -340,7 +340,7 @@ $tabfieldvalue[3] = "code,libelle,country"; $tabfieldvalue[4] = "code,label"; $tabfieldvalue[5] = "code,label"; $tabfieldvalue[6] = "code,libelle,type,color,position"; -$tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible"; +$tabfieldvalue[7] = "code,libelle,country,accountancy_code"; $tabfieldvalue[8] = "code,libelle,country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : ''); $tabfieldvalue[9] = "code,label,unicode"; $tabfieldvalue[10] = "country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; @@ -386,7 +386,7 @@ $tabfieldinsert[3] = "code_region,nom,fk_pays"; $tabfieldinsert[4] = "code,label"; $tabfieldinsert[5] = "code,label"; $tabfieldinsert[6] = "code,libelle,type,color,position"; -$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code,deductible"; +$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code"; $tabfieldinsert[8] = "code,libelle,fk_country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : ''); $tabfieldinsert[9] = "code_iso,label,unicode"; $tabfieldinsert[10] = "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; From 6cefd0a756429f77f957f1fd89ca0523fda33764 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Aug 2021 12:18:51 +0200 Subject: [PATCH 197/356] FIX Link of download main doc on vat list --- htdocs/compta/tva/list.php | 10 +++++++++- htdocs/core/class/html.formfile.class.php | 5 +++-- htdocs/core/lib/files.lib.php | 9 ++++++--- htdocs/theme/eldy/global.inc.php | 3 +++ htdocs/theme/md/style.css.php | 6 ++++++ 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 69ce8ae8ae5..1dc0180bd60 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -31,6 +31,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; @@ -135,6 +136,7 @@ if (empty($reshook)) { $form = new Form($db); $formother = new FormOther($db); +$formfile = new FormFile($db); $tva_static = new Tva($db); $bankstatic = new Account($db); $accountingjournal = new AccountingJournal($db); @@ -445,7 +447,13 @@ while ($i < min($num, $limit)) { // Ref if (!empty($arrayfields['t.rowid']['checked'])) { - print ''.$tva_static->getNomUrl(1).''; + print ''; + print $tva_static->getNomUrl(1); + $filename = dol_sanitizeFileName($tva_static->ref); + $filedir = $conf->tax->dir_output.'/vat/'.dol_sanitizeFileName($tva_static->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$tva_static->id; + print $formfile->getDocumentsLink($tva_static->element, $filename, $filedir, '', 'valignmiddle paddingleft2imp'); + print ''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 2b8a2d15aff..3a5cff5ea9e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -985,9 +985,10 @@ class FormFile * @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. * @param string $filedir Full path to directory to scan * @param string $filter Filter filenames on this regex string (Example: '\.pdf$') + * @param string $morecss Add more css to the download picto * @return string Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles */ - public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = '') + public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = '', $morecss = 'valignmiddle') { global $conf, $langs; @@ -1019,7 +1020,7 @@ class FormFile $out .= ''."\n"; if (!empty($file_list)) { $out = '