diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php
index 62b97f6d100..a6e8a3824e7 100644
--- a/htdocs/compta/bank/card.php
+++ b/htdocs/compta/bank/card.php
@@ -759,6 +759,7 @@ if ($action == 'create') {
print '';
}
+ // TODO ICS is not used with bank transfer !
if ($conf->paymentbybanktransfer->enabled) {
print '
| '.$langs->trans("ICS").' ('.$langs->trans("BankTransfer").') | ';
print ''.$object->ics_transfer.' | ';
diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php
index 172cf020e34..6416468fd63 100644
--- a/htdocs/compta/prelevement/create.php
+++ b/htdocs/compta/prelevement/create.php
@@ -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';
}
diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php
index 8711f663d55..e1850575dc0 100644
--- a/htdocs/compta/prelevement/fiche-rejet.php
+++ b/htdocs/compta/prelevement/fiche-rejet.php
@@ -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');
diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php
index 4a9bfbf6345..9336ad51370 100644
--- a/htdocs/compta/prelevement/fiche-stat.php
+++ b/htdocs/compta/prelevement/fiche-stat.php
@@ -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');
diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php
index feb69bdc7fb..095d07460b9 100644
--- a/htdocs/compta/prelevement/list.php
+++ b/htdocs/compta/prelevement/list.php
@@ -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
diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php
index 3ca9ce32fbe..2733223b5b5 100644
--- a/htdocs/compta/prelevement/orders_list.php
+++ b/htdocs/compta/prelevement/orders_list.php
@@ -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
diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php
index ed8c704bcfa..3aa57a6f3e0 100644
--- a/htdocs/compta/prelevement/rejets.php
+++ b/htdocs/compta/prelevement/rejets.php
@@ -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
diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php
index ae1dd54a13c..7c7bce9f2ef 100644
--- a/htdocs/compta/prelevement/stats.php
+++ b/htdocs/compta/prelevement/stats.php
@@ -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');
+}
/*