Qual: Debuggage du module prélèvement, 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 \file htdocs/compta/prelevement/bon.php
\ingroup prelevement \ingroup prelevement
\brief Fiche aperçu du bon de prelevement \brief Fiche aperçu du bon de prelevement
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); 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"); $head[$h][1] = $langs->trans("Card");
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"]; if ($conf->use_preview_tabs)
$head[$h][1] = $langs->trans("Bon"); {
$hselected = $h; $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"];
$h++; $head[$h][1] = $langs->trans("Preview");
$hselected = $h;
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"]; $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++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"]; $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 '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; 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_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 '<td class="liste_titre" align="right">'.$langs->trans("Amount").'</td>';
print '</tr>'; print '</tr>';

View File

@ -20,21 +20,26 @@
*/ */
/** /**
\file htdocs/compta/prelevement/create.php \file htdocs/compta/prelevement/create.php
\brief Prelevement \brief Prelevement
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); 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) if (!$user->rights->prelevement->bons->creer)
accessforbidden(); accessforbidden();
/*
* Actions
*/
if ($_GET["action"] == 'create') if ($_GET["action"] == 'create')
{ {
$bprev = new BonPrelevement($db); $bprev = new BonPrelevement($db);
$bprev->create($_GET["banque"],$_GET["guichet"]); $result=$bprev->create($_GET["banque"],$_GET["guichet"]);
} }
@ -49,42 +54,60 @@ dolibarr_fiche_head($head, $hselected, $langs->trans("StandingOrders"));
$bprev = new BonPrelevement($db); $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 '<tr><td>Nb de facture à prélever :</td>';
print '<td align="right">'; print '<td align="right">';
print $bprev->NbFactureAPrelever(); print $nb;
print '</td><td>Notre banque :</td><td align="right">'; 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 '</td><td>Notre agence :</td><td align="right">';
print $bprev->NbFactureAPrelever(1,1); print $nb11;
print '</td></tr>'; print '</td></tr>';
print '<tr><td>Somme à prélever</td>'; print '<tr><td>Somme à prélever</td>';
print '<td align="right">'; print '<td align="right">';
print price($bprev->SommeAPrelever()); print price($bprev->SommeAPrelever());
print '</td></tr></table>'; print '</td>';
print '<td colspan="4">&nbsp;</td>';
print '</tr></table>';
print '</div>'; 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 = "SELECT p.rowid, p.ref, p.amount,".$db->pdate("p.datec")." as datec";
$sql .= ", p.statut"; $sql.= ", p.statut";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " ORDER BY datec DESC";
$sql .= " ORDER BY datec DESC LIMIT 2"; $sql.=$db->plimit($limit);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
@ -93,13 +116,13 @@ if ($result)
print"\n<!-- debut table -->\n"; print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%">'; 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 '<td><Date</td><td align="right">'.$langs->trans("Amount").'</td>';
print '</tr>'; print '</tr>';
$var=True; $var=True;
while ($i < min($num,$conf->liste_limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$var=!$var; $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"; $sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp";
@ -155,9 +178,9 @@ if ( $db->query($sql) )
$obj = $db->fetch_object(); $obj = $db->fetch_object();
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'; 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.'">'.img_file().' '.$obj->facnumber.'</a></td>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.$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>'.$obj->nom.'</td></tr>'; print '</tr>';
$i++; $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 .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " WHERE s.idp = f.fk_soc"; $sql .= " WHERE s.idp = f.fk_soc";
$sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid"; $sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid";
if (strlen(trim($_GET["search_societe"]))) if (strlen(trim($_GET["search_societe"])))
{ {
$sql .= " AND s.nom LIKE '%".$_GET["search_societe"]."%'"; $sql .= " AND s.nom LIKE '%".$_GET["search_societe"]."%'";
} }
if ($socidp) if ($socidp)
{ {
$sql .= " AND f.fk_soc = $socidp"; $sql .= " AND f.fk_soc = $socidp";
} }
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
if ( $db->query($sql) ) if ( $db->query($sql) )
@ -92,15 +89,13 @@ if ( $db->query($sql) )
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; 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("Bill").'</td><td class="liste_titre">'.$langs->trans("Company").'</td>';
print '<td class="liste_titre">'.$langs->trans("Date").'</td>'; print '<td class="liste_titre" align="center">'.$langs->trans("Date").'</td>';
print '<td class="liste_titre">'.$langs->trans("Author").'</td>'; print '<td class="liste_titre" align="center">'.$langs->trans("Author").'</td>';
print '</tr>'; print '</tr>';
print '<form action="demandes.php" method="GET">'; print '<form action="demandes.php" method="GET">';
print '<tr class="liste_titre"><td class="liste_titre">-</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">'; print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" size="18" value="'.$GET["search_societe"].'"></td>';
print '<input type="text" class="flat" name="search_societe" size="12" value="'.$GET["search_societe"].'">';
print '</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 '<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 '</tr>';
print '</form>'; print '</form>';
@ -113,17 +108,24 @@ if ( $db->query($sql) )
{ {
$obj = $db->fetch_object(); $obj = $db->fetch_object();
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'; print '<tr '.$bc[$var].'>';
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>'; // Ref facture
print '<td>'.$obj->nom.'</td>'; print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.img_file().' '.$obj->facnumber.'</a></td>';
print '<td>'.strftime("%d %m %Y", $obj->date_demande).'</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)) 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] = new User($db, $obj->fk_user_demande);
$users[$obj->fk_user_demande]->fetch(); $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>'; print '</tr>';
$i++; $i++;
} }

View File

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

View File

@ -1,5 +1,6 @@
<?PHP <?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* 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 * 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 * it under the terms of the GNU General Public License as published by
@ -17,42 +18,44 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
require("./pre.inc.php"); 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"; // Sécurité accés client
require_once DOL_DOCUMENT_ROOT."/paiement.class.php";
require_once DOL_DOCUMENT_ROOT."/lib/dolibarrmail.class.php";
/*
* Sécurité accés client
*/
if ($user->societe_id > 0) accessforbidden(); if ($user->societe_id > 0) accessforbidden();
llxHeader('','Bon de prélèvement - Rejet'); llxHeader('','Bon de prélèvement - Rejet');
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; $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++; $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][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Lignes"); $head[$h][1] = $langs->trans("Lines");
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"]; $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++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"]; $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; $hselected = $h;
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"]; $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++; $h++;
$prev_id = $_GET["id"]; $prev_id = $_GET["id"];
@ -149,5 +152,5 @@ else
$db->close(); $db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>"); llxFooter('$Date$ - $Revision$');
?> ?>

View File

@ -1,5 +1,6 @@
<?PHP <?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* 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 * 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 * it under the terms of the GNU General Public License as published by
@ -17,36 +18,41 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
/* // Sécurité accés client
* Sécurité accés client
*/
if ($user->societe_id > 0) accessforbidden(); if ($user->societe_id > 0) accessforbidden();
llxHeader('','Statistique Bon de prélèvement'); llxHeader('','Statistique Bon de prélèvement');
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; $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++; $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][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Lignes"); $head[$h][1] = $langs->trans("Lines");
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"]; $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++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"]; $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++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"]; $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; $hselected = $h;
$h++; $h++;

View File

@ -22,10 +22,10 @@
*/ */
/** /**
\file htdocs/compta/prelevement/fiche.php \file htdocs/compta/prelevement/fiche.php
\ingroup prelevement \ingroup prelevement
\brief Fiche prelevement \brief Fiche prelevement
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -56,7 +56,7 @@ if ($_POST["action"] == 'infotrans')
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $bon->ref) 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'])) if (doliMoveFileUpload($_FILES['userfile']['tmp_name'], $dir . "/" . $_FILES['userfile']['name']))
{ {
@ -99,12 +99,15 @@ $head[$h][1] = $langs->trans("Card");
$hselected = $h; $hselected = $h;
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"]; if ($conf->use_preview_tabs)
$head[$h][1] = $langs->trans("Bon"); {
$h++; $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][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"];
$head[$h][1] = $langs->trans("Lignes"); $head[$h][1] = $langs->trans("Lines");
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"]; $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
@ -112,7 +115,7 @@ $head[$h][1] = $langs->trans("Bills");
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"]; $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++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"]; $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"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%">'; 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 '<td align="right">'.$langs->trans("Amount").'</td>';
print '</tr>'; print '</tr>';
@ -99,9 +99,9 @@ if ($result)
print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n"; 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"; print "</tr>\n";
$i++; $i++;
@ -147,9 +147,9 @@ if ( $db->query($sql) )
$obj = $db->fetch_object(); $obj = $db->fetch_object();
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'; 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.'">'.img_file().' '.$obj->facnumber.'</a></td>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.$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>'.$obj->nom.'</td></tr>'; print '</tr>';
$i++; $i++;
} }

View File

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

View File

@ -1,5 +1,6 @@
<?PHP <?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* 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 * 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 * it under the terms of the GNU General Public License as published by
@ -17,41 +18,44 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
require("./pre.inc.php"); 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"; // Sécurité accés client
require_once DOL_DOCUMENT_ROOT."/paiement.class.php";
require_once DOL_DOCUMENT_ROOT."/lib/dolibarrmail.class.php";
/*
* Sécurité accés client
*/
if ($user->societe_id > 0) accessforbidden(); if ($user->societe_id > 0) accessforbidden();
llxHeader('','Bon de prélèvement'); llxHeader('','Bon de prélèvement');
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; $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++; $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][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; $hselected = $h;
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"]; $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++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"]; $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++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"]; $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++; $h++;
$prev_id = $_GET["id"]; $prev_id = $_GET["id"];
@ -192,5 +196,5 @@ else
$db->close(); $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 '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans("Line").'</td>'; 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("Company"),"liste.php","s.nom");
print_liste_field_titre($langs->trans("Date"),"liste.php","p.datec","","",'align="center"'); print_liste_field_titre($langs->trans("Date"),"liste.php","p.datec","","",'align="center"');
print_liste_field_titre($langs->trans("Amount"),"liste.php","pl.amount"); print_liste_field_titre($langs->trans("Amount"),"liste.php","pl.amount");

View File

@ -28,16 +28,13 @@
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-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."/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(); if ($user->societe_id > 0) accessforbidden();
llxHeader('','Bon de prélèvement'); llxHeader('','Bon de prélèvement');
$page = $_GET["page"]; $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("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("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("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 '</tr>';
print '<form method="get" action="liste_factures.php">'; print '<form method="get" action="liste_factures.php">';
@ -113,7 +110,7 @@ if ($result)
print "</tr>\n"; print "</tr>\n";
print '</form>'; print '</form>';
$var=True; $var=false;
$total = 0; $total = 0;
@ -128,7 +125,6 @@ if ($result)
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid_ligne.'">'; print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid_ligne.'">';
print substr('000000'.$obj->rowid_ligne, -6).'</a></td>'; print substr('000000'.$obj->rowid_ligne, -6).'</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">'; print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">';
print img_object($langs->trans("ShowBill"),"bill"); print img_object($langs->trans("ShowBill"),"bill");
print '</a>&nbsp;'; 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/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/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(DOL_URL_ROOT."/compta/prelevement/demandes.php",$langs->trans("Demandes"));
$menu->add_submenu(DOL_URL_ROOT."/compta/prelevement/demandes.php",$langs->trans("StandingOrderToProcess")); $menu->add_submenu(DOL_URL_ROOT."/compta/prelevement/demandes.php",$langs->trans("StandingOrderToProcess"));

View File

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

View File

@ -17,41 +17,37 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
require("./pre.inc.php"); 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) if (!$user->rights->prelevement->bons->lire)
accessforbidden(); accessforbidden();
require_once DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php"; // Sécurité accés client
require_once DOL_DOCUMENT_ROOT."/paiement.class.php";
require_once DOL_DOCUMENT_ROOT."/lib/dolibarrmail.class.php";
/*
* Sécurité accés client
*/
if ($user->societe_id > 0) accessforbidden(); if ($user->societe_id > 0) accessforbidden();
llxHeader('','Bon de prélèvement - Rejet'); llxHeader('','Bon de prélèvement - Rejet');
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"]; $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++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"]; $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++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/rejets.php?id='.$_GET["id"]; $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; $hselected = $h;
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"]; $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++; $h++;
$prev_id = $_GET["id"]; $prev_id = $_GET["id"];
@ -72,7 +68,6 @@ $rej = new RejetPrelevement($db, $user);
/* /*
* Liste des factures * Liste des factures
* *
*
*/ */
$sql = "SELECT pl.rowid, pr.motif, p.ref, pl.statut"; $sql = "SELECT pl.rowid, pr.motif, p.ref, pl.statut";
$sql .= " , s.idp, s.nom"; $sql .= " , s.idp, s.nom";
@ -138,5 +133,5 @@ else
$db->close(); $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 * \brief Créé une demande de prélèvement
* \param user utilisateur créant la demande * \param user Utilisateur créant la demande
* \return int <0 si ko, >0 si ok
*/ */
function demande_prelevement($user) function demande_prelevement($user)
{ {
//dolibarr_syslog("Facture::DemandePrelevement"); dolibarr_syslog("Facture::demande_prelevement");
$soc = new Societe($this->db); $soc = new Societe($this->db);
$soc->id = $this->socidp; $soc->id = $this->socidp;
$soc->rib(); $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 = "SELECT count(*) FROM ".MAIN_DB_PREFIX."prelevement_facture_demande";
$sql .= " WHERE fk_facture=".$this->id; $sql .= " WHERE fk_facture=".$this->id;
@ -1482,28 +1483,32 @@ class Facture
if ( $this->db->query( $sql) ) if ( $this->db->query( $sql) )
{ {
return 0; return 1;
} }
else else
{ {
$this->error=$this->db->error();
dolibarr_syslog("Facture::DemandePrelevement Erreur"); dolibarr_syslog("Facture::DemandePrelevement Erreur");
return -1; return -1;
} }
} }
else else
{ {
$this->error="Une demande existe déjà";
dolibarr_syslog("Facture::DemandePrelevement Impossible de créer une demande, demande déja en cours"); dolibarr_syslog("Facture::DemandePrelevement Impossible de créer une demande, demande déja en cours");
} }
} }
else else
{ {
$this->error=$this->db->error();
dolibarr_syslog("Facture::DemandePrelevement Erreur -2"); dolibarr_syslog("Facture::DemandePrelevement Erreur -2");
return -2; return -2;
} }
} }
else 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; 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 * 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'; if (! $conf->global->MAIN_MONNAIE) $conf->global->MAIN_MONNAIE='EUR';
$conf->monnaie=$conf->global->MAIN_MONNAIE; $conf->monnaie=$conf->global->MAIN_MONNAIE;
/* // $conf->compta->mode = Option du module Compta: Defini le mode de calcul des etats comptables (CA,...)
* Option du module Compta: Defini le mode de calcul des etats comptables (CA,...)
*/
$conf->compta->mode = 'RECETTES-DEPENSES'; // Par défaut $conf->compta->mode = 'RECETTES-DEPENSES'; // Par défaut
if (defined('COMPTA_MODE') && COMPTA_MODE) { if (defined('COMPTA_MODE') && COMPTA_MODE) {
// Peut etre 'RECETTES-DEPENSES' ou 'CREANCES-DETTES' // Peut etre 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
$conf->compta->mode = COMPTA_MODE; $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 // $conf->defaulttx
* (pour particuliers ou libéraux en franchise)
* En attendant, valeur forcée à 1
*/
$conf->compta->tva=1;
/*
* Option du module Facture
*/
if (defined('FACTURE_TVAOPTION') && FACTURE_TVAOPTION == 'franchise') { if (defined('FACTURE_TVAOPTION') && FACTURE_TVAOPTION == 'franchise') {
$conf->defaulttx='0'; // Taux par défaut des factures clients $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 $conf->defaulttx=''; // Pas de taux par défaut des factures clients, le premier sera pris
} }
/* // $conf->liste_limit = constante de taille maximale des listes
* SIZE_LISTE_LIMIT : constante de taille maximale des listes
*/
if (! $conf->global->SIZE_LISTE_LIMIT) $conf->global->SIZE_LISTE_LIMIT=20; if (! $conf->global->SIZE_LISTE_LIMIT) $conf->global->SIZE_LISTE_LIMIT=20;
$conf->liste_limit=$conf->global->SIZE_LISTE_LIMIT; $conf->liste_limit=$conf->global->SIZE_LISTE_LIMIT;
/* // $conf->theme et $conf->css
* MAIN_THEME : theme
*/
if (! $conf->global->MAIN_THEME) $conf->global->MAIN_THEME="eldy"; if (! $conf->global->MAIN_THEME) $conf->global->MAIN_THEME="eldy";
$conf->theme=$conf->global->MAIN_THEME; $conf->theme=$conf->global->MAIN_THEME;
$conf->css = "theme/".$conf->theme."/".$conf->theme.".css"; $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; else $conf->mailing->email_from=$conf->email_from;
// $conf->adherent->email_resil, ...
if (defined("MAIN_MAIL_RESIL")) if (defined("MAIN_MAIL_RESIL"))
{ {
$conf->adherent->email_resil=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; $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 // Delai de tolerance des alertes
$conf->actions->warning_delay=7*24*60*60; // 1 semaine $conf->actions->warning_delay=7*24*60*60; // 1 semaine
$conf->commande->traitement->warning_delay=2*24*60*60; $conf->commande->traitement->warning_delay=2*24*60*60;