Add execution date on prelevement
This commit is contained in:
parent
cc7ac2a0da
commit
975300b90b
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
*
|
||||
* 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
|
||||
@ -760,9 +761,10 @@ class BonPrelevement extends CommonObject
|
||||
* @param int $agence dolibarr mysoc bank office (guichet)
|
||||
* @param string $mode real=do action, simu=test only
|
||||
* @param string $format FRST, RCUR or ALL
|
||||
* @param string $executiondate
|
||||
* @return int <0 if KO, nbre of invoice withdrawed if OK
|
||||
*/
|
||||
function Create($banque=0, $agence=0, $mode='real', $format='ALL')
|
||||
function Create($banque=0, $agence=0, $mode='real', $format='ALL',$executiondate='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
@ -776,6 +778,8 @@ class BonPrelevement extends CommonObject
|
||||
$error = 0;
|
||||
|
||||
$datetimeprev = time();
|
||||
//Choice the date of the execution direct debit
|
||||
if(!empty($executiondate)) $datetimeprev = $executiondate;
|
||||
|
||||
$month = strftime("%m", $datetimeprev);
|
||||
$year = strftime("%Y", $datetimeprev);
|
||||
@ -1077,7 +1081,7 @@ class BonPrelevement extends CommonObject
|
||||
$this->factures = $factures_prev_id;
|
||||
|
||||
// Generation of SEPA file $this->filename
|
||||
$this->generate($format);
|
||||
$this->generate($format,$executiondate);
|
||||
}
|
||||
dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG);
|
||||
}
|
||||
@ -1276,7 +1280,7 @@ class BonPrelevement extends CommonObject
|
||||
* @param string $format FRST, RCUR or ALL
|
||||
* @return int 0 if OK, <0 if KO
|
||||
*/
|
||||
function generate($format='ALL')
|
||||
function generate($format='ALL',$executiondate='')
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
@ -1306,9 +1310,11 @@ class BonPrelevement extends CommonObject
|
||||
// SEPA Initialisation
|
||||
$CrLf = "\n";
|
||||
$date_actu = dol_now();
|
||||
$dateTime_ECMA = dol_print_date($date_actu, '%Y-%m-%dT%H:%M:%S');
|
||||
|
||||
if(!empty($executiondate)) $date_actu=$executiondate;
|
||||
$dateTime_YMD = dol_print_date($date_actu, '%Y%m%d');
|
||||
$dateTime_YMDHMS = dol_print_date($date_actu, '%Y%m%d%H%M%S');
|
||||
$dateTime_ECMA = dol_print_date($date_actu, '%Y-%m-%dT%H:%M:%S');
|
||||
$fileDebiteurSection = '';
|
||||
$fileEmetteurSection = '';
|
||||
$i = 0;
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2010-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
*
|
||||
* 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
|
||||
@ -65,7 +66,9 @@ if ($action == 'create')
|
||||
{
|
||||
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty
|
||||
$bprev = new BonPrelevement($db);
|
||||
$result=$bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format);
|
||||
$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
|
||||
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format,$executiondate);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($bprev->error, $bprev->errors, 'errors');
|
||||
@ -90,6 +93,7 @@ if ($action == 'create')
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$form = new Form($db);
|
||||
|
||||
$thirdpartystatic=new Societe($db);
|
||||
$invoicestatic=new Facture($db);
|
||||
@ -144,23 +148,22 @@ print '</div>';
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
print '<form action="' . $_SERVER['PHP_SELF'] . '?action=create" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
if ($nb) {
|
||||
if ($pricetowithdraw) {
|
||||
print $langs->trans('ExecutionDate').' ';
|
||||
print $form->select_date();
|
||||
if ($mysoc->isInEEC()) {
|
||||
print '<select name="format"><option value="FRST">'.$langs->trans('SEPAFRST').'</option><option value="RCUR">'.$langs->trans('SEPARCUR').'</option></select>';
|
||||
print '<input class="butAction" type="submit" value="' . $langs->trans("CreateForSepa") . '"/>';
|
||||
} else {
|
||||
print '<a class="butAction" type="submit" href="create.php?action=create&format=ALL">' . $langs->trans("CreateAll") . "</a>\n";
|
||||
}
|
||||
|
||||
if ($nb)
|
||||
{
|
||||
if ($pricetowithdraw)
|
||||
{
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<a class="butAction" href="create.php?action=create&format=FRST">'.$langs->trans("CreateForSepaFRST")."</a>\n";
|
||||
print '<a class="butAction" href="create.php?action=create&format=RCUR">'.$langs->trans("CreateForSepaRCUR")."</a>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="create.php?action=create&format=ALL">'.$langs->trans("CreateAll")."</a>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<a class="butActionRefused" href="#">'.$langs->trans("CreateForSepaFRST")."</a>\n";
|
||||
|
||||
@ -98,6 +98,10 @@ ModeFRST=One-off payment
|
||||
PleaseCheckOne=Please check one only
|
||||
DirectDebitOrderCreated=Direct debit order %s created
|
||||
AmountRequested=Amount requested
|
||||
SEPARCUR=SEPA CUR
|
||||
SEPAFRST=SEPA FRST
|
||||
ExecutionDate=Execution date
|
||||
CreateForSepa=Create direct debit file
|
||||
|
||||
### Notifications
|
||||
InfoCreditSubject=Payment of direct debit payment order %s by the bank
|
||||
|
||||
Loading…
Reference in New Issue
Block a user