Qual: Debuggage du module prlvement, uniformisation du code

Qual: Fusion des classes en doublons dolibarrmail et CMailFile dans la meme "CMailFile".
This commit is contained in:
Laurent Destailleur 2005-09-10 14:24:10 +00:00
parent c5992d42af
commit 9b568fc000
19 changed files with 1538 additions and 1514 deletions

File diff suppressed because it is too large Load Diff

View File

@ -22,10 +22,10 @@
*/
/**
\file htdocs/compta/prelevement/bon.php
\ingroup prelevement
\brief Fiche aperçu du bon de prelevement
\version $Revision$
\file htdocs/compta/prelevement/bon.php
\ingroup prelevement
\brief Fiche aperçu du bon de prelevement
\version $Revision$
*/
require("./pre.inc.php");
@ -45,13 +45,16 @@ $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Card");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Bon");
$hselected = $h;
$h++;
if ($conf->use_preview_tabs)
{
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Preview");
$hselected = $h;
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Lignes");
$head[$h][1] = $langs->trans("Lines");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];

View File

@ -81,7 +81,7 @@ if ($result)
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Receipt"),"bons.php","p.ref",'','','class="liste_titre"');
print_liste_field_titre($langs->trans("WithdrawalReceipt"),"bons.php","p.ref",'','','class="liste_titre"');
print_liste_field_titre($langs->trans("Date"),"bons.php","p.datec","","",'class="liste_titre" align="center"');
print '<td class="liste_titre" align="right">'.$langs->trans("Amount").'</td>';
print '</tr>';

View File

@ -20,21 +20,26 @@
*/
/**
\file htdocs/compta/prelevement/create.php
\brief Prelevement
\version $Revision$
\file htdocs/compta/prelevement/create.php
\brief Prelevement
\version $Revision$
*/
require("./pre.inc.php");
require_once DOL_DOCUMENT_ROOT."/includes/modules/modPrelevement.class.php";
require_once(DOL_DOCUMENT_ROOT."/includes/modules/modPrelevement.class.php");
if (!$user->rights->prelevement->bons->creer)
accessforbidden();
/*
* Actions
*/
if ($_GET["action"] == 'create')
{
$bprev = new BonPrelevement($db);
$bprev->create($_GET["banque"],$_GET["guichet"]);
$bprev = new BonPrelevement($db);
$result=$bprev->create($_GET["banque"],$_GET["guichet"]);
}
@ -49,42 +54,60 @@ dolibarr_fiche_head($head, $hselected, $langs->trans("StandingOrders"));
$bprev = new BonPrelevement($db);
print '<table>';
$nb=$bprev->NbFactureAPrelever();
$nb1=$bprev->NbFactureAPrelever(1);
$nb11=$bprev->NbFactureAPrelever(1,1);
print '<table class="border" width="100%">';
print '<tr><td>Nb de facture à prélever :</td>';
print '<td align="right">';
print $bprev->NbFactureAPrelever();
print $nb;
print '</td><td>Notre banque :</td><td align="right">';
print $bprev->NbFactureAPrelever(1);
print $nb1;
print '</td><td>Notre agence :</td><td align="right">';
print $bprev->NbFactureAPrelever(1,1);
print $nb11;
print '</td></tr>';
print '<tr><td>Somme à prélever</td>';
print '<td align="right">';
print price($bprev->SommeAPrelever());
print '</td></tr></table>';
print '</td>';
print '<td colspan="4">&nbsp;</td>';
print '</tr></table>';
print '</div>';
print "<div class=\"tabsAction\">\n";
if ($nb)
{
print "<div class=\"tabsAction\">\n";
if ($nb) print '<a class="tabAction" href="create.php?action=create">'.$langs->trans("Create")."</a>\n";
if ($nb1) print '<a class="tabAction" href="create.php?action=create&amp;banque=1&amp;guichet=1">'.$langs->trans("CreateGuichet")."</a>\n";
if ($nb11) print '<a class="tabAction" href="create.php?action=create&amp;banque=1">'.$langs->trans("CreateBanque")."</a>\n";
print "</div>\n";
}
else
{
print "Aucune facture en mode de paiement 'Prélevement' n'a de demande de prélèvements en attente.<br>";
}
print '<br>';
print '<a class="tabAction" href="create.php?action=create&amp;banque=1&amp;guichet=1">'.$langs->trans("CreateGuichet")."</a>\n";
print '<a class="tabAction" href="create.php?action=create&amp;banque=1">'.$langs->trans("CreateBanque")."</a>\n";
print '<a class="tabAction" href="create.php?action=create">'.$langs->trans("Create")."</a>\n";
print "</div><br>\n";
/*
* Mode Liste
* Liste des derniers bons
*
*/
$limit=5;
$sql = "SELECT p.rowid, p.ref, p.amount,".$db->pdate("p.datec")." as datec";
$sql .= ", p.statut";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " ORDER BY datec DESC LIMIT 2";
$sql.= ", p.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " ORDER BY datec DESC";
$sql.=$db->plimit($limit);
$result = $db->query($sql);
if ($result)
{
@ -93,13 +116,13 @@ if ($result)
print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>Derniers Bons</td>';
print '<tr class="liste_titre"><td>'.$langs->trans("LastWithdrawalReceipts",$limit).'</td>';
print '<td><Date</td><td align="right">'.$langs->trans("Amount").'</td>';
print '</tr>';
$var=True;
while ($i < min($num,$conf->liste_limit))
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($result);
$var=!$var;
@ -125,7 +148,7 @@ else
/*
* Factures
* Factures en attente de prélèvement
*
*/
$sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp";
@ -155,9 +178,9 @@ if ( $db->query($sql) )
$obj = $db->fetch_object();
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.img_file().'</a>&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.$obj->facnumber.'</a></td>';
print '<td>'.$obj->nom.'</td></tr>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.img_file().' '.$obj->facnumber.'</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$obj->nom.'</a></td>';
print '</tr>';
$i++;
}
@ -171,5 +194,5 @@ else
}
llxFooter();
llxFooter('$Date$ - $Revision$');
?>

View File

@ -69,17 +69,14 @@ $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " WHERE s.idp = f.fk_soc";
$sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid";
if (strlen(trim($_GET["search_societe"])))
{
$sql .= " AND s.nom LIKE '%".$_GET["search_societe"]."%'";
}
if ($socidp)
{
$sql .= " AND f.fk_soc = $socidp";
}
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
if ( $db->query($sql) )
@ -92,15 +89,13 @@ if ( $db->query($sql) )
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans("Bill").'</td><td class="liste_titre">'.$langs->trans("Company").'</td>';
print '<td class="liste_titre">'.$langs->trans("Date").'</td>';
print '<td class="liste_titre">'.$langs->trans("Author").'</td>';
print '<td class="liste_titre" align="center">'.$langs->trans("Date").'</td>';
print '<td class="liste_titre" align="center">'.$langs->trans("Author").'</td>';
print '</tr>';
print '<form action="demandes.php" method="GET">';
print '<tr class="liste_titre"><td class="liste_titre">-</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_societe" size="12" value="'.$GET["search_societe"].'">';
print '</td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_facture" size="12" value="'.$GET["search_facture"].'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" size="18" value="'.$GET["search_societe"].'"></td>';
print '<td colspan="2" class="liste_titre" align="right"><input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" alt="'.$langs->trans("Search").'"></td>';
print '</tr>';
print '</form>';
@ -113,17 +108,24 @@ if ( $db->query($sql) )
{
$obj = $db->fetch_object();
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.img_file().'</a>&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.$obj->facnumber.'</a></td>';
print '<td>'.$obj->nom.'</td>';
print '<td>'.strftime("%d %m %Y", $obj->date_demande).'</td>';
print '<tr '.$bc[$var].'>';
// Ref facture
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.img_file().' '.$obj->facnumber.'</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$obj->nom.'</a></td>';
print '<td align="center">'.dolibarr_print_date($obj->date_demande).'</td>';
if (!array_key_exists($obj->fk_user_demande,$users))
{
$users[$obj->fk_user_demande] = new User($db, $obj->fk_user_demande);
$users[$obj->fk_user_demande]->fetch();
}
print '<td>'.$users[$obj->fk_user_demande]->fullname.'</td>';
// User
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$users[$obj->fk_user_demande]->id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$users[$obj->fk_user_demande]->code.'</a></td>';
print '</tr>';
$i++;
}

View File

@ -18,7 +18,6 @@
*
* $Id$
* $Source$
*
*/
/**
@ -29,38 +28,41 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php");
require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
require_once DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php";
require_once DOL_DOCUMENT_ROOT."/paiement.class.php";
require_once DOL_DOCUMENT_ROOT."/lib/dolibarrmail.class.php";
/*
* Sécurité accés client
*/
// Sécurité accés client
if ($user->societe_id > 0) accessforbidden();
llxHeader('','Bon de prélèvement');
$h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Fiche");
$head[$h][1] = $langs->trans("Card");
$h++;
if ($conf->use_preview_tabs)
{
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Preview");
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Lignes");
$head[$h][1] = $langs->trans("Lines");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Factures");
$head[$h][1] = $langs->trans("Bills");
$hselected = $h;
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Rejets");
$head[$h][1] = $langs->trans("Rejects");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Statistiques");
$head[$h][1] = $langs->trans("Statistics");
$h++;
@ -131,9 +133,9 @@ if ($result)
print"\n<!-- debut table -->\n";
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre("Facture","factures.php","p.ref",'',$urladd,'class="liste_titre"');
print_liste_field_titre("Société","factures.php","s.nom",'',$urladd,'class="liste_titre"');
print_liste_field_titre("Montant","factures.php","f.total_ttc","",$urladd,'class="liste_titre" align="center"');
print_liste_field_titre($langs->trans("Bill"),"factures.php","p.ref",'',$urladd,'class="liste_titre"');
print_liste_field_titre($langs->trans("Company"),"factures.php","s.nom",'',$urladd,'class="liste_titre"');
print_liste_field_titre($langs->trans("Amount"),"factures.php","f.total_ttc","",$urladd,'class="liste_titre" align="center"');
print '<td class="liste_titre" colspan="2">&nbsp;</td></tr>';
$var=True;
@ -202,5 +204,5 @@ else
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
llxFooter('$Date$ - $Revision$');
?>

View File

@ -1,5 +1,6 @@
<?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -17,42 +18,44 @@
*
* $Id$
* $Source$
*
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php");
require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
require_once DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php";
require_once DOL_DOCUMENT_ROOT."/paiement.class.php";
require_once DOL_DOCUMENT_ROOT."/lib/dolibarrmail.class.php";
/*
* Sécurité accés client
*/
// Sécurité accés client
if ($user->societe_id > 0) accessforbidden();
llxHeader('','Bon de prélèvement - Rejet');
$h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Fiche");
$head[$h][1] = $langs->trans("Card");
$h++;
if ($conf->use_preview_tabs)
{
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Preview");
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Lignes");
$head[$h][1] = $langs->trans("Lines");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Factures");
$head[$h][1] = $langs->trans("Bills");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Rejets");
$head[$h][1] = $langs->trans("Rejects");
$hselected = $h;
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Statistiques");
$head[$h][1] = $langs->trans("Statistics");
$h++;
$prev_id = $_GET["id"];
@ -149,5 +152,5 @@ else
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
llxFooter('$Date$ - $Revision$');
?>

View File

@ -1,5 +1,6 @@
<?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -17,36 +18,41 @@
*
* $Id$
* $Source$
*
*/
require("./pre.inc.php");
/*
* Sécurité accés client
*/
// Sécurité accés client
if ($user->societe_id > 0) accessforbidden();
llxHeader('','Statistique Bon de prélèvement');
$h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Fiche");
$head[$h][1] = $langs->trans("Card");
$h++;
if ($conf->use_preview_tabs)
{
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Preview");
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Lignes");
$head[$h][1] = $langs->trans("Lines");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Factures");
$head[$h][1] = $langs->trans("Bills");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Rejets");
$head[$h][1] = $langs->trans("Rejects");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Statistiques");
$head[$h][1] = $langs->trans("Statistics");
$hselected = $h;
$h++;

View File

@ -22,10 +22,10 @@
*/
/**
\file htdocs/compta/prelevement/fiche.php
\ingroup prelevement
\brief Fiche prelevement
\version $Revision$
\file htdocs/compta/prelevement/fiche.php
\ingroup prelevement
\brief Fiche prelevement
\version $Revision$
*/
require("./pre.inc.php");
@ -56,7 +56,7 @@ if ($_POST["action"] == 'infotrans')
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $bon->ref)
{
$dir = DOL_DATA_ROOT.'/prelevement/bon/';
$dir = $conf->prelevement->dir_output.'/bon/';
if (doliMoveFileUpload($_FILES['userfile']['tmp_name'], $dir . "/" . $_FILES['userfile']['name']))
{
@ -99,12 +99,15 @@ $head[$h][1] = $langs->trans("Card");
$hselected = $h;
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Bon");
$h++;
if ($conf->use_preview_tabs)
{
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Preview");
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Lignes");
$head[$h][1] = $langs->trans("Lines");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
@ -112,7 +115,7 @@ $head[$h][1] = $langs->trans("Bills");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Rejets");
$head[$h][1] = $langs->trans("Rejects");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];

View File

@ -84,7 +84,7 @@ if ($result)
print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Receipt").'</td><td>'.$langs->trans("Date").'</td>';
print '<tr class="liste_titre"><td>'.$langs->trans("WithdrawalReceiptShort").'</td><td>'.$langs->trans("Date").'</td>';
print '<td align="right">'.$langs->trans("Amount").'</td>';
print '</tr>';
@ -99,9 +99,9 @@ if ($result)
print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
print '<td>'.strftime("%d/%m/%Y %H:%M",$obj->datec)."</td>\n";
print '<td>'.dolibarr_print_date($obj->datec,"%d/%m/%Y %H:%M")."</td>\n";
print '<td align="right">'.price($obj->amount)." ".$langs->trans("Currency".$conf->monnaie)."</td>\n";
print '<td align="right">'.price($obj->amount)."</td>\n";
print "</tr>\n";
$i++;
@ -147,9 +147,9 @@ if ( $db->query($sql) )
$obj = $db->fetch_object();
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.img_file().'</a>&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.$obj->facnumber.'</a></td>';
print '<td>'.$obj->nom.'</td></tr>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.img_file().' '.$obj->facnumber.'</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$obj->nom.'</a></td>';
print '</tr>';
$i++;
}

View File

@ -17,19 +17,17 @@
*
* $Id$
* $Source$
*
*/
require("./pre.inc.php");
require_once DOL_DOCUMENT_ROOT."/compta/prelevement/ligne-prelevement.class.php";
require_once DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php";
require_once DOL_DOCUMENT_ROOT."/paiement.class.php";
require_once DOL_DOCUMENT_ROOT."/lib/dolibarrmail.class.php";
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/ligne-prelevement.class.php");
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php");
require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
/*
* Sécurité accés client
*/
// Sécurité accés client
if ($user->societe_id > 0) accessforbidden();
if ($_POST["action"] == 'confirm_rejet')
{
if ( $_POST["confirm"] == 'yes')
@ -285,5 +283,5 @@ if ($_GET["id"])
print "</div>";
}
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
llxFooter('$Date$ - $Revision$');
?>

View File

@ -1,5 +1,6 @@
<?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -17,41 +18,44 @@
*
* $Id$
* $Source$
*
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php");
require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
require_once DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php";
require_once DOL_DOCUMENT_ROOT."/paiement.class.php";
require_once DOL_DOCUMENT_ROOT."/lib/dolibarrmail.class.php";
/*
* Sécurité accés client
*/
// Sécurité accés client
if ($user->societe_id > 0) accessforbidden();
llxHeader('','Bon de prélèvement');
$h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Fiche");
$head[$h][1] = $langs->trans("Card");
$h++;
if ($conf->use_preview_tabs)
{
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Preview");
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Lignes");
$head[$h][1] = $langs->trans("Lines");
$hselected = $h;
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Factures");
$head[$h][1] = $langs->trans("Bills");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Rejets");
$head[$h][1] = $langs->trans("Rejects");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Statistiques");
$head[$h][1] = $langs->trans("Statistics");
$h++;
$prev_id = $_GET["id"];
@ -192,5 +196,5 @@ else
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
llxFooter('$Date$ - $Revision$');
?>

View File

@ -103,7 +103,7 @@ if ($result)
print '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans("Line").'</td>';
print_liste_field_titre($langs->trans("Receipt"),"liste.php","p.ref");
print_liste_field_titre($langs->trans("WithdrawalReceipt"),"liste.php","p.ref");
print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom");
print_liste_field_titre($langs->trans("Date"),"liste.php","p.datec","","",'align="center"');
print_liste_field_titre($langs->trans("Amount"),"liste.php","pl.amount");

View File

@ -28,16 +28,13 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php");
require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/dolibarrmail.class.php");
/*
* Sécurité accés client
*/
// Sécurité accés client
if ($user->societe_id > 0) accessforbidden();
llxHeader('','Bon de prélèvement');
$page = $_GET["page"];
@ -99,7 +96,7 @@ if ($result)
print_liste_field_titre($langs->trans("Bill"),"liste_factures.php","f.facnumber",'',$urladd);
print_liste_field_titre($langs->trans("Company"),"liste_factures.php","s.nom",'',$urladd);
print_liste_field_titre($langs->trans("Amount"),"liste_factures.php","f.total_ttc","",$urladd,'align="right"');
print_liste_field_titre($langs->trans("Receipt"),"liste_factures.php","p.rowid","",$urladd,'align="center"');
print_liste_field_titre($langs->trans("WithdrawalReceipt"),"liste_factures.php","p.rowid","",$urladd,'align="center"');
print '</tr>';
print '<form method="get" action="liste_factures.php">';
@ -113,7 +110,7 @@ if ($result)
print "</tr>\n";
print '</form>';
$var=True;
$var=false;
$total = 0;
@ -128,7 +125,6 @@ if ($result)
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid_ligne.'">';
print substr('000000'.$obj->rowid_ligne, -6).'</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">';
print img_object($langs->trans("ShowBill"),"bill");
print '</a>&nbsp;';

View File

@ -61,7 +61,7 @@ function llxHeader($head = "", $title="", $help_url='')
$menu->add_submenu(DOL_URL_ROOT."/compta/prelevement/rejets.php",$langs->trans("Rejects"));
$menu->add_submenu(DOL_URL_ROOT."/compta/prelevement/stats.php",$langs->trans("Statistics"));
$menu->add_submenu(DOL_URL_ROOT."/compta/prelevement/config.php",$langs->trans("Config"));
$menu->add_submenu(DOL_URL_ROOT."/compta/prelevement/config.php",$langs->trans("Setup"));
$menu->add(DOL_URL_ROOT."/compta/prelevement/demandes.php",$langs->trans("Demandes"));
$menu->add_submenu(DOL_URL_ROOT."/compta/prelevement/demandes.php",$langs->trans("StandingOrderToProcess"));

View File

@ -157,79 +157,75 @@ class RejetPrelevement
}
/**
*
*
*
*/
function _send_email($fac)
{
$userid = 0;
$sql = "SELECT fk_user_demande";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " WHERE pfd.fk_prelevement_bons = ".$this->bon_id;
$sql .= " AND pfd.fk_facture = ".$fac->id;
$result=$this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows();
if ($num > 0)
{
$row = $this->db->fetch_row();
$userid = $row[0];
}
}
else
{
dolibarr_syslog("RejetPrelevement::_send_email Erreur lecture user");
}
if ($userid > 0)
{
$emuser = new User($this->db, $userid);
$emuser->fetch();
$subject = "Prélèvement rejeté";
$soc = new Societe($this->db);
$soc->fetch($fac->socidp);
$sendto = $emuser->fullname." <".$emuser->email.">";
$from = $this->user->fullname." <".$this->user->email.">";
$message = "Bonjour,\n";
//$message .= "\nLe prélèvement de la facture ".$fac->ref." pour le compte de la société ".$soc->nom." d'un montant de ".price($fac->total_ttc).' '.$langs->trans("Currency".$conf->monnaie)." a été rejeté par la banque.";
// $langs n'est pas accessible ici !!!
// Inutile de traduire la monnaie si le reste du message n'est pas traduit
// TODO LATER
$message .= "\nLe prélèvement de la facture ".$fac->ref." pour le compte de la société ".$soc->nom." d'un montant de ".price($fac->total_ttc)." a été rejeté par la banque.";
$message .= "\n\n--\n".$this->user->fullname;
$mailfile = new DolibarrMail($subject,
$sendto,
$from,
$message);
$mailfile->errors_to = $this->user->email;
if ( $mailfile->sendfile() )
{
dolibarr_syslog("RejetPrelevement::_send_email email envoyé");
}
else
{
dolibarr_syslog("RejetPrelevement::_send_email Erreur envoi email");
}
}
else
{
dolibarr_syslog("RejetPrelevement::_send_email Userid invalide");
}
}
/**
* \brief Envoi mail
*
*/
function _send_email($fac)
{
$userid = 0;
$sql = "SELECT fk_user_demande";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " WHERE pfd.fk_prelevement_bons = ".$this->bon_id;
$sql .= " AND pfd.fk_facture = ".$fac->id;
$resql=$this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
if ($num > 0)
{
$row = $this->db->fetch_row($resql);
$userid = $row[0];
}
}
else
{
dolibarr_syslog("RejetPrelevement::_send_email Erreur lecture user");
}
if ($userid > 0)
{
$emuser = new User($this->db, $userid);
$emuser->fetch();
$soc = new Societe($this->db);
$soc->fetch($fac->socidp);
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
$subject = "Prélèvement rejeté";
$sendto = $emuser->fullname." <".$emuser->email.">";
$from = $this->user->fullname." <".$this->user->email.">";
$arr_file = array();
$arr_mime = array();
$arr_name = array();
$message = "Bonjour,\n";
$message .= "\nLe prélèvement de la facture ".$fac->ref." pour le compte de la société ".$soc->nom." d'un montant de ".price($fac->total_ttc)." a été rejeté par la banque.";
$message .= "\n\n--\n".$this->user->fullname;
$mailfile = new CMailFile($subject,$sendto,$from,$message,
$arr_file,$arr_mime,$arr_name);
$mailfile->errors_to = $this->user->email;
$result=$mailfile->sendfile();
if ($result)
{
dolibarr_syslog("RejetPrelevement::_send_email email envoyé");
}
else
{
dolibarr_syslog("RejetPrelevement::_send_email Erreur envoi email");
}
}
else
{
dolibarr_syslog("RejetPrelevement::_send_email Userid invalide");
}
}
/**

View File

@ -17,41 +17,37 @@
*
* $Id$
* $Source$
*
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php");
require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
if (!$user->rights->prelevement->bons->lire)
accessforbidden();
require_once DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php";
require_once DOL_DOCUMENT_ROOT."/paiement.class.php";
require_once DOL_DOCUMENT_ROOT."/lib/dolibarrmail.class.php";
/*
* Sécurité accés client
*/
// Sécurité accés client
if ($user->societe_id > 0) accessforbidden();
llxHeader('','Bon de prélèvement - Rejet');
$h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Fiche");
$head[$h][1] = $langs->trans("Card");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Factures");
$head[$h][1] = $langs->trans("Bills");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/rejets.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Rejets");
$head[$h][1] = $langs->trans("Rejects");
$hselected = $h;
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Statistiques");
$head[$h][1] = $langs->trans("Statistics");
$h++;
$prev_id = $_GET["id"];
@ -72,7 +68,6 @@ $rej = new RejetPrelevement($db, $user);
/*
* Liste des factures
*
*
*/
$sql = "SELECT pl.rowid, pr.motif, p.ref, pl.statut";
$sql .= " , s.idp, s.nom";
@ -138,5 +133,5 @@ else
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
llxFooter('$Date$ - $Revision$');
?>

View File

@ -1446,19 +1446,20 @@ class Facture
/**
* \brief Créé une demande de prélèvement
* \param user utilisateur créant la demande
* \brief Créé une demande de prélèvement
* \param user Utilisateur créant la demande
* \return int <0 si ko, >0 si ok
*/
function demande_prelevement($user)
{
//dolibarr_syslog("Facture::DemandePrelevement");
dolibarr_syslog("Facture::demande_prelevement");
$soc = new Societe($this->db);
$soc->id = $this->socidp;
$soc->rib();
if ($this->statut > 0 && $this->paye == 0 && $this->mode_reglement == 3)
if ($this->statut > 0 && $this->paye == 0 && $this->mode_reglement_id == 3)
{
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."prelevement_facture_demande";
$sql .= " WHERE fk_facture=".$this->id;
@ -1482,28 +1483,32 @@ class Facture
if ( $this->db->query( $sql) )
{
return 0;
return 1;
}
else
{
$this->error=$this->db->error();
dolibarr_syslog("Facture::DemandePrelevement Erreur");
return -1;
}
}
else
{
$this->error="Une demande existe déjà";
dolibarr_syslog("Facture::DemandePrelevement Impossible de créer une demande, demande déja en cours");
}
}
else
{
$this->error=$this->db->error();
dolibarr_syslog("Facture::DemandePrelevement Erreur -2");
return -2;
}
}
else
{
dolibarr_syslog("Facture::DemandePrelevement Impossible de créer une demande, etat facture incompatible");
$this->error="Etat facture incompatible avec l'action";
dolibarr_syslog("Facture::DemandePrelevement Etat facture incompatible $this->statut, $this->paye, $this->mode_reglement_id");
return -3;
}
}

View File

@ -295,27 +295,23 @@ $conf->actionscomm->dir_output=DOL_DATA_ROOT."/action";
/*
* Modification de quelques variable de conf en fonction des Constantes
*/
// conf->use_preview_tabs
$conf->use_preview_tabs=1;
if (isset($conf->global->USE_PREVIEW_TABS)) $conf->use_preview_tabs=$conf->global->USE_PREVIEW_TABS;
// conf->monnaie
if (! $conf->global->MAIN_MONNAIE) $conf->global->MAIN_MONNAIE='EUR';
$conf->monnaie=$conf->global->MAIN_MONNAIE;
/*
* Option du module Compta: Defini le mode de calcul des etats comptables (CA,...)
*/
// $conf->compta->mode = Option du module Compta: Defini le mode de calcul des etats comptables (CA,...)
$conf->compta->mode = 'RECETTES-DEPENSES'; // Par défaut
if (defined('COMPTA_MODE') && COMPTA_MODE) {
// Peut etre 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
$conf->compta->mode = COMPTA_MODE;
}
/* \todo Ajouter une option Gestion de la TVA dans le module compta qui permet de désactiver la fonction TVA
* (pour particuliers ou libéraux en franchise)
* En attendant, valeur forcée à 1
*/
$conf->compta->tva=1;
/*
* Option du module Facture
*/
// $conf->defaulttx
if (defined('FACTURE_TVAOPTION') && FACTURE_TVAOPTION == 'franchise') {
$conf->defaulttx='0'; // Taux par défaut des factures clients
}
@ -323,15 +319,11 @@ else {
$conf->defaulttx=''; // Pas de taux par défaut des factures clients, le premier sera pris
}
/*
* SIZE_LISTE_LIMIT : constante de taille maximale des listes
*/
// $conf->liste_limit = constante de taille maximale des listes
if (! $conf->global->SIZE_LISTE_LIMIT) $conf->global->SIZE_LISTE_LIMIT=20;
$conf->liste_limit=$conf->global->SIZE_LISTE_LIMIT;
/*
* MAIN_THEME : theme
*/
// $conf->theme et $conf->css
if (! $conf->global->MAIN_THEME) $conf->global->MAIN_THEME="eldy";
$conf->theme=$conf->global->MAIN_THEME;
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
@ -349,6 +341,7 @@ if (defined('MAILING_EMAIL_FROM'))
}
else $conf->mailing->email_from=$conf->email_from;
// $conf->adherent->email_resil, ...
if (defined("MAIN_MAIL_RESIL"))
{
$conf->adherent->email_resil=MAIN_MAIL_RESIL;
@ -382,6 +375,12 @@ if (defined("MAIN_MAIL_NEW_SUBJECT"))
$conf->adherent->email_new_subject=MAIN_MAIL_NEW_SUBJECT;
}
/* \todo Ajouter une option Gestion de la TVA dans le module compta qui permet de désactiver la fonction TVA
* (pour particuliers ou libéraux en franchise)
* En attendant, valeur forcée à 1
*/
$conf->compta->tva=1;
// Delai de tolerance des alertes
$conf->actions->warning_delay=7*24*60*60; // 1 semaine
$conf->commande->traitement->warning_delay=2*24*60*60;