From 819dc44533503046179eba1ab95e5742164bb0dd Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Tue, 17 Jan 2017 10:01:59 +0100 Subject: [PATCH 1/2] Fix: Show correct bank account order --- htdocs/societe/rib.php | 74 ++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 8a6a9b87209..8d28f144c78 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Peter Fontaine * Copyright (C) 2015-2016 Marcos GarcĂ­a + * Copyright (C) 2017 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 @@ -94,13 +95,13 @@ if (empty($reshook)) if (! GETPOST('label')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); - $action='update'; + $action='edit'; $error++; } if (! GETPOST('bank')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors'); - $action='update'; + $action='edit'; $error++; } if ($account->needIBAN() == 1) @@ -108,13 +109,13 @@ if (empty($reshook)) if (! GETPOST('iban')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("IBAN")), null, 'errors'); - $action='update'; + $action='edit'; $error++; } if (! GETPOST('bic')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors'); - $action='update'; + $action='edit'; $error++; } } @@ -809,41 +810,42 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) print ''.$langs->trans("Bank").''; print ''; - // BBAN - if ($account->useDetailedBBAN() == 1) - { - print ''.$langs->trans("BankCode").''; - print ''; - print ''; + // Show fields of bank account + foreach ($account->getFieldsToShow(1) as $val) { - print ''.$langs->trans("DeskCode").''; - print ''; + $require=false; + if ($val == 'BankCode') { + $name = 'code_banque'; + $size = 8; + $content = $account->code_banque; + } elseif ($val == 'DeskCode') { + $name = 'code_guichet'; + $size = 8; + $content = $account->code_guichet; + } elseif ($val == 'BankAccountNumber') { + $name = 'number'; + $size = 18; + $content = $account->number; + } elseif ($val == 'BankAccountNumberKey') { + $name = 'cle_rib'; + $size = 3; + $content = $account->cle_rib; + } elseif ($val == 'IBAN') { + $name = 'iban'; + $size = 30; + $content = $account->iban; + if ($account->needIBAN()) $require=true; + } elseif ($val == 'BIC') { + $name = 'bic'; + $size = 12; + $content = $account->bic; + if ($account->needIBAN()) $require=true; + } + + print ''.$langs->trans($val).''; + print ''; print ''; } - if ($account->useDetailedBBAN() == 2) - { - print ''.$langs->trans("BankCode").''; - print ''; - print ''; - } - - print ''.$langs->trans("BankAccountNumber").''; - print ''; - print ''; - - if ($account->useDetailedBBAN() == 1) - { - print ''.$langs->trans("BankAccountNumberKey").''; - print ''; - print ''; - } - - // IBAN - print 'needIBAN()?' class="fieldrequired" ':'').'>'.$langs->trans("IBAN").''; - print ''; - - print 'needIBAN()?' class="fieldrequired" ':'').'>'.$langs->trans("BIC").''; - print ''; print ''.$langs->trans("BankAccountDomiciliation").''; print '