From 57f4ac2072641fa00f5297118962bf489d1f9f12 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Sat, 16 Jan 2021 23:41:06 +0100 Subject: [PATCH 1/6] Update list.php --- htdocs/societe/list.php | 73 ++++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 19 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index ec748d95e94..22c7b583122 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -93,6 +93,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_staff = GETPOST("search_staff", 'int'); $search_status = GETPOST("search_status", 'int'); $search_type = GETPOST('search_type', 'alpha'); @@ -188,8 +189,8 @@ $arrayfields = array( 's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'position'=>13, 'checked'=>$checkedcustomeraccountcode), 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'position'=>14, 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))), 's.address'=>array('label'=>"Address", 'position'=>19, 'checked'=>0), - 's.town'=>array('label'=>"Town", 'position'=>20, 'checked'=>0), - 's.zip'=>array('label'=>"Zip", 'position'=>21, 'checked'=>1), + 's.zip'=>array('label'=>"Zip", 'position'=>20, 'checked'=>1), + 's.town'=>array('label'=>"Town", 'position'=>21, 'checked'=>0), 'state.nom'=>array('label'=>"State", 'position'=>22, 'checked'=>0), 'region.nom'=>array('label'=>"Region", 'position'=>23, 'checked'=>0), 'country.code_iso'=>array('label'=>"Country", 'position'=>24, 'checked'=>0), @@ -198,7 +199,7 @@ $arrayfields = array( 's.phone'=>array('label'=>"Phone", 'position'=>27, 'checked'=>1), 's.fax'=>array('label'=>"Fax", 'position'=>28, 'checked'=>0), 'typent.code'=>array('label'=>"ThirdPartyType", 'position'=>29, 'checked'=>$checkedtypetiers), - 'staff.code'=>array('label'=>"Staff", 'position'=>30, 'checked'=>0), + 'staff.code'=>array('label'=>"Staff", 'position'=>31, 'checked'=>0), 's.siren'=>array('label'=>"ProfId1Short", 'position'=>40, 'checked'=>$checkedprofid1), 's.siret'=>array('label'=>"ProfId2Short", 'position'=>41, 'checked'=>$checkedprofid2), 's.ape'=>array('label'=>"ProfId3Short", 'position'=>42, 'checked'=>$checkedprofid3), @@ -215,6 +216,12 @@ $arrayfields = array( 's.status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), 's.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100), ); +if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) +{ + $arrayfields['s.price_level'] =array('label'=>"PriceLevel", 'position'=>30, 'checked'=>0); + +} + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -308,6 +315,7 @@ if (empty($reshook)) $search_idprof6 = ''; $search_vat = ''; $search_type = ''; + $search_prive_level = ''; $search_type_thirdparty = ''; $search_staff = ''; $search_status = -1; @@ -395,7 +403,7 @@ $sql .= " s.entity,"; $sql .= " st.libelle as stcomm, st.picto as stcomm_picto, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,"; $sql .= " s.email, s.phone, s.fax, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,"; $sql .= " s.tms as date_update, s.datec as date_creation,"; -$sql .= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,"; +$sql .= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,"; $sql .= " s2.nom as name2,"; $sql .= " typent.code as typent_code,"; $sql .= " staff.code as staff_code,"; @@ -475,6 +483,7 @@ if ($search_type > 0 && in_array($search_type, array('4'))) $sql .= " AN if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0"; if ($search_status != '' && $search_status >= 0) $sql .= natural_search("s.status", $search_status, 2); 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_type_thirdparty && $search_type_thirdparty != '-1') $sql .= natural_search("s.fk_typent", $search_type_thirdparty, 2); 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); @@ -571,6 +580,7 @@ if ($search_idprof4 != '') $param .= '&search_idprof4='.urlencode($search_idprof if ($search_idprof5 != '') $param .= '&search_idprof5='.urlencode($search_idprof5); if ($search_idprof6 != '') $param .= '&search_idprof6='.urlencode($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_type_thirdparty != '') $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); if ($search_type != '') $param .= '&search_type='.urlencode($search_type); if (is_array($search_level) && count($search_level)) foreach ($search_level as $slevel) $param .= '&search_level[]='.urlencode($slevel); @@ -779,13 +789,6 @@ if (!empty($arrayfields['s.address']['checked'])) print ''; print ''; } -// Town -if (!empty($arrayfields['s.town']['checked'])) -{ - print ''; - print ''; - print ''; -} // Zip if (!empty($arrayfields['s.zip']['checked'])) { @@ -793,6 +796,13 @@ if (!empty($arrayfields['s.zip']['checked'])) print ''; print ''; } +// Town +if (!empty($arrayfields['s.town']['checked'])) +{ + print ''; + print ''; + print ''; +} // State if (!empty($arrayfields['state.nom']['checked'])) { @@ -821,6 +831,16 @@ if (!empty($arrayfields['typent.code']['checked'])) print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'maxwidth75', 1); print ''; } +// Multiprice level +if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) +{ + if (!empty($arrayfields['s.price_level']['checked'])) + { + print ''; + print ''; + print ''; + } +} // Staff if (!empty($arrayfields['staff.code']['checked'])) { @@ -989,8 +1009,8 @@ if (!empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_fi if (!empty($arrayfields['s.code_compta']['checked'])) print_liste_field_titre($arrayfields['s.code_compta']['label'], $_SERVER["PHP_SELF"], "s.code_compta", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'], $_SERVER["PHP_SELF"], "s.code_compta_fournisseur", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['s.address']['checked'])) print_liste_field_titre($arrayfields['s.address']['label'], $_SERVER['PHP_SELF'], 's.address', '', $param, '', $sortfield, $sortorder); -if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], "s.town", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], "s.zip", "", $param, '', $sortfield, $sortorder); +if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], "s.town", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'], $_SERVER["PHP_SELF"], "region.nom", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); @@ -998,7 +1018,7 @@ if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre if (!empty($arrayfields['staff.code']['checked'])) print_liste_field_titre($arrayfields['staff.code']['label'], $_SERVER["PHP_SELF"], "staff.code", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'], $_SERVER["PHP_SELF"], "s.phone", "", $param, '', $sortfield, $sortorder); -if (!empty($arrayfields['s.fax']['checked'])) print_liste_field_titre($arrayfields['s.fax']['label'], $_SERVER["PHP_SELF"], "s.fax", "", $param, '', $sortfield, $sortorder); +if (!empty($arrayfields['s.fax']['checked'])) print_liste_field_titre($arrayfields['s.fax']['label'], $_SERVER["PHP_SELF"], "s.fax", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['s.url']['checked'])) print_liste_field_titre($arrayfields['s.url']['label'], $_SERVER["PHP_SELF"], "s.url", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"), $textprofid[1], 1, 0), $_SERVER["PHP_SELF"], "s.siren", "", $param, '', $sortfield, $sortorder, 'nowrap '); if (!empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"), $textprofid[2], 1, 0), $_SERVER["PHP_SELF"], "s.siret", "", $param, '', $sortfield, $sortorder, 'nowrap '); @@ -1011,6 +1031,12 @@ if (!empty($arrayfields['customerorsupplier']['checked'])) print_liste_fi if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "s.fk_prospectlevel", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'], $_SERVER["PHP_SELF"], "s.fk_stcomm", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['s2.nom']['checked'])) print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER["PHP_SELF"], "s2.nom", "", $param, '', $sortfield, $sortorder, 'center '); +// Multiprice level +if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) +{ + if (!empty($arrayfields['s.price_level']['checked'])) print_liste_field_titre($arrayfields['s.price_level']['label'], $_SERVER["PHP_SELF"], "s.price_level", "", $param, '', $sortfield, $sortorder); +} + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -1123,18 +1149,18 @@ while ($i < min($num, $limit)) print ''.$obj->address.''; if (!$i) $totalarray['nbfield']++; } - // Town - if (!empty($arrayfields['s.town']['checked'])) - { - print "".$obj->town."\n"; - if (!$i) $totalarray['nbfield']++; - } // Zip if (!empty($arrayfields['s.zip']['checked'])) { print "".$obj->zip."\n"; if (!$i) $totalarray['nbfield']++; } + // Town + if (!empty($arrayfields['s.town']['checked'])) + { + print "".$obj->town."\n"; + if (!$i) $totalarray['nbfield']++; + } // State if (!empty($arrayfields['state.nom']['checked'])) { @@ -1165,6 +1191,15 @@ while ($i < min($num, $limit)) print ''; if (!$i) $totalarray['nbfield']++; } + // Multiprice level + if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) + { + if (!empty($arrayfields['s.price_level']['checked'])) + { + print "".$obj->price_level."\n"; + if (!$i) $totalarray['nbfield']++; + } + } // Staff if (!empty($arrayfields['staff.code']['checked'])) { From af169ac700082783b114f90db710d0bb3c59b35a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 16 Jan 2021 22:49:15 +0000 Subject: [PATCH 2/6] Fixing style errors. --- htdocs/societe/list.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 22c7b583122..35d1c123092 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -219,7 +219,6 @@ $arrayfields = array( if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { $arrayfields['s.price_level'] =array('label'=>"PriceLevel", 'position'=>30, 'checked'=>0); - } // Extra fields From 4f9e294fc7a5808eaa45efebfee852a7b7dbf67b Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Fri, 22 Jan 2021 18:10:48 +0100 Subject: [PATCH 3/6] Update list.php --- htdocs/societe/list.php | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 35d1c123092..ae54bf5c83e 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -831,14 +831,11 @@ if (!empty($arrayfields['typent.code']['checked'])) print ''; } // Multiprice level -if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) +if (!empty($arrayfields['s.price_level']['checked'])) { - if (!empty($arrayfields['s.price_level']['checked'])) - { - print ''; - print ''; - print ''; - } + print ''; + print ''; + print ''; } // Staff if (!empty($arrayfields['staff.code']['checked'])) @@ -1015,6 +1012,7 @@ if (!empty($arrayfields['region.nom']['checked'])) print_liste_field_titre if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['staff.code']['checked'])) print_liste_field_titre($arrayfields['staff.code']['label'], $_SERVER["PHP_SELF"], "staff.code", "", $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['s.price_level']['checked'])) print_liste_field_titre($arrayfields['s.price_level']['label'], $_SERVER["PHP_SELF"], "s.price_level", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'], $_SERVER["PHP_SELF"], "s.phone", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['s.fax']['checked'])) print_liste_field_titre($arrayfields['s.fax']['label'], $_SERVER["PHP_SELF"], "s.fax", "", $param, '', $sortfield, $sortorder); @@ -1030,11 +1028,6 @@ if (!empty($arrayfields['customerorsupplier']['checked'])) print_liste_fi if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "s.fk_prospectlevel", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'], $_SERVER["PHP_SELF"], "s.fk_stcomm", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['s2.nom']['checked'])) print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER["PHP_SELF"], "s2.nom", "", $param, '', $sortfield, $sortorder, 'center '); -// Multiprice level -if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) -{ - if (!empty($arrayfields['s.price_level']['checked'])) print_liste_field_titre($arrayfields['s.price_level']['label'], $_SERVER["PHP_SELF"], "s.price_level", "", $param, '', $sortfield, $sortorder); -} // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -1191,13 +1184,10 @@ while ($i < min($num, $limit)) if (!$i) $totalarray['nbfield']++; } // Multiprice level - if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) + if (!empty($arrayfields['s.price_level']['checked'])) { - if (!empty($arrayfields['s.price_level']['checked'])) - { - print "".$obj->price_level."\n"; - if (!$i) $totalarray['nbfield']++; - } + print "".$obj->price_level."\n"; + if (!$i) $totalarray['nbfield']++; } // Staff if (!empty($arrayfields['staff.code']['checked'])) From e93e6be3fe8b334c99d6324a3ff65867b04318f9 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Fri, 22 Jan 2021 18:31:53 +0100 Subject: [PATCH 4/6] Update list.php --- 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 ae54bf5c83e..ec0a38bd255 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1186,7 +1186,7 @@ while ($i < min($num, $limit)) // Multiprice level if (!empty($arrayfields['s.price_level']['checked'])) { - print "".$obj->price_level."\n"; + print ''.$obj->price_level."\n"; if (!$i) $totalarray['nbfield']++; } // Staff From 6d0cf7bd01d90e77593426fd637a2bdc8970df5a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 24 Jan 2021 17:18:21 +0100 Subject: [PATCH 5/6] NEW support sepa_debit in stripe paymentmethods list alternatives methods as sofort , ideal or giropay are saved as sepa_debit for futur use --- htdocs/societe/paymentmodes.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 06d0deb8ba3..40f7932b9fb 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -6,7 +6,7 @@ * Copyright (C) 2013 Peter Fontaine * Copyright (C) 2015-2016 Marcos GarcĂ­a * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018 ptibogxiv + * Copyright (C) 2018 -2021Thibault FOUCART * * 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 @@ -957,17 +957,21 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' try { if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage - $paymentmethodobjs = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "card")); + $paymentmethodobjsA = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "card")); + $paymentmethodobjsB = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "sepa_debit")); } else { - $paymentmethodobjs = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "card"), array("stripe_account" => $stripeacc)); + $paymentmethodobjsA = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "card"), array("stripe_account" => $stripeacc)); + $paymentmethodobjsB = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "sepa_debit"), array("stripe_account" => $stripeacc)); } - $listofsources = $paymentmethodobjs->data; + if ($paymentmethodobjsA->data != null && $paymentmethodobjsB->data != null) { $listofsources = array_merge((array) $paymentmethodobjsA->data, (array) $paymentmethodobjsB->data); + } elseif ($paymentmethodobjsB->data != null) { $listofsources = $paymentmethodobjsB->data; } + else { $listofsources = $paymentmethodobjsA->data; } } catch (Exception $e) { $error++; setEventMessages($e->getMessage(), null, 'errors'); - } + } } } } catch (Exception $e) @@ -1181,7 +1185,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print getCountry($src->card->country, 1); } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } elseif ($src->object == 'source' && $src->type == 'sepa_debit') { - print 'SEPA debit'; + print ''.$src->billing_details->name.'
....'.$src->sepa_debit->last4; print ''; if ($src->sepa_debit->country) { $img = picto_from_langcode($src->sepa_debit->country); @@ -1198,7 +1202,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print getCountry($src->card->country, 1); } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') { - print 'SEPA debit'; + print ''.$src->billing_details->name.'
....'.$src->sepa_debit->last4; print ''; if ($src->sepa_debit->country) { $img = picto_from_langcode($src->sepa_debit->country); From 15b6acd37fc0ff62f4249fa5c5656dae97d7c6ee Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 24 Jan 2021 16:22:49 +0000 Subject: [PATCH 6/6] Fixing style errors. --- htdocs/societe/paymentmodes.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 40f7932b9fb..8956a80d0d8 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -958,20 +958,20 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' try { if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage $paymentmethodobjsA = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "card")); - $paymentmethodobjsB = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "sepa_debit")); + $paymentmethodobjsB = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "sepa_debit")); } else { $paymentmethodobjsA = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "card"), array("stripe_account" => $stripeacc)); - $paymentmethodobjsB = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "sepa_debit"), array("stripe_account" => $stripeacc)); + $paymentmethodobjsB = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "sepa_debit"), array("stripe_account" => $stripeacc)); } - if ($paymentmethodobjsA->data != null && $paymentmethodobjsB->data != null) { $listofsources = array_merge((array) $paymentmethodobjsA->data, (array) $paymentmethodobjsB->data); - } elseif ($paymentmethodobjsB->data != null) { $listofsources = $paymentmethodobjsB->data; } - else { $listofsources = $paymentmethodobjsA->data; } + if ($paymentmethodobjsA->data != null && $paymentmethodobjsB->data != null) { $listofsources = array_merge((array) $paymentmethodobjsA->data, (array) $paymentmethodobjsB->data); + } elseif ($paymentmethodobjsB->data != null) { $listofsources = $paymentmethodobjsB->data; } + else { $listofsources = $paymentmethodobjsA->data; } } catch (Exception $e) { $error++; setEventMessages($e->getMessage(), null, 'errors'); - } + } } } } catch (Exception $e) @@ -1202,7 +1202,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print getCountry($src->card->country, 1); } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') { - print ''.$src->billing_details->name.'
....'.$src->sepa_debit->last4; + print ''.$src->billing_details->name.'
....'.$src->sepa_debit->last4; print ''; if ($src->sepa_debit->country) { $img = picto_from_langcode($src->sepa_debit->country);