FIX SEPA ICS is not mandatory for bank transfer

This commit is contained in:
Regis Houssin 2022-04-15 16:17:03 +02:00
parent 4d1eed7dc1
commit 81f0aedc8f
7 changed files with 69 additions and 40 deletions

View File

@ -39,12 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Load translation files required by the page
$langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies', 'bills'));
// Security check
if ($user->socid) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
$type = GETPOST('type', 'aZ09');
// Get supervariables
@ -54,6 +48,8 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
$mode = GETPOST('mode', 'alpha') ?GETPOST('mode', 'alpha') : 'real';
$format = GETPOST('format', 'aZ09');
$id_bankaccount = GETPOST('id_bankaccount', 'int');
$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
@ -63,6 +59,17 @@ $offset = $limit * $page;
$hookmanager->initHooks(array('directdebitcreatecard', 'globalcard'));
// Security check
if ($user->socid) {
$socid = $user->socid;
}
if ($type == 'bank-transfer') {
$result = restrictedArea($user, 'paymentbybanktransfer', '', '', '');
} else {
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
}
$error = 0;
/*
* Actions
@ -95,13 +102,15 @@ if (empty($reshook)) {
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) && $type !== 'bank-transfer')
// ICS is not mandatory with payment by bank transfer
/*if ((empty($bank->ics) && $type !== 'bank-transfer')
|| (empty($bank->ics_transfer) && $type === 'bank-transfer')
) {
) {*/
if (empty($bank->ics) && $type !== 'bank-transfer') {
$errormessage = str_replace('{url}', $bank->getNomUrl(1, '', '', -1, 1), $langs->trans("ErrorICSmissing", '{url}'));
setEventMessages($errormessage, null, 'errors');
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/create.php');
exit;
$action = '';
$error++;
}
@ -136,12 +145,16 @@ if (empty($reshook)) {
setEventMessages($texttoshow, null);
}
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$bprev->id);
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.urlencode($bprev->id).'&type='.urlencode($type));
exit;
}
}
$objectclass = "BonPrelevement";
if ($type == 'bank-transfer') {
$uploaddir = $conf->paymentbybanktransfer->dir_output;
} else {
$uploaddir = $conf->prelevement->dir_output;
}
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}

View File

@ -40,7 +40,7 @@ if ($user->socid > 0) {
}
// Get supervariables
$prev_id = GETPOST('id', 'int');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$type = GETPOST('type', 'aZ09');
@ -77,8 +77,8 @@ if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transf
llxHeader('', $langs->trans("WithdrawalsReceipts"));
if ($prev_id > 0 || $ref) {
if ($object->fetch($prev_id, $ref) >= 0) {
if ($id > 0 || $ref) {
if ($object->fetch($id, $ref) >= 0) {
$head = prelevement_prepare_head($object);
print dol_get_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), -1, 'payment');

View File

@ -38,7 +38,7 @@ if ($user->socid > 0) {
}
// Get supervariables
$prev_id = GETPOST('id', 'int');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$type = GETPOST('type', 'aZ09');
@ -76,8 +76,8 @@ if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transf
llxHeader('', $langs->trans("WithdrawalsReceipts"));
if ($prev_id > 0 || $ref) {
if ($object->fetch($prev_id, $ref) >= 0) {
if ($id > 0 || $ref) {
if ($object->fetch($id, $ref) >= 0) {
$head = prelevement_prepare_head($object);
print dol_get_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), -1, 'payment');

View File

@ -42,13 +42,6 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'di
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
// Security check
$socid = GETPOST('socid', 'int');
if ($user->socid) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
$type = GETPOST('type', 'aZ09');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
@ -80,6 +73,17 @@ $company = new Societe($db);
$hookmanager->initHooks(array('withdrawalsreceiptslineslist'));
// Security check
$socid = GETPOST('socid', 'int');
if ($user->socid) {
$socid = $user->socid;
}
if ($type == 'bank-transfer') {
$result = restrictedArea($user, 'paymentbybanktransfer', '', '', '');
} else {
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
}
/*
* Actions

View File

@ -33,13 +33,6 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals'));
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'directdebitcredittransferlist'; // To manage different context of search
// Security check
$socid = GETPOST('socid', 'int');
if ($user->socid) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
$type = GETPOST('type', 'aZ09');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
@ -72,6 +65,17 @@ if ($type == 'bank-transfer') {
$usercancreate = $user->rights->paymentbybanktransfer->create;
}
// Security check
$socid = GETPOST('socid', 'int');
if ($user->socid) {
$socid = $user->socid;
}
if ($type == 'bank-transfer') {
$result = restrictedArea($user, 'paymentbybanktransfer', '', '', '');
} else {
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
}
/*
* Actions

View File

@ -33,13 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Load translation files required by the page
$langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies'));
// Security check
$socid = GETPOST('socid', 'int');
if ($user->socid) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
$type = GETPOST('type', 'aZ09');
// Get supervariables
@ -54,6 +47,17 @@ $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
// Security check
$socid = GETPOST('socid', 'int');
if ($user->socid) {
$socid = $user->socid;
}
if ($type == 'bank-transfer') {
$result = restrictedArea($user, 'paymentbybanktransfer', '', '', '');
} else {
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
}
/*
* View

View File

@ -31,14 +31,18 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Load translation files required by the page
$langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies'));
$type = GETPOST('type', 'aZ09');
// Security check
$socid = GETPOST('socid', 'int');
if ($user->socid) {
$socid = $user->socid;
}
if ($type == 'bank-transfer') {
$result = restrictedArea($user, 'paymentbybanktransfer', '', '', '');
} else {
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
$type = GETPOST('type', 'aZ09');
}
/*