Fix: Corrections de nombreux bugs sur le module don (register_globals=off pour la plupart)
This commit is contained in:
parent
866079cd33
commit
0816776704
@ -1,167 +0,0 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* 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$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
require("./pre.inc.php");
|
||||
require("../../don.class.php");
|
||||
require("../../paiement.class.php");
|
||||
|
||||
if ($action == 'update')
|
||||
{
|
||||
|
||||
if ($amount > 0)
|
||||
{
|
||||
|
||||
$don = new Don($db);
|
||||
|
||||
$don->id = $_POST["rowid"];
|
||||
$don->prenom = $prenom;
|
||||
$don->nom = $nom;
|
||||
$don->statut = $_POST["statutid"];
|
||||
$don->societe = $societe;
|
||||
$don->adresse = $adresse;
|
||||
$don->amount = $amount;
|
||||
$don->cp = $cp;
|
||||
$don->ville = $ville;
|
||||
$don->email = $email;
|
||||
$don->date = mktime(12, 0 , 0, $remonth, $reday, $reyear);
|
||||
$don->note = $note;
|
||||
$don->pays = $pays;
|
||||
$don->public = $public;
|
||||
$don->projetid = $projetid;
|
||||
$don->commentaire = $_POST["comment"];
|
||||
$don->modepaiementid = $modepaiement;
|
||||
|
||||
if ($don->update($user->id) )
|
||||
{
|
||||
Header("Location: fiche.php?rowid=$don->id&action=edit");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Erreur";
|
||||
$action = "create";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
|
||||
if ($rowid)
|
||||
{
|
||||
|
||||
$don = new Don($db);
|
||||
$don->id = $rowid;
|
||||
$don->fetch($rowid);
|
||||
|
||||
$sql = "SELECT s.nom,s.idp, f.amount, f.total, f.facnumber";
|
||||
$sql .= " FROM societe as s, ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp";
|
||||
$sql .= " AND f.rowid = $facid";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows();
|
||||
if ($num) {
|
||||
$obj = $db->fetch_object( 0);
|
||||
|
||||
$total = $obj->total;
|
||||
}
|
||||
}
|
||||
print_titre("Saisir un don");
|
||||
print "<form action=\"edit.php\" method=\"post\">";
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
|
||||
print "<input type=\"hidden\" name=\"rowid\" value=\"$rowid\">";
|
||||
|
||||
print "<tr><td>Date du don</td><td>";
|
||||
print_date_select($don->date);
|
||||
print "</td>";
|
||||
|
||||
print '<td rowspan="13" valign="top">'.$langs->trans("Comments").' :<br>';
|
||||
print '<textarea name="comment" wrap="soft" cols="40" rows="15">'.$don->commentaire.'</textarea></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||
|
||||
$listst[0] = "Promesse à valider";
|
||||
$listst[1] = "Promesse validée";
|
||||
$listst[2] = "Don payé";
|
||||
$listst[3] = "Don encaissé";
|
||||
|
||||
|
||||
$sel = new Form($db);
|
||||
$sel->select_array("statutid",$listst,$don->statut);
|
||||
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td>Mode de paiement</td><td>\n";
|
||||
|
||||
$paiement = new Paiement($db);
|
||||
|
||||
$paiement->select("modepaiement","", $don->modepaiementid);
|
||||
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "<tr><td>Projet</td><td>\n";
|
||||
|
||||
$prj = new ProjetDon($db);
|
||||
$listeprj = $prj->liste_array();
|
||||
|
||||
$sel = new Form($db);
|
||||
$sel->select_array("projetid",$listeprj,$don->projetid);
|
||||
|
||||
|
||||
print "<br>";
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "<tr><td>Don public</td><td><select name=\"public\">\n";
|
||||
if ($don->public)
|
||||
{
|
||||
print '<option value="1" SELECTED>oui</option>';
|
||||
print '<option value="0">non</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<option value="1">oui</option>';
|
||||
print '<option value="0" SELECTED>non</option>';
|
||||
}
|
||||
print "</select><br>";
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td>Prénom</td><td><input type="text" name="prenom" size="40" value="'.$don->prenom.'"></td></tr>';
|
||||
print '<tr><td>Nom</td><td><input type="text" name="nom" size="40" value="'.$don->nom.'"></td></tr>';
|
||||
print '<tr><td>Societe</td><td><input type="text" name="societe" size="40" value="'.$don->societe.'"></td></tr>';
|
||||
print '<tr><td>Adresse</td><td>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="3">'.$don->adresse.'</textarea></td></tr>';
|
||||
print '<tr><td>CP Ville</td><td><input type="text" name="cp" size="8" value="'.$don->cp.'"> <input type="text" name="ville" size="40" value="'.$don->ville.'"></td></tr>';
|
||||
print '<tr><td>Pays</td><td><input type="text" name="pays" size="40" value="'.$don->pays.'"></td></tr>';
|
||||
print '<tr><td>Email</td><td><input type="text" name="email" size="40" value="'.$don->email.'"></td></tr>';
|
||||
print '<tr><td>Montant</td><td><input type="text" name="amount" size="10" value="'.$don->amount.'"> euros</td></tr>';
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>';
|
||||
print "</form>\n";
|
||||
print "</table>\n";
|
||||
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
@ -20,33 +20,81 @@
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/*! \file htdocs/compta/dons/fiche.php
|
||||
\ingroup don
|
||||
\brief Page de fiche de don
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require("../../don.class.php");
|
||||
require("../../paiement.class.php");
|
||||
|
||||
if ($action == 'add')
|
||||
{
|
||||
|
||||
if ($amount > 0)
|
||||
|
||||
$mesg="";
|
||||
|
||||
if ($_POST["action"] == 'update')
|
||||
{
|
||||
|
||||
if ($_POST["amount"] > 0)
|
||||
{
|
||||
|
||||
$don = new Don($db);
|
||||
$don->id = $_POST["rowid"];
|
||||
$don->fetch($_POST["rowid"]);
|
||||
|
||||
$don->prenom = $_POST["prenom"];
|
||||
$don->nom = $_POST["nom"];
|
||||
$don->societe = $_POST["societe"];
|
||||
$don->adresse = $_POST["adresse"];
|
||||
$don->amount = $_POST["amount"];
|
||||
$don->cp = $_POST["cp"];
|
||||
$don->ville = $_POST["ville"];
|
||||
$don->email = $_POST["email"];
|
||||
$don->date = mktime(12, 0 , 0, $remonth, $reday, $reyear);
|
||||
$don->note = $_POST["note"];
|
||||
$don->pays = $_POST["pays"];
|
||||
$don->public = $_POST["public"];
|
||||
$don->projetid = $_POST["projetid"];
|
||||
$don->commentaire = $_POST["comment"];
|
||||
$don->modepaiementid = $_POST["modepaiement"];
|
||||
|
||||
if ($don->update($user->id) )
|
||||
{
|
||||
Header("Location: index.php");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg="Montant non défini";
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'add')
|
||||
{
|
||||
|
||||
if ($_POST["amount"] > 0)
|
||||
{
|
||||
|
||||
$don = new Don($db);
|
||||
|
||||
$don->prenom = $prenom;
|
||||
$don->nom = $nom;
|
||||
$don->societe = $societe;
|
||||
$don->adresse = $adresse;
|
||||
$don->amount = $amount;
|
||||
$don->cp = $cp;
|
||||
$don->ville = $ville;
|
||||
$don->email = $email;
|
||||
$don->prenom = $_POST["prenom"];
|
||||
$don->nom = $_POST["nom"];
|
||||
$don->societe = $_POST["societe"];
|
||||
$don->adresse = $_POST["adresse"];
|
||||
$don->amount = $_POST["amount"];
|
||||
$don->cp = $_POST["cp"];
|
||||
$don->ville = $_POST["ville"];
|
||||
$don->email = $_POST["email"];
|
||||
$don->date = mktime(12, 0 , 0, $remonth, $reday, $reyear);
|
||||
$don->note = $note;
|
||||
$don->pays = $pays;
|
||||
$don->public = $public;
|
||||
$don->projetid = $projetid;
|
||||
$don->note = $_POST["note"];
|
||||
$don->pays = $_POST["pays"];
|
||||
$don->public = $_POST["public"];
|
||||
$don->projetid = $_POST["projetid"];
|
||||
$don->commentaire = $_POST["comment"];
|
||||
$don->modepaiementid = $modepaiement;
|
||||
$don->modepaiementid = $_POST["modepaiement"];
|
||||
|
||||
if ($don->create($user->id) )
|
||||
{
|
||||
@ -55,45 +103,45 @@ if ($action == 'add')
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Erreur";
|
||||
$action = "create";
|
||||
$mesg="Montant non défini";
|
||||
$_GET["action"] = "create";
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'delete')
|
||||
if ($_GET["action"] == 'delete')
|
||||
{
|
||||
$don = new Don($db);
|
||||
$don->delete($rowid);
|
||||
Header("Location: liste.php?statut=0");
|
||||
$don->delete($_GET["rowid"]);
|
||||
Header("Location: liste.php");
|
||||
}
|
||||
if ($action == 'commentaire')
|
||||
if ($_POST["action"] == 'commentaire')
|
||||
{
|
||||
$don = new Don($db);
|
||||
$don->set_commentaire($rowid,$_POST["commentaire"]);
|
||||
$action = "edit";
|
||||
$don->set_commentaire($_POST["rowid"],$_POST["commentaire"]);
|
||||
$_GET["rowid"] = $_POST["rowid"];
|
||||
}
|
||||
if ($action == 'valid_promesse')
|
||||
if ($_GET["action"] == 'valid_promesse')
|
||||
{
|
||||
$don = new Don($db);
|
||||
if ($don->valid_promesse($rowid, $user->id))
|
||||
if ($don->valid_promesse($_GET["rowid"], $user->id))
|
||||
{
|
||||
Header("Location: liste.php?statut=0");
|
||||
Header("Location: liste.php");
|
||||
}
|
||||
}
|
||||
if ($action == 'set_paye')
|
||||
if ($_GET["action"] == 'set_payed')
|
||||
{
|
||||
$don = new Don($db);
|
||||
if ($don->set_paye($rowid, $modepaiement))
|
||||
if ($don->set_paye($_GET["rowid"], $modepaiement))
|
||||
{
|
||||
Header("Location: liste.php?statut=1");
|
||||
Header("Location: liste.php");
|
||||
}
|
||||
}
|
||||
if ($action == 'set_encaisse')
|
||||
if ($_GET["action"] == 'set_encaisse')
|
||||
{
|
||||
$don = new Don($db);
|
||||
if ($don->set_encaisse($rowid))
|
||||
if ($don->set_encaisse($_GET["rowid"]))
|
||||
{
|
||||
Header("Location: liste.php?statut=2");
|
||||
Header("Location: liste.php");
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,39 +149,27 @@ if ($action == 'set_encaisse')
|
||||
|
||||
llxHeader();
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Création d'une fiche don */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($_GET["action"] == 'create') {
|
||||
|
||||
if ($action == 'create') {
|
||||
|
||||
$sql = "SELECT s.nom,s.idp, f.amount, f.total, f.facnumber";
|
||||
$sql .= " FROM societe as s, ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp";
|
||||
$sql .= " AND f.rowid = $facid";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows();
|
||||
if ($num) {
|
||||
$obj = $db->fetch_object( 0);
|
||||
|
||||
$total = $obj->total;
|
||||
}
|
||||
}
|
||||
print_titre("Saisir un don");
|
||||
print "<form action=\"fiche.php\" method=\"post\">";
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
|
||||
print '<form action="fiche.php" method="post">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print "<tr $bc[1]>".'<td>Date du don</td><td>';
|
||||
print_date_select();
|
||||
print '</td>';
|
||||
|
||||
print '<td rowspan="11" valign="top">'.$langs->trans("Comments").' :<br>';
|
||||
print '<td rowspan="12" valign="top">'.$langs->trans("Comments").' :<br>';
|
||||
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\"></textarea></td></tr>";
|
||||
print "<tr $bc[1]><td>Mode de paiement</td><td>\n";
|
||||
|
||||
@ -143,10 +179,8 @@ if ($action == 'create') {
|
||||
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "<tr $bc[1]><td>Projet</td><td><select name=\"projetid\">\n";
|
||||
|
||||
print "<tr $bc[1]><td>".$langs->trans("Project")."</td><td><select name=\"projetid\">\n";
|
||||
$sql = "SELECT rowid, libelle FROM ".MAIN_DB_PREFIX."don_projet ORDER BY rowid";
|
||||
|
||||
if ($db->query($sql))
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
@ -160,7 +194,7 @@ if ($action == 'create') {
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error();
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print "</select><br>";
|
||||
print "</td></tr>\n";
|
||||
@ -173,59 +207,125 @@ if ($action == 'create') {
|
||||
print "</select><br>";
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "<tr $bc[1]>".'<td>Prénom</td><td><input type="text" name="prenom" size="40"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>Nom</td><td><input type="text" name="nom" size="40"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>Societe</td><td><input type="text" name="societe" size="40"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>Adresse</td><td>';
|
||||
$langs->load("companies");
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="prenom" size="40"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("LastName").'</td><td><input type="text" name="nom" size="40"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="3"></textarea></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>CP Ville</td><td><input type="text" name="cp" size="8"> <input type="text" name="ville" size="40"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>Pays</td><td><input type="text" name="pays" size="40"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>Email</td><td><input type="text" name="email" size="40"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>Montant</td><td><input type="text" name="amount" size="10"> euros</td></tr>';
|
||||
print "<tr $bc[1]>".'<td colspan="2" align="center"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>';
|
||||
print "</form>\n";
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td><input type="text" name="cp" size="8"> <input type="text" name="ville" size="40"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Country").'</td><td><input type="text" name="pays" size="40"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" size="40"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10"> euros</td></tr>';
|
||||
print "<tr $bc[1]>".'<td colspan="3" align="center"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>';
|
||||
print "</table>\n";
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
}
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edition de la fiche don */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($rowid > 0 && $action == 'edit')
|
||||
|
||||
|
||||
/* ************************************************************ */
|
||||
/* */
|
||||
/* Fiche don en mode edition */
|
||||
/* */
|
||||
/* ************************************************************ */
|
||||
|
||||
if ($_GET["rowid"] && $_GET["action"] == 'edit')
|
||||
{
|
||||
|
||||
$don = new Don($db);
|
||||
$don->id = $rowid;
|
||||
$don->fetch($rowid);
|
||||
$don->id = $_GET["rowid"];
|
||||
$don->fetch($_GET["rowid"]);
|
||||
|
||||
print_titre("Traitement du don");
|
||||
|
||||
print '<form action="fiche.php" method="post">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="rowid" value="'.$don->id.'">';
|
||||
|
||||
print "<tr $bc[1]>".'<td>Date du don</td><td>';
|
||||
print_date_select($don->date);
|
||||
print '</td>';
|
||||
|
||||
print '<td rowspan="12" valign="top">'.$langs->trans("Comments").' :<br>';
|
||||
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\">$don->commentaire</textarea></td></tr>";
|
||||
|
||||
print "<tr $bc[1]><td>".$langs->trans("Project")."</td><td><select name=\"projetid\">\n";
|
||||
$sql = "SELECT rowid, libelle FROM ".MAIN_DB_PREFIX."don_projet ORDER BY rowid";
|
||||
if ($db->query($sql))
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objopt = $db->fetch_object( $i);
|
||||
print "<option value=\"$objopt->rowid\">$objopt->libelle</option>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print "</select><br>";
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "<tr $bc[1]><td>Don public</td><td><select name=\"public\">\n";
|
||||
print '<option value="1">oui</option>';
|
||||
print '<option value="0">non</option>';
|
||||
print "</select><br>";
|
||||
print "</td></tr>\n";
|
||||
|
||||
$langs->load("companies");
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.$don->societe.'"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="prenom" size="40" value="'.$don->prenom.'"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("LastName").'</td><td><input type="text" name="nom" size="40" value="'.$don->nom.'"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="3">'.$don->adresse.'</textarea></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td><input type="text" name="cp" size="8" value="'.$don->cp.'"> <input type="text" name="ville" size="40" value="'.$don->ville.'"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Country").'</td><td><input type="text" name="pays" size="40" value="'.$don->pays.'"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" size="40" value="'.$don->email.'"></td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.$don->amount.'"> euros</td></tr>';
|
||||
|
||||
print "<tr $bc[1]><td>Mode de paiement</td><td>\n";
|
||||
$paiement = new Paiement($db);
|
||||
$paiement->select("modepaiement","crédit");
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "<tr $bc[1]>".'<td colspan="3" align="center"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
print "</form>\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ************************************************************ */
|
||||
/* */
|
||||
/* Fiche don en mode visu */
|
||||
/* */
|
||||
/* ************************************************************ */
|
||||
if ($_GET["rowid"] && $_GET["action"] != 'edit')
|
||||
{
|
||||
|
||||
$don = new Don($db);
|
||||
$don->id = $_GET["rowid"];
|
||||
$don->fetch($_GET["rowid"]);
|
||||
|
||||
print_titre("Traitement du don");
|
||||
print "<form action=\"fiche.php\" method=\"post\">";
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<tr $bc[1]><td>Date du don</td><td>";
|
||||
print strftime("%d %B %Y",$don->date);
|
||||
print "</td>";
|
||||
|
||||
print '<td rowspan="11" valign="top" width="50%">'.$langs->trans("Comments").' :<br>';
|
||||
print '<td rowspan="12" valign="top" width="50%">'.$langs->trans("Comments").' :<br>';
|
||||
print nl2br($don->commentaire).'</td></tr>';
|
||||
|
||||
if ($don->statut == 1)
|
||||
{
|
||||
print "<tr $bc[1]><td>Mode de paiement</td><td>";
|
||||
$paiement = new Paiement($db);
|
||||
$paiement->select("modepaiement","crédit", $don->modepaiementid);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
if ($don->statut > 1)
|
||||
{
|
||||
print "<tr><td>Mode de paiement</td><td>";
|
||||
print $don->modepaiement;
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
print "<tr $bc[1]>".'<td>Projet</td><td>'.$don->projet.'</td></tr>';
|
||||
|
||||
print "<tr $bc[1]><td>Don public</td><td>";
|
||||
@ -234,98 +334,75 @@ if ($rowid > 0 && $action == 'edit')
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
print "<tr $bc[1]>".'<td>Prénom</td><td>'.$don->prenom.' </td></tr>';
|
||||
print "<tr $bc[1]>".'<td>Nom</td><td>'.$don->nom.' </td></tr>';
|
||||
print "<tr $bc[1]>".'<td>Société</td><td>'.$don->societe.' </td></tr>';
|
||||
print "<tr $bc[1]>".'<td>Adresse</td><td>'.nl2br($don->adresse).' </td></tr>';
|
||||
print "<tr $bc[1]>".'<td>CP Ville</td><td>'.$don->cp.' '.$don->ville.' </td></tr>';
|
||||
print "<tr $bc[1]>".'<td>Pays</td><td>'.$don->pays.' </td></tr>';
|
||||
print "<tr $bc[1]>".'<td>Email</td><td>'.$don->email.' </td></tr>';
|
||||
print "<tr $bc[1]>".'<td>Montant</td><td>'.price($don->amount).' euros</td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Company").'</td><td>'.$don->societe.'</td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Firstname").'</td><td>'.$don->prenom.'</td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("LastName").'</td><td>'.$don->nom.'</td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Address").'</td><td>'.nl2br($don->adresse).'</td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>'.$don->cp.' '.$don->ville.'</td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Country").'</td><td>'.$don->pays.'</td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("EMail").'</td><td>'.$don->email.'</td></tr>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Amount").'</td><td>'.price($don->amount).' euros</td></tr>';
|
||||
if ($don->statut == 1)
|
||||
{
|
||||
print "<tr $bc[1]><td>Mode de paiement</td><td>";
|
||||
$paiement = new Paiement($db);
|
||||
$paiement->select("modepaiement","crédit", $don->modepaiementid);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr $bc[1]><td>Mode de paiement</td><td>";
|
||||
print $don->modepaiement;
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr $bc[1]>";
|
||||
|
||||
/*
|
||||
* Case 1
|
||||
*/
|
||||
|
||||
print '<td align="center" width="25%">[<a href="edit.php?rowid='.$don->id.'">'.$langs->trans('Edit').'</a>]</td>';
|
||||
/*
|
||||
* Barre d'actions
|
||||
*
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
print '<a class="tabAction" href="fiche.php?action=edit&rowid='.$don->id.'">'.$langs->trans('Edit').'</a>';
|
||||
|
||||
/*
|
||||
* Case 2
|
||||
*/
|
||||
|
||||
if ($don->statut == 1 && $resteapayer > 0)
|
||||
if ($don->statut == 1 && $resteapayer > 0)
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">[<a href=\"paiement.php?facid=$facid&action=create\">Emettre un paiement</a>]</td>";
|
||||
}
|
||||
elseif ($don->statut == 0)
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">[<a href=\"fiche.php?rowid=$don->id&action=valid_promesse\">Valider la promesse</a>]</td>";
|
||||
}
|
||||
elseif ($don->statut == 3)
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">[<a href=\"formulaire/".DONS_FORM."?rowid=$don->id\">Formulaire</a>]</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">-</td>";
|
||||
}
|
||||
/*
|
||||
* Case 3
|
||||
*/
|
||||
if ($don->statut == 1 && abs($resteapayer == 0) && $don->paye == 0)
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">";
|
||||
|
||||
print '<input type="hidden" name="action" value="set_paye">';
|
||||
print '<input type="hidden" name="rowid" value="'.$don->id.'">';
|
||||
|
||||
print '<input type="submit" value="Classer Payé">';
|
||||
|
||||
print "</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">-</td>";
|
||||
}
|
||||
/*
|
||||
* Case 4
|
||||
*/
|
||||
if ($don->statut == 0)
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">[<a href=\"fiche.php?rowid=$don->id&action=delete\">Supprimer</a>]</td>";
|
||||
}
|
||||
elseif ($don->statut == 2)
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">[<a href=\"fiche.php?rowid=$don->id&action=set_encaisse\">Encaisser</a>]</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">-</td>";
|
||||
print "<a class=\"tabAction\" href=\"paiement.php?facid=$facid&action=create\">Emettre un paiement</a>";
|
||||
}
|
||||
|
||||
print "</tr></table></form><p>";
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Commentaire */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($don->statut == 0)
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$don->id&action=valid_promesse\">Valider la promesse</a>";
|
||||
}
|
||||
|
||||
if ($don->statut == 3)
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"formulaire/".DONS_FORM."?rowid=$don->id\">Formulaire</a>";
|
||||
}
|
||||
|
||||
if ($don->statut == 1 && abs($resteapayer == 0) && $don->paye == 0)
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$don->id&action=set_payed\">Classé payé</a>";
|
||||
}
|
||||
|
||||
if ($don->statut == 0)
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$don->id&action=delete\">".$langs->trans("Delete")."</a>";
|
||||
}
|
||||
if ($don->statut == 2)
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$don->id&action=set_encaisse\">Encaisser</a>";
|
||||
}
|
||||
|
||||
print "</div><br>";
|
||||
|
||||
print "<form action=\"fiche.php\" method=\"post\">";
|
||||
print '<input type="hidden" name="action" value="commentaire">';
|
||||
print '<input type="hidden" name="rowid" value="'.$don->id.'">';
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
print "<tr $bc[1]>".'<td align="center">'.$langs->trans("Comments").'</td></tr>';
|
||||
print "<tr $bc[1]>".'<td><textarea cols="60" rows="20" name="commentaire">'.$don->commentaire.'</textarea></td></tr>';
|
||||
print "<tr $bc[1]>".'<td align="center"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>';
|
||||
print '</table></form>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
|
||||
@ -19,6 +19,14 @@
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
\file htdocs/compta/dons/formulaire/fsfe.fr.php
|
||||
\ingroup don
|
||||
\brief Formulaire de don
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("../../../main.inc.php");
|
||||
|
||||
echo '
|
||||
@ -40,8 +48,8 @@ require("../../../don.class.php");
|
||||
setlocale(LC_TIME,"fr_FR");
|
||||
|
||||
$don = new Don($db);
|
||||
$don->id = $rowid;
|
||||
$don->fetch($rowid);
|
||||
$don->id = $_GET["rowid"];
|
||||
$don->fetch($_GET["rowid"]);
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@ -20,8 +20,16 @@
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/*! \file htdocs/compta/dons/index.php
|
||||
\ingroup don
|
||||
\brief Page accueil espace don
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
$sql = "SELECT sum(d.amount) as somme , d.fk_statut FROM ".MAIN_DB_PREFIX."don as d GROUP BY d.fk_statut";
|
||||
@ -44,7 +52,7 @@ if ($result)
|
||||
|
||||
print_titre("Dons");
|
||||
|
||||
print '<table class="noboerder" cellspacing="0" cellpadding="3">';
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print "<td> </td>";
|
||||
print "<td>Somme</td>";
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 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
|
||||
@ -19,10 +20,24 @@
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
\file htdocs/compta/dons/liste.php
|
||||
\ingroup don
|
||||
\brief Page de liste des dons
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
$sortorder=$_GET["sortorder"];
|
||||
$sortfield=$_GET["sortfield"];
|
||||
$statut=$_GET["statut"];
|
||||
$page=$_GET["page"];
|
||||
|
||||
if ($sortorder == "") { $sortorder="DESC"; }
|
||||
if ($sortfield == "") { $sortfield="d.datedon"; }
|
||||
|
||||
@ -32,13 +47,13 @@ $offset = $conf->liste_limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
|
||||
// Genere requete de liste des dons
|
||||
$sql = "SELECT d.rowid, ".$db->pdate("d.datedon")." as datedon, d.prenom, d.nom, d.societe, d.amount, p.libelle as projet";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."don as d, ".MAIN_DB_PREFIX."don_projet as p";
|
||||
$sql .= " WHERE p.rowid = d.fk_don_projet";
|
||||
if (strlen($statut))
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."don as d left join ".MAIN_DB_PREFIX."don_projet as p";
|
||||
$sql .= " ON p.rowid = d.fk_don_projet WHERE 1 = 1";
|
||||
if (isset($_GET["statut"]))
|
||||
{
|
||||
$sql .= " AND d.fk_statut = $statut";
|
||||
$sql .= " AND d.fk_statut = ".$_GET["statut"];
|
||||
}
|
||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
|
||||
|
||||
@ -56,9 +71,9 @@ if ($result)
|
||||
{
|
||||
print_barre_liste("Dons", $page, "liste.php", "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield");
|
||||
}
|
||||
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
print '<TR class="liste_titre">';
|
||||
print '<tr class="liste_titre">';
|
||||
print "<td>";
|
||||
print_liste_field_titre("Prénom","liste.php","d.prenom","&page=$page&statut=$statut");
|
||||
print "</td><td>";
|
||||
@ -71,20 +86,20 @@ if ($result)
|
||||
print "<td align=\"right\">";
|
||||
print_liste_field_titre("Montant","liste.php","d.amount","&page=$page&statut=$statut");
|
||||
print '</td><td> </td>';
|
||||
print "</TR>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object( $i);
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".stripslashes($objp->prenom)."</a></TD>\n";
|
||||
print "<TD><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".stripslashes($objp->nom)."</a></TD>\n";
|
||||
print "<TD><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".stripslashes($objp->societe)."</a></TD>\n";
|
||||
print "<TD><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".strftime("%d %B %Y",$objp->datedon)."</a></td>\n";
|
||||
print "<TD>$objp->projet</TD>\n";
|
||||
print '<TD align="right">'.price($objp->amount).'</TD><td> </td>';
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".stripslashes($objp->prenom)."</a></TD>\n";
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".stripslashes($objp->nom)."</a></TD>\n";
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".stripslashes($objp->societe)."</a></TD>\n";
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".strftime("%d %B %Y",$objp->datedon)."</a></td>\n";
|
||||
print "<td>$objp->projet</td>\n";
|
||||
print '<td align="right">'.price($objp->amount).'</td><td> </td>';
|
||||
|
||||
print "</tr>";
|
||||
$i++;
|
||||
@ -93,8 +108,7 @@ if ($result)
|
||||
}
|
||||
else
|
||||
{
|
||||
print $sql;
|
||||
print $db->error();
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -20,6 +20,14 @@
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
\file htdocs/compta/dons/stats.php
|
||||
\ingroup don
|
||||
\brief Page des statistiques de dons
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
llxHeader();
|
||||
@ -28,14 +36,16 @@ llxHeader();
|
||||
print_titre($langs->trans("Statistics"));
|
||||
|
||||
$sql = "SELECT d.amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."don as d, ".MAIN_DB_PREFIX."don_projet as p";
|
||||
$sql .= " WHERE p.rowid = d.fk_don_projet";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."don_projet as p";
|
||||
$sql .= " ON p.rowid = d.fk_don_projet";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i=0;
|
||||
$total=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object( $i);
|
||||
@ -43,20 +53,19 @@ if ($result)
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print '<table class="border">';
|
||||
|
||||
print "<tr $bc[1]>";
|
||||
print '<td>Nombre de dons</td><td align="right">'.$i.'</td></tr>';
|
||||
print '<td>Nombre de dons</td><td align="right">'.$num.'</td></tr>';
|
||||
print "<tr $bc[0]>".'<td>'.$langs->trans("Total").'</td><td align="right">'.price($total).'</td>';
|
||||
print "<tr $bc[1]>".'<td>Moyenne</td><td align="right">'.price($total / $i).'</td>';
|
||||
print "<tr $bc[1]>".'<td>'.$langs->trans("Average").'</td><td align="right">'.price($total / ($num?$num:1)).'</td>';
|
||||
print "</tr>";
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $sql;
|
||||
print $db->error();
|
||||
pdolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user