From 91d2d573c315dcfd99afa4e4d3a32520dcff3179 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Jul 2016 11:26:55 +0200 Subject: [PATCH] Fix NNE has been replaced with ICS --- htdocs/admin/prelevement.php | 43 ++++++++----------- .../class/bonprelevement.class.php | 11 ++--- htdocs/core/lib/prelevement.lib.php | 4 +- 3 files changed, 24 insertions(+), 34 deletions(-) diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 410851b640b..b131009ab88 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -45,14 +45,6 @@ $action = GETPOST('action','alpha'); if ($action == "set") { $db->begin(); - for ($i = 0 ; $i < 2 ; $i++) - { - $res = dolibarr_set_const($db, GETPOST("nom$i",'alpha'), GETPOST("value$i",'alpha'),'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - } - - $res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"),'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; $id=GETPOST('PRELEVEMENT_ID_BANKACCOUNT','int'); $account = new Account($db); @@ -78,6 +70,15 @@ if ($action == "set") } else $error++; + $res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"),'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + + if (GETPOST("PRELEVEMENT_USER") > 0) + { + $res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"),'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + if (! $error) { $db->commit(); @@ -131,33 +132,25 @@ print ''.$langs->trans("Parameter").''; print ''.$langs->trans("Value").''; print ""; -//User -print ''.$langs->trans("ResponsibleUser").''; -print ''; -print ''; -print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'value0', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); -print ''; -print ''; - -//Profid1 of Transmitter -print ''.$langs->trans("NumeroNationalEmetter").' - '.$langs->transcountry('ProfId1',$mysoc->country_code).''; -print ''; -print ''; -print ''; -print ''; - // Bank account (from Banks module) -print ''.$langs->trans("BankToReceiveWithdraw").''; +print ''.$langs->trans("BankToReceiveWithdraw").''; print ''; $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT,'PRELEVEMENT_ID_BANKACCOUNT',0,"courant=1",1); print ''; // ICS -print ''.$langs->trans("ICS").''; +print ''.$langs->trans("ICS").''; print ''; print ''; print ''; +//User +print ''.$langs->trans("ResponsibleUser").''; +print ''; +print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'PRELEVEMENT_USER', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); +print ''; +print ''; + print ''; print '
'; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 31d9e4d67c1..a318673e1c8 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -87,8 +87,6 @@ class BonPrelevement extends CommonObject $this->factures = array(); - $this->numero_national_emetteur = ""; - $this->methodes_trans = array(); $this->methodes_trans[0] = "Internet"; @@ -1018,7 +1016,6 @@ class BonPrelevement extends CommonObject $this->date_echeance = $datetimeprev; $this->reference_remise = $ref; - $this->numero_national_emetteur = $conf->global->PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR; $this->raison_sociale = $conf->global->PRELEVEMENT_RAISON_SOCIALE; $this->emetteur_code_banque = $conf->global->PRELEVEMENT_CODE_BANQUE; @@ -1027,7 +1024,7 @@ class BonPrelevement extends CommonObject $this->emetteur_number_key = $conf->global->PRELEVEMENT_NUMBER_KEY; $this->emetteur_iban = $conf->global->PRELEVEMENT_IBAN; $this->emetteur_bic = $conf->global->PRELEVEMENT_BIC; - $this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // TODO Add this into setup of admin/prelevement.php. Ex: PRELEVEMENT_ICS = "FR78ZZZ123456"; + $this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456"; $this->factures = $factures_prev_id; @@ -1462,7 +1459,7 @@ class BonPrelevement extends CommonObject fputs($this->file, " "); // Zone Reservee B2 - fputs($this->file, $this->numero_national_emetteur); // Numero National d'emmetteur B3 + fputs($this->file, $this->emetteur_ics); // ICS // Date d'echeance C1 @@ -1611,7 +1608,7 @@ class BonPrelevement extends CommonObject fputs($this->file, " "); // Zone Reservee B2 - fputs($this->file, $this->numero_national_emetteur); // Numero National d'emmetteur B3 + fputs($this->file, $this->emetteur_ics); // ICS // Date d'echeance C1 @@ -1778,7 +1775,7 @@ class BonPrelevement extends CommonObject fputs($this->file, " "); // Zone Reservee B2 - fputs($this->file, $this->numero_national_emetteur); // Numero National d'emmetteur B3 + fputs($this->file, $this->emetteur_ics); // ICS // Reserve C1 diff --git a/htdocs/core/lib/prelevement.lib.php b/htdocs/core/lib/prelevement.lib.php index a575ae51bcc..47bc2cb1974 100644 --- a/htdocs/core/lib/prelevement.lib.php +++ b/htdocs/core/lib/prelevement.lib.php @@ -78,9 +78,9 @@ function prelevement_prepare_head(BonPrelevement $object) function prelevement_check_config() { global $conf; - if(empty($conf->global->PRELEVEMENT_USER)) return -1; if(empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) return -1; - if(empty($conf->global->PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR)) return -1; + if(empty($conf->global->PRELEVEMENT_ICS)) return -1; + if(empty($conf->global->PRELEVEMENT_USER)) return -1; return 0; }