diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index c3d92edefda..11cd105137c 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1903,6 +1903,9 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') { print ''; } + else{ + print ''; + } print ''; } elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) { @@ -1965,7 +1968,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'; @@ -1982,7 +1991,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) { @@ -1992,8 +2001,11 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') } if (! $transfound) { - print ''; + print ''; } + else{ + print ''; + } print ''; } } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 8e8d21c51b1..af54186e255 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -8,6 +8,7 @@ * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2018-2019 Frédéric France + * 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 @@ -252,7 +253,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; diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 9f9e3276542..5da37d46fd5 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -261,7 +261,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))."'"; elseif ($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)."'"; } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 0a5efadd832..2982246c6d9 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/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 4ece2eae661..5c747065138 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -220,6 +220,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 4e7849ab048..d06098daa3b 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -217,6 +217,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 3ba42cc6d0a..8c4cb250376 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -216,6 +216,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 6bfc47c504d..a584c7288ca 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -215,6 +215,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 e085cd82f07..d32c9bb1918 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -332,6 +332,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 9ced39271d0..861c5086704 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -219,6 +219,7 @@ class box_graph_propales_permonth extends ModeleBoxes '; $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; 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 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); diff --git a/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php b/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php index e4d8e89159a..ebf9e2bfbd2 100644 --- a/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php @@ -8,6 +8,36 @@ 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'); + $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 +50,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", 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..638de5580e4 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 > 0 ? $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/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 0c6091b694a..dae11084fe1 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -242,7 +242,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 ++; @@ -279,7 +279,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/fourn/facture/list.php b/htdocs/fourn/facture/list.php index f72261a0802..b18af4c3f19 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; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2e9ec140bf7..090bfd3bcd4 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -353,6 +353,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 { diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 95f61d2f20a..a7e45d488e1 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) { 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') { diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 6a3596f6e24..0e41e11cbaa 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, ["stripe_account" => $stripeacc]); + 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);