From 1daba56bbc665f666bad0af7a56dca80cfd68fc8 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Mon, 9 Jul 2018 10:05:53 +0200 Subject: [PATCH 01/27] Fix count(): Parameter must be an array or an object that implements Countable --- htdocs/comm/action/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 381c3e7cc28..e178bcdd468 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1243,7 +1243,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array(); $ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day); - $nextindextouse=count($colorindexused); // At first run this is 0, so fist user has 0, next 1, ... + $nextindextouse=is_array($colorindexused)?count($colorindexused):0; // At first run this is 0, so fist user has 0, next 1, ... //print $nextindextouse; foreach ($eventarray as $daykey => $notused) From 170a668b2bdf15f232c60a1d3c3f6a01a1236e32 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Fri, 13 Jul 2018 11:09:56 +0200 Subject: [PATCH 02/27] FIX : Set contactCivName substitution key --- htdocs/core/tpl/card_presend.tpl.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 43cacab0e1c..b5d342d3e0a 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -167,6 +167,27 @@ if ($action == 'presend') ); complete_substitutions_array($substitutionarray, $outputlangs, $object, $parameters); + // Find the good contact adress + $custcontact = ''; + $contactarr = array(); + $contactarr = $object->liste_contact(- 1, 'external'); + + if (is_array($contactarr) && count($contactarr) > 0) { + foreach ($contactarr as $contact) { + if (in_array($contact['code'], array('BILLING'))) { + require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; + + $contactstatic = new Contact($db); + $contactstatic->fetch($contact['id']); + $custcontact = $contactstatic->getFullName($langs, 1); + } + } + + if (! empty($custcontact)) { + $substitutionarray['__CONTACTCIVNAME__'] = $custcontact; + } + } + // Tableau des substitutions $formmail->substit = $substitutionarray; From de8fd3d12c75ed44889c5656fd00a4b365de6691 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Mon, 16 Jul 2018 09:33:14 +0200 Subject: [PATCH 03/27] NEW : Contact substitutions keys --- htdocs/core/tpl/card_presend.tpl.php | 32 ++++++++++++++++++---------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index b5d342d3e0a..63b1cbab28d 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -173,18 +173,28 @@ if ($action == 'presend') $contactarr = $object->liste_contact(- 1, 'external'); if (is_array($contactarr) && count($contactarr) > 0) { + require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; + $contactstatic = new Contact($db); + foreach ($contactarr as $contact) { - if (in_array($contact['code'], array('BILLING'))) { - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; - - $contactstatic = new Contact($db); - $contactstatic->fetch($contact['id']); - $custcontact = $contactstatic->getFullName($langs, 1); - } - } - - if (! empty($custcontact)) { - $substitutionarray['__CONTACTCIVNAME__'] = $custcontact; + switch($contact['code']) { + case 'BILLING': + $contactstatic->fetch($contact['id']); + $substitutionarray['__CONTACT_NAME_BILLING__'] = $contactstatic->getFullName($langs, 1); + break; + case 'CUSTOMER': + $contactstatic->fetch($contact['id']); + $substitutionarray['__CONTACT_NAME_CUSTOMER__'] = $contactstatic->getFullName($langs, 1); + break; + case 'SHIPPING': + $contactstatic->fetch($contact['id']); + $substitutionarray['__CONTACT_NAME_SHIPPING__'] = $contactstatic->getFullName($langs, 1); + break; + case 'SERVICE': + $contactstatic->fetch($contact['id']); + $substitutionarray['__CONTACT_NAME_SERVICE__'] = $contactstatic->getFullName($langs, 1); + break; + } } } From 3c5998e697f214224da97fb9b2a63d883c4d303c Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Mon, 16 Jul 2018 11:16:55 +0200 Subject: [PATCH 04/27] FIX : Refactoring --- htdocs/core/tpl/card_presend.tpl.php | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 63b1cbab28d..34f46a7ab92 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -177,24 +177,8 @@ if ($action == 'presend') $contactstatic = new Contact($db); foreach ($contactarr as $contact) { - switch($contact['code']) { - case 'BILLING': - $contactstatic->fetch($contact['id']); - $substitutionarray['__CONTACT_NAME_BILLING__'] = $contactstatic->getFullName($langs, 1); - break; - case 'CUSTOMER': - $contactstatic->fetch($contact['id']); - $substitutionarray['__CONTACT_NAME_CUSTOMER__'] = $contactstatic->getFullName($langs, 1); - break; - case 'SHIPPING': - $contactstatic->fetch($contact['id']); - $substitutionarray['__CONTACT_NAME_SHIPPING__'] = $contactstatic->getFullName($langs, 1); - break; - case 'SERVICE': - $contactstatic->fetch($contact['id']); - $substitutionarray['__CONTACT_NAME_SERVICE__'] = $contactstatic->getFullName($langs, 1); - break; - } + $contactstatic->fetch($contact['id']); + $substitutionarray['__CONTACT_NAME_'.$contact['code'].'__'] = $contactstatic->getFullName($langs, 1); } } From 33aa37336277645259f134b3eae1b62464e67b78 Mon Sep 17 00:00:00 2001 From: gauthier Date: Mon, 16 Jul 2018 15:25:06 +0200 Subject: [PATCH 05/27] FIX: when stock is empty for current entity but > 0 in other entity, until this commit product wasn't displaied on replenishment, it must depends on multientity stock sharing --- htdocs/product/stock/replenish.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 5a61e8b2a98..b9d8875b5f7 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -294,7 +294,7 @@ $sql.= ' ,'.$sqldesiredtock.' as desiredstock, '.$sqlalertstock.' as alertstock, $sql.= ' SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").') as stock_physique'; $sql.= ' FROM ' . MAIN_DB_PREFIX . 'product as p'; $sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s'; -$sql.= ' ON p.rowid = s.fk_product'; +$sql.= ' ON (p.rowid = s.fk_product AND s.fk_entrepot IN(SELECT ent.rowid FROM '.MAIN_DB_PREFIX.'entrepot AS ent WHERE ent.entity IN('.getEntity('stock').')))'; if($fk_supplier > 0) { $sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price pfp ON (pfp.fk_product = p.rowid AND pfp.fk_soc = '.$fk_supplier.')'; } From b306394c15b1871235702254c544d4f17c3097f2 Mon Sep 17 00:00:00 2001 From: Chl Date: Tue, 17 Jul 2018 23:50:06 +0200 Subject: [PATCH 06/27] corr. group by pour PostgreSQL --- htdocs/compta/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 59a901ccdf8..ebaef08c7b5 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -838,7 +838,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $reshook=$hookmanager->executeHooks('printFieldListWhereCustomerUnpaid',$parameters); $sql.=$hookmanager->resPrint; - $sql.= " GROUP BY f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,"; + $sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,"; $sql.= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, cc.rowid, cc.code"; $sql.= " ORDER BY f.datef ASC, f.facnumber ASC"; From 1e986bc39a54f73d336ff8e5da0e98e13905690c Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Fri, 20 Jul 2018 11:49:38 +0200 Subject: [PATCH 07/27] Fix: Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) --- htdocs/core/class/html.form.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f782da206da..4efedc2544e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3231,21 +3231,21 @@ class Form if ($resql && $this->db->num_rows($resql) > 0) { // Last seen cycle $ref = 0; - while ($res = $this->db->fetch_array($resql, MYSQL_NUM)) { + while ($obj = $this->db->fetch_object($resql)){ //Same company ? - if ($socid == $res[5]) { + if ($socid == $obj->fk_soc) { //Same cycle ? - if ($res[2] != $ref) { + if ($obj->situation_cycle_ref != $ref) { // Just seen this cycle - $ref = $res[2]; + $ref = $obj->situation_cycle_ref; //not final ? - if ($res[4] != 1) { + if ($obj->situation_final != 1) { //Not prov? - if (substr($res[1], 1, 4) != 'PROV') { - if ($selected == $res[0]) { - $opt .= ''; + if (substr($obj->facnumber, 1, 4) != 'PROV') { + if ($selected == $obj->situation_final) { + $opt .= ''; } else { - $opt .= ''; + $opt .= ''; } } } From 0c01f6e1395b4926817a0bb0e70422a1ead5da3f Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Fri, 20 Jul 2018 15:53:32 +0200 Subject: [PATCH 08/27] Fix situation invoice status --- htdocs/compta/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d5835f96781..3bf70b9fc38 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4730,7 +4730,7 @@ else if ($id > 0 || ! empty($ref)) } // For situation invoice with excess received - if ($object->statut == Facture::STATUS_VALIDATED + if ($object->statut > 0 && ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0 && $user->rights->facture->creer && !$objectidnext @@ -4748,7 +4748,7 @@ else if ($id > 0 || ! empty($ref)) } // remove situation from cycle - if ($object->statut == Facture::STATUS_VALIDATED + if ($object->statut > 0 && $object->type == Facture::TYPE_SITUATION && $user->rights->facture->creer && !$objectidnext From 984a8e3720884511ada2a9c0b78bc5bd1be5a1eb Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 20 Jul 2018 17:28:32 +0200 Subject: [PATCH 09/27] FIX disable/enable foreign key checking for avoid errors --- htdocs/install/repair.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 896d6964bdd..ad63582c142 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -1081,6 +1081,10 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha')) { $listoftables = $db->DDLListTables($db->database_name); + // Disable foreign key checking for avoid errors + $sql='SET FOREIGN_KEY_CHECKS=0'; + $resql = $db->query($sql); + foreach($listoftables as $table) { print ''; @@ -1095,6 +1099,10 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha')) else print ' - Disabled'; print ''; } + + // Enable foreign key checking + $sql='SET FOREIGN_KEY_CHECKS=1'; + $resql = $db->query($sql); } else { From e9d9954380adff4258ae9fa7551b7880a062e92a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 20 Jul 2018 18:33:14 +0200 Subject: [PATCH 10/27] FIX do not convert llx_const if mysql encrypt/decrypt is used --- htdocs/install/repair.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index ad63582c142..269d276d338 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -1087,6 +1087,9 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha')) foreach($listoftables as $table) { + // do not convert llx_const if mysql encrypt/decrypt is used + if ($conf->db->dolibarr_main_db_encryption != 0 && preg_match('/\_const$/', $table)) continue; + print ''; print $table; $sql='ALTER TABLE '.$table.' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci'; From 719db2574e98f29b9255b6143175dba44c1ae3ee Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 20 Jul 2018 18:39:18 +0200 Subject: [PATCH 11/27] FIX check if "confirmed" mode --- htdocs/install/repair.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 269d276d338..8e8aa5017ce 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -1079,11 +1079,16 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha')) if ($db->type == "mysql" || $db->type == "mysqli") { - $listoftables = $db->DDLListTables($db->database_name); + $force_utf8_on_tables = GETPOST('force_utf8_on_tables','alpha'); + + $listoftables = $db->DDLListTables($db->database_name); // Disable foreign key checking for avoid errors - $sql='SET FOREIGN_KEY_CHECKS=0'; - $resql = $db->query($sql); + if ($force_utf8_on_tables == 'confirmed') + { + $sql='SET FOREIGN_KEY_CHECKS=0'; + $resql = $db->query($sql); + } foreach($listoftables as $table) { @@ -1094,7 +1099,7 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha')) print $table; $sql='ALTER TABLE '.$table.' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci'; print ''; - if (GETPOST('force_utf8_on_tables','alpha') == 'confirmed') + if ($force_utf8_on_tables == 'confirmed') { $resql = $db->query($sql); print ' - Done ('.($resql?'OK':'KO').')'; @@ -1104,8 +1109,11 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha')) } // Enable foreign key checking - $sql='SET FOREIGN_KEY_CHECKS=1'; - $resql = $db->query($sql); + if ($force_utf8_on_tables == 'confirmed') + { + $sql='SET FOREIGN_KEY_CHECKS=1'; + $resql = $db->query($sql); + } } else { From 5cdc9db1f8a29b9466a6f2f5f807d74229ad9c8e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 20 Jul 2018 18:45:52 +0200 Subject: [PATCH 12/27] FIX add html comment --- htdocs/install/repair.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 8e8aa5017ce..1ad1beca350 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -1087,6 +1087,7 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha')) if ($force_utf8_on_tables == 'confirmed') { $sql='SET FOREIGN_KEY_CHECKS=0'; + print ''; $resql = $db->query($sql); } @@ -1112,6 +1113,7 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha')) if ($force_utf8_on_tables == 'confirmed') { $sql='SET FOREIGN_KEY_CHECKS=1'; + print ''; $resql = $db->query($sql); } } From c4e207e8b7775097dbc641370fc618bdac98203c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 Jul 2018 15:51:19 +0200 Subject: [PATCH 13/27] Fix dol_string_onlythesehtmltags --- 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 b3611b2d9e3..6bbcbb9109e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5491,7 +5491,7 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UT function dol_string_onlythesehtmltags($stringtoclean) { $allowed_tags = array( - "html", "head", "meta", "body", "b", "br", "div", "em", "font", "img", "ins", "hr", "i", "li", "link", + "html", "head", "meta", "body", "article", "a", "b", "br", "div", "em", "font", "img", "ins", "hr", "i", "li", "link", "ol", "p", "s", "section", "span", "strong", "title", "table", "tr", "th", "td", "u", "ul" ); From d582f72bd95fd290b2ab1efa8fb0b29b74d003d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 22 Jul 2018 17:27:02 +0200 Subject: [PATCH 14/27] __NEXT_MONTH __PREVIOUS_MONTH give day instead month --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0b0f74c1a09..9cbd8562949 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5159,9 +5159,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_day($tmp['mday'], $tmp['mon'], $tmp['year']); - $tmp3=dol_get_prev_month($tmp['mday'], $tmp['mon'], $tmp['year']); + $tmp3=dol_get_prev_month($tmp['mon'], $tmp['year']); $tmp4=dol_get_next_day($tmp['mday'], $tmp['mon'], $tmp['year']); - $tmp5=dol_get_next_month($tmp['mday'], $tmp['mon'], $tmp['year']); + $tmp5=dol_get_next_month($tmp['mon'], $tmp['year']); } $substitutionarray=array_merge($substitutionarray, array( '__DAY__' => $tmp['mday'], From 4341e367d26e5136b05128a8e95e3a32a5025a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 23 Jul 2018 10:30:28 +0200 Subject: [PATCH 15/27] remove % in supplier order pdf --- htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index b70a299fa03..196d1f0c6a2 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -430,7 +430,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if ($object->lines[$i]->remise_percent) { $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); - $pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $remise_percent."%", 0, 'R'); + $pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $remise_percent, 0, 'R'); } // Total HT line From df7a3598a8ad9cbba40c766d71a8b72c4869c012 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Jul 2018 10:56:28 +0200 Subject: [PATCH 16/27] 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 7e8039d66ec..3782ba816e4 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1794,7 +1794,7 @@ EnterCalculationRuleIfPreviousFieldIsYes=Enter calculcation rule if previous fie SeveralLangugeVariatFound=Several language variants found COMPANY_AQUARIUM_REMOVE_SPECIAL=Remove special characters COMPANY_AQUARIUM_CLEAN_REGEX=Regex filter to clean value (COMPANY_AQUARIUM_CLEAN_REGEX) -GDPRContact=GDPR contact +GDPRContact=Privacy Policies or GDPR contact GDPRContactDesc=If you store data about European companies/citizen, you can store here the contact who is responsible for the General Data Protection Regulation ##### Resource #### ResourceSetup=Configuration du module Resource From 18125d56e5644e61fc0a2286b89277c961ee6ba5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Jul 2018 14:10:59 +0200 Subject: [PATCH 17/27] css --- htdocs/theme/md/style.css.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index a7c102d16eb..58a34ce1873 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3735,6 +3735,8 @@ tr.visible { border: 0px; background-color: transparent; background-image: none; + color: #000 !important; + text-shadow: none; } .websitebar { border-bottom: 1px solid #ccc; From 4995a0feb116c94bd34e0142cf31db9fb24774c5 Mon Sep 17 00:00:00 2001 From: Chl Date: Mon, 23 Jul 2018 18:27:53 +0200 Subject: [PATCH 18/27] Translation: adding 'Enable' term in main compta/facture/fiche-rec.php uses 'Enable' / 'Disable' in a button text but no translation is available for 'Enable'. Another option would be to change 'Enable' to 'Activate' in fiche-rec.php but I guess this word will probably be useful in other places. --- htdocs/langs/en_US/main.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index fb4d1d3dc20..92f32a80069 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -142,6 +142,7 @@ Closed=Closed Closed2=Closed NotClosed=Not closed Enabled=Enabled +Enable=Enable Deprecated=Deprecated Disable=Disable Disabled=Disabled From 0f115dafee2a75cc7000c57265493d15c9038199 Mon Sep 17 00:00:00 2001 From: Chl Date: Tue, 24 Jul 2018 00:30:43 +0200 Subject: [PATCH 19/27] 2 bugfix for PDF generated by Templates/Cron: DueDate and translation When launching Cron on a facturerec with auto_validate at 1, the generated PDF doesn't contain the DueDate, and some tokens like __INVOICE_PREVIOUS_MONTH_TEXT__ in the public notes are not translated (tested with fr_FR). --- htdocs/compta/facture/class/facture-rec.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 71123d1c6e2..a82f06ad851 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -984,6 +984,7 @@ class FactureRec extends CommonInvoice $error=0; $langs->load("bills"); + $langs->load('main'); $nb_create=0; @@ -1060,6 +1061,8 @@ class FactureRec extends CommonInvoice } if (! $error && $facturerec->generate_pdf) { + // We refresh the object in order to have all necessary data (like date_lim_reglement) + $facture->fetch($facture->id); $result = $facture->generateDocument($facturerec->modelpdf, $langs); if ($result <= 0) { From ccd733264742014e594c2e58ada979eb0846dde0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Jul 2018 01:46:14 +0200 Subject: [PATCH 20/27] Fix default value of joinfile when creating a new email template --- htdocs/admin/mails_templates.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index af7d29c0fd6..c63ff44c32b 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -556,7 +556,7 @@ foreach ($fieldsforcontent as $tmpfieldlist) print ''; } else if ($tmpfieldlist == 'joinfiles') { - print ''; + print ''; } else { From 25c93de80149135fe995c59b02f283c9cfde2e93 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 24 Jul 2018 11:23:44 +0200 Subject: [PATCH 21/27] FIX missing drop old postgresql unique key --- htdocs/install/mysql/migration/7.0.0-8.0.0.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index 4da1c8cf408..8710b340622 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -51,6 +51,9 @@ ALTER TABLE llx_ecm_files ADD UNIQUE INDEX uk_ecm_files (filepath, filename, ent DROP TABLE llx_c_accountancy_category; DROP TABLE llx_c_accountingaccount; +-- drop old postgresql unique key +-- VPGSQL8.2 DROP INDEX llx_usergroup_rights_fk_usergroup_fk_id_key + update llx_propal set fk_statut = 1 where fk_statut = -1; ALTER TABLE llx_inventory ADD COLUMN fk_user_creat integer; From 20a1ffe8102dd169b616913cc4ed082bc8c6766d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 24 Jul 2018 12:15:54 +0200 Subject: [PATCH 22/27] FIX field is autoincrement but not "rowid" --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index e4f9fa1dd90..32995bce38f 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -379,7 +379,7 @@ $tabrowid[9] = "code_iso"; $tabrowid[10]= ""; $tabrowid[11]= "rowid"; $tabrowid[12]= ""; -$tabrowid[13]= ""; +$tabrowid[13]= "id"; $tabrowid[14]= ""; $tabrowid[15]= ""; $tabrowid[16]= "code"; From bde30b85ad7a493d9421379dfff3c467b7ac48e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 24 Jul 2018 17:06:12 +0200 Subject: [PATCH 23/27] use defaut currency for supplier order --- htdocs/fourn/commande/card.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index fa1cef8fe0e..7a1d80daa28 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1342,6 +1342,8 @@ if ($action=='create') dol_htmloutput_events(); + $currency_code = $conf->currency; + $societe=''; if ($socid>0) { From 438cdfc004da9c572d4dd43b7425c154bb00f76a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Jul 2018 17:16:21 +0200 Subject: [PATCH 24/27] FIX #9141 --- htdocs/user/class/api_users.class.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 556b86332bc..9bdb456dd34 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -67,7 +67,7 @@ class Users extends DolibarrApi global $db, $conf; $obj_ret = array(); - +se if(! DolibarrApiAccess::$user->rights->user->user->lire) { throw new RestException(401, "You are not allowed to read list of users"); } @@ -227,7 +227,7 @@ class Users extends DolibarrApi } /** - * add user to group + * Add a user into a group * * @param int $id User ID * @param int $group Group ID @@ -236,6 +236,9 @@ class Users extends DolibarrApi * @url GET {id}/setGroup/{group} */ function setGroup($id, $group) { + + global $conf; + //if (!DolibarrApiAccess::$user->rights->user->user->supprimer) { //throw new RestException(401); //} @@ -250,7 +253,9 @@ class Users extends DolibarrApi throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } - $result = $this->useraccount->SetInGroup($group,1); + // When using API, action is done on entity of logged user because a user of entity X with permission to create user should not be able to + // hack the security by giving himself permissions on another entity. + $result = $this->useraccount->SetInGroup($group, DolibarrApiAccess::$user->entity > 0 ? DolibarrApiAccess::$user->entity : $conf->entity); if (! ($result > 0)) { throw new RestException(500, $this->useraccount->error); From 869a97c8d1942a8b570db4225e881af6fc2f96e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Jul 2018 17:49:10 +0200 Subject: [PATCH 25/27] Update card.php --- htdocs/compta/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3bf70b9fc38..45e94d1e5d3 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4730,7 +4730,7 @@ else if ($id > 0 || ! empty($ref)) } // For situation invoice with excess received - if ($object->statut > 0 + if ($object->statut > Facture::STATUS_DRAFT && ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0 && $user->rights->facture->creer && !$objectidnext @@ -4748,7 +4748,7 @@ else if ($id > 0 || ! empty($ref)) } // remove situation from cycle - if ($object->statut > 0 + if ($object->statut > Facture::STATUS_DRAFT && $object->type == Facture::TYPE_SITUATION && $user->rights->facture->creer && !$objectidnext From e9eb8da61b12d995f1091c5678429ae9855c873d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Jul 2018 18:09:50 +0200 Subject: [PATCH 26/27] Update replenish.php --- htdocs/product/stock/replenish.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index b9d8875b5f7..5a9b9888470 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -294,7 +294,7 @@ $sql.= ' ,'.$sqldesiredtock.' as desiredstock, '.$sqlalertstock.' as alertstock, $sql.= ' SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").') as stock_physique'; $sql.= ' FROM ' . MAIN_DB_PREFIX . 'product as p'; $sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s'; -$sql.= ' ON (p.rowid = s.fk_product AND s.fk_entrepot IN(SELECT ent.rowid FROM '.MAIN_DB_PREFIX.'entrepot AS ent WHERE ent.entity IN('.getEntity('stock').')))'; +$sql.= ' ON (p.rowid = s.fk_product AND s.fk_entrepot IN (SELECT ent.rowid FROM '.MAIN_DB_PREFIX.'entrepot AS ent WHERE ent.entity IN('.getEntity('stock').')))'; if($fk_supplier > 0) { $sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price pfp ON (pfp.fk_product = p.rowid AND pfp.fk_soc = '.$fk_supplier.')'; } From f672e8bf02ec73667b19033a068cf87b3bec9ed6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Jul 2018 19:12:35 +0200 Subject: [PATCH 27/27] Fix trans --- htdocs/societe/paymentmodes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index a097872c9b1..89aad30e2f5 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; -$langs->loadLangs(array("companies","commercial","banks","bills",'paypal','stripe')); +$langs->loadLangs(array("companies","commercial","banks","bills",'paypal','stripe','withdrawals')); // Security check