forked from Wavyzz/dolibarr
NEW: ICS fields moved into bank account table
This commit is contained in:
@@ -71,10 +71,10 @@ if ($action == "set")
|
|||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
*/
|
*/
|
||||||
} else $error++;
|
} else $error++;
|
||||||
|
/* Moved to account
|
||||||
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_ICS", GETPOST("PAYMENTBYBANKTRANSFER_ICS"), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_ICS", GETPOST("PAYMENTBYBANKTRANSFER_ICS"), 'chaine', 0, '', $conf->entity);
|
||||||
if (!$res > 0) $error++;
|
if (!$res > 0) $error++;
|
||||||
|
*/
|
||||||
if (GETPOST("PAYMENTBYBANKTRANSFER_USER") > 0)
|
if (GETPOST("PAYMENTBYBANKTRANSFER_USER") > 0)
|
||||||
{
|
{
|
||||||
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_USER", GETPOST("PAYMENTBYBANKTRANSFER_USER"), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_USER", GETPOST("PAYMENTBYBANKTRANSFER_USER"), 'chaine', 0, '', $conf->entity);
|
||||||
@@ -156,11 +156,13 @@ print '<td class="left">';
|
|||||||
$form->select_comptes($conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT, 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT', 0, "courant=1", 1);
|
$form->select_comptes($conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT, 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT', 0, "courant=1", 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
/* Moved to bank account data
|
||||||
// ICS
|
// ICS
|
||||||
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("ICS").'</td>';
|
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("ICS").'</td>';
|
||||||
print '<td class="left">';
|
print '<td class="left">';
|
||||||
print '<input type="text" name="PAYMENTBYBANKTRANSFER_ICS" value="'.$conf->global->PAYMENTBYBANKTRANSFER_ICS.'" size="15" ></td>';
|
print '<input type="text" name="PAYMENTBYBANKTRANSFER_ICS" value="'.$conf->global->PAYMENTBYBANKTRANSFER_ICS.'" size="15" ></td>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
*/
|
||||||
|
|
||||||
//User
|
//User
|
||||||
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("ResponsibleUser").'</td>';
|
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("ResponsibleUser").'</td>';
|
||||||
|
|||||||
@@ -70,11 +70,14 @@ if ($action == "set")
|
|||||||
$res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity);
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
} else $error++;
|
} else $error++;
|
||||||
|
|
||||||
|
/* Moved to account
|
||||||
|
|
||||||
$res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity);
|
||||||
if (!$res > 0) $error++;
|
if (!$res > 0) $error++;
|
||||||
|
*/
|
||||||
if (GETPOST("PRELEVEMENT_USER") > 0)
|
if (GETPOST("PRELEVEMENT_USER") > 0)
|
||||||
{
|
{
|
||||||
$res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"), 'chaine', 0, '', $conf->entity);
|
||||||
@@ -149,13 +152,16 @@ print '<td class="titlefieldcreate">'.$langs->trans("Parameter").'</td>';
|
|||||||
print '<td>'.$langs->trans("Value").'</td>';
|
print '<td>'.$langs->trans("Value").'</td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
|
|
||||||
// Bank account (from Banks module)
|
// Bank account (from Banks module)
|
||||||
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("BankToReceiveWithdraw").'</td>';
|
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("BankToReceiveWithdraw").'</td>';
|
||||||
print '<td class="left">';
|
print '<td class="left">';
|
||||||
$form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT, 'PRELEVEMENT_ID_BANKACCOUNT', 0, "courant=1", 1);
|
$form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT, 'PRELEVEMENT_ID_BANKACCOUNT', 0, "courant=1", 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
/* Moved to bank account data
|
||||||
// ICS
|
// ICS
|
||||||
|
|
||||||
print '<tr class="oddeven"><td class="fieldrequired">';
|
print '<tr class="oddeven"><td class="fieldrequired">';
|
||||||
$htmltext = $langs->trans("AskThisIDToYourBank");
|
$htmltext = $langs->trans("AskThisIDToYourBank");
|
||||||
print $form->textwithpicto($langs->trans("ICS"), $htmltext);
|
print $form->textwithpicto($langs->trans("ICS"), $htmltext);
|
||||||
@@ -164,6 +170,7 @@ print '<td class="left">';
|
|||||||
print '<input type="text" name="PRELEVEMENT_ICS" value="'.$conf->global->PRELEVEMENT_ICS.'" size="15" >';
|
print '<input type="text" name="PRELEVEMENT_ICS" value="'.$conf->global->PRELEVEMENT_ICS.'" size="15" >';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
*/
|
||||||
|
|
||||||
//User
|
//User
|
||||||
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("ResponsibleUser").'</td>';
|
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("ResponsibleUser").'</td>';
|
||||||
|
|||||||
@@ -95,6 +95,9 @@ if ($action == 'add')
|
|||||||
$object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
|
$object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
|
||||||
$object->owner_address = trim(GETPOST("owner_address", 'nohtml'));
|
$object->owner_address = trim(GETPOST("owner_address", 'nohtml'));
|
||||||
|
|
||||||
|
$object->ics = trim($_POST["ics"]);
|
||||||
|
$object->ics_transfer = trim($_POST["ics_transfer"]);
|
||||||
|
|
||||||
$account_number = GETPOST('account_number', 'alphanohtml');
|
$account_number = GETPOST('account_number', 'alphanohtml');
|
||||||
if (empty($account_number) || $account_number == '-1')
|
if (empty($account_number) || $account_number == '-1')
|
||||||
{
|
{
|
||||||
@@ -196,6 +199,9 @@ if ($action == 'update')
|
|||||||
$object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
|
$object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
|
||||||
$object->owner_address = trim(GETPOST("owner_address", 'nohtml'));
|
$object->owner_address = trim(GETPOST("owner_address", 'nohtml'));
|
||||||
|
|
||||||
|
$object->ics = trim($_POST["ics"]);
|
||||||
|
$object->ics_transfer = trim($_POST["ics_transfer"]);
|
||||||
|
|
||||||
$account_number = GETPOST('account_number', 'alpha');
|
$account_number = GETPOST('account_number', 'alpha');
|
||||||
if (empty($account_number) || $account_number == '-1')
|
if (empty($account_number) || $account_number == '-1')
|
||||||
{
|
{
|
||||||
@@ -731,6 +737,14 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("ICS").'</td>';
|
||||||
|
print '<td>'.$object->ics.'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("ICSTransfer").'</td>';
|
||||||
|
print '<td>'.$object->ics_transfer.'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
|
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
|
||||||
print nl2br($object->domiciliation);
|
print nl2br($object->domiciliation);
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
@@ -1011,6 +1025,12 @@ if ($action == 'create')
|
|||||||
print '<tr><td>'.$langs->trans($bickey).'</td>';
|
print '<tr><td>'.$langs->trans($bickey).'</td>';
|
||||||
print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.$object->bic.'"></td></tr>';
|
print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.$object->bic.'"></td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("ICS").'</td>';
|
||||||
|
print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="ics" value="'.$object->ics.'"></td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("ICSTransfer").'</td>';
|
||||||
|
print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="ics_transfer" value="'.$object->ics_transfer.'"></td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
|
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
|
||||||
print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.'">';
|
print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.'">';
|
||||||
print $object->domiciliation;
|
print $object->domiciliation;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||||
|
* Copyright (C) 2019 JC Prieto <jcprieto@virtual20.com><prietojc@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -214,6 +215,14 @@ class Account extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $date_solde;
|
public $date_solde;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creditor Identifier CI and Transfer ICS. Some banks use different ICS for direct debit and bank tranfer
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $ics;
|
||||||
|
public $ics_transfer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
||||||
@@ -652,6 +661,8 @@ class Account extends CommonObject
|
|||||||
$sql .= ", comment";
|
$sql .= ", comment";
|
||||||
$sql .= ", state_id";
|
$sql .= ", state_id";
|
||||||
$sql .= ", fk_pays";
|
$sql .= ", fk_pays";
|
||||||
|
$sql .= ", ics";
|
||||||
|
$sql .= ", ics_transfer";
|
||||||
$sql .= ") VALUES (";
|
$sql .= ") VALUES (";
|
||||||
$sql .= "'".$this->db->idate($now)."'";
|
$sql .= "'".$this->db->idate($now)."'";
|
||||||
$sql .= ", '".$this->db->escape($this->ref)."'";
|
$sql .= ", '".$this->db->escape($this->ref)."'";
|
||||||
@@ -676,6 +687,8 @@ class Account extends CommonObject
|
|||||||
$sql .= ", '".$this->db->escape($this->comment)."'";
|
$sql .= ", '".$this->db->escape($this->comment)."'";
|
||||||
$sql .= ", ".($this->state_id > 0 ? $this->state_id : "null");
|
$sql .= ", ".($this->state_id > 0 ? $this->state_id : "null");
|
||||||
$sql .= ", ".$this->country_id;
|
$sql .= ", ".$this->country_id;
|
||||||
|
$sql .= ", ".$this->db->escape($this->ics);
|
||||||
|
$sql .= ", ".$this->db->escape($this->ics_transfer);
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
@@ -804,6 +817,8 @@ class Account extends CommonObject
|
|||||||
|
|
||||||
$sql .= ",state_id = ".($this->state_id > 0 ? $this->state_id : "null");
|
$sql .= ",state_id = ".($this->state_id > 0 ? $this->state_id : "null");
|
||||||
$sql .= ",fk_pays = ".$this->country_id;
|
$sql .= ",fk_pays = ".$this->country_id;
|
||||||
|
$sql .= ",ics='".$this->db->escape($this->ics)."'";
|
||||||
|
$sql .= ",ics_transfer='".$this->db->escape($this->ics_transfer)."'";
|
||||||
|
|
||||||
$sql .= " WHERE rowid = ".$this->id;
|
$sql .= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
@@ -922,7 +937,7 @@ class Account extends CommonObject
|
|||||||
$sql .= " ba.domiciliation, ba.proprio, ba.owner_address, ba.state_id, ba.fk_pays as country_id,";
|
$sql .= " ba.domiciliation, ba.proprio, ba.owner_address, ba.state_id, ba.fk_pays as country_id,";
|
||||||
$sql .= " ba.account_number, ba.fk_accountancy_journal, ba.currency_code,";
|
$sql .= " ba.account_number, ba.fk_accountancy_journal, ba.currency_code,";
|
||||||
$sql .= " ba.min_allowed, ba.min_desired, ba.comment,";
|
$sql .= " ba.min_allowed, ba.min_desired, ba.comment,";
|
||||||
$sql .= " ba.datec as date_creation, ba.tms as date_update,";
|
$sql .= " ba.datec as date_creation, ba.tms as date_update, ba.ics, ba.ics_transfer,";
|
||||||
$sql .= ' c.code as country_code, c.label as country,';
|
$sql .= ' c.code as country_code, c.label as country,';
|
||||||
$sql .= ' d.code_departement as state_code, d.nom as state';
|
$sql .= ' d.code_departement as state_code, d.nom as state';
|
||||||
$sql .= ' , aj.code as accountancy_journal';
|
$sql .= ' , aj.code as accountancy_journal';
|
||||||
@@ -984,6 +999,9 @@ class Account extends CommonObject
|
|||||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||||
$this->date_update = $this->db->jdate($obj->date_update);
|
$this->date_update = $this->db->jdate($obj->date_update);
|
||||||
|
|
||||||
|
$this->ics = $obj->ics;
|
||||||
|
$this->ics_transfer = $obj->ics_transfer;
|
||||||
|
|
||||||
// Retrieve all extrafield
|
// Retrieve all extrafield
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$this->fetch_optionals();
|
$this->fetch_optionals();
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ $result = restrictedArea($user, 'paymentbybanktransfer', '', '');
|
|||||||
|
|
||||||
llxHeader('', $langs->trans("SuppliersStandingOrdersArea"));
|
llxHeader('', $langs->trans("SuppliersStandingOrdersArea"));
|
||||||
|
|
||||||
if (prelevement_check_config() < 0)
|
if (prelevement_check_config('bank-transfer') < 0)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Withdraw")), null, 'errors');
|
setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Withdraw")), null, 'errors');
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
|
* Copyright (C) 2019 JC Prieto <jcprieto@virtual20.com><prietojc@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -1154,7 +1155,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$this->emetteur_iban = $account->iban;
|
$this->emetteur_iban = $account->iban;
|
||||||
$this->emetteur_bic = $account->bic;
|
$this->emetteur_bic = $account->bic;
|
||||||
|
|
||||||
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
|
$this->emetteur_ics = ($type == 'bank-transfer' ? $account->ics_transfer : $account->ics);
|
||||||
|
|
||||||
$this->raison_sociale = $account->proprio;
|
$this->raison_sociale = $account->proprio;
|
||||||
}
|
}
|
||||||
@@ -1585,7 +1586,7 @@ class BonPrelevement extends CommonObject
|
|||||||
fputs($this->file, ' <Id>'.$CrLf);
|
fputs($this->file, ' <Id>'.$CrLf);
|
||||||
fputs($this->file, ' <PrvtId>'.$CrLf);
|
fputs($this->file, ' <PrvtId>'.$CrLf);
|
||||||
fputs($this->file, ' <Othr>'.$CrLf);
|
fputs($this->file, ' <Othr>'.$CrLf);
|
||||||
fputs($this->file, ' <Id>'.$conf->global->PRELEVEMENT_ICS.'</Id>'.$CrLf);
|
fputs($this->file, ' <Id>'.$this->emetteur_ics.'</Id>'.$CrLf);
|
||||||
fputs($this->file, ' </Othr>'.$CrLf);
|
fputs($this->file, ' </Othr>'.$CrLf);
|
||||||
fputs($this->file, ' </PrvtId>'.$CrLf);
|
fputs($this->file, ' </PrvtId>'.$CrLf);
|
||||||
fputs($this->file, ' </Id>'.$CrLf);
|
fputs($this->file, ' </Id>'.$CrLf);
|
||||||
@@ -2126,7 +2127,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$this->emetteur_iban = $account->iban;
|
$this->emetteur_iban = $account->iban;
|
||||||
$this->emetteur_bic = $account->bic;
|
$this->emetteur_bic = $account->bic;
|
||||||
|
|
||||||
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
|
$this->emetteur_ics = $account->ics; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
|
||||||
|
|
||||||
$this->raison_sociale = $account->proprio;
|
$this->raison_sociale = $account->proprio;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ $type = GETPOST('type', 'aZ09');
|
|||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$mode = GETPOST('mode', 'alpha') ?GETPOST('mode', 'alpha') : 'real';
|
$mode = GETPOST('mode', 'alpha') ?GETPOST('mode', 'alpha') : 'real';
|
||||||
$format = GETPOST('format', 'aZ09');
|
$format = GETPOST('format', 'aZ09');
|
||||||
|
$id_bankaccount = GETPOST ( 'id_bankaccount','int' );
|
||||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
@@ -77,11 +78,28 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
|
$default_account=($type == 'bank-transfer' ? 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT' : 'PRELEVEMENT_ID_BANKACCOUNT');
|
||||||
|
|
||||||
|
if($id_bankaccount != $conf->global->{$default_account}){
|
||||||
|
$res = dolibarr_set_const($db, $default_account, $id_bankaccount, 'chaine', 0, '', $conf->entity); //Set as default
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
$bank = new Account($db);
|
||||||
|
$bank->fetch($conf->global->{$default_account});
|
||||||
|
if (empty($bank->ics) || empty($bank->ics_transfer)){
|
||||||
|
setEventMessages($langs->trans("ErrorICSmissing", $bank->getNomUrl(1)), null, 'errors');
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/create.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$delayindays = 0;
|
$delayindays = 0;
|
||||||
if ($type != 'bank-transfer') {
|
if ($type != 'bank-transfer') {
|
||||||
$conf->global->PRELEVEMENT_ADDDAYS;
|
$delayindays = $conf->global->PRELEVEMENT_ADDDAYS;
|
||||||
} else {
|
} else {
|
||||||
$conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS;
|
$delayindays = $conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS;
|
||||||
}
|
}
|
||||||
$bprev = new BonPrelevement($db);
|
$bprev = new BonPrelevement($db);
|
||||||
$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), (GETPOST('reday', 'int') + $delayindays), GETPOST('reyear', 'int'));
|
$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), (GETPOST('reday', 'int') + $delayindays), GETPOST('reyear', 'int'));
|
||||||
@@ -128,12 +146,13 @@ $bprev = new BonPrelevement($db);
|
|||||||
|
|
||||||
llxHeader('', $langs->trans("NewStandingOrder"));
|
llxHeader('', $langs->trans("NewStandingOrder"));
|
||||||
|
|
||||||
if (prelevement_check_config() < 0)
|
if (prelevement_check_config($type) < 0)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Withdraw")), null, 'errors');
|
setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Withdraw")), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*$h=0;
|
/*$h=0;
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/create.php';
|
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/create.php';
|
||||||
$head[$h][1] = $langs->trans("NewStandingOrder");
|
$head[$h][1] = $langs->trans("NewStandingOrder");
|
||||||
@@ -188,11 +207,17 @@ print '<form action="'.$_SERVER['PHP_SELF'].'?action=create" method="POST">';
|
|||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||||
if ($nb) {
|
if ($nb) {
|
||||||
|
|
||||||
if ($pricetowithdraw) {
|
if ($pricetowithdraw) {
|
||||||
|
print $langs->trans('BankToReceiveWithdraw').': ';
|
||||||
|
$form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT, 'id_bankaccount', 0, "courant=1");
|
||||||
|
print ' - ';
|
||||||
|
|
||||||
print $langs->trans('ExecutionDate').' ';
|
print $langs->trans('ExecutionDate').' ';
|
||||||
$datere = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
$datere = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||||
print $form->selectDate($datere, 're');
|
print $form->selectDate($datere, 're');
|
||||||
|
|
||||||
|
|
||||||
if ($mysoc->isInEEC()) {
|
if ($mysoc->isInEEC()) {
|
||||||
$title = $langs->trans("CreateForSepa");
|
$title = $langs->trans("CreateForSepa");
|
||||||
if ($type == 'bank-transfer') {
|
if ($type == 'bank-transfer') {
|
||||||
|
|||||||
@@ -78,13 +78,21 @@ function prelevement_prepare_head(BonPrelevement $object)
|
|||||||
/**
|
/**
|
||||||
* Check need data to create standigns orders receipt file
|
* Check need data to create standigns orders receipt file
|
||||||
*
|
*
|
||||||
|
* @param string $type 'bank-transfer' or 'direct-debit'
|
||||||
|
*
|
||||||
* @return int -1 if ko 0 if ok
|
* @return int -1 if ko 0 if ok
|
||||||
*/
|
*/
|
||||||
function prelevement_check_config()
|
function prelevement_check_config($type='direct-debit')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf, $db;
|
||||||
|
if ($type == 'bank-transfer'){
|
||||||
|
if (empty($conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT)) return -1;
|
||||||
|
//if (empty($conf->global->PRELEVEMENT_ICS)) return -1;
|
||||||
|
if (empty($conf->global->PAYMENTBYBANKTRANSFER_USER)) return -1;
|
||||||
|
}else{
|
||||||
if (empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) return -1;
|
if (empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) return -1;
|
||||||
if (empty($conf->global->PRELEVEMENT_ICS)) return -1;
|
//if (empty($conf->global->PRELEVEMENT_ICS)) return -1;
|
||||||
if (empty($conf->global->PRELEVEMENT_USER)) return -1;
|
if (empty($conf->global->PRELEVEMENT_USER)) return -1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,7 +131,8 @@ SEPARCUR=SEPA CUR
|
|||||||
SEPAFRST=SEPA FRST
|
SEPAFRST=SEPA FRST
|
||||||
ExecutionDate=Execution date
|
ExecutionDate=Execution date
|
||||||
CreateForSepa=Create direct debit file
|
CreateForSepa=Create direct debit file
|
||||||
ICS=Creditor Identifier CI
|
ICS=Creditor Identifier CI for direct debit
|
||||||
|
ICSTransfer=Creditor Identifier CI for bank transfer
|
||||||
END_TO_END="EndToEndId" SEPA XML tag - Unique id assigned per transaction
|
END_TO_END="EndToEndId" SEPA XML tag - Unique id assigned per transaction
|
||||||
USTRD="Unstructured" SEPA XML tag
|
USTRD="Unstructured" SEPA XML tag
|
||||||
ADDDAYS=Add days to Execution Date
|
ADDDAYS=Add days to Execution Date
|
||||||
@@ -146,3 +147,4 @@ InfoRejectSubject=Direct debit payment order refused
|
|||||||
InfoRejectMessage=Hello,<br><br>the direct debit payment order of invoice %s related to the company %s, with an amount of %s has been refused by the bank.<br><br>--<br>%s
|
InfoRejectMessage=Hello,<br><br>the direct debit payment order of invoice %s related to the company %s, with an amount of %s has been refused by the bank.<br><br>--<br>%s
|
||||||
ModeWarning=Option for real mode was not set, we stop after this simulation
|
ModeWarning=Option for real mode was not set, we stop after this simulation
|
||||||
ErrorCompanyHasDuplicateDefaultBAN=Company with id %s has more than one default bank account. No way to know wich one to use.
|
ErrorCompanyHasDuplicateDefaultBAN=Company with id %s has more than one default bank account. No way to know wich one to use.
|
||||||
|
ErrorICSmissing=Missing ICS in Bank account %s
|
||||||
Reference in New Issue
Block a user