FIX Debug module direct debit order. Solve conflict with credit transfer
This commit is contained in:
parent
b6a3938921
commit
f62717a16a
@ -146,11 +146,9 @@ if (empty($reshook))
|
|||||||
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||||
|
|
||||||
$error = $object->set_infocredit($user, $dt);
|
$error = $object->set_infocredit($user, $dt);
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
header("Location: card.php?id=".$id."&error=$error");
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -67,6 +68,9 @@ class BonPrelevement extends CommonObject
|
|||||||
public $emetteur_bic;
|
public $emetteur_bic;
|
||||||
public $emetteur_ics;
|
public $emetteur_ics;
|
||||||
|
|
||||||
|
public $date_trans;
|
||||||
|
public $user_trans;
|
||||||
|
|
||||||
public $total;
|
public $total;
|
||||||
public $fetched;
|
public $fetched;
|
||||||
public $statut; // 0-Wait, 1-Trans, 2-Done
|
public $statut; // 0-Wait, 1-Trans, 2-Done
|
||||||
@ -425,7 +429,7 @@ class BonPrelevement extends CommonObject
|
|||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Set direct debit order to "credited" status.
|
* Set direct debit or credit transfer order to "paid" status.
|
||||||
*
|
*
|
||||||
* @param User $user Id of user
|
* @param User $user Id of user
|
||||||
* @param int $date date of action
|
* @param int $date date of action
|
||||||
@ -440,128 +444,158 @@ class BonPrelevement extends CommonObject
|
|||||||
|
|
||||||
if ($this->fetched == 1)
|
if ($this->fetched == 1)
|
||||||
{
|
{
|
||||||
if ($date >= $this->date_trans)
|
if ($date < $this->date_trans)
|
||||||
{
|
{
|
||||||
if ($this->db->begin())
|
$this->error = 'DateOfMovementLowerThanDateOfFileTransmission';
|
||||||
|
dol_syslog("bon-prelevment::set_infocredit 1027 ".$this->error);
|
||||||
|
return -1027;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons ";
|
||||||
|
$sql .= " SET fk_user_credit = ".$user->id;
|
||||||
|
$sql .= ", statut = ".self::STATUS_CREDITED;
|
||||||
|
$sql .= ", date_credit = '".$this->db->idate($date)."'";
|
||||||
|
$sql .= " WHERE rowid=".$this->id;
|
||||||
|
$sql .= " AND entity = ".$conf->entity;
|
||||||
|
$sql .= " AND statut = ".self::STATUS_TRANSFERED;
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$langs->load('withdrawals');
|
||||||
|
$subject = $langs->trans("InfoCreditSubject", $this->ref);
|
||||||
|
$message = $langs->trans("InfoCreditMessage", $this->ref, dol_print_date($date, 'dayhour'));
|
||||||
|
|
||||||
|
//Add payment of withdrawal into bank
|
||||||
|
$bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT;
|
||||||
|
$facs = array();
|
||||||
|
$amounts = array();
|
||||||
|
$amountsperthirdparty = array();
|
||||||
|
|
||||||
|
$facs = $this->getListInvoices(1);
|
||||||
|
|
||||||
|
// Loop on each invoice. $facs=array(0=>id, 1=>amount requested)
|
||||||
|
$num = count($facs);
|
||||||
|
for ($i = 0; $i < $num; $i++)
|
||||||
{
|
{
|
||||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons ";
|
if ($this->type == 'bank-transfer') {
|
||||||
$sql .= " SET fk_user_credit = ".$user->id;
|
$fac = new FactureFournisseur($this->db);
|
||||||
$sql .= ", statut = ".self::STATUS_CREDITED;
|
} else {
|
||||||
$sql .= ", date_credit = '".$this->db->idate($date)."'";
|
$fac = new Facture($this->db);
|
||||||
$sql .= " WHERE rowid=".$this->id;
|
|
||||||
$sql .= " AND entity = ".$conf->entity;
|
|
||||||
$sql .= " AND statut = ".self::STATUS_TRANSFERED;
|
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
|
||||||
{
|
|
||||||
$langs->load('withdrawals');
|
|
||||||
$subject = $langs->trans("InfoCreditSubject", $this->ref);
|
|
||||||
$message = $langs->trans("InfoCreditMessage", $this->ref, dol_print_date($date, 'dayhour'));
|
|
||||||
|
|
||||||
//Add payment of withdrawal into bank
|
|
||||||
$bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT;
|
|
||||||
$facs = array();
|
|
||||||
$amounts = array();
|
|
||||||
$amountsperthirdparty = array();
|
|
||||||
|
|
||||||
$facs = $this->getListInvoices(1);
|
|
||||||
|
|
||||||
// Loop on each invoice. $facs=array(0=>id, 1=>amount requested)
|
|
||||||
$num = count($facs);
|
|
||||||
for ($i = 0; $i < $num; $i++)
|
|
||||||
{
|
|
||||||
$fac = new Facture($this->db);
|
|
||||||
$fac->fetch($facs[$i][0]);
|
|
||||||
$amounts[$fac->id] = $facs[$i][1];
|
|
||||||
$amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1];
|
|
||||||
|
|
||||||
$totalpaye = $fac->getSommePaiement();
|
|
||||||
$totalcreditnotes = $fac->getSumCreditNotesUsed();
|
|
||||||
$totaldeposits = $fac->getSumDepositsUsed();
|
|
||||||
$alreadypayed = $totalpaye + $totalcreditnotes + $totaldeposits;
|
|
||||||
|
|
||||||
if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) {
|
|
||||||
$result = $fac->set_paid($user);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make one payment per customer
|
|
||||||
foreach ($amountsperthirdparty as $thirdpartyid => $cursoramounts)
|
|
||||||
{
|
|
||||||
$paiement = new Paiement($this->db);
|
|
||||||
$paiement->datepaye = $date;
|
|
||||||
$paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice
|
|
||||||
$paiement->paiementid = 3; //
|
|
||||||
$paiement->num_payment = $this->ref; // Set ref of direct debit note
|
|
||||||
$paiement->num_paiement = $this->ref; // For backward compatibility
|
|
||||||
$paiement->id_prelevement = $this->id;
|
|
||||||
|
|
||||||
$paiement_id = $paiement->create($user);
|
|
||||||
if ($paiement_id < 0)
|
|
||||||
{
|
|
||||||
dol_syslog(get_class($this)."::set_infocredit AddPayment Error");
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$result = $paiement->addPaymentToBank($user, 'payment', '(WithdrawalPayment)', $bankaccount, '', '');
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error");
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//var_dump($paiement->amounts);
|
|
||||||
//var_dump($thirdpartyid);
|
|
||||||
//var_dump($cursoramounts);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update withdrawal line
|
|
||||||
// TODO: Translate to ligneprelevement.class.php
|
|
||||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
|
|
||||||
$sql .= " SET statut = 2";
|
|
||||||
$sql .= " WHERE fk_prelevement_bons = ".$this->id;
|
|
||||||
|
|
||||||
if (!$this->db->query($sql))
|
|
||||||
{
|
|
||||||
dol_syslog(get_class($this)."::set_infocredit Update lines Error");
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_syslog(get_class($this)."::set_infocredit Update Bons Error");
|
|
||||||
$error++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
$result = $fac->fetch($facs[$i][0]);
|
||||||
* End of procedure
|
|
||||||
*/
|
|
||||||
if ($error == 0)
|
|
||||||
{
|
|
||||||
$this->date_credit = $date;
|
|
||||||
$this->statut = self::STATUS_CREDITED;
|
|
||||||
|
|
||||||
$this->db->commit();
|
$amounts[$fac->id] = $facs[$i][1];
|
||||||
return 0;
|
$amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1];
|
||||||
}
|
|
||||||
else
|
$totalpaye = $fac->getSommePaiement();
|
||||||
{
|
$totalcreditnotes = $fac->getSumCreditNotesUsed();
|
||||||
$this->db->rollback();
|
$totaldeposits = $fac->getSumDepositsUsed();
|
||||||
dol_syslog("bon-prelevment::set_infocredit ROLLBACK ");
|
$alreadypayed = $totalpaye + $totalcreditnotes + $totaldeposits;
|
||||||
return -1;
|
|
||||||
|
// @TODO Move this after creation of payment
|
||||||
|
if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) {
|
||||||
|
$result = $fac->set_paid($user);
|
||||||
|
if ($result < 0) {
|
||||||
|
$this->error = $fac->error;
|
||||||
|
$this->errors = $fac->errors;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
//var_dump($amountsperthirdparty);exit;
|
||||||
|
|
||||||
|
// Make one payment per customer
|
||||||
|
foreach ($amountsperthirdparty as $thirdpartyid => $cursoramounts)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::set_infocredit 1025 Open SQL transaction impossible ");
|
if ($this->type == 'bank-transfer') {
|
||||||
return -1025;
|
$paiement = new PaiementFourn($this->db);
|
||||||
|
} else {
|
||||||
|
$paiement = new Paiement($this->db);
|
||||||
|
}
|
||||||
|
$paiement->datepaye = $date;
|
||||||
|
$paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice
|
||||||
|
|
||||||
|
if ($this->type == 'bank-transfer') {
|
||||||
|
$paiement->paiementid = 2;
|
||||||
|
$paiement->paiementcode = 'VIR';
|
||||||
|
} else {
|
||||||
|
$paiement->paiementid = 3;
|
||||||
|
$paiement->paiementcode = 'PRE';
|
||||||
|
}
|
||||||
|
|
||||||
|
$paiement->num_payment = $this->ref; // Set ref of direct debit note
|
||||||
|
$paiement->num_paiement = $this->ref; // For backward compatibility
|
||||||
|
$paiement->id_prelevement = $this->id;
|
||||||
|
|
||||||
|
$paiement_id = $paiement->create($user); // This use ->paiementid, that is ID of payment mode
|
||||||
|
if ($paiement_id < 0)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$this->error = $paiement->error;
|
||||||
|
$this->errors = $paiement->errors;
|
||||||
|
dol_syslog(get_class($this)."::set_infocredit AddPayment Error ".$this->error);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($this->type == 'bank-transfer') {
|
||||||
|
$modeforaddpayment = 'payment_supplier';
|
||||||
|
} else {
|
||||||
|
$modeforaddpayment = 'payment';
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $paiement->addPaymentToBank($user, $modeforaddpayment, '(WithdrawalPayment)', $bankaccount, '', '');
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$this->error = $paiement->error;
|
||||||
|
$this->errors = $paiement->errors;
|
||||||
|
dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error ".$this->error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//var_dump($paiement->amounts);
|
||||||
|
//var_dump($thirdpartyid);
|
||||||
|
//var_dump($cursoramounts);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update withdrawal line
|
||||||
|
// TODO: Translate to ligneprelevement.class.php
|
||||||
|
if (! $error) {
|
||||||
|
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
|
||||||
|
$sql .= " SET statut = 2";
|
||||||
|
$sql .= " WHERE fk_prelevement_bons = ".$this->id;
|
||||||
|
|
||||||
|
if (!$this->db->query($sql))
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::set_infocredit Update lines Error");
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("bon-prelevment::set_infocredit 1027 Date de credit < Date de trans ");
|
$this->error = $this->db->lasterror();
|
||||||
return -1027;
|
dol_syslog(get_class($this)."::set_infocredit Update Bons Error");
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* End of procedure
|
||||||
|
*/
|
||||||
|
if ($error == 0)
|
||||||
|
{
|
||||||
|
$this->date_credit = $date;
|
||||||
|
$this->statut = self::STATUS_CREDITED;
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -593,7 +627,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql .= " SET fk_user_trans = ".$user->id;
|
$sql .= " SET fk_user_trans = ".$user->id;
|
||||||
$sql .= " , date_trans = '".$this->db->idate($date)."'";
|
$sql .= " , date_trans = '".$this->db->idate($date)."'";
|
||||||
$sql .= " , method_trans = ".$method;
|
$sql .= " , method_trans = ".$method;
|
||||||
$sql .= " , statut = 1";
|
$sql .= " , statut = ".self::STATUS_TRANSFERED;
|
||||||
$sql .= " WHERE rowid = ".$this->id;
|
$sql .= " WHERE rowid = ".$this->id;
|
||||||
$sql .= " AND entity = ".$conf->entity;
|
$sql .= " AND entity = ".$conf->entity;
|
||||||
$sql .= " AND statut = 0";
|
$sql .= " AND statut = 0";
|
||||||
@ -617,6 +651,7 @@ class BonPrelevement extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->date_trans = $date;
|
$this->date_trans = $date;
|
||||||
$this->statut = 1;
|
$this->statut = 1;
|
||||||
|
$this->user_trans = $user->id;
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -651,7 +686,12 @@ class BonPrelevement extends CommonObject
|
|||||||
/*
|
/*
|
||||||
* Returns all invoices presented within same order
|
* Returns all invoices presented within same order
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT fk_facture";
|
$sql = "SELECT ";
|
||||||
|
if ($this->type == 'bank-transfer') {
|
||||||
|
$sql .= " pf.fk_facture_fourn";
|
||||||
|
} else {
|
||||||
|
$sql .= " pf.fk_facture";
|
||||||
|
}
|
||||||
if ($amounts) $sql .= ", SUM(pl.amount)";
|
if ($amounts) $sql .= ", SUM(pl.amount)";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||||
@ -660,7 +700,13 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
|
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
|
||||||
$sql .= " AND p.rowid = ".$this->id;
|
$sql .= " AND p.rowid = ".$this->id;
|
||||||
$sql .= " AND p.entity = ".$conf->entity;
|
$sql .= " AND p.entity = ".$conf->entity;
|
||||||
if ($amounts) $sql .= " GROUP BY fk_facture";
|
if ($amounts) {
|
||||||
|
if ($this->type == 'bank-transfer') {
|
||||||
|
$sql .= " GROUP BY fk_facture_fourn";
|
||||||
|
} else {
|
||||||
|
$sql .= " GROUP BY fk_facture";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -59,7 +59,7 @@ class LignePrelevement
|
|||||||
|
|
||||||
$langs->load("withdrawals");
|
$langs->load("withdrawals");
|
||||||
$this->statuts[0] = $langs->trans("StatusWaiting");
|
$this->statuts[0] = $langs->trans("StatusWaiting");
|
||||||
$this->statuts[2] = $langs->trans("StatusCredited");
|
$this->statuts[2] = $langs->trans("StatusPaid");
|
||||||
$this->statuts[3] = $langs->trans("StatusRefused");
|
$this->statuts[3] = $langs->trans("StatusRefused");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -105,7 +105,7 @@ if ($id > 0 || $ref)
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||||
print dol_print_date($object->date_trans, 'day');
|
print dol_print_date($object->date_trans, 'day');
|
||||||
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
|
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||||
print $object->methodes_trans[$object->method_trans];
|
print $object->methodes_trans[$object->method_trans];
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -160,7 +160,7 @@ if ($id > 0 || $ref)
|
|||||||
|
|
||||||
|
|
||||||
// List of invoices
|
// List of invoices
|
||||||
$sql = "SELECT pf.rowid,";
|
$sql = "SELECT pf.rowid, p.type,";
|
||||||
$sql .= " f.rowid as facid, f.ref as ref, f.total_ttc,";
|
$sql .= " f.rowid as facid, f.ref as ref, f.total_ttc,";
|
||||||
$sql .= " s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested";
|
$sql .= " s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||||
@ -193,8 +193,8 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
{
|
{
|
||||||
$result = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
$nbtotalofrecords = $db->num_rows($resql);
|
||||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
{
|
{
|
||||||
$page = 0;
|
$page = 0;
|
||||||
@ -204,10 +204,10 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($result)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$param = "&id=".$id;
|
$param = "&id=".$id;
|
||||||
@ -236,22 +236,28 @@ if ($result)
|
|||||||
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("AmountInvoice", $_SERVER["PHP_SELF"], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder);
|
print_liste_field_titre("AmountInvoice", $_SERVER["PHP_SELF"], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "pl.amount", "", $param, 'class="right"', $sortfield, $sortorder);
|
print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "pl.amount", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("StatusDebitCredit", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre('');
|
print_liste_field_titre('');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$totalinvoices = 0;
|
$totalinvoices = 0;
|
||||||
$totalamount_requested = 0;
|
$totalamount_requested = 0;
|
||||||
|
|
||||||
|
$invoicetmpcustomer = new Facture($db);
|
||||||
|
$invoicetmpsupplier = new FactureFournisseur($db);
|
||||||
|
|
||||||
while ($i < min($num, $limit))
|
while ($i < min($num, $limit))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
$invoicetmp->id = $obj->facid;
|
if ($obj->type == 'bank-transfer') {
|
||||||
$invoicetmp->ref = $obj->ref;
|
$invoicetmp = $invoicetmpsupplier;
|
||||||
|
} else {
|
||||||
|
$invoicetmp = $invoicetmpcustomer;
|
||||||
|
}
|
||||||
|
$invoicetmp->fetch($obj->facid);
|
||||||
|
|
||||||
$thirdpartytmp->id = $obj->socid;
|
$thirdpartytmp->fetch($obj->socid);
|
||||||
$thirdpartytmp->name = $obj->name;
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
@ -278,7 +284,11 @@ if ($result)
|
|||||||
}
|
}
|
||||||
elseif ($obj->statut == 2)
|
elseif ($obj->statut == 2)
|
||||||
{
|
{
|
||||||
print $langs->trans("StatusCredited");
|
if ($obj->type == 'bank-transfer') {
|
||||||
|
print $langs->trans("StatusDebited");
|
||||||
|
} else {
|
||||||
|
print $langs->trans("StatusCredited");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elseif ($obj->statut == 3)
|
elseif ($obj->statut == 3)
|
||||||
{
|
{
|
||||||
@ -317,7 +327,7 @@ if ($result)
|
|||||||
print "</table>";
|
print "</table>";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
$db->free($result);
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -99,7 +99,7 @@ if ($prev_id > 0 || $ref)
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||||
print dol_print_date($object->date_trans, 'day');
|
print dol_print_date($object->date_trans, 'day');
|
||||||
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
|
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||||
print $object->methodes_trans[$object->method_trans];
|
print $object->methodes_trans[$object->method_trans];
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -234,7 +234,7 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
print '<tr><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
|
|||||||
@ -98,7 +98,7 @@ if ($prev_id > 0 || $ref)
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||||
print dol_print_date($object->date_trans, 'day');
|
print dol_print_date($object->date_trans, 'day');
|
||||||
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
|
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||||
print $object->methodes_trans[$object->method_trans];
|
print $object->methodes_trans[$object->method_trans];
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|||||||
@ -1290,7 +1290,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn';
|
||||||
$sql .= ' SET paye = 1, fk_statut=2';
|
$sql .= ' SET paye = 1, fk_statut = '.self::STATUS_CLOSED;
|
||||||
$sql .= ' WHERE rowid = '.$this->id;
|
$sql .= ' WHERE rowid = '.$this->id;
|
||||||
|
|
||||||
dol_syslog("FactureFournisseur::set_paid", LOG_DEBUG);
|
dol_syslog("FactureFournisseur::set_paid", LOG_DEBUG);
|
||||||
|
|||||||
@ -63,7 +63,9 @@ InvoiceRefused=Invoice refused (Charge the rejection to customer)
|
|||||||
StatusDebitCredit=Status debit/credit
|
StatusDebitCredit=Status debit/credit
|
||||||
StatusWaiting=Waiting
|
StatusWaiting=Waiting
|
||||||
StatusTrans=Sent
|
StatusTrans=Sent
|
||||||
|
StatusDebited=Debited
|
||||||
StatusCredited=Credited
|
StatusCredited=Credited
|
||||||
|
StatusPaid=Paid
|
||||||
StatusRefused=Refused
|
StatusRefused=Refused
|
||||||
StatusMotif0=Unspecified
|
StatusMotif0=Unspecified
|
||||||
StatusMotif1=Insufficient funds
|
StatusMotif1=Insufficient funds
|
||||||
@ -82,8 +84,8 @@ CreateSepaFileForPaymentByBankTransfer=Create credit transfer file (SEPA)
|
|||||||
CreateGuichet=Only office
|
CreateGuichet=Only office
|
||||||
CreateBanque=Only bank
|
CreateBanque=Only bank
|
||||||
OrderWaiting=Waiting for treatment
|
OrderWaiting=Waiting for treatment
|
||||||
NotifyTransmision=File transmission
|
NotifyTransmision=Record file transmission of order
|
||||||
NotifyCredit=Withdrawal Credit
|
NotifyCredit=Record credit of order
|
||||||
NumeroNationalEmetter=National Transmitter Number
|
NumeroNationalEmetter=National Transmitter Number
|
||||||
WithBankUsingRIB=For bank accounts using RIB
|
WithBankUsingRIB=For bank accounts using RIB
|
||||||
WithBankUsingBANBIC=For bank accounts using IBAN/BIC/SWIFT
|
WithBankUsingBANBIC=For bank accounts using IBAN/BIC/SWIFT
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user