Debug withdraw module
This commit is contained in:
parent
2612585d1c
commit
230fd7a7e4
@ -3061,10 +3061,11 @@ class Facture extends CommonInvoice
|
|||||||
/**
|
/**
|
||||||
* Create a withdrawal request for a standing order
|
* Create a withdrawal request for a standing order
|
||||||
*
|
*
|
||||||
* @param User $user User asking standing order
|
* @param User $fuser User asking standing order
|
||||||
|
* @param float $amount Amount we request withdraw for
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function demande_prelevement($user)
|
function demande_prelevement($fuser, $amount=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
@ -3101,18 +3102,16 @@ class Facture extends CommonInvoice
|
|||||||
// For example print 239.2 - 229.3 - 9.9; does not return 0.
|
// For example print 239.2 - 229.3 - 9.9; does not return 0.
|
||||||
//$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
//$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||||
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||||
|
if (empty($amount)) $amount = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
|
||||||
|
|
||||||
//$resteapayer = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
|
if (is_numeric($amount) && $amount != 0)
|
||||||
|
{
|
||||||
$amount = GETPOST('withdraw_request_amount');
|
|
||||||
|
|
||||||
if (is_numeric($amount) && $amount != 0) {
|
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
||||||
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
|
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
|
||||||
$sql .= ' VALUES ('.$this->id;
|
$sql .= ' VALUES ('.$this->id;
|
||||||
$sql .= ",'".price2num($amount)."'";
|
$sql .= ",'".price2num($amount)."'";
|
||||||
$sql .= ",'".$this->db->idate($now)."'";
|
$sql .= ",'".$this->db->idate($now)."'";
|
||||||
$sql .= ",".$user->id;
|
$sql .= ",".$fuser->id;
|
||||||
$sql .= ",'".$bac->code_banque."'";
|
$sql .= ",'".$bac->code_banque."'";
|
||||||
$sql .= ",'".$bac->code_guichet."'";
|
$sql .= ",'".$bac->code_guichet."'";
|
||||||
$sql .= ",'".$bac->number."'";
|
$sql .= ",'".$bac->number."'";
|
||||||
@ -3126,9 +3125,11 @@ class Facture extends CommonInvoice
|
|||||||
dol_syslog(get_class($this).'::demandeprelevement Erreur');
|
dol_syslog(get_class($this).'::demandeprelevement Erreur');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
$this->error=$langs->trans('WithdrawRequestErrorNilAmount');
|
else
|
||||||
dol_syslog(get_class($this).'::demandeprelevement ' . $langs->trans('WithdrawRequestErrorNilAmount'));
|
{
|
||||||
|
$this->error='WithdrawRequestErrorNilAmount';
|
||||||
|
dol_syslog(get_class($this).'::demandeprelevement WithdrawRequestErrorNilAmount');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3170,11 +3171,11 @@ class Facture extends CommonInvoice
|
|||||||
/**
|
/**
|
||||||
* Supprime une demande de prelevement
|
* Supprime une demande de prelevement
|
||||||
*
|
*
|
||||||
* @param User $user utilisateur creant la demande
|
* @param User $fuser User making delete
|
||||||
* @param int $did id de la demande a supprimer
|
* @param int $did id de la demande a supprimer
|
||||||
* @return int <0 if OK, >0 if KO
|
* @return int <0 if OK, >0 if KO
|
||||||
*/
|
*/
|
||||||
function demande_prelevement_delete($user, $did)
|
function demande_prelevement_delete($fuser, $did)
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
||||||
$sql .= ' WHERE rowid = '.$did;
|
$sql .= ' WHERE rowid = '.$did;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
@ -68,14 +68,19 @@ if ($action == "new")
|
|||||||
{
|
{
|
||||||
if ($object->id > 0)
|
if ($object->id > 0)
|
||||||
{
|
{
|
||||||
$result = $object->demande_prelevement($user);
|
$db->begin();
|
||||||
|
|
||||||
|
$result = $object->demande_prelevement($user, GETPOST('withdraw_request_amount'));
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
|
$db->commit();
|
||||||
|
|
||||||
setEventMessage($langs->trans("RecordSaved"));
|
setEventMessage($langs->trans("RecordSaved"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage($object->error, 'errors');
|
$db->rollback();
|
||||||
|
setEventMessage($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$action='';
|
$action='';
|
||||||
@ -309,7 +314,7 @@ if ($object->id > 0)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Conditions de reglement
|
// Payment condition
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('PaymentConditionsShort');
|
print $langs->trans('PaymentConditionsShort');
|
||||||
@ -514,10 +519,12 @@ if ($object->id > 0)
|
|||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td align="left">'.$langs->trans("DateRequest").'</td>';
|
print '<td align="left">'.$langs->trans("DateRequest").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("DateProcess").'</td>';
|
print '<td align="center">'.$langs->trans("User").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("Amount").'</td>';
|
print '<td align="center">'.$langs->trans("Amount").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("WithdrawalReceipt").'</td>';
|
print '<td align="center">'.$langs->trans("WithdrawalReceipt").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("User").'</td><td> </td><td> </td>';
|
print '<td> </td>';
|
||||||
|
print '<td align="center">'.$langs->trans("DateProcess").'</td>';
|
||||||
|
print '<td> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
@ -532,15 +539,18 @@ if ($object->id > 0)
|
|||||||
|
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";
|
print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";
|
||||||
print '<td align="center">'.$langs->trans("OrderWaiting").'</td>';
|
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
|
||||||
print '<td align="center">'.price($obj->amount).'</td>';
|
print '<td align="center">'.price($obj->amount).'</td>';
|
||||||
print '<td align="center">-</td>';
|
print '<td align="center">-</td>';
|
||||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
|
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print '<td>';
|
|
||||||
|
print '<td align="center">'.$langs->trans("OrderWaiting").'</td>';
|
||||||
|
|
||||||
|
print '<td align="right">';
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&did='.$obj->rowid.'">';
|
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&did='.$obj->rowid.'">';
|
||||||
print img_delete();
|
print img_delete();
|
||||||
print '</a></td>';
|
print '</a></td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -580,7 +590,7 @@ if ($object->id > 0)
|
|||||||
|
|
||||||
print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";
|
print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";
|
||||||
|
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($obj->date_traite),'day')."</td>\n";
|
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
|
||||||
|
|
||||||
print '<td align="center">'.price($obj->amount).'</td>';
|
print '<td align="center">'.price($obj->amount).'</td>';
|
||||||
|
|
||||||
@ -591,9 +601,10 @@ if ($object->id > 0)
|
|||||||
print $withdrawreceipt->getNomUrl(1);
|
print $withdrawreceipt->getNomUrl(1);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
|
|
||||||
|
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
|
|
||||||
|
print '<td align="center">'.dol_print_date($db->jdate($obj->date_traite),'day')."</td>\n";
|
||||||
|
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@ -55,7 +55,7 @@ $pagenext = $page + 1;
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mode Liste
|
* Mode List
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT p.rowid, p.ref, p.amount, p.statut";
|
$sql = "SELECT p.rowid, p.ref, p.amount, p.statut";
|
||||||
@ -81,7 +81,7 @@ if ($result)
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"');
|
print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"');
|
||||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"');
|
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"');
|
||||||
print '<td class="liste_titre" align="right">'.$langs->trans("Amount").'</td>';
|
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"","","",'align="center"');
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -121,7 +121,7 @@ else
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
require('../../main.inc.php');
|
require('../../main.inc.php');
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
|
||||||
@ -45,6 +46,11 @@ if ($user->societe_id > 0) accessforbidden();
|
|||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$id = GETPOST('id','int');
|
$id = GETPOST('id','int');
|
||||||
|
|
||||||
|
$socid = GETPOST('socid','int');
|
||||||
|
$page = GETPOST('page','int');
|
||||||
|
$sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha');
|
||||||
|
$sortfield = ((GETPOST('sortfield','alpha')=="")) ? "pl.fk_soc" : GETPOST('sortfield','alpha');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -207,10 +213,10 @@ if ($id > 0)
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="3">'.$langs->trans("NotifyTransmision").'</td></tr>';
|
print '<td colspan="3">'.$langs->trans("NotifyTransmision").'</td></tr>';
|
||||||
print '<tr><td width="20%">'.$langs->trans("TransData").'</td><td>';
|
print '<tr '.$bc[false].'><td width="20%">'.$langs->trans("TransData").'</td><td>';
|
||||||
print $form->select_date('','','','','',"userfile",1,1);
|
print $form->select_date('','','','','',"userfile",1,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
|
print '<tr '.$bc[false].'><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
|
||||||
print $form->selectarray("methode",$bon->methodes_trans);
|
print $form->selectarray("methode",$bon->methodes_trans);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
/* print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
|
/* print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
|
||||||
@ -230,7 +236,7 @@ if ($id > 0)
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="3">'.$langs->trans("NotifyCredit").'</td></tr>';
|
print '<td colspan="3">'.$langs->trans("NotifyCredit").'</td></tr>';
|
||||||
print '<tr><td width="20%">'.$langs->trans('CreditDate').'</td><td>';
|
print '<tr '.$bc[false].'><td width="20%">'.$langs->trans('CreditDate').'</td><td>';
|
||||||
print $form->select_date('','','','','',"infocredit",1,1);
|
print $form->select_date('','','','','',"infocredit",1,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -259,6 +265,122 @@ if ($id > 0)
|
|||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$ligne=new LignePrelevement($db,$user);
|
||||||
|
|
||||||
|
if ($page == -1) { $page = 0 ; }
|
||||||
|
|
||||||
|
$offset = $conf->liste_limit * $page ;
|
||||||
|
$pageprev = $page - 1;
|
||||||
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Lines into withdraw request
|
||||||
|
*/
|
||||||
|
$sql = "SELECT pl.rowid, pl.statut, pl.amount";
|
||||||
|
$sql.= ", s.rowid as socid, s.nom as name";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||||
|
$sql.= " WHERE pl.fk_prelevement_bons = ".$id;
|
||||||
|
$sql.= " AND pl.fk_prelevement_bons = pb.rowid";
|
||||||
|
$sql.= " AND pb.entity = ".$conf->entity;
|
||||||
|
$sql.= " AND pl.fk_soc = s.rowid";
|
||||||
|
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||||
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
$urladd = "&id=".$prev_id;
|
||||||
|
|
||||||
|
print_barre_liste("", $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
|
||||||
|
print"\n<!-- debut table -->\n";
|
||||||
|
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print_liste_field_titre($langs->trans("Lines"),$_SERVER["PHP_SELF"],"pl.rowid",'',$urladd);
|
||||||
|
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",'',$urladd);
|
||||||
|
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"pl.amount","",$urladd,'align="center"');
|
||||||
|
print_liste_field_titre('');
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$var=false;
|
||||||
|
|
||||||
|
$total = 0;
|
||||||
|
|
||||||
|
while ($i < min($num,$conf->liste_limit))
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
|
print "<tr ".$bc[$var].">";
|
||||||
|
|
||||||
|
print "<td>";
|
||||||
|
|
||||||
|
print $ligne->LibStatut($obj->statut,2);
|
||||||
|
print " ";
|
||||||
|
|
||||||
|
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
|
||||||
|
print substr('000000'.$obj->rowid, -6);
|
||||||
|
print '</a></td>';
|
||||||
|
|
||||||
|
$thirdparty=new Societe($db);
|
||||||
|
$thirdparty->fetch($obj->socid);
|
||||||
|
print '<td>';
|
||||||
|
print $thirdparty->getNomUrl(1);
|
||||||
|
print "</td>\n";
|
||||||
|
|
||||||
|
print '<td align="center">'.price($obj->amount)."</td>\n";
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
|
||||||
|
if ($obj->statut == 3)
|
||||||
|
{
|
||||||
|
print '<b>'.$langs->trans("StatusRefused").'</b>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
$total += $obj->total_ttc;
|
||||||
|
$var=!$var;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($socid)
|
||||||
|
{
|
||||||
|
print "<tr ".$bc[$var].">";
|
||||||
|
|
||||||
|
print '<td>'.$langs->trans("Total").'</td>';
|
||||||
|
|
||||||
|
print '<td align="center">'.price($total)."</td>\n";
|
||||||
|
|
||||||
|
print '<td> </td>';
|
||||||
|
|
||||||
|
print '<td> </td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
$db->free($result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -846,7 +846,7 @@ class BonPrelevement extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog(__METHOD__."::Check RIB Error on default bank number RIB/IBAN for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR);
|
dol_syslog(__METHOD__."::Check RIB Error on default bank number RIB/IBAN for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR);
|
||||||
$this->invoice_in_error[$fac[0]]="Error on default bank number RIB/IBAN for invoice ".$fact->getNomUrl(0)." for thirdparty (reported by function verif) ".$soc->name;
|
$this->invoice_in_error[$fac[0]]="Error on default bank number RIB/IBAN for invoice ".$fact->getNomUrl(0)." for thirdparty (reported by function verif) ".$soc->getNomUrl(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1237,6 +1237,11 @@ class BonPrelevement extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::generate build file ".$this->filename);
|
dol_syslog(get_class($this)."::generate build file ".$this->filename);
|
||||||
|
|
||||||
$this->file = fopen($this->filename,"w");
|
$this->file = fopen($this->filename,"w");
|
||||||
|
if (empty($this->file))
|
||||||
|
{
|
||||||
|
$this->error=$langs->trans('ErrorFailedToOpenFile', $this->filename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
$found=0;
|
$found=0;
|
||||||
|
|
||||||
@ -1298,7 +1303,8 @@ class BonPrelevement extends CommonObject
|
|||||||
//echo $sql;
|
//echo $sql;
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{ $num = $this->db->num_rows($resql);
|
{
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
@ -1308,7 +1314,8 @@ class BonPrelevement extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ fputs($this->file, 'ERREUR DEBITEUR '.$sql.$CrLf);
|
{
|
||||||
|
fputs($this->file, 'ERREUR DEBITEUR '.$sql.$CrLf);
|
||||||
$result = -2;
|
$result = -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1316,10 +1323,12 @@ class BonPrelevement extends CommonObject
|
|||||||
* section Emetteur(sepa Emetteur bloc lines)
|
* section Emetteur(sepa Emetteur bloc lines)
|
||||||
*/
|
*/
|
||||||
if ($result != -2)
|
if ($result != -2)
|
||||||
{ $fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $i, $this->total, $CrLf);
|
{
|
||||||
|
$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $i, $this->total, $CrLf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ fputs($this->file, 'ERREUR EMETTEUR'.$CrLf);
|
{
|
||||||
|
fputs($this->file, 'ERREUR EMETTEUR'.$CrLf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1514,7 +1523,7 @@ class BonPrelevement extends CommonObject
|
|||||||
*/
|
*/
|
||||||
static function buildRumNumber($row_code_client, $row_datec, $row_drum)
|
static function buildRumNumber($row_code_client, $row_datec, $row_drum)
|
||||||
{
|
{
|
||||||
$pre = ($row_datec > 1359673200) ? 'Rum' : '++R';
|
$pre = ($row_datec > 1359673200) ? 'RUM-' : '++R';
|
||||||
return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec);
|
return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2010-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
@ -96,13 +96,19 @@ if (prelevement_check_config() < 0)
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$h=0;
|
/*$h=0;
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/create.php';
|
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/create.php';
|
||||||
$head[$h][1] = $langs->trans("NewStandingOrder");
|
$head[$h][1] = $langs->trans("NewStandingOrder");
|
||||||
|
$head[$h][2] = 'payment';
|
||||||
|
$hselected = 'payment';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
dol_fiche_head($head, $hselected, $langs->trans("StandingOrders"), 0, 'payment');
|
dol_fiche_head($head, $hselected, $langs->trans("StandingOrders"), 0, 'payment');
|
||||||
|
*/
|
||||||
|
|
||||||
|
print_barre_liste($langs->trans("NewStandingOrder"), 0, $_SERVER["PHP_SELF"]);
|
||||||
|
|
||||||
|
dol_fiche_head();
|
||||||
|
|
||||||
$nb=$bprev->NbFactureAPrelever();
|
$nb=$bprev->NbFactureAPrelever();
|
||||||
$nb1=$bprev->NbFactureAPrelever(1);
|
$nb1=$bprev->NbFactureAPrelever(1);
|
||||||
@ -184,6 +190,7 @@ if ($resql)
|
|||||||
print '<td>'.$langs->trans("Invoice").'</td>';
|
print '<td>'.$langs->trans("Invoice").'</td>';
|
||||||
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
||||||
print '<td>'.$langs->trans("RIB").'</td>';
|
print '<td>'.$langs->trans("RIB").'</td>';
|
||||||
|
print '<td>'.$langs->trans("RUM").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("DateRequest").'</td>';
|
print '<td align="right">'.$langs->trans("DateRequest").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -210,6 +217,10 @@ if ($resql)
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
print $thirdpartystatic->display_rib();
|
print $thirdpartystatic->display_rib();
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
// RUM
|
||||||
|
print '<td>';
|
||||||
|
print $thirdpartystatic->display_rib('rum');
|
||||||
|
print '</td>';
|
||||||
// Amount
|
// Amount
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print price($obj->amount,0,$langs,0,0,-1,$conf->currency);
|
print price($obj->amount,0,$langs,0,0,-1,$conf->currency);
|
||||||
@ -265,11 +276,14 @@ if ($result)
|
|||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
print "<tr ".$bc[$var]."><td>";
|
print "<tr ".$bc[$var].">";
|
||||||
|
|
||||||
|
print "<td>";
|
||||||
$bprev->id=$obj->rowid;
|
$bprev->id=$obj->rowid;
|
||||||
$bprev->ref=$obj->ref;
|
$bprev->ref=$obj->ref;
|
||||||
print $bprev->getNomUrl(1);
|
print $bprev->getNomUrl(1);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datec),'day')."</td>\n";
|
print '<td align="center">'.dol_print_date($db->jdate($obj->datec),'day')."</td>\n";
|
||||||
|
|
||||||
print '<td align="right">'.price($obj->amount,0,$langs,0,0,-1,$conf->currency)."</td>\n";
|
print '<td align="right">'.price($obj->amount,0,$langs,0,0,-1,$conf->currency)."</td>\n";
|
||||||
|
|||||||
@ -1,225 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
||||||
* Copyright (C) 2005 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>
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/compta/prelevement/lignes.php
|
|
||||||
* \ingroup prelevement
|
|
||||||
* \brief Prelevement lines
|
|
||||||
*/
|
|
||||||
|
|
||||||
require('../../main.inc.php');
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
|
||||||
|
|
||||||
$langs->load("banks");
|
|
||||||
$langs->load("categories");
|
|
||||||
|
|
||||||
// Security check
|
|
||||||
if ($user->societe_id > 0) accessforbidden();
|
|
||||||
|
|
||||||
$langs->load('withdrawals');
|
|
||||||
$langs->load('bills');
|
|
||||||
|
|
||||||
// Get supervariables
|
|
||||||
$prev_id = GETPOST('id','int');
|
|
||||||
$socid = GETPOST('socid','int');
|
|
||||||
$page = GETPOST('page','int');
|
|
||||||
$sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha');
|
|
||||||
$sortfield = ((GETPOST('sortfield','alpha')=="")) ? "pl.fk_soc" : GETPOST('sortfield','alpha');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* View
|
|
||||||
*/
|
|
||||||
|
|
||||||
llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
|
||||||
|
|
||||||
if ($prev_id)
|
|
||||||
{
|
|
||||||
$bon = new BonPrelevement($db,"");
|
|
||||||
|
|
||||||
if ($bon->fetch($prev_id) == 0)
|
|
||||||
{
|
|
||||||
$head = prelevement_prepare_head($bon);
|
|
||||||
dol_fiche_head($head, 'lines', $langs->trans("WithdrawalsReceipts"), '', 'payment');
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
|
|
||||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
|
|
||||||
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
|
|
||||||
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
|
|
||||||
|
|
||||||
// Status
|
|
||||||
print '<tr><td width="20%">'.$langs->trans('Status').'</td>';
|
|
||||||
print '<td>'.$bon->getLibStatut(1).'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
if($bon->date_trans <> 0)
|
|
||||||
{
|
|
||||||
$muser = new User($db);
|
|
||||||
$muser->fetch($bon->user_trans);
|
|
||||||
|
|
||||||
print '<tr><td width="20%">'.$langs->trans("TransData").'</td><td>';
|
|
||||||
print dol_print_date($bon->date_trans,'day');
|
|
||||||
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
|
|
||||||
print '<tr><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
|
|
||||||
print $bon->methodes_trans[$bon->method_trans];
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
if($bon->date_credit <> 0)
|
|
||||||
{
|
|
||||||
print '<tr><td width="20%">'.$langs->trans('CreditDate').'</td><td>';
|
|
||||||
print dol_print_date($bon->date_credit,'day');
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print '<table class="border" width="100%"><tr><td width="20%">';
|
|
||||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
|
||||||
$relativepath = 'receipts/'.$bon->ref;
|
|
||||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
|
||||||
print '</td></tr></table>';
|
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$ligne=new LignePrelevement($db,$user);
|
|
||||||
|
|
||||||
if ($page == -1) { $page = 0 ; }
|
|
||||||
|
|
||||||
$offset = $conf->liste_limit * $page ;
|
|
||||||
$pageprev = $page - 1;
|
|
||||||
$pagenext = $page + 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Liste des lignes de prelevement
|
|
||||||
*/
|
|
||||||
$sql = "SELECT pl.rowid, pl.statut, pl.amount";
|
|
||||||
$sql.= ", s.rowid as socid, s.nom as name";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
|
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
|
||||||
$sql.= " WHERE pl.fk_prelevement_bons = ".$prev_id;
|
|
||||||
$sql.= " AND pl.fk_prelevement_bons = pb.rowid";
|
|
||||||
$sql.= " AND pb.entity = ".$conf->entity;
|
|
||||||
$sql.= " AND pl.fk_soc = s.rowid";
|
|
||||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
|
||||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
|
||||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
|
||||||
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$num = $db->num_rows($result);
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
$urladd = "&id=".$prev_id;
|
|
||||||
|
|
||||||
print_barre_liste("", $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
|
|
||||||
print"\n<!-- debut table -->\n";
|
|
||||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print_liste_field_titre($langs->trans("Lines"),$_SERVER["PHP_SELF"],"pl.rowid",'',$urladd);
|
|
||||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",'',$urladd);
|
|
||||||
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"pl.amount","",$urladd,'align="center"');
|
|
||||||
print '<td colspan="2"> </td></tr>';
|
|
||||||
|
|
||||||
$var=false;
|
|
||||||
|
|
||||||
$total = 0;
|
|
||||||
|
|
||||||
while ($i < min($num,$conf->liste_limit))
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($result);
|
|
||||||
|
|
||||||
print "<tr ".$bc[$var]."><td>";
|
|
||||||
|
|
||||||
print $ligne->LibStatut($obj->statut,2);
|
|
||||||
print " ";
|
|
||||||
|
|
||||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
|
|
||||||
print substr('000000'.$obj->rowid, -6);
|
|
||||||
print '</a></td>';
|
|
||||||
|
|
||||||
$thirdparty=new Societe($db);
|
|
||||||
$thirdparty->fetch($obj->socid);
|
|
||||||
print '<td>';
|
|
||||||
print $thirdparty->getNomUrl(1);
|
|
||||||
print "</td>\n";
|
|
||||||
|
|
||||||
print '<td align="center">'.price($obj->amount)."</td>\n";
|
|
||||||
|
|
||||||
print '<td>';
|
|
||||||
|
|
||||||
if ($obj->statut == 3)
|
|
||||||
{
|
|
||||||
print '<b>'.$langs->trans("StatusRefused").'</b>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print " ";
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
$total += $obj->total_ttc;
|
|
||||||
$var=!$var;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($socid)
|
|
||||||
{
|
|
||||||
print "<tr ".$bc[$var]."><td>";
|
|
||||||
|
|
||||||
print '<td>Total</td>';
|
|
||||||
|
|
||||||
print '<td align="center">'.price($total)."</td>\n";
|
|
||||||
|
|
||||||
print '<td> </td>';
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
$db->free($result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
|
||||||
@ -2324,7 +2324,7 @@ class Form
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Charge dans cache la liste des conditions de paiements possibles
|
* Load into cache list of payment terms
|
||||||
*
|
*
|
||||||
* @return int Nb of lines loaded, <0 if KO
|
* @return int Nb of lines loaded, <0 if KO
|
||||||
*/
|
*/
|
||||||
@ -2358,7 +2358,7 @@ class Form
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//$this->cache_conditions_paiements=dol_sort_array($this->cache_conditions_paiements, 'label'); // We use the sortorder
|
//$this->cache_conditions_paiements=dol_sort_array($this->cache_conditions_paiements, 'label', 'asc', 0, 0, 1); // We use the field sortorder of table
|
||||||
|
|
||||||
return $num;
|
return $num;
|
||||||
}
|
}
|
||||||
@ -2403,7 +2403,7 @@ class Form
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->cache_availability = dol_sort_array($this->cache_availability, 'label');
|
$this->cache_availability = dol_sort_array($this->cache_availability, 'label', 'asc', 0, 0, 1);
|
||||||
|
|
||||||
return $num;
|
return $num;
|
||||||
}
|
}
|
||||||
@ -2484,7 +2484,7 @@ class Form
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->cache_demand_reason=dol_sort_array($tmparray, 'label', 'asc');
|
$this->cache_demand_reason=dol_sort_array($tmparray, 'label', 'asc', 0, 0, 1);
|
||||||
|
|
||||||
unset($tmparray);
|
unset($tmparray);
|
||||||
return $num;
|
return $num;
|
||||||
@ -2547,7 +2547,9 @@ class Form
|
|||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
$sql = "SELECT id, code, libelle, type";
|
$this->cache_types_paiements = array();
|
||||||
|
|
||||||
|
$sql = "SELECT id, code, libelle as label, type";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||||
$sql.= " WHERE active > 0";
|
$sql.= " WHERE active > 0";
|
||||||
|
|
||||||
@ -2561,14 +2563,15 @@ class Form
|
|||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
|
||||||
$label=($langs->trans("PaymentTypeShort".$obj->code)!=("PaymentTypeShort".$obj->code)?$langs->trans("PaymentTypeShort".$obj->code):($obj->libelle!='-'?$obj->libelle:''));
|
$label=($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code)!=("PaymentTypeShort".$obj->code)?$langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code):($obj->label!='-'?$obj->label:''));
|
||||||
|
$this->cache_types_paiements[$obj->id]['id'] =$obj->id;
|
||||||
$this->cache_types_paiements[$obj->id]['code'] =$obj->code;
|
$this->cache_types_paiements[$obj->id]['code'] =$obj->code;
|
||||||
$this->cache_types_paiements[$obj->id]['label']=$label;
|
$this->cache_types_paiements[$obj->id]['label']=$label;
|
||||||
$this->cache_types_paiements[$obj->id]['type'] =$obj->type;
|
$this->cache_types_paiements[$obj->id]['type'] =$obj->type;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->cache_types_paiements = dol_sort_array($this->cache_types_paiements, 'label');
|
$this->cache_types_paiements = dol_sort_array($this->cache_types_paiements, 'label', 'asc', 0, 0, 1);
|
||||||
|
|
||||||
return $num;
|
return $num;
|
||||||
}
|
}
|
||||||
@ -3579,7 +3582,7 @@ class Form
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Affiche formulaire de selection des modes de reglement
|
* Show form with payment mode
|
||||||
*
|
*
|
||||||
* @param string $page Page
|
* @param string $page Page
|
||||||
* @param int $selected Id mode pre-selectionne
|
* @param int $selected Id mode pre-selectionne
|
||||||
@ -3607,6 +3610,7 @@ class Form
|
|||||||
if ($selected)
|
if ($selected)
|
||||||
{
|
{
|
||||||
$this->load_cache_types_paiements();
|
$this->load_cache_types_paiements();
|
||||||
|
|
||||||
print $this->cache_types_paiements[$selected]['label'];
|
print $this->cache_types_paiements[$selected]['label'];
|
||||||
} else {
|
} else {
|
||||||
print " ";
|
print " ";
|
||||||
|
|||||||
@ -4557,12 +4557,13 @@ function dol_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0)
|
|||||||
*
|
*
|
||||||
* @param array $array Array to sort (array of array('key','otherkey1','otherkey2'...))
|
* @param array $array Array to sort (array of array('key','otherkey1','otherkey2'...))
|
||||||
* @param string $index Key in array to use for sorting criteria
|
* @param string $index Key in array to use for sorting criteria
|
||||||
* @param int $order Sort order
|
* @param int $order Sort order ('asc' or 'desc')
|
||||||
* @param int $natsort 1=use "natural" sort (natsort), 0=use "standard" sort (asort)
|
* @param int $natsort 1=use "natural" sort (natsort), 0=use "standard" sort (asort)
|
||||||
* @param int $case_sensitive 1=sort is case sensitive, 0=not case sensitive
|
* @param int $case_sensitive 1=sort is case sensitive, 0=not case sensitive
|
||||||
|
* @param int $keepindex If 0 and index key of array to sort is a numeric, than index will be rewrote. If 1 or index key is not numeric, key for index is kept after sorting.
|
||||||
* @return array Sorted array
|
* @return array Sorted array
|
||||||
*/
|
*/
|
||||||
function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0)
|
function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
|
||||||
{
|
{
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$order=strtolower($order);
|
$order=strtolower($order);
|
||||||
@ -4571,13 +4572,21 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensiti
|
|||||||
if (is_array($array) && $sizearray>0)
|
if (is_array($array) && $sizearray>0)
|
||||||
{
|
{
|
||||||
foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index];
|
foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index];
|
||||||
|
|
||||||
if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp);
|
if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
($case_sensitive) ? natsort($temp) : natcasesort($temp);
|
($case_sensitive) ? natsort($temp) : natcasesort($temp);
|
||||||
if($order!='asc') $temp=array_reverse($temp,TRUE);
|
if($order!='asc') $temp=array_reverse($temp,TRUE);
|
||||||
}
|
}
|
||||||
foreach(array_keys($temp) as $key) (is_numeric($key))? $sorted[]=$array[$key] : $sorted[$key]=$array[$key];
|
|
||||||
|
$sorted = array();
|
||||||
|
|
||||||
|
foreach(array_keys($temp) as $key)
|
||||||
|
{
|
||||||
|
(is_numeric($key) && empty($keepindex)) ? $sorted[]=$array[$key] : $sorted[$key]=$array[$key];
|
||||||
|
}
|
||||||
|
|
||||||
return $sorted;
|
return $sorted;
|
||||||
}
|
}
|
||||||
return $array;
|
return $array;
|
||||||
|
|||||||
@ -44,11 +44,6 @@ function prelevement_prepare_head(BonPrelevement $object)
|
|||||||
$head[$h][2] = 'prelevement';
|
$head[$h][2] = 'prelevement';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$object->id;
|
|
||||||
$head[$h][1] = $langs->trans("Lines");
|
|
||||||
$head[$h][2] = 'lines';
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("Bills");
|
$head[$h][1] = $langs->trans("Bills");
|
||||||
$head[$h][2] = 'invoices';
|
$head[$h][2] = 'invoices';
|
||||||
|
|||||||
@ -163,7 +163,7 @@ class CompanyBankAccount extends Account
|
|||||||
* Load record from database
|
* Load record from database
|
||||||
*
|
*
|
||||||
* @param int $id Id of record
|
* @param int $id Id of record
|
||||||
* @param int $socid Id of company
|
* @param int $socid Id of company. If this is filled, function will return the default RIB of company
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch($id, $socid=0)
|
function fetch($id, $socid=0)
|
||||||
@ -171,7 +171,7 @@ class CompanyBankAccount extends Account
|
|||||||
if (empty($id) && empty($socid)) return -1;
|
if (empty($id) && empty($socid)) return -1;
|
||||||
|
|
||||||
$sql = "SELECT rowid, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,";
|
$sql = "SELECT rowid, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,";
|
||||||
$sql.= " owner_address, default_rib, label, datec, tms as datem, frstrecur";
|
$sql.= " owner_address, default_rib, label, datec, tms as datem, rum, frstrecur";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_rib";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe_rib";
|
||||||
if ($id) $sql.= " WHERE rowid = ".$id;
|
if ($id) $sql.= " WHERE rowid = ".$id;
|
||||||
if ($socid) $sql.= " WHERE fk_soc = ".$socid." AND default_rib = 1";
|
if ($socid) $sql.= " WHERE fk_soc = ".$socid." AND default_rib = 1";
|
||||||
@ -199,6 +199,7 @@ class CompanyBankAccount extends Account
|
|||||||
$this->default_rib = $obj->default_rib;
|
$this->default_rib = $obj->default_rib;
|
||||||
$this->datec = $this->db->jdate($obj->datec);
|
$this->datec = $this->db->jdate($obj->datec);
|
||||||
$this->datem = $this->db->jdate($obj->datem);
|
$this->datem = $this->db->jdate($obj->datem);
|
||||||
|
$this->rum = $obj->rum;
|
||||||
$this->frstrecur = $obj->frstrecur;
|
$this->frstrecur = $obj->frstrecur;
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|||||||
@ -2132,17 +2132,34 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return bank number property of thirdparty
|
* Return bank number property of thirdparty (label or rum)
|
||||||
*
|
*
|
||||||
|
* @param string $mode 'label' or 'rum'
|
||||||
* @return string Bank number
|
* @return string Bank number
|
||||||
*/
|
*/
|
||||||
function display_rib()
|
function display_rib($mode='label')
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
|
||||||
$bac = new CompanyBankAccount($this->db);
|
$bac = new CompanyBankAccount($this->db);
|
||||||
$bac->fetch(0,$this->id);
|
$bac->fetch(0,$this->id);
|
||||||
|
|
||||||
|
if ($mode == 'label')
|
||||||
|
{
|
||||||
return $bac->getRibLabel(true);
|
return $bac->getRibLabel(true);
|
||||||
}
|
}
|
||||||
|
elseif ($mode == 'rum')
|
||||||
|
{
|
||||||
|
if (empty($bac->rum))
|
||||||
|
{
|
||||||
|
$prelevement = new BonPrelevement($this->db);
|
||||||
|
$bac->fetch_thirdparty();
|
||||||
|
$bac->rum = $prelevement->buildRumNumber($bac->thirdparty->code_client, $bac->datec, $bac->id);
|
||||||
|
}
|
||||||
|
return $bac->rum;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'BadParameterToFunctionDisplayRib';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return Array of RIB
|
* Return Array of RIB
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
||||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||||
@ -396,8 +396,10 @@ if ($socid && $action != 'edit' && $action != "create")
|
|||||||
|
|
||||||
if (! empty($conf->prelevement->enabled))
|
if (! empty($conf->prelevement->enabled))
|
||||||
{
|
{
|
||||||
|
// RUM
|
||||||
print '<td>'.$prelevement->buildRumNumber($soc->code_client, $rib->datec, $rib->id).'</td>';
|
print '<td>'.$prelevement->buildRumNumber($soc->code_client, $rib->datec, $rib->id).'</td>';
|
||||||
|
|
||||||
|
// FRSTRECUR
|
||||||
print '<td>'.$rib->frstrecur.'</td>';
|
print '<td>'.$rib->frstrecur.'</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,9 +551,13 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
if (empty($account->rum)) $account->rum = $prelevement->buildRumNumber($soc->code_client, $account->datec, $account->id);
|
||||||
|
|
||||||
|
// RUM
|
||||||
print '<tr><td width="35%">'.$langs->trans("RUM").'</td>';
|
print '<tr><td width="35%">'.$langs->trans("RUM").'</td>';
|
||||||
print '<td colspan="4">'.$account->rum.'</td></tr>';
|
print '<td colspan="4">'.$account->rum.'</td></tr>';
|
||||||
|
|
||||||
|
// FRSTRECUR
|
||||||
print '<tr><td width="35%">'.$langs->trans("WithdrawMode").'</td>';
|
print '<tr><td width="35%">'.$langs->trans("WithdrawMode").'</td>';
|
||||||
print '<td colspan="4"><input size="30" type="text" name="frstrecur" value="'.(GETPOST('frstrecur')?GETPOST('frstrecur'):$account->frstrecur).'"></td></tr>';
|
print '<td colspan="4"><input size="30" type="text" name="frstrecur" value="'.(GETPOST('frstrecur')?GETPOST('frstrecur'):$account->frstrecur).'"></td></tr>';
|
||||||
|
|
||||||
@ -640,9 +646,11 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
// RUM
|
||||||
print '<tr><td width="35%">'.$langs->trans("RUM").'</td>';
|
print '<tr><td width="35%">'.$langs->trans("RUM").'</td>';
|
||||||
print '<td colspan="4">'.$langs->trans("RUMWillBeGenerated").'</td></tr>';
|
print '<td colspan="4">'.$langs->trans("RUMWillBeGenerated").'</td></tr>';
|
||||||
|
|
||||||
|
// FRSTRECUR
|
||||||
print '<tr><td width="35%">'.$langs->trans("WithdrawMode").'</td>';
|
print '<tr><td width="35%">'.$langs->trans("WithdrawMode").'</td>';
|
||||||
print '<td colspan="4"><input size="30" type="text" name="frstrecur" value="'.(isset($_POST['frstrecur'])?GETPOST('frstrecur'):'FRST').'"></td></tr>';
|
print '<td colspan="4"><input size="30" type="text" name="frstrecur" value="'.(isset($_POST['frstrecur'])?GETPOST('frstrecur'):'FRST').'"></td></tr>';
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user