diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php
index dd9c1394563..b24723330a0 100644
--- a/htdocs/compta/facture/prelevement.php
+++ b/htdocs/compta/facture/prelevement.php
@@ -48,13 +48,12 @@ $ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'alpha');
$type = GETPOST('type', 'aZ09');
-$mode = GETPOST('mode', 'aZ09');
$fieldid = (!empty($ref) ? 'ref' : 'rowid');
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid);
-if ($mode == 'bank-transfer') {
+if ($type == 'bank-transfer') {
$object = new FactureFournisseur($db);
} else {
$object = new Facture($db);
@@ -94,6 +93,7 @@ if (empty($reshook))
$sourcetype = 'facture';
if ($type == 'bank-transfer') {
$sourcetype = 'supplier_invoice';
+ $newtype = 'bank-transfer';
}
$result = $object->demande_prelevement($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype);
@@ -119,7 +119,7 @@ if (empty($reshook))
$result = $object->demande_prelevement_delete($user, GETPOST('did', 'int'));
if ($result == 0)
{
- header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id.'&mode='.$mode);
+ header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id.'&type='.$type);
exit;
}
}
@@ -135,7 +135,7 @@ $form = new Form($db);
$now = dol_now();
-if ($mode == 'bank-transfer') {
+if ($type == 'bank-transfer') {
$title = $langs->trans('InvoiceSupplier')." - ".$langs->trans('CreditTransfer');
$helpurl = "";
} else {
@@ -170,7 +170,7 @@ if ($object->id > 0)
if ($object->paye) $resteapayer = 0;
$resteapayeraffiche = $resteapayer;
- if ($mode == 'bank-transfer') {
+ if ($type == 'bank-transfer') {
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Never use this
$filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
@@ -204,7 +204,7 @@ if ($object->id > 0)
$author->fetch($object->user_author);
}
- if ($mode == 'bank-transfer') {
+ if ($type == 'bank-transfer') {
$head = facturefourn_prepare_head($object);
} else {
$head = facture_prepare_head($object);
@@ -213,7 +213,7 @@ if ($object->id > 0)
dol_fiche_head($head, 'standingorders', $title, -1, 'bill');
// Invoice content
- if ($mode == 'bank-transfer') {
+ if ($type == 'bank-transfer') {
$linkback = ''.$langs->trans("BackToList").'';
} else {
$linkback = ''.$langs->trans("BackToList").'';
@@ -221,7 +221,7 @@ if ($object->id > 0)
$morehtmlref = '
';
// Ref customer
- if ($mode == 'bank-transfer') {
+ if ($type == 'bank-transfer') {
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
} else {
@@ -230,7 +230,7 @@ if ($object->id > 0)
}
// Thirdparty
$morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
- if ($mode == 'bank-transfer') {
+ if ($type == 'bank-transfer') {
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (
'.$langs->trans("OtherBills").')';
} else {
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (
'.$langs->trans("OtherBills").')';
@@ -290,7 +290,7 @@ if ($object->id > 0)
}
if ($object->type == $object::TYPE_REPLACEMENT)
{
- if ($mode == 'bank-transfer') {
+ if ($type == 'bank-transfer') {
$facreplaced = new FactureFournisseur($db);
} else {
$facreplaced = new Facture($db);
@@ -300,7 +300,7 @@ if ($object->id > 0)
}
if ($object->type == $object::TYPE_CREDIT_NOTE)
{
- if ($mode == 'bank-transfer') {
+ if ($type == 'bank-transfer') {
$facusing = new FactureFournisseur($db);
} else {
$facusing = new Facture($db);
@@ -318,7 +318,7 @@ if ($object->id > 0)
{
if ($i == 0) print ' ';
else print ',';
- if ($mode == 'bank-transfer') {
+ if ($type == 'bank-transfer') {
$facavoir = new FactureFournisseur($db);
} else {
$facavoir = new Facture($db);
@@ -341,7 +341,7 @@ if ($object->id > 0)
// Discounts
print '
| '.$langs->trans('Discounts').' | ';
- if ($mode == 'bank-transfer') {
+ if ($type == 'bank-transfer') {
//$societe = new Fournisseur($db);
//$result = $societe->fetch($object->socid);
$thirdparty = $object->thirdparty;
@@ -357,7 +357,7 @@ if ($object->id > 0)
print ' |
';
// Label
- if ($mode == 'bank-transfer') {
+ if ($type == 'bank-transfer') {
print '
';
print '| '.$form->editfieldkey("Label", 'label', $object->label, $object, 0).' | ';
print ''.$form->editfieldval("Label", 'label', $object->label, $object, 0).' | ';
@@ -427,7 +427,7 @@ if ($object->id > 0)
if ($object->type != $object::TYPE_CREDIT_NOTE)
{
$duedate = $object->date_lim_reglement;
- if ($mode == 'bank-transfer') {
+ if ($type == 'bank-transfer') {
$duedate = $object->date_echeance;
}
@@ -488,7 +488,7 @@ if ($object->id > 0)
print '
';
$title = 'CustomerIBAN';
- if ($mode == 'bank-transfer') {
+ if ($type == 'bank-transfer') {
$title = 'SupplierIBAN';
}
print '
| '.$langs->trans($title).' | ';
@@ -649,7 +649,7 @@ if ($object->id > 0)
print "\n \n";
$buttonlabel = $langs->trans("MakeWithdrawRequest");
- if ($mode == 'bank-transfer') {
+ if ($type == 'bank-transfer') {
$buttonlabel = $langs->trans("MakeBankTransferOrder");
}
@@ -665,6 +665,7 @@ if ($object->id > 0)
print ' \n";
- if ($mode == 'bank-transfer') {
+ if ($type == 'bank-transfer') {
print ''.$langs->trans("DoCreditTransferBeforePayments").' ';
} else {
print ''.$langs->trans("DoStandingOrdersBeforePayments").' ';
@@ -711,7 +712,7 @@ if ($object->id > 0)
print ' | '.$langs->trans("DateRequest").' | ';
print ''.$langs->trans("User").' | ';
print ''.$langs->trans("Amount").' | ';
- if ($mode == 'bank-transfer') {
+ if ($type == 'bank-transfer') {
print ''.$langs->trans("BankTransferReceipt").' | ';
} else {
print ''.$langs->trans("WithdrawalReceipt").' | ';
@@ -723,7 +724,7 @@ if ($object->id > 0)
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,";
$sql .= " pfd.date_traite as date_traite, pfd.amount,";
- $sql .= " u.rowid as user_id, u.lastname, u.firstname, u.login";
+ $sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
@@ -743,14 +744,29 @@ if ($object->id > 0)
{
$i = 0;
+ $tmpuser = new User($db);
+
$num = $db->num_rows($result);
while ($i < $num)
{
$obj = $db->fetch_object($result_sql);
+ $tmpuser->id = $obj->user_id;
+ $tmpuser->login = $obj->login;
+ $tmpuser->ref = $obj->login;
+ $tmpuser->email = $obj->email;
+ $tmpuser->lastname = $obj->lastname;
+ $tmpuser->firstname = $obj->firstname;
+ $tmpuser->statut = $obj->user_status;
+
print '
';
+
print '| '.dol_print_date($db->jdate($obj->date_demande), 'dayhour')." | \n";
- print ''.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.' | ';
+
+ print '';
+ print $tmpuser->getNomUrl(1, '', 0, 0, 0, 0, 'login');
+ print ' | ';
+
print ''.price($obj->amount).' | ';
print '- | ';
print ' | ';
@@ -758,7 +774,7 @@ if ($object->id > 0)
print ''.$langs->trans("OrderWaiting").' | ';
print '';
- print '';
+ print '';
print img_delete();
print ' | ';
@@ -778,7 +794,7 @@ if ($object->id > 0)
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande, pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,";
$sql .= " pb.ref,";
- $sql .= " u.rowid as user_id, u.lastname, u.firstname, u.login";
+ $sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
@@ -798,15 +814,27 @@ if ($object->id > 0)
$numclosed = $num;
$i = 0;
+ $tmpuser = new User($db);
+
while ($i < $num)
{
$obj = $db->fetch_object($result);
+ $tmpuser->id = $obj->user_id;
+ $tmpuser->login = $obj->login;
+ $tmpuser->ref = $obj->login;
+ $tmpuser->email = $obj->email;
+ $tmpuser->lastname = $obj->lastname;
+ $tmpuser->firstname = $obj->firstname;
+ $tmpuser->statut = $obj->user_status;
+
print '
';
print '| '.dol_print_date($db->jdate($obj->date_demande), 'day')." | \n";
- print ''.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.' | ';
+ print '';
+ print $tmpuser->getNomUrl(1, '', 0, 0, 0, 0, 'login');
+ print ' | ';
print ''.price($obj->amount).' | ';
diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php
index 6172b3f1284..792507c56fd 100644
--- a/htdocs/compta/paymentbybanktransfer/index.php
+++ b/htdocs/compta/paymentbybanktransfer/index.php
@@ -94,11 +94,11 @@ print '