From 8cdb251ca5038bc2959d68b3f41991926fc18719 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Tue, 2 Jul 2019 10:13:26 +0200 Subject: [PATCH 01/18] FIX product_use_units was set to 0 each time a conf in block other was set --- htdocs/product/admin/product.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 334640e87d3..4c58591e987 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -245,12 +245,12 @@ if ($action == 'set') if (! $res > 0) $error++; } -if ($action == 'other') -{ - $value = GETPOST('activate_units', 'alpha'); - $res = dolibarr_set_const($db, "PRODUCT_USE_UNITS", $value, 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; -} +//if ($action == 'other') +//{ +// $value = GETPOST('activate_units', 'alpha'); +// $res = dolibarr_set_const($db, "PRODUCT_USE_UNITS", $value, 'chaine', 0, '', $conf->entity); +// if (! $res > 0) $error++; +//} if ($action) { From 6b43c325c74923158dc71a8c8a39f86a0f2adcf5 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 2 Jul 2019 10:53:47 +0200 Subject: [PATCH 02/18] Fix wrong column for filters on invoice template list --- htdocs/compta/facture/invoicetemplate_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 306106d4889..0e09cb72ab1 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -264,7 +264,7 @@ if ($search_month_date_when > 0) if ($search_year_date_when > 0 && empty($search_day_date_when)) $sql.= " AND f.date_when BETWEEN '".$db->idate(dol_get_first_day($search_year_date_when,$search_month_date_when,false))."' AND '".$db->idate(dol_get_last_day($search_year_date_when,$search_month_date_when,false))."'"; else if ($search_year_date_when > 0 && ! empty($search_day_date_when)) - $sql.= " AND f.date_date_when_reglement BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month_date_when, $search_day_date_when, $search_year_date_when))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month_date_when, $search_day_date_when, $search_year_date_when))."'"; + $sql.= " AND f.date_when BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month_date_when, $search_day_date_when, $search_year_date_when))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month_date_when, $search_day_date_when, $search_year_date_when))."'"; else $sql.= " AND date_format(f.date_when, '%m') = '".$db->escape($search_month_date_when)."'"; } From 1b4507f07d03555724eb3aa6e401b99432c8b0f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jul 2019 11:40:05 +0200 Subject: [PATCH 03/18] Fix on a hidden option --- htdocs/projet/element.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 08351fc752f..b4d2a8b290f 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -605,6 +605,7 @@ foreach ($listofreferent as $key => $value) if ($key == 'invoice') { if (! empty($element->close_code) && $element->close_code == 'replaced') $qualifiedfortotal=false; // Replacement invoice, do not include into total + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $element->type == Facture::TYPE_DEPOSIT) $qualifiedfortotal=false; // If hidden option to use deposits as payment (deprecated, not recommended to use this), deposits are not included } if ($key == 'propal') { From ab7cb7bb2e3debda6ee7c7ce5a2c8dc2e87a3a5e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 2 Jul 2019 12:01:50 +0200 Subject: [PATCH 04/18] FIX Nowrap on amount --- htdocs/compta/facture/list.php | 14 +++++++------- htdocs/don/card.php | 4 ++-- htdocs/don/class/don.class.php | 4 ++-- htdocs/fourn/facture/list.php | 14 +++++++------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 6c325c865a9..284b747465d 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1143,7 +1143,7 @@ if ($resql) // Amount HT if (! empty($arrayfields['f.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; + print ''.price($obj->total_ht)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield']; $totalarray['totalht'] += $obj->total_ht; @@ -1151,7 +1151,7 @@ if ($resql) // Amount VAT if (! empty($arrayfields['f.total_vat']['checked'])) { - print ''.price($obj->total_vat)."\n"; + print ''.price($obj->total_vat)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; $totalarray['totalvat'] += $obj->total_vat; @@ -1159,7 +1159,7 @@ if ($resql) // Amount LocalTax1 if (! empty($arrayfields['f.total_localtax1']['checked'])) { - print ''.price($obj->total_localtax1)."\n"; + print ''.price($obj->total_localtax1)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totallocaltax1field']=$totalarray['nbfield']; $totalarray['totallocaltax1'] += $obj->total_localtax1; @@ -1167,7 +1167,7 @@ if ($resql) // Amount LocalTax2 if (! empty($arrayfields['f.total_localtax2']['checked'])) { - print ''.price($obj->total_localtax2)."\n"; + print ''.price($obj->total_localtax2)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totallocaltax2field']=$totalarray['nbfield']; $totalarray['totallocaltax2'] += $obj->total_localtax2; @@ -1175,7 +1175,7 @@ if ($resql) // Amount TTC if (! empty($arrayfields['f.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; + print ''.price($obj->total_ttc)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->total_ttc; @@ -1183,7 +1183,7 @@ if ($resql) if (! empty($arrayfields['dynamount_payed']['checked'])) { - print ''.(! empty($totalpay)?price($totalpay, 0, $langs):' ').''; // TODO Use a denormalized field + print ''.(! empty($totalpay)?price($totalpay, 0, $langs):' ').''; // TODO Use a denormalized field if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalamfield']=$totalarray['nbfield']; $totalarray['totalam'] += $totalpay; @@ -1191,7 +1191,7 @@ if ($resql) if (! empty($arrayfields['rtp']['checked'])) { - print ''.(! empty($remaintopay)?price($remaintopay, 0, $langs):' ').''; // TODO Use a denormalized field + print ''.(! empty($remaintopay)?price($remaintopay, 0, $langs):' ').''; // TODO Use a denormalized field if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield']; $totalarray['totalrtp'] += $remaintopay; diff --git a/htdocs/don/card.php b/htdocs/don/card.php index cd92d8d02f5..6e6bab0cf57 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -154,7 +154,7 @@ if ($action == 'add') if (! $error) { - $object->socid = GETPOST("socid", 'int'); + $object->socid = GETPOST("socid", 'int'); $object->firstname = GETPOST("firstname", 'alpha'); $object->lastname = GETPOST("lastname", 'alpha'); $object->societe = GETPOST("societe", 'alpha'); @@ -164,7 +164,7 @@ if ($action == 'add') $object->town = GETPOST("town", 'alpha'); $object->country_id = GETPOST('country_id', 'int'); $object->email = GETPOST('email', 'alpha'); - $object->date = $donation_date; + $object->date = $donation_date; $object->note_private = GETPOST("note_private", 'none'); $object->note_public = GETPOST("note_public", 'none'); $object->public = GETPOST("public", 'alpha'); diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index d75e658a191..caeb70aca94 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -392,11 +392,11 @@ class Don extends CommonObject $sql.= ", phone"; $sql.= ", phone_mobile"; $sql.= ") VALUES ("; - $sql.= " '".$this->db->idate($now)."'"; + $sql.= "'".$this->db->idate($now)."'"; $sql.= ", ".$conf->entity; $sql.= ", ".price2num($this->amount); $sql.= ", ".($this->modepaymentid?$this->modepaymentid:"null"); - $sql.= ", '".$this->db->escape($this->socid)."'"; + $sql.= ", ".($this->socid?$this->socid:"null"); $sql.= ", '".$this->db->escape($this->firstname)."'"; $sql.= ", '".$this->db->escape($this->lastname)."'"; $sql.= ", '".$this->db->escape($this->societe)."'"; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index ed7caf0061d..7d51f3783c1 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -986,7 +986,7 @@ if ($resql) // Amount HT if (! empty($arrayfields['f.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; + print ''.price($obj->total_ht)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield']; $totalarray['totalht'] += $obj->total_ht; @@ -994,7 +994,7 @@ if ($resql) // Amount VAT if (! empty($arrayfields['f.total_vat']['checked'])) { - print ''.price($obj->total_vat)."\n"; + print ''.price($obj->total_vat)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; $totalarray['totalvat'] += $obj->total_vat; @@ -1002,7 +1002,7 @@ if ($resql) // Amount LocalTax1 if (! empty($arrayfields['f.total_localtax1']['checked'])) { - print ''.price($obj->total_localtax1)."\n"; + print ''.price($obj->total_localtax1)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totallocaltax1field']=$totalarray['nbfield']; $totalarray['totallocaltax1'] += $obj->total_localtax1; @@ -1010,7 +1010,7 @@ if ($resql) // Amount LocalTax2 if (! empty($arrayfields['f.total_localtax2']['checked'])) { - print ''.price($obj->total_localtax2)."\n"; + print ''.price($obj->total_localtax2)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totallocaltax2field']=$totalarray['nbfield']; $totalarray['totallocaltax2'] += $obj->total_localtax2; @@ -1018,7 +1018,7 @@ if ($resql) // Amount TTC if (! empty($arrayfields['f.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; + print ''.price($obj->total_ttc)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->total_ttc; @@ -1026,7 +1026,7 @@ if ($resql) if (! empty($arrayfields['dynamount_payed']['checked'])) { - print ''.(! empty($totalpay)?price($totalpay, 0, $langs):' ').''; // TODO Use a denormalized field + print ''.(! empty($totalpay)?price($totalpay, 0, $langs):' ').''; // TODO Use a denormalized field if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalamfield']=$totalarray['nbfield']; $totalarray['totalam'] += $totalpay; @@ -1034,7 +1034,7 @@ if ($resql) if (! empty($arrayfields['rtp']['checked'])) { - print ''.(! empty($remaintopay)?price($remaintopay, 0, $langs):' ').''; // TODO Use a denormalized field + print ''.(! empty($remaintopay)?price($remaintopay, 0, $langs):' ').''; // TODO Use a denormalized field if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield']; $totalarray['totalrtp'] += $remaintopay; From 8a25c854e9b75c9134e5232a0640799e9badaa9f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jul 2019 14:38:26 +0200 Subject: [PATCH 05/18] Hide sensitive data --- .../DataCollector/DolRequestDataCollector.php | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php b/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php index e4d8e89159a..d6e939a9964 100644 --- a/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php @@ -8,6 +8,31 @@ use \DebugBar\DataCollector\RequestDataCollector; class DolRequestDataCollector extends RequestDataCollector { + public function collect() + { + $vars = array('_GET', '_POST', '_SESSION', '_COOKIE', '_SERVER'); + $data = array(); + + foreach ($vars as $var) { + if (isset($GLOBALS[$var])) { + $arrayofvalues = $GLOBALS[$var]; + + if ($var == '_COOKIE') + { + foreach($arrayofvalues as $key => $val) + { + if (preg_match('/^DOLSESSID_/', $key)) $arrayofvalues[$key]='*****hidden*****'; + } + //var_dump($arrayofvalues); + } + + $data["$" . $var] = $this->getDataFormatter()->formatVar($arrayofvalues); + } + } + + return $data; + } + /** * Return widget settings * @@ -20,7 +45,7 @@ class DolRequestDataCollector extends RequestDataCollector $langs->load("other"); return array( - $langs->transnoentities('Request') => array( + $langs->transnoentities('Variables') => array( "icon" => "tags", "widget" => "PhpDebugBar.Widgets.VariableListWidget", "map" => "request", From 3b0f1c733f36d6a6de2181da60783fdd71624da7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jul 2019 15:00:17 +0200 Subject: [PATCH 06/18] Fix missing token --- htdocs/core/boxes/box_graph_invoices_permonth.php | 1 + htdocs/core/boxes/box_graph_invoices_supplier_permonth.php | 1 + htdocs/core/boxes/box_graph_orders_permonth.php | 1 + htdocs/core/boxes/box_graph_orders_supplier_permonth.php | 1 + htdocs/core/boxes/box_graph_product_distribution.php | 1 + htdocs/core/boxes/box_graph_propales_permonth.php | 1 + htdocs/main.inc.php | 1 + 7 files changed, 7 insertions(+) diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 4323661370c..91416452609 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -224,6 +224,7 @@ class box_graph_invoices_permonth extends ModeleBoxes '; $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.='
'; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index bba5185c94a..b95cffdb499 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -221,6 +221,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes '; $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index b06558393aa..271ed4911b4 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -220,6 +220,7 @@ class box_graph_orders_permonth extends ModeleBoxes '; $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 9cb11aed7c1..b7589e0efd2 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -219,6 +219,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes '; $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 0fe5c66d532..0cdffafa050 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -338,6 +338,7 @@ class box_graph_product_distribution extends ModeleBoxes '; $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index b21381473c2..42643fb72bc 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -223,6 +223,7 @@ class box_graph_propales_permonth extends ModeleBoxes '; $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index d283abd7d15..5456e2ce1eb 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -374,6 +374,7 @@ if (! defined('NOTOKENRENEWAL')) //var_dump(GETPOST('token').' '.$_SESSION['token'].' - '.$_SESSION['newtoken'].' '.$_SERVER['SCRIPT_FILENAME']); // Check token +//var_dump((! defined('NOCSRFCHECK')).' '.empty($dolibarr_nocsrfcheck).' '.(! empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)).' '.$_SERVER['REQUEST_METHOD'].' '.(! GETPOSTISSET('token'))); if ((! defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && ! empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) || defined('CSRFCHECK_WITH_TOKEN')) // Check validity of token, only if option MAIN_SECURITY_CSRF_WITH_TOKEN enabled or if constant CSRFCHECK_WITH_TOKEN is set { From a75a2ae8e45a730e9a74ac9944acb43aac4c4ee2 Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 2 Jul 2019 15:44:42 +0200 Subject: [PATCH 07/18] Fix missing hidden input and short label --- htdocs/admin/dict.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index d160793b735..6bffb7fe535 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1889,6 +1889,9 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') { print ''; } + else{ + print ''; + } print ''; } elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) { @@ -1951,7 +1954,13 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } else { - if ($fieldlist[$field]=='sortorder') $fieldlist[$field]='position'; + + $fieldValue = isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''; + + if ($fieldlist[$field]=='sortorder') + { + $fieldlist[$field]='position'; + } $classtd=''; $class=''; if ($fieldlist[$field]=='code') $classtd='width100'; @@ -1972,7 +1981,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } if ($tabname == MAIN_DB_PREFIX.'c_payment_term') { $langs->load("bills"); - $transkey="PaymentCondition".strtoupper($obj->code); + $transkey="PaymentConditionShort".strtoupper($obj->code); } if ($transkey && $langs->trans($transkey) != $transkey) { @@ -1982,8 +1991,11 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } if (! $transfound) { - print ''; + print ''; } + else{ + print ''; + } print ''; } } From d9560dbb6187a26c6badf7af3be04e467cccc1bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jul 2019 18:02:06 +0200 Subject: [PATCH 08/18] Fix var not initialized --- htdocs/core/modules/export/export_csv.modules.php | 3 +++ htdocs/core/modules/export/export_excel.modules.php | 2 ++ htdocs/core/modules/export/export_excel2007new.modules.php | 2 ++ 3 files changed, 7 insertions(+) diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index c3c8431962e..9d606aadc33 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -261,6 +261,9 @@ class ExportCsv extends ModeleExports } $this->col=0; + + $reg=array(); + foreach($array_selected_sorted as $code => $value) { if (strpos($code, ' as ') == 0) $alias=str_replace(array('.','-','(',')'), '_', $code); diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php index ffb1fd83cce..0e7fd0f1169 100644 --- a/htdocs/core/modules/export/export_excel.modules.php +++ b/htdocs/core/modules/export/export_excel.modules.php @@ -345,6 +345,8 @@ class ExportExcel extends ModeleExports // Define first row $this->col=0; + $reg=array(); + foreach($array_selected_sorted as $code => $value) { if (strpos($code, ' as ') == 0) $alias=str_replace(array('.','-','(',')'), '_', $code); diff --git a/htdocs/core/modules/export/export_excel2007new.modules.php b/htdocs/core/modules/export/export_excel2007new.modules.php index 266cedc1310..038446643a2 100644 --- a/htdocs/core/modules/export/export_excel2007new.modules.php +++ b/htdocs/core/modules/export/export_excel2007new.modules.php @@ -304,6 +304,8 @@ class ExportExcel2007new extends ModeleExports // Define first row $this->col=0; + $reg=array(); + foreach($array_selected_sorted as $code => $value) { if (strpos($code, ' as ') == 0) $alias=str_replace(array('.','-','(',')'), '_', $code); From 9d50c672088b16a6208358e4f1e890ca3ab0eaab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jul 2019 18:06:51 +0200 Subject: [PATCH 09/18] FIX option EXPORT_LABEL_FOR_SELECT to restore compatibility in export --- htdocs/core/extrafieldsinexport.inc.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index 13b2d1ae520..78dbba9934e 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -34,6 +34,15 @@ if ($resql) // This can fail when class is used on old database (during migra case 'boolean': $typeFilter="Boolean"; break; + case 'select': + if (! empty($conf->global->EXPORT_LABEL_FOR_SELECT)) + { + $tmpparam=unserialize($obj->param); // $tmpparam may be array with 'options' = array(key1=>val1, key2=>val2 ...) + if ($tmpparam['options'] && is_array($tmpparam['options'])) { + $typeFilter="Select:".$obj->param; + } + } + break; case 'sellist': $tmp=''; $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null From 126479b5a9408bc3c6c55fa640e276fc44d36c4e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 2 Jul 2019 21:46:00 +0200 Subject: [PATCH 10/18] Fix paymentmethod detach --- htdocs/societe/paymentmodes.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 6a3596f6e24..21af1f0a35c 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -637,6 +637,16 @@ if (empty($reshook)) elseif ($action == 'deletecard' && $source) { try { + if (preg_match('/pm_/', $source)) + { + $payment_method = \Stripe\PaymentMethod::retrieve($source); + if ($payment_method) + { + $payment_method->detach(); + } + } + else + { $cu=$stripe->customerStripe($object, $stripeacc, $servicestatus); $card=$cu->sources->retrieve("$source"); if ($card) @@ -645,6 +655,7 @@ if (empty($reshook)) if (method_exists($card, 'detach')) $card->detach(); else $card->delete(); } + } $url=DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id; header('Location: '.$url); From 03938e21239396b44353f234a2d8219694722332 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 2 Jul 2019 21:56:50 +0200 Subject: [PATCH 11/18] Update paymentmodes.php --- 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 21af1f0a35c..0e41e11cbaa 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -639,7 +639,7 @@ if (empty($reshook)) try { if (preg_match('/pm_/', $source)) { - $payment_method = \Stripe\PaymentMethod::retrieve($source); + $payment_method = \Stripe\PaymentMethod::retrieve($source, ["stripe_account" => $stripeacc]); if ($payment_method) { $payment_method->detach(); From ff68b110b27aca9c0f76b12d0ddc38acdd73726a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jul 2019 23:14:22 +0200 Subject: [PATCH 12/18] Fix phpcs --- .../debugbar/class/DataCollector/DolRequestDataCollector.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php b/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php index d6e939a9964..ebf9e2bfbd2 100644 --- a/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php @@ -8,6 +8,11 @@ use \DebugBar\DataCollector\RequestDataCollector; class DolRequestDataCollector extends RequestDataCollector { + /** + * Collects the data from the collectors + * + * @return array + */ public function collect() { $vars = array('_GET', '_POST', '_SESSION', '_COOKIE', '_SERVER'); From 433835860c2cbf470b9421d75f035a2567c33aee Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 3 Jul 2019 13:12:41 +0200 Subject: [PATCH 13/18] FIX: When saving an action it didn't save the label based on the type of event if the label is empty and the type is customized --- htdocs/comm/action/card.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 470a90c355f..8989807a645 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -7,6 +7,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2019 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 @@ -246,7 +247,10 @@ if ($action == 'add') { $object->label = $langs->transnoentitiesnoconv("Action".$object->type_code)."\n"; } - else $object->label = $cactioncomm->libelle; + else { + $cactioncomm->fetch($object->type_code); + $object->label = $cactioncomm->label; + } } } $object->fk_project = isset($_POST["projectid"])?$_POST["projectid"]:0; From 3e53a06b2ef93b487dbb4b18ffb3b4c82292ad40 Mon Sep 17 00:00:00 2001 From: "atm-florian.m" Date: Wed, 3 Jul 2019 16:17:47 +0200 Subject: [PATCH 14/18] minor spelling issues --- htdocs/fourn/commande/dispatch.php | 4 ++-- htdocs/langs/fr_FR/stocks.lang | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 77fd4b1aa69..dd6fd76a46a 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -245,7 +245,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) // We ask to move a qty if (GETPOST($qty) != 0) { if (! (GETPOST($ent, 'int') > 0)) { - dol_syslog('No dispatch for line ' . $key . ' as no warehouse choosed'); + dol_syslog('No dispatch for line ' . $key . ' as no warehouse was chosen.'); $text = $langs->transnoentities('Warehouse') . ', ' . $langs->transnoentities('Line') . ' ' . ($numline); setEventMessages($langs->trans('ErrorFieldRequired', $text), null, 'errors'); $error ++; @@ -282,7 +282,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) // We ask to move a qty if (GETPOST($qty) > 0) { if (! (GETPOST($ent, 'int') > 0)) { - dol_syslog('No dispatch for line ' . $key . ' as no warehouse choosed'); + dol_syslog('No dispatch for line ' . $key . ' as no warehouse was chosen.'); $text = $langs->transnoentities('Warehouse') . ', ' . $langs->transnoentities('Line') . ' ' . ($numline) . '-' . ($reg[1] + 1); setEventMessages($langs->trans('ErrorFieldRequired', $text), null, 'errors'); $error ++; diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang index 5898f7384e5..df9f738f4d8 100644 --- a/htdocs/langs/fr_FR/stocks.lang +++ b/htdocs/langs/fr_FR/stocks.lang @@ -65,7 +65,7 @@ RuleForStockManagementIncrease=Règle de gestion des incrémentations de stock ( DeStockOnBill=Décrémenter les stocks physiques sur validation des factures/avoirs clients DeStockOnValidateOrder=Décrémenterr les stocks physiques sur validation des commandes clients DeStockOnShipment=Décrémenter les stocks physiques sur validation des expéditions -DeStockOnShipmentOnClosing=Décrémenter les stocks phisiques au classement "clôturée" de l'expédition +DeStockOnShipmentOnClosing=Décrémenter les stocks physiques au classement "clôturée" de l'expédition ReStockOnBill=Incrémenter les stocks physiques sur validation des factures/avoirs fournisseurs ReStockOnValidateOrder=Incrémenter les stocks physiques sur approbation des commandes fournisseurs ReStockOnDispatchOrder=Incrémenter les stocks physiques sur ventilation manuelle dans les entrepôts, après réception de la marchandise From 2f5b9ccb22b9bcd3cce64d3a234bdf3e945b6d1e Mon Sep 17 00:00:00 2001 From: atm-greg Date: Wed, 3 Jul 2019 17:00:18 +0200 Subject: [PATCH 15/18] fix case objecttmp is an invoice --- 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 fe8a812a8a2..a8d96ed4b34 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5558,7 +5558,8 @@ class Form if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company'; $confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT - $fieldstoshow='t.ref'; + if (DOL_VERSION < 10 && $objecttmp->element == 'facture') $fieldstoshow = 't.facnumber'; + else $fieldstoshow='t.ref'; if (! empty($objecttmp->fields)) // For object that declare it, it is better to use declared fields ( like societe, contact, ...) { $tmpfieldstoshow=''; From 75aa11e5269efcccf6d3b4de08ebfa7f7dc6a217 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 01:58:25 +0200 Subject: [PATCH 16/18] Code comment --- htdocs/core/triggers/interface_20_all_Logevents.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 1ce13ff2193..92d93eef10f 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; /** - * Class of triggers for security events + * Class of triggers for security audit events */ class InterfaceLogevents extends DolibarrTriggers { @@ -47,7 +47,7 @@ class InterfaceLogevents extends DolibarrTriggers public $version = self::VERSION_DOLIBARR; /** - * Function called when a Dolibarrr business event is done. + * Function called when a Dolibarrr security audit event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) * * @param string $action Event action code From 10e3e37c6c2d560b283263e673ad46d86cc6981a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 10:39:30 +0200 Subject: [PATCH 17/18] Update don.class.php --- htdocs/don/class/don.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index caeb70aca94..638de5580e4 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -396,7 +396,7 @@ class Don extends CommonObject $sql.= ", ".$conf->entity; $sql.= ", ".price2num($this->amount); $sql.= ", ".($this->modepaymentid?$this->modepaymentid:"null"); - $sql.= ", ".($this->socid?$this->socid:"null"); + $sql.= ", ".($this->socid > 0 ? $this->socid : "null"); $sql.= ", '".$this->db->escape($this->firstname)."'"; $sql.= ", '".$this->db->escape($this->lastname)."'"; $sql.= ", '".$this->db->escape($this->societe)."'"; From 63c93be94e0a28be0cb05fb08ecc3c76c2f2e7cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 12:20:34 +0200 Subject: [PATCH 18/18] 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 a8d96ed4b34..a462f40ebdc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5558,7 +5558,7 @@ class Form if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company'; $confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT - if (DOL_VERSION < 10 && $objecttmp->element == 'facture') $fieldstoshow = 't.facnumber'; + if (((float) DOL_VERSION) < 10 && $objecttmp->element == 'facture') $fieldstoshow = 't.facnumber'; else $fieldstoshow='t.ref'; if (! empty($objecttmp->fields)) // For object that declare it, it is better to use declared fields ( like societe, contact, ...) {