mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Qual: Debug and clean notification module
This commit is contained in:
parent
d53cb49bf9
commit
e1094fc293
|
|
@ -68,6 +68,7 @@ For users:
|
|||
- Fix: Better Postgresql compatibility.
|
||||
- Fix: Numbering module for invoices use same number for invoice
|
||||
and credit note if mask is same.
|
||||
- Fix: Debug and clean withdraw module.
|
||||
|
||||
For developers:
|
||||
- New: External modules can add tabs on agenda views.
|
||||
|
|
|
|||
|
|
@ -2463,7 +2463,7 @@ else
|
|||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Montants
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
|
||||
print '<td align="right" colspan="2" nowrap>'.price($object->total_ht).'</td>';
|
||||
print '<td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
|
||||
|
|
|
|||
|
|
@ -75,42 +75,208 @@ if ($id > 0 || ! empty($ref))
|
|||
$author->fetch($object->user_author);
|
||||
}
|
||||
|
||||
$head = facture_prepare_head($object);
|
||||
$head = facture_prepare_head($object);
|
||||
dol_fiche_head($head, 'preview', $langs->trans("InvoiceCustomer"), 0, 'bill');
|
||||
|
||||
|
||||
$totalpaye = $object->getSommePaiement();
|
||||
|
||||
/*
|
||||
* Facture
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
$rowspan=3;
|
||||
$rowspan=3;
|
||||
|
||||
// Reference
|
||||
print '<tr><td width="20%">'.$langs->trans('Ref').'</td><td colspan="5">'.$object->ref.'</td></tr>';
|
||||
|
||||
// Societe
|
||||
// Societe
|
||||
print '<tr><td>'.$langs->trans("Company").'</td>';
|
||||
print '<td colspan="5">'.$soc->getNomUrl(1,'compta').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Dates
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
print '<td colspan="3">'.dol_print_date($object->date,"daytext").'</td>';
|
||||
print '<td>'.$langs->trans("DateMaxPayment").'</td><td>' . dol_print_date($object->date_lim_reglement,"daytext");
|
||||
if ($object->paye == 0 && $object->date_lim_reglement < ($now - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
print "</td></tr>";
|
||||
// Type
|
||||
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="5">';
|
||||
print $object->getLibType();
|
||||
if ($object->type == 1)
|
||||
{
|
||||
$facreplaced=new Facture($db);
|
||||
$facreplaced->fetch($object->fk_facture_source);
|
||||
print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
|
||||
}
|
||||
if ($object->type == 2)
|
||||
{
|
||||
$facusing=new Facture($db);
|
||||
$facusing->fetch($object->fk_facture_source);
|
||||
print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')';
|
||||
}
|
||||
|
||||
// Conditions et modes de reglement
|
||||
print '<tr><td>'.$langs->trans("PaymentConditions").'</td><td colspan="3">';
|
||||
$html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$object->id",$object->cond_reglement_id,"none");
|
||||
print '</td>';
|
||||
print '<td width="25%">'.$langs->trans("PaymentMode").'</td><td width="25%">';
|
||||
$html->form_modes_reglement($_SERVER["PHP_SELF"]."?facid=$object->id",$object->mode_reglement_id,"none");
|
||||
$facidavoir=$object->getListIdAvoirFromInvoice();
|
||||
if (sizeof($facidavoir) > 0)
|
||||
{
|
||||
print ' ('.$langs->transnoentities("InvoiceHasAvoir");
|
||||
$i=0;
|
||||
foreach($facidavoir as $id)
|
||||
{
|
||||
if ($i==0) print ' ';
|
||||
else print ',';
|
||||
$facavoir=new Facture($db);
|
||||
$facavoir->fetch($id);
|
||||
print $facavoir->getNomUrl(1);
|
||||
}
|
||||
print ')';
|
||||
}
|
||||
if ($objectidnext > 0)
|
||||
{
|
||||
$facthatreplace=new Facture($db);
|
||||
$facthatreplace->fetch($objectidnext);
|
||||
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Remise globale
|
||||
print '<tr><td>'.$langs->trans('GlobalDiscount').'</td>';
|
||||
print '<td colspan="3">'.$object->remise_percent.'%</td>';
|
||||
// Relative and absolute discounts
|
||||
$addabsolutediscount=' <a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?facid='.$object->id.'">'.$langs->trans("AddGlobalDiscount").'</a>';
|
||||
$addcreditnote=' <a href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$soc->id.'&type=2&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?facid='.$object->id.'">'.$langs->trans("AddCreditNote").'</a>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Discounts');
|
||||
print '</td><td colspan="5">';
|
||||
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
|
||||
if ($absolute_discount > 0)
|
||||
{
|
||||
print '. ';
|
||||
if ($object->statut > 0 || $object->type == 2 || $object->type == 3)
|
||||
{
|
||||
if ($object->statut == 0)
|
||||
{
|
||||
print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->monnaie));
|
||||
print '. ';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->statut < 1 || $object->type == 2 || $object->type == 3)
|
||||
{
|
||||
$text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->monnaie));
|
||||
print '<br>'.$text.'.<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->monnaie));
|
||||
$text2=$langs->trans("AbsoluteDiscountUse");
|
||||
print $html->textwithpicto($text,$text2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remise dispo de type remise fixe (not credit note)
|
||||
$filter='fk_facture_source IS NULL';
|
||||
print '<br>';
|
||||
$html->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id',$soc->id, $absolute_discount, $filter, $resteapayer, ' - '.$addabsolutediscount);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($absolute_creditnote > 0) // If not linke will be added later
|
||||
{
|
||||
if ($object->statut == 0 && $object->type != 2 && $object->type != 3) print ' - '.$addabsolutediscount.'<br>';
|
||||
else print '.';
|
||||
}
|
||||
else print '. ';
|
||||
}
|
||||
if ($absolute_creditnote > 0)
|
||||
{
|
||||
// If validated, we show link "add credit note to payment"
|
||||
if ($object->statut != 1 || $object->type == 2 || $object->type == 3)
|
||||
{
|
||||
if ($object->statut == 0 && $object->type != 3)
|
||||
{
|
||||
$text=$langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->monnaie));
|
||||
print $html->textwithpicto($text,$langs->trans("CreditNoteDepositUse"));
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->monnaie)).'.';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remise dispo de type avoir
|
||||
$filter='fk_facture_source IS NOT NULL';
|
||||
if (! $absolute_discount) print '<br>';
|
||||
$html->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filter, $resteapayer);
|
||||
}
|
||||
}
|
||||
if (! $absolute_discount && ! $absolute_creditnote)
|
||||
{
|
||||
print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
if ($object->statut == 0 && $object->type != 2 && $object->type != 3) print ' - '.$addabsolutediscount.'<br>';
|
||||
else print '. ';
|
||||
}
|
||||
/*if ($object->statut == 0 && $object->type != 2 && $object->type != 3)
|
||||
{
|
||||
if (! $absolute_discount && ! $absolute_creditnote) print '<br>';
|
||||
//print ' - ';
|
||||
print $addabsolutediscount;
|
||||
//print ' - '.$addcreditnote; // We disbale link to credit note
|
||||
}*/
|
||||
print '</td></tr>';
|
||||
|
||||
// Dates
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
print '<td colspan="5">'.dol_print_date($object->date,"daytext").'</td>';
|
||||
print "</tr>";
|
||||
|
||||
// Date payment term
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DateMaxPayment');
|
||||
print '</td>';
|
||||
if ($object->type != 2 && $action != 'editpaymentterm' && $object->brouillon && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&facid='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="5">';
|
||||
if ($object->type != 2)
|
||||
{
|
||||
if ($action == 'editpaymentterm')
|
||||
{
|
||||
$html->form_date($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->date_lim_reglement,'paymentterm');
|
||||
}
|
||||
else
|
||||
{
|
||||
print dol_print_date($object->date_lim_reglement,'daytext');
|
||||
if ($object->date_lim_reglement < ($now - $conf->facture->client->warning_delay) && ! $object->paye && $object->statut == 1 && ! $object->am) print img_warning($langs->trans('Late'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Conditions reglement
|
||||
print '<tr><td>'.$langs->trans("PaymentConditionsShort").'</td><td colspan="5">';
|
||||
$html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$object->id",$object->cond_reglement_id,"none");
|
||||
print '</td>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Mode de reglement
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
if ($action != 'editmode' && $object->brouillon && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&facid='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editmode')
|
||||
{
|
||||
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->mode_reglement_id,'mode_reglement_id');
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->mode_reglement_id,'none');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$nbrows=5;
|
||||
if ($conf->projet->enabled) $nbrows++;
|
||||
|
|
@ -121,7 +287,7 @@ if ($id > 0 || ! empty($ref))
|
|||
*/
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir_output = $conf->facture->dir_output . "/";
|
||||
$filepath = $dir_output . $objectref . "/";
|
||||
$filepath = $dir_output . $objectref . "/";
|
||||
$file = $filepath . $objectref . ".pdf";
|
||||
$filedetail = $filepath . $objectref . "-detail.pdf";
|
||||
$relativepath = $objectref.'/'.$objectref.'.pdf';
|
||||
|
|
@ -164,15 +330,15 @@ if ($id > 0 || ! empty($ref))
|
|||
// Conversion du PDF en image png si fichier png non existant
|
||||
if (! file_exists($fileimage) && ! file_exists($fileimagebis))
|
||||
{
|
||||
if (class_exists("Imagick"))
|
||||
{
|
||||
$ret = dol_convert_file($file);
|
||||
if ($ret < 0) $error++;
|
||||
if (class_exists("Imagick"))
|
||||
{
|
||||
$ret = dol_convert_file($file);
|
||||
if ($ret < 0) $error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("other");
|
||||
print '<font class="error">'.$langs->trans("ErrorNoImagickReadimage").'</font>';
|
||||
$langs->load("other");
|
||||
print '<font class="error">'.$langs->trans("ErrorNoImagickReadimage").'</font>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -182,19 +348,19 @@ if ($id > 0 || ! empty($ref))
|
|||
print '<td align="right" colspan="2"><b>'.price($object->total_ht).'</b></td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td align="right" colspan="2" nowrap>'.price($object->total_tva).'</td>';
|
||||
print '<td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right" colspan="2" nowrap>'.price($object->total_ttc).'</td>';
|
||||
print '<td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td align="right" colspan="2" nowrap>'.price($object->total_tva).'</td>';
|
||||
print '<td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right" colspan="2" nowrap>'.price($object->total_ttc).'</td>';
|
||||
print '<td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans('Status').'</td><td align="left" colspan="3">'.($object->getLibStatut()).'</td></tr>';
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans('Status').'</td><td align="left" colspan="3">'.($object->getLibStatut(4,$totalpaye)).'</td></tr>';
|
||||
|
||||
// Projet
|
||||
// Projet
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$langs->load("projects");
|
||||
print '<tr>';
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
if ($object->fk_project > 0)
|
||||
{
|
||||
|
|
@ -206,7 +372,7 @@ if ($id > 0 || ! empty($ref))
|
|||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
|
@ -223,22 +389,22 @@ if ($id > 0 || ! empty($ref))
|
|||
// Si fichier png PDF d'1 page trouve
|
||||
if (file_exists($fileimage))
|
||||
{
|
||||
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($relativepathimage).'">';
|
||||
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($relativepathimage).'">';
|
||||
}
|
||||
// Si fichier png PDF de plus d'1 page trouve
|
||||
elseif (file_exists($fileimagebis))
|
||||
{
|
||||
$multiple = preg_replace('/\.png/','',$relativepath) . "-";
|
||||
$multiple = preg_replace('/\.png/','',$relativepath) . "-";
|
||||
|
||||
for ($i = 0; $i < 20; $i++)
|
||||
{
|
||||
$preview = $multiple.$i.'.png';
|
||||
for ($i = 0; $i < 20; $i++)
|
||||
{
|
||||
$preview = $multiple.$i.'.png';
|
||||
|
||||
if (file_exists($dir_output.$preview))
|
||||
{
|
||||
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($preview).'"><p>';
|
||||
}
|
||||
}
|
||||
if (file_exists($dir_output.$preview))
|
||||
{
|
||||
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($preview).'"><p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2207,14 +2207,65 @@ class Facture extends CommonObject
|
|||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->lasterror();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return amount (with tax) of all credit notes and deposits invoices used by invoice
|
||||
* \return int <0 if KO, Sum of credit notes and deposits amount otherwise
|
||||
* Return list of payments
|
||||
* @return Array with list of payments
|
||||
*/
|
||||
function getListOfPayments($filtertype='')
|
||||
{
|
||||
$retarray=array();
|
||||
|
||||
$table='paiement_facture';
|
||||
$table2='paiement';
|
||||
$field='fk_facture';
|
||||
$field2='fk_paiement';
|
||||
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
|
||||
{
|
||||
$table='paiementfourn_facturefourn';
|
||||
$table2='paiementfourn';
|
||||
$field='fk_facturefourn';
|
||||
$field2='fk_paiementfourn';
|
||||
}
|
||||
|
||||
$sql = 'SELECT pf.amount, p.fk_paiement, p.datep, t.code';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$table.' as pf, '.MAIN_DB_PREFIX.$table2.' as p, '.MAIN_DB_PREFIX.'c_paiement as t';
|
||||
$sql.= ' WHERE pf.'.$field.' = '.$this->id;
|
||||
$sql.= ' AND pf.'.$field2.' = p.rowid';
|
||||
$sql.= ' AND p.fk_paiement = t.rowid';
|
||||
if ($filtertype) $sql.=" AND t.code='PRE'";
|
||||
|
||||
dol_syslog("Facture::getListOfPayments sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$retarray[]=array('amount'=>$obj->amount,'type'=>$obj->code, 'date'=>$obj->datep);
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
return $retarray;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_print_error($this->db);
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return amount (with tax) of all credit notes and deposits invoices used by invoice
|
||||
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise
|
||||
*/
|
||||
function getSumCreditNotesUsed()
|
||||
{
|
||||
|
|
@ -2234,8 +2285,8 @@ class Facture extends CommonObject
|
|||
}
|
||||
|
||||
/**
|
||||
* \brief Return amount (with tax) of all deposits invoices used by invoice
|
||||
* \return int <0 if KO, Sum of deposits amount otherwise
|
||||
* Return amount (with tax) of all deposits invoices used by invoice
|
||||
* @return int <0 if KO, Sum of deposits amount otherwise
|
||||
*/
|
||||
function getSumDepositsUsed()
|
||||
{
|
||||
|
|
@ -2902,9 +2953,9 @@ class Facture extends CommonObject
|
|||
}
|
||||
|
||||
/**
|
||||
* \brief Supprime une demande de prelevement
|
||||
* \param user utilisateur creant la demande
|
||||
* \param did id de la demande a supprimer
|
||||
* Supprime une demande de prelevement
|
||||
* @param user utilisateur creant la demande
|
||||
* @param did id de la demande a supprimer
|
||||
*/
|
||||
function demande_prelevement_delete($user, $did)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -400,6 +400,7 @@ if ($_REQUEST["facid"] > 0 || $_REQUEST["ref"])
|
|||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Withdrawal request
|
||||
*/
|
||||
|
|
@ -443,6 +444,9 @@ if ($_REQUEST["facid"] > 0 || $_REQUEST["ref"])
|
|||
print "</div><br>\n";
|
||||
|
||||
|
||||
print $langs->trans("DoStandingOrdersBeforePayments").'<br>';
|
||||
|
||||
|
||||
/*
|
||||
* Withdrawals
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
|
|
@ -246,7 +246,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||
$formquestion[$i++]=array('type' => 'hidden','name' => 'socid', 'value' => $facture->socid);
|
||||
$formquestion[$i++]=array('type' => 'hidden','name' => 'type', 'value' => $facture->type);
|
||||
}
|
||||
|
||||
|
||||
// Invoice with Paypal transaction
|
||||
if ($conf->paypalplus->enabled && $conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT && ! empty($facture->ref_int))
|
||||
{
|
||||
|
|
@ -285,7 +285,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||
print '</script>'."\n";
|
||||
}
|
||||
|
||||
print '<form name="add_paiement" action="paiement.php" method="post">';
|
||||
print '<form name="add_paiement" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add_paiement">';
|
||||
print '<input type="hidden" name="facid" value="'.$facture->id.'">';
|
||||
|
|
@ -634,6 +634,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||
{
|
||||
// print '<tr><td colspan="3" align="center">';
|
||||
print '<center><br><input type="checkbox" checked="checked" name="closepaidinvoices"> '.$langs->trans("ClosePaidInvoicesAutomatically");
|
||||
/*if ($conf->prelevement->enabled)
|
||||
{
|
||||
$langs->load("withdrawals");
|
||||
if ($conf->global->WITHDRAW_DISABLE_AUTOCREATE_ONPAYMENTS) print '<br>'.$langs->trans("IfInvoiceNeedOnWithdrawPaymentWontBeClosed");
|
||||
}*/
|
||||
print '<br><input type="submit" class="button" value="'.$langs->trans('Save').'"></center>';
|
||||
// print '</td></tr>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,12 +185,25 @@ class Paiement extends CommonObject
|
|||
$deposits=$invoice->getSumDepositsUsed();
|
||||
$alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT');
|
||||
$remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
|
||||
|
||||
if ($remaintopay == 0)
|
||||
// If there is withdrawals request to do and not done yet, we wait before closing.
|
||||
$mustwait=0;
|
||||
$listofpayments=$invoice->getListOfPayments();
|
||||
foreach($listofpayments as $paym)
|
||||
{
|
||||
$result=$invoice->set_paid($user,'','');
|
||||
// This payment might be this one or a previous one
|
||||
if ($paym['type']=='PRE')
|
||||
{
|
||||
if ($conf->prelevement->enabled)
|
||||
{
|
||||
// TODO Check if this payment has a withdraw request
|
||||
// if not, $mustwait++; // This will disable automatic close on invoice to allow to process
|
||||
}
|
||||
}
|
||||
}
|
||||
else dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing.");
|
||||
|
||||
if ($remaintopay) dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing more.");
|
||||
else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more.");
|
||||
else $result=$invoice->set_paid($user,'','');
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -282,7 +295,7 @@ class Paiement extends CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
// Efface la ligne de paiement (dans paiement_facture et paiement)
|
||||
// Delete payment (into paiement_facture and paiement)
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'paiement_facture';
|
||||
$sql.= ' WHERE fk_paiement = '.$this->id;
|
||||
$result = $this->db->query($sql);
|
||||
|
|
@ -430,7 +443,7 @@ class Paiement extends CommonObject
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class BonPrelevement extends CommonObject
|
|||
function BonPrelevement($DB, $filename='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
|
||||
$error = 0;
|
||||
$this->db = $DB;
|
||||
|
||||
|
|
@ -84,8 +84,8 @@ class BonPrelevement extends CommonObject
|
|||
$this->methodes_trans[0] = "Internet";
|
||||
|
||||
$this->_fetched = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
$langs->load("withdrawals");
|
||||
$this->labelstatut[0]=$langs->trans("StatusWaiting");
|
||||
$this->labelstatut[1]=$langs->trans("StatusTrans");
|
||||
|
|
@ -102,7 +102,7 @@ class BonPrelevement extends CommonObject
|
|||
* @param amount amount of invoice
|
||||
* @param code_banque code of bank withdrawal
|
||||
* @param code_guichet code of bank's office
|
||||
* @param number bank account number
|
||||
* @param number bank account number
|
||||
* @param number_key number key of account number
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
|
|
@ -159,7 +159,7 @@ class BonPrelevement extends CommonObject
|
|||
* @param amount amount of invoice
|
||||
* @param code_banque code of bank withdrawal
|
||||
* @param code_guichet code of bank's office
|
||||
* @param number bank account number
|
||||
* @param number bank account number
|
||||
* @param number_key number key of account number
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
|
|
@ -235,7 +235,7 @@ class BonPrelevement extends CommonObject
|
|||
/**
|
||||
* Read errors
|
||||
* @param error id of error
|
||||
* @return array of errors
|
||||
* @return array of errors
|
||||
*/
|
||||
function ReadError($error)
|
||||
{
|
||||
|
|
@ -386,7 +386,7 @@ class BonPrelevement extends CommonObject
|
|||
/**
|
||||
* Set withdrawal to creditet status
|
||||
* @param user id of user
|
||||
* @param date date of action
|
||||
* @param date date of action
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function set_infocredit($user, $date)
|
||||
|
|
@ -411,18 +411,16 @@ class BonPrelevement extends CommonObject
|
|||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
|
||||
|
||||
$langs->load('withdrawals');
|
||||
$subject = $langs->trans("InfoCreditSubject", $this->ref);
|
||||
$subject = $langs->trans("InfoCreditSubject", $this->ref);
|
||||
$message = $langs->trans("InfoCreditMessage", $this->ref, dol_print_date($date,'dayhour'));
|
||||
|
||||
$this->Notify($user, "cr", $subject, $message);
|
||||
|
||||
|
||||
//Add payment of withdrawal into bank
|
||||
$bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT;
|
||||
$facs = array();
|
||||
$amounts = array();
|
||||
|
||||
|
||||
$facs = $this->_get_list_factures();
|
||||
|
||||
for ($i = 0 ; $i < sizeof($facs) ; $i++)
|
||||
|
|
@ -437,14 +435,14 @@ class BonPrelevement extends CommonObject
|
|||
$paiement->amounts = $amounts;
|
||||
$paiement->paiementid = 3; //
|
||||
$paiement->num_paiement = $this->ref ;
|
||||
|
||||
|
||||
$paiement_id = $paiement->create($user);
|
||||
if ($paiement_id < 0)
|
||||
{
|
||||
dol_syslog("BonPrelevement::set_credite AddPayment Error");
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$result=$paiement->addPaymentToBank($user,'payment','(WithdrawalPayment)',$bankaccount);
|
||||
if ($result < 0)
|
||||
|
|
@ -453,7 +451,7 @@ class BonPrelevement extends CommonObject
|
|||
$error++;
|
||||
}
|
||||
}
|
||||
// Update prelevement line
|
||||
// Update prelevement line
|
||||
// TODO: Translate to ligne-prelevement.class.php
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
|
||||
$sql.= " SET statut = 2";
|
||||
|
|
@ -464,7 +462,7 @@ class BonPrelevement extends CommonObject
|
|||
dol_syslog("BonPrelevement::set_credite Update lines Error");
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -509,7 +507,7 @@ class BonPrelevement extends CommonObject
|
|||
/**
|
||||
* Set withdrawal to transmited status
|
||||
* @param user id of user
|
||||
* @param date date of action
|
||||
* @param date date of action
|
||||
* @param method method of transmision to bank
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
|
|
@ -534,11 +532,11 @@ class BonPrelevement extends CommonObject
|
|||
{
|
||||
$this->method_trans = $method;
|
||||
$langs->load('withdrawals');
|
||||
$subject = $langs->trans("InfoTransSubject", $this->ref);
|
||||
$subject = $langs->trans("InfoTransSubject", $this->ref);
|
||||
$message = $langs->trans("InfoTransMessage", $this->ref, $user->prenom, $user->nom);
|
||||
$message .=$langs->trans("InfoTransData", price($this->amount), $this->methodes_trans[$this->method_trans], dol_print_date($date,'day'));
|
||||
|
||||
$this->Notify($user,"tr", $subject, $message, 1);
|
||||
// TODO Call trigger to create a notification using notification module
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -551,7 +549,7 @@ class BonPrelevement extends CommonObject
|
|||
* End of procedure
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
if ($error == 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
|
|
@ -574,67 +572,7 @@ class BonPrelevement extends CommonObject
|
|||
}
|
||||
|
||||
/**
|
||||
* Notify withdrawal actions
|
||||
* @param user id of user
|
||||
* @param action notify action
|
||||
* @param subject message subject
|
||||
* @param message message
|
||||
* @param joinfile files joineds
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function Notify($user, $action, $subject, $message, $joinfile=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$message .= "\n\n--\n";
|
||||
$message .= $langs->trans("InfoFoot"); //"Ceci est un message automatique envoye par Dolibarr";
|
||||
|
||||
$sql = "SELECT u.name, u.firstname, u.email";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."prelevement_notifications as pn";
|
||||
$sql.= " WHERE pn.action = '".$action."'";
|
||||
$sql.= " AND u.rowid = pn.fk_user";
|
||||
$sql.= " AND u.entity IN (0,".$conf->entity.")";
|
||||
dol_syslog("BonPrelevement::Notify: ".$sql, LOG_CRIT);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
||||
|
||||
$sendto = $obj->firstname . " " .$obj->name . "<".$obj->email.">";
|
||||
$from = $user->prenom . " " .$user->nom . "<".$user->email.">";
|
||||
$arr_file = array();
|
||||
$arr_mime = array();
|
||||
$arr_name = array();
|
||||
$msgishtml=0;
|
||||
|
||||
if ($joinfile == 1)
|
||||
{
|
||||
$arr_file = array($conf->prelevement->dir_output.'/receipts/'.$this->ref.'.ps');
|
||||
$arr_mime = array("application/ps");
|
||||
$arr_name = array($this->ref.".ps");
|
||||
}
|
||||
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,
|
||||
$arr_file,$arr_mime,$arr_name,
|
||||
'', '', 0, $msgishtml);
|
||||
|
||||
$result=$mailfile->sendfile();
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get invoice list
|
||||
* Get invoice list
|
||||
* @return array id of invoices
|
||||
*/
|
||||
function _get_list_factures()
|
||||
|
|
@ -775,7 +713,7 @@ class BonPrelevement extends CommonObject
|
|||
|
||||
require_once (DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
|
||||
|
||||
|
||||
$error = 0;
|
||||
|
||||
$datetimeprev = time();
|
||||
|
|
@ -986,17 +924,17 @@ class BonPrelevement extends CommonObject
|
|||
// Fetch invoice
|
||||
$fact = new Facture($this->db);
|
||||
$fact->fetch($fac[0]);
|
||||
/*
|
||||
* Add standing order
|
||||
*
|
||||
*
|
||||
* $fac[3] : banque
|
||||
* $fac[4] : guichet
|
||||
* $fac[5] : number
|
||||
* $fac[6] : cle rib
|
||||
* $fac[7] : amount
|
||||
* $fac[8] : client nom
|
||||
* $fac[2] : client id
|
||||
/*
|
||||
* Add standing order
|
||||
*
|
||||
*
|
||||
* $fac[3] : banque
|
||||
* $fac[4] : guichet
|
||||
* $fac[5] : number
|
||||
* $fac[6] : cle rib
|
||||
* $fac[7] : amount
|
||||
* $fac[8] : client nom
|
||||
* $fac[2] : client id
|
||||
*/
|
||||
$ri = $bonprev->AddFacture($fac[0], $fac[2], $fac[8], $fac[7],
|
||||
$fac[3], $fac[4], $fac[5], $fac[6]);
|
||||
|
|
@ -1028,7 +966,7 @@ class BonPrelevement extends CommonObject
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1053,7 +991,7 @@ class BonPrelevement extends CommonObject
|
|||
$bonprev->emetteur_code_guichet = $conf->global->PRELEVEMENT_CODE_GUICHET;
|
||||
$bonprev->emetteur_numero_compte = $conf->global->PRELEVEMENT_NUMERO_COMPTE;
|
||||
$bonprev->emetteur_number_key = $conf->global->PRELEVEMENT_NUMBER_KEY;
|
||||
|
||||
|
||||
$bonprev->factures = $factures_prev_id;
|
||||
|
||||
//Build file
|
||||
|
|
@ -1190,7 +1128,7 @@ class BonPrelevement extends CommonObject
|
|||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)";
|
||||
$sql .= " VALUES (".$db->idate(mktime()).",".$user.", 'NULL', 'NULL', ".$action.")";
|
||||
|
||||
|
||||
dol_syslog("adnotiff: ".$sql);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
|
|
@ -1230,7 +1168,7 @@ class BonPrelevement extends CommonObject
|
|||
//Build file for Spain
|
||||
if ($mysoc->pays_code=='ES')
|
||||
{
|
||||
if ($conf->esaeb->enabled)
|
||||
if ($conf->esaeb->enabled)
|
||||
{
|
||||
//Head
|
||||
$esaeb19 = new AEB19DocWritter;
|
||||
|
|
@ -1246,18 +1184,18 @@ class BonPrelevement extends CommonObject
|
|||
$sql.= " WHERE pl.fk_prelevement_bons = ".$this->id;
|
||||
$sql.= " AND pl.rowid = pf.fk_prelevement_lignes";
|
||||
$sql.= " AND pf.fk_facture = f.rowid";
|
||||
|
||||
|
||||
//Lines
|
||||
$i = 0;
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
|
||||
$esaeb19->agregaRecibo($idOrdenante,
|
||||
"idcliente".$i+1,
|
||||
$obj->client_nom,
|
||||
|
|
@ -1267,21 +1205,21 @@ class BonPrelevement extends CommonObject
|
|||
$obj->number,
|
||||
$obj->amount,
|
||||
"Fra.".$obj->facnumber." ".$obj->amount);
|
||||
|
||||
|
||||
$this->total = $this->total + $obj->amount;
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
$result = -2;
|
||||
}
|
||||
|
||||
|
||||
fputs ($this->file, $esaeb19->generaRemesa());
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$this->total = 0;
|
||||
$sql = "SELECT pl.amount";
|
||||
|
|
@ -1292,14 +1230,14 @@ class BonPrelevement extends CommonObject
|
|||
$sql.= " WHERE pl.fk_prelevement_bons = ".$this->id;
|
||||
$sql.= " AND pl.rowid = pf.fk_prelevement_lignes";
|
||||
$sql.= " AND pf.fk_facture = f.rowid";
|
||||
|
||||
|
||||
//Lines
|
||||
$i = 0;
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
|
@ -1314,9 +1252,9 @@ class BonPrelevement extends CommonObject
|
|||
$langs->load('withdrawals');
|
||||
fputs ($this->file, $langs->trans('WithdrawalFileNotCapable'));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Build file for France
|
||||
elseif ($mysoc->pays_code=='FR')
|
||||
{
|
||||
|
|
@ -1376,9 +1314,9 @@ class BonPrelevement extends CommonObject
|
|||
|
||||
$this->EnregTotal($this->total);
|
||||
}
|
||||
|
||||
//Build file for Other Countries with unknow format
|
||||
else
|
||||
|
||||
//Build file for Other Countries with unknow format
|
||||
else
|
||||
{
|
||||
$this->total = 0;
|
||||
$sql = "SELECT pl.amount";
|
||||
|
|
@ -1389,14 +1327,14 @@ class BonPrelevement extends CommonObject
|
|||
$sql.= " WHERE pl.fk_prelevement_bons = ".$this->id;
|
||||
$sql.= " AND pl.rowid = pf.fk_prelevement_lignes";
|
||||
$sql.= " AND pf.fk_facture = f.rowid";
|
||||
|
||||
|
||||
//Lines
|
||||
$i = 0;
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
|
@ -1416,7 +1354,7 @@ class BonPrelevement extends CommonObject
|
|||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($this->file, octdec($conf->global->MAIN_UMASK));
|
||||
return $result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1611,7 +1549,7 @@ class BonPrelevement extends CommonObject
|
|||
|
||||
fputs ($this->file, "\n");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return status label of object
|
||||
* @param mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto
|
||||
|
|
@ -1636,7 +1574,7 @@ class BonPrelevement extends CommonObject
|
|||
{
|
||||
return $langs->trans($this->labelstatut[$statut]);
|
||||
}
|
||||
|
||||
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut0').' '.$langs->trans($this->labelstatut[$statut]);
|
||||
|
|
@ -1649,7 +1587,7 @@ class BonPrelevement extends CommonObject
|
|||
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
|
||||
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut4');
|
||||
}
|
||||
|
||||
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut0');
|
||||
|
|
@ -1657,7 +1595,7 @@ class BonPrelevement extends CommonObject
|
|||
if ($statut==2) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut4');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
|
|
@ -76,7 +76,9 @@ print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</
|
|||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("NbOfInvoiceToWithdraw").'</td>';
|
||||
print '<td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0&mainmenu=bank">';
|
||||
print $bprev->NbFactureAPrelever();
|
||||
print '</a>';
|
||||
print '</td></tr>';
|
||||
$var=!$var;
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("AmountToWithdraw").'</td>';
|
||||
|
|
@ -86,6 +88,57 @@ print '</td></tr></table><br>';
|
|||
|
||||
print '</td><td valign="top" width="70%">';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Withdraw receipts
|
||||
*/
|
||||
$limit=5;
|
||||
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec";
|
||||
$sql .= " ,p.statut ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= " ORDER BY datec DESC LIMIT ".$limit;
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$var=True;
|
||||
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("LastWithdrawalReceipt",$limit).'</td>';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Amount").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]><td>";
|
||||
|
||||
print '<img border="0" src="./img/statut'.$obj->statut.'.png"></a> ';
|
||||
|
||||
print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
|
||||
|
||||
print '<td>'.dol_print_date($db->jdate($obj->datec),"dayhour")."</td>\n";
|
||||
|
||||
print '<td align="right">'.price($obj->amount)."</td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
/*
|
||||
* Invoices waiting for withdraw
|
||||
*/
|
||||
|
|
@ -163,56 +216,6 @@ else
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Withdraw receipts
|
||||
*/
|
||||
$limit=5;
|
||||
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec";
|
||||
$sql .= " ,p.statut ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= " ORDER BY datec DESC LIMIT ".$limit;
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$var=True;
|
||||
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("LastWithdrawalReceipt",$limit).'</td>';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Amount").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]><td>";
|
||||
|
||||
print '<img border="0" src="./img/statut'.$obj->statut.'.png"></a> ';
|
||||
|
||||
print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
|
||||
|
||||
print '<td>'.dol_print_date($db->jdate($obj->datec),"dayhour")."</td>\n";
|
||||
|
||||
print '<td align="right">'.price($obj->amount)."</td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ $result = restrictedArea($user, 'prelevement','','','bons');
|
|||
|
||||
llxHeader('',$langs->trans("WithdrawStatistics"));
|
||||
|
||||
print_fiche_titre($langs->trans("WithdrawStatistics"));
|
||||
print_fiche_titre($langs->trans("Statistics"));
|
||||
|
||||
// Define total and nbtotal
|
||||
$sql = "SELECT sum(pl.amount), count(pl.amount)";
|
||||
|
|
@ -70,6 +70,10 @@ if ($resql)
|
|||
/*
|
||||
* Stats
|
||||
*/
|
||||
|
||||
print '<br>';
|
||||
print_titre($langs->trans("WithdrawStatistics"));
|
||||
|
||||
$ligne=new LignePrelevement($db,$user);
|
||||
|
||||
$sql = "SELECT sum(pl.amount), count(pl.amount), pl.statut";
|
||||
|
|
@ -140,6 +144,7 @@ else
|
|||
print '<br>';
|
||||
print_titre($langs->trans("WithdrawRejectStatistics"));
|
||||
|
||||
|
||||
// Define total and nbtotal
|
||||
$sql = "SELECT sum(pl.amount), count(pl.amount)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
|
|
|
|||
|
|
@ -207,7 +207,6 @@ insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk
|
|||
-- Withdrawal
|
||||
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->prelevement->enabled', __HANDLER__, 'left', 2500__+MAX_llx_menu__, 'accountancy', '', 14__+MAX_llx_menu__, '/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank', 'StandingOrders', 0, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 9, __ENTITY__);
|
||||
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2502__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/create.php?leftmenu=withdraw', 'NewStandingOrder', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2501__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/demandes.php?status=0&leftmenu=withdraw', 'StandingOrderToProcess', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2503__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/bons.php?leftmenu=withdraw', 'WithdrawalsReceipts', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2504__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/liste.php?leftmenu=withdraw', 'WithdrawalsLines', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2506__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/rejets.php?leftmenu=withdraw', 'Rejects', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 5, __ENTITY__);
|
||||
|
|
|
|||
|
|
@ -1025,11 +1025,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
|
|||
{
|
||||
$newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank",$langs->trans("StandingOrders"),0,$user->rights->prelevement->bons->lire);
|
||||
|
||||
//if ($leftmenu=="withdraw") $newmenu->add("/compta/prelevement/demandes.php?status=0&mainmenu=bank",$langs->trans("StandingOrderToProcess"),1,$user->rights->prelevement->bons->lire);
|
||||
|
||||
if ($leftmenu=="withdraw") $newmenu->add("/compta/prelevement/create.php?mainmenu=bank",$langs->trans("NewStandingOrder"),1,$user->rights->prelevement->bons->creer);
|
||||
|
||||
//if ($leftmenu=="withdraw") $newmenu->add("/compta/prelevement/demandes.php",$langs->trans("StandingOrder"),1,$user->rights->prelevement->bons->lire);
|
||||
if ($leftmenu=="withdraw") $newmenu->add("/compta/prelevement/demandes.php?status=0&mainmenu=bank",$langs->trans("StandingOrderToProcess"),1,$user->rights->prelevement->bons->lire);
|
||||
//if ($leftmenu=="withdraw") $newmenu->add("/compta/prelevement/demandes.php?status=1",$langs->trans("StandingOrderProcessed"),2,$user->rights->prelevement->bons->lire);
|
||||
|
||||
if ($leftmenu=="withdraw") $newmenu->add("/compta/prelevement/bons.php?mainmenu=bank",$langs->trans("WithdrawalsReceipts"),1,$user->rights->prelevement->bons->lire);
|
||||
if ($leftmenu=="withdraw") $newmenu->add("/compta/prelevement/liste.php?mainmenu=bank",$langs->trans("WithdrawalsLines"),1,$user->rights->prelevement->bons->lire);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
-- To change type of field: ALTER TABLE llx_table MODIFY name varchar(60);
|
||||
--
|
||||
|
||||
DROP table llx_prelevement_notifications;
|
||||
|
||||
-- Fix corrupted data
|
||||
update llx_deplacement set dated='2010-01-01' where dated < '2000-01-01';
|
||||
|
||||
|
|
@ -376,3 +378,4 @@ update llx_actioncomm set elementtype='contract' where elementtype='contrat';
|
|||
|
||||
|
||||
alter table llx_propal add column tms timestamp after fk_projet;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
-- ===================================================================
|
||||
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2010 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 2 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, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
--
|
||||
-- $Id$
|
||||
-- ===================================================================
|
||||
|
||||
--
|
||||
-- Utilisateur a notifier
|
||||
--
|
||||
-- actions :
|
||||
-- 'NOTIFY_EMT_WITHDRAW' emission d'un bon
|
||||
-- 'NOTIFY_TRN_WITHDRAW' tranmission d'un bon
|
||||
-- 'NOTIFY_CRD_WITHDRAW' credit du bon par la banque
|
||||
|
||||
create table llx_prelevement_notifications
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_user integer NOT NULL,
|
||||
action varchar(32)
|
||||
|
||||
)ENGINE=innodb;
|
||||
|
|
@ -79,6 +79,8 @@ BankToReceiveWithdraw=Bank account to receive withdraws
|
|||
CreditDate=Credit on
|
||||
WithdrawalFileNotCapable=Unable to generate withdrawal receipt file for your country
|
||||
ShowWithdraw=Show Withdraw
|
||||
IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one withdrawal payment not yet processed, it won't be set as payed to allow to manage withdrawal before.
|
||||
DoStandingOrdersBeforePayments=This tabs allows you to request for a standing order. Once it will be finished, you can type the payment to close the invoice.
|
||||
|
||||
### Notifications
|
||||
InfoCreditSubject=Payment of standing order %s by the bank
|
||||
|
|
|
|||
|
|
@ -79,6 +79,8 @@ BankToReceiveWithdraw=Compte bancaire recevant les prélèvements
|
|||
CreditDate=Crédité le
|
||||
WithdrawalFileNotCapable=Impossible de generer fichier de bon de prelevements pour votre pays
|
||||
ShowWithdraw=Voir prélèvement
|
||||
IfInvoiceNeedOnWithdrawPaymentWontBeClosed=Toutefois, si la facture a au moins un paiement par prélèvement non traité, elle ne le sera pas afin de permettre la gestion du prélèvement d'abord.
|
||||
DoStandingOrdersBeforePayments=Cet onglet permet de faire une demande de pélèvement bancaire. Une fois terminé, vous pourrez saisir le payement sur la facture pour la clore.
|
||||
|
||||
### Notifications
|
||||
InfoCreditSubject=Credit prélèvement %s a la banque
|
||||
|
|
|
|||
|
|
@ -86,18 +86,15 @@ function prelevement_prepare_head($object)
|
|||
|
||||
/**
|
||||
* Check need data to create standigns orders receipt file
|
||||
* @return int -1 if ko 0 if ok
|
||||
* @return int -1 if ko 0 if ok
|
||||
*/
|
||||
function prelevement_check_config()
|
||||
{
|
||||
global $conf;
|
||||
if(empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) return -1;
|
||||
if(empty($conf->global->PRELEVEMENT_CODE_BANQUE)) return -1;
|
||||
if(empty($conf->global->PRELEVEMENT_CODE_GUICHET)) return -1;
|
||||
if(empty($conf->global->PRELEVEMENT_NUMERO_COMPTE)) return -1;
|
||||
if(empty($conf->global->PRELEVEMENT_NUMBER_KEY)) return -1;
|
||||
if(empty($conf->global->PRELEVEMENT_RAISON_SOCIALE)) return -1;
|
||||
if(empty($conf->global->PRELEVEMENT_USER)) return -1;
|
||||
if(empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) return -1;
|
||||
if(empty($conf->global->PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR)) return -1;
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user