forked from Wavyzz/dolibarr
*** empty log message ***
This commit is contained in:
290
htdocs/compta/dons/fiche.php
Normal file
290
htdocs/compta/dons/fiche.php
Normal file
@@ -0,0 +1,290 @@
|
||||
<?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");
|
||||
|
||||
$db = new Db();
|
||||
|
||||
if ($action == 'add')
|
||||
{
|
||||
|
||||
if ($amount > 0)
|
||||
{
|
||||
|
||||
$don = new Don($db);
|
||||
|
||||
$don->nom = $nom;
|
||||
$don->adresse = $adresse;
|
||||
$don->amount = $amount;
|
||||
$don->cp = $cp;
|
||||
$don->ville = $ville;
|
||||
$don->date = $db->idate(mktime(12, 0 , 0, $remonth, $reday, $reyear));
|
||||
$don->note = $note;
|
||||
$don->public = $public;
|
||||
$don->projetid = $projetid;
|
||||
$don->modepaiement = $modepaiement;
|
||||
|
||||
if ($don->create($user->id) )
|
||||
{
|
||||
|
||||
Header("Location: index.php");
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Erreur";
|
||||
$action = "create";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$don = new Don($db);
|
||||
$don->delete($rowid);
|
||||
}
|
||||
if ($action == 'valid_promesse')
|
||||
{
|
||||
$don = new Don($db);
|
||||
if ($don->valid_promesse($rowid, $user->id))
|
||||
{
|
||||
Header("Location: liste.php?statut=0");
|
||||
}
|
||||
}
|
||||
if ($action == 'set_paye')
|
||||
{
|
||||
$don = new Don($db);
|
||||
if ($don->set_paye($rowid))
|
||||
{
|
||||
Header("Location: liste.php?statut=1");
|
||||
}
|
||||
}
|
||||
if ($action == 'set_encaisse')
|
||||
{
|
||||
$don = new Don($db);
|
||||
if ($don->set_encaisse($rowid))
|
||||
{
|
||||
Header("Location: liste.php?statut=2");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($action == 'create') {
|
||||
|
||||
$sql = "SELECT s.nom,s.idp, f.amount, f.total, f.facnumber";
|
||||
$sql .= " FROM societe as s, llx_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=\"$PHP_SELF\" method=\"post\">";
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
|
||||
print "<input type=\"hidden\" name=\"facid\" value=\"$facid\">";
|
||||
print "<input type=\"hidden\" name=\"facnumber\" value=\"$obj->facnumber\">";
|
||||
print "<input type=\"hidden\" name=\"socid\" value=\"$obj->idp\">";
|
||||
print "<input type=\"hidden\" name=\"societe\" value=\"$obj->nom\">";
|
||||
|
||||
print "<tr><td>Date du don :</td><td>";
|
||||
print_date_select();
|
||||
print "</td>";
|
||||
|
||||
print '<td rowspan="9" valign="top">Commentaires :<br>';
|
||||
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\"></textarea></td></tr>";
|
||||
|
||||
$author = $GLOBALS["REMOTE_USER"];
|
||||
print "<input type=\"hidden\" name=\"author\" value=\"$author\">\n";
|
||||
|
||||
|
||||
print "<tr><td>Type :</td><td>\n";
|
||||
|
||||
$paiement = new Paiement($db);
|
||||
|
||||
$paiement->select("modepaiement","cr<EFBFBD>dit");
|
||||
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "<tr><td>Projet :</td><td><select name=\"projetid\">\n";
|
||||
|
||||
$sql = "SELECT rowid, libelle FROM llx_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
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
print "</select><br>";
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "<tr><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";
|
||||
|
||||
|
||||
|
||||
print '<tr><td>Nom</td><td><input type="text" name="nom" size="40"></td></tr>';
|
||||
print '<tr><td>Adresse</td><td><input type="text" name="adresse" size="40"></td></tr>';
|
||||
print '<tr><td>CP Ville</td><td><input type="text" name="cp" size="8"> <input type="text" name="ville" size="40"></td></tr>';
|
||||
|
||||
print '<tr><td>Montant</td><td><input type="text" name="amount" size="10"> euros</td></tr>';
|
||||
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"></td></tr>';
|
||||
print "</form>\n";
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
}
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($rowid > 0 && $action == 'edit')
|
||||
{
|
||||
|
||||
$don = new Don($db);
|
||||
$don->id = $rowid;
|
||||
$don->fetch($rowid);
|
||||
|
||||
print_titre("Traitement du don");
|
||||
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
|
||||
print "<tr><td>Date du don :</td><td>";
|
||||
print strftime("%d %B %Y",$don->date);
|
||||
print "</td>";
|
||||
|
||||
print '<td rowspan="9" valign="top" width="50%">Commentaires :<br>';
|
||||
print nl2br($don->note).'</td></tr>';
|
||||
|
||||
$author = $GLOBALS["REMOTE_USER"];
|
||||
print "<input type=\"hidden\" name=\"author\" value=\"$author\">\n";
|
||||
|
||||
if ($don->statut > 0)
|
||||
{
|
||||
|
||||
print "<tr><td>Type :</td><td>";
|
||||
|
||||
$paiement = new Paiement($db);
|
||||
|
||||
$paiement->select("modepaiement","cr<EFBFBD>dit", $don->modepaiement);
|
||||
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
print '<tr><td>Projet :</td><td>'.$don->projet.'</td></tr>';
|
||||
|
||||
print "<tr><td>Don public :</td><td>";
|
||||
|
||||
print $yn[$don->public];
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
|
||||
print '<tr><td>Nom</td><td>'.$don->nom.' </td></tr>';
|
||||
print '<tr><td>Adresse</td><td>'.$don->adresse.' </td></tr>';
|
||||
print '<tr><td>CP Ville</td><td>'.$don->cp.' '.$don->ville.' </td></tr>';
|
||||
|
||||
print '<tr><td>Montant</td><td>'.price($don->amount).' euros</td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr>";
|
||||
|
||||
|
||||
if ($don->statut == 0)
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?rowid=$don->id&action=delete\">Supprimer</a>]</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">-</td>";
|
||||
}
|
||||
|
||||
if ($don->statut == 1 && $resteapayer > 0)
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">[<a href=\"paiement.php3?facid=$facid&action=create\">Emettre un paiement</a>]</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">-</td>";
|
||||
}
|
||||
|
||||
if ($don->statut == 1 && abs($resteapayer == 0) && $don->paye == 0)
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?rowid=$don->id&action=set_paye\">Classer 'Pay<61>'</a>]</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">-</td>";
|
||||
}
|
||||
|
||||
if ($don->statut == 0)
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?rowid=$don->id&action=valid_promesse\">Valider la promesse</a>]</td>";
|
||||
}
|
||||
elseif ($don->statut == 2)
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\"><a href=\"$PHP_SELF?rowid=$don->id&action=set_encaisse\">Encaiss<73></a></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\" width=\"25%\">-</td>";
|
||||
}
|
||||
|
||||
print "</tr></table><p>";
|
||||
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
84
htdocs/compta/dons/index.php
Normal file
84
htdocs/compta/dons/index.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?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");
|
||||
|
||||
llxHeader();
|
||||
|
||||
$db = new Db();
|
||||
|
||||
|
||||
$sql = "SELECT sum(d.amount) as somme , d.fk_statut FROM llx_don as d GROUP BY d.fk_statut";
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object( $i);
|
||||
|
||||
$somme[$objp->fk_statut] = $objp->somme;
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
|
||||
print_barre_liste("Dons", $page, $PHP_SELF);
|
||||
|
||||
$libelle[0] = "Promesses non valid<69>es";
|
||||
$libelle[1] = "Promesses valid<69>es";
|
||||
$libelle[2] = "Dons pay<61>s";
|
||||
$libelle[3] = "Dons encaiss<73>s";
|
||||
|
||||
print '<TABLE border="0" cellspacing="0" cellpadding="4">';
|
||||
print '<TR class="liste_titre">';
|
||||
print "<td> </td>";
|
||||
print "<td>Somme</td>";
|
||||
print "</TR>\n";
|
||||
|
||||
$var=True;
|
||||
|
||||
for ($i = 0 ; $i < 4 ; $i++)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
if ($somme[$i])
|
||||
{
|
||||
print '<TD><a href="liste.php?statut='.$i.'">'.$libelle[$i].'</a></TD>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<TD>'.$libelle[$i].'</TD>';
|
||||
}
|
||||
print '<TD align="right">'.price($somme[$i]).'</TD>';
|
||||
print "</tr>";
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
@@ -24,15 +24,26 @@ class Don
|
||||
{
|
||||
var $id;
|
||||
var $db;
|
||||
var $facid;
|
||||
var $datepaye;
|
||||
var $amount;
|
||||
var $author;
|
||||
var $paiementid; // numero du paiement dans le cas ou une facture paye +ieur fois
|
||||
var $num_paiement;
|
||||
var $nom;
|
||||
var $adresse;
|
||||
var $cp;
|
||||
var $ville;
|
||||
var $date;
|
||||
var $pays;
|
||||
var $public;
|
||||
var $projetid;
|
||||
var $modepaiement;
|
||||
var $note;
|
||||
var $statut;
|
||||
|
||||
var $projet;
|
||||
/*
|
||||
*
|
||||
* Statut du don
|
||||
* 0 : promesse non valid<69>e
|
||||
* 1 : promesse valid<69>e
|
||||
* 2 : don valid<69>
|
||||
* 3 : don pay<61>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@@ -45,29 +56,168 @@ class Don
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function create()
|
||||
Function create($userid)
|
||||
{
|
||||
/*
|
||||
* Insertion dans la base
|
||||
*/
|
||||
|
||||
$sql = "INSERT INTO llx_paiement (fk_facture, datec, datep, amount, author, fk_paiement, num_paiement, note)";
|
||||
$sql .= " VALUES ($this->facid, now(), $this->datepaye,$this->amount,'$this->author', $this->paiementid, '$this->num_paiement', '$this->note')";
|
||||
$sql = "INSERT INTO llx_don (datec, amount, fk_paiement, nom, adresse, cp, ville, pays, public, fk_don_projet, note, fk_user_author, datedon)";
|
||||
$sql .= " VALUES (now(), $this->amount, $this->modepaiement,'$this->nom','$this->adresse', '$this->cp','$this->ville','$this->pays',$this->public, $this->projetid, '$this->note', $userid, '$this->date')";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$label = "Facture $this->facnumber - $this->societe";
|
||||
$sql = "INSERT INTO llx_bank (datec, dateo, amount, author, label)";
|
||||
$sql .= " VALUES (now(), $this->datepaye, $this->amount,'$this->author', '$this->label')";
|
||||
$result = $this->db->query($sql);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "$sql";
|
||||
print $this->db->error();
|
||||
print "<h2><br>$sql<br></h2>";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Suppression du don
|
||||
*
|
||||
*/
|
||||
Function delete($rowid)
|
||||
{
|
||||
|
||||
$sql = "DELETE FROM llx_don WHERE rowid = $rowid AND fk_statut = 0;";
|
||||
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
if ( $this->db->affected_rows() )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Err : ".$this->db->error();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Fetch
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function fetch($rowid)
|
||||
{
|
||||
$sql = "SELECT d.rowid, ".$this->db->pdate("d.datedon")." as datedon, d.nom, d.amount, p.libelle as projet, d.fk_statut, d.adresse, d.cp, d.ville, d.public, d.amount, d.fk_paiement";
|
||||
$sql .= " FROM llx_don as d, llx_don_projet as p";
|
||||
$sql .= " WHERE p.rowid = d.fk_don_projet AND d.rowid = $rowid";
|
||||
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
|
||||
$obj = $this->db->fetch_object(0);
|
||||
|
||||
$this->date = $obj->datedon;
|
||||
$this->nom = $obj->nom;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->adresse = $obj->adresse;
|
||||
$this->cp = $obj->cp;
|
||||
$this->ville = $obj->ville;
|
||||
$this->projet = $obj->projet;
|
||||
$this->public = $obj->public;
|
||||
$this->modepaiement = $obj->modepaiement;
|
||||
$this->amount = $obj->amount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Suppression du don
|
||||
*
|
||||
*/
|
||||
Function valid_promesse($rowid, $userid)
|
||||
{
|
||||
|
||||
$sql = "UPDATE llx_don SET fk_statut = 1, fk_user_valid = $userid WHERE rowid = $rowid AND fk_statut = 0;";
|
||||
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
if ( $this->db->affected_rows() )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Err : ".$this->db->error();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Class<73> comme pay<61>, le don a <20>t<EFBFBD> recu
|
||||
*
|
||||
*/
|
||||
Function set_paye($rowid)
|
||||
{
|
||||
|
||||
$sql = "UPDATE llx_don SET fk_statut = 2 WHERE rowid = $rowid AND fk_statut = 1;";
|
||||
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
if ( $this->db->affected_rows() )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Err : ".$this->db->error();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Class<73> comme encaiss<73>
|
||||
*
|
||||
*/
|
||||
Function set_encaisse($rowid)
|
||||
{
|
||||
|
||||
$sql = "UPDATE llx_don SET fk_statut = 3 WHERE rowid = $rowid AND fk_statut = 2;";
|
||||
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
if ( $this->db->affected_rows() )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Err : ".$this->db->error();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
97
htdocs/html.form.class.php
Normal file
97
htdocs/html.form.class.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?PHP
|
||||
/* Copyright (c) 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$
|
||||
*/
|
||||
|
||||
class Form {
|
||||
var $db;
|
||||
var $errorstr;
|
||||
|
||||
|
||||
Function Form($DB)
|
||||
{
|
||||
|
||||
$this->db = $DB;
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
Function select($name, $sql, $id='')
|
||||
{
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
print '<select name="'.$name.'">';
|
||||
|
||||
$num = $this->db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
if (strlen($id))
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row($i);
|
||||
print "<option value=\"$row[0]\" ";
|
||||
if ($id == $row[0])
|
||||
{
|
||||
print "SELECTED";
|
||||
}
|
||||
print ">$row[1]</option>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row($i);
|
||||
print "<option value=\"$row[0]\">$row[1]</option>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
print "</select>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Renvoie la cha<68>ne de caract<63>re d<>crivant l'erreur
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function error()
|
||||
{
|
||||
return $this->errorstr;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -21,6 +21,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
$yn[0] = "non";
|
||||
$yn[1] = "oui";
|
||||
|
||||
function transcoS2L($zonein,$devise)
|
||||
{
|
||||
// Open source offert par <A HREF="mailto:alainfloch@free.fr?subject=chif2let">alainfloch@free.fr</A> 28/10/2001, sans garantie.
|
||||
@@ -294,28 +297,52 @@ function print_date_select() {
|
||||
|
||||
$smonth = 1;
|
||||
$syear = date("Y", time());
|
||||
$cday = date("d", time());
|
||||
|
||||
print "<select name=\"reday\">";
|
||||
for ($day = 1 ; $day < $sday + 32 ; $day++) {
|
||||
print "<option value=\"$day\">$day";
|
||||
}
|
||||
|
||||
for ($day = 1 ; $day < $sday + 32 ; $day++)
|
||||
{
|
||||
if ($day == $cday)
|
||||
{
|
||||
print "<option value=\"$day\" SELECTED>$day";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<option value=\"$day\">$day";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print "</select>";
|
||||
$cmonth = date("n", time());
|
||||
print "<select name=\"remonth\">";
|
||||
for ($month = $smonth ; $month < $smonth + 12 ; $month++) {
|
||||
if ($month == $cmonth) {
|
||||
print "<option value=\"$month\" SELECTED>" . $strmonth[$month];
|
||||
} else {
|
||||
print "<option value=\"$month\">" . $strmonth[$month];
|
||||
for ($month = $smonth ; $month < $smonth + 12 ; $month++)
|
||||
{
|
||||
if ($month == $cmonth)
|
||||
{
|
||||
print "<option value=\"$month\" SELECTED>" . $strmonth[$month];
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<option value=\"$month\">" . $strmonth[$month];
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</select>";
|
||||
|
||||
print "<select name=\"reyear\">";
|
||||
|
||||
for ($year = $syear ; $year < $syear + 5 ; $year++) {
|
||||
print "<option value=\"$year\">$year";
|
||||
}
|
||||
for ($year = $syear - 2; $year < $syear + 5 ; $year++)
|
||||
{
|
||||
if ($year == $syear)
|
||||
{
|
||||
print "<option value=\"$year\" SELECTED>$year";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<option value=\"$year\">$year";
|
||||
}
|
||||
}
|
||||
print "</select>\n";
|
||||
|
||||
}
|
||||
|
||||
@@ -75,14 +75,23 @@ class Paiement
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function select($name)
|
||||
Function select($name, $filtre='', $id='')
|
||||
{
|
||||
$form = new Form($this->db);
|
||||
|
||||
$sql = "SELECT id, libelle FROM c_paiement ORDER BY id";
|
||||
|
||||
$form->select($name, $sql);
|
||||
|
||||
if ($filtre == 'cr<63>dit')
|
||||
{
|
||||
$sql = "SELECT id, libelle FROM c_paiement WHERE type IN (0,2) ORDER BY libelle";
|
||||
}
|
||||
elseif ($filtre == 'd<>bit')
|
||||
{
|
||||
$sql = "SELECT id, libelle FROM c_paiement WHERE type IN (1,2) ORDER BY libelle";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT id, libelle FROM c_paiement ORDER BY libelle";
|
||||
}
|
||||
$form->select($name, $sql, $id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
require ("./main.inc.php3");
|
||||
|
||||
|
||||
function llxHeader($head = "") {
|
||||
global $user, $conf;
|
||||
|
||||
@@ -34,7 +33,8 @@ function llxHeader($head = "") {
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
$menu->add("/societe.php", "Soci<EFBFBD>t<EFBFBD>s");
|
||||
$menu->add("/societe.php", "Soci<EFBFBD>t<EFBFBD>s","company");
|
||||
$menu->add_submenu("../soc.php3?&action=create", "Nouvelle soci<63>t<EFBFBD>");
|
||||
|
||||
$menu->add("/comm/index.php3", "Commercial");
|
||||
|
||||
@@ -62,17 +62,20 @@ function llxHeader($head = "") {
|
||||
|
||||
$menu->add("/adherents/", "Adherents");
|
||||
|
||||
$menu->add("/compta/dons/", "Dons");
|
||||
|
||||
$menu->add("/user/", "Utilisateurs");
|
||||
|
||||
$menu->add("/info.php3", "Configuration");
|
||||
|
||||
if ($conf->voyage) {
|
||||
if ($conf->voyage)
|
||||
{
|
||||
|
||||
$menu->add("/compta/voyage/index.php3","Voyages");
|
||||
$menu->add("/compta/voyage/index.php3","Voyages");
|
||||
|
||||
$menu->add_submenu("/compta/voyage/index.php3","Voyages");
|
||||
$menu->add_submenu("/compta/voyage/reduc.php3","Reduc");
|
||||
}
|
||||
$menu->add_submenu("/compta/voyage/index.php3","Voyages");
|
||||
$menu->add_submenu("/compta/voyage/reduc.php3","Reduc");
|
||||
}
|
||||
|
||||
|
||||
$menu->add("/domain/", "Domaines");
|
||||
|
||||
@@ -26,7 +26,7 @@ llxHeader();
|
||||
|
||||
$db = new Db();
|
||||
|
||||
if ($action == 'add')
|
||||
if ($action == 'add' && $user->admin)
|
||||
{
|
||||
$service = new Service($db);
|
||||
|
||||
@@ -37,34 +37,42 @@ if ($action == 'add')
|
||||
|
||||
$id = $service->create($user->id);
|
||||
|
||||
if ($comm_now && $id) {
|
||||
$service->start_comm($id, $user->id);
|
||||
}
|
||||
if ($comm_now && $id)
|
||||
{
|
||||
$service->start_comm($id, $user->id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($action == 'set_datedeb')
|
||||
if ($action == 'update' && $user->admin)
|
||||
{
|
||||
$service = new Service($db);
|
||||
$service->start_comm($id, $user->id, $datedeb);
|
||||
}
|
||||
if ($action == 'set_datefin') {
|
||||
$service = new Service($db);
|
||||
$service->stop_comm($id, $user->id, $datefin);
|
||||
$edituser = new User($db, $id);
|
||||
$edituser->fetch();
|
||||
|
||||
$edituser->nom = $nom;
|
||||
$edituser->prenom = $prenom;
|
||||
$edituser->login = $login;
|
||||
$edituser->email = $email;
|
||||
|
||||
if (! $edituser->update($id, $user))
|
||||
{
|
||||
print $edituser->error();
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'update') {
|
||||
$service = new Service($db);
|
||||
if ($action == 'password' && $user->admin)
|
||||
{
|
||||
$edituser = new User($db, $id);
|
||||
$edituser->fetch();
|
||||
|
||||
$service->ref = $ref;
|
||||
$service->libelle = $label;
|
||||
$service->price = $price;
|
||||
$service->description = $desc;
|
||||
|
||||
$service->update($id, $user);
|
||||
if ($edituser->password())
|
||||
{
|
||||
print "Mot de passe chang<6E> et envoy<6F> <20> $edituser->email<p>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Nouvel utilisateur */
|
||||
@@ -107,87 +115,88 @@ if ($action == 'create')
|
||||
}
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Visue et edition */
|
||||
/* Visu et edition */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
else
|
||||
{
|
||||
if ($id) {
|
||||
$fuser = new User($db, $id);
|
||||
$fuser->fetch();
|
||||
if ($id)
|
||||
{
|
||||
$fuser = new User($db, $id);
|
||||
$fuser->fetch();
|
||||
|
||||
print '<div class="titre">Fiche utilisateur</div><br>';
|
||||
print '<div class="titre">Fiche utilisateur</div><br>';
|
||||
|
||||
print '<table width="100%" border="1" cellpadding="3" cellspacing="0">';
|
||||
|
||||
print '<tr><td valign="top">Nom</td>';
|
||||
print '<td bgcolor="#e0e0e0">'.$fuser->nom.'</td>';
|
||||
print '<td valign="top">Pr<50>nom</td>';
|
||||
print '<td>'.$fuser->prenom.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">Login</td>';
|
||||
print '<td bgcolor="#e0e0e0">'.$fuser->login.'</td>';
|
||||
print '<td valign="top">Pass</td>';
|
||||
print '<td>'.$fuser->pass.'</td></tr>';
|
||||
|
||||
print '<tr><td width="25%" valign="top">Webcal Login</td>';
|
||||
print '<td width="25%" bgcolor="#e0e0e0">'.$fuser->webcal_login.'</td>';
|
||||
print '<td width="25%" valign="top">Pass</td>';
|
||||
print '<td width="25%">'.$fuser->pass.'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '<br><table width="100%" border="1" cellspacing="0" cellpadding="2">';
|
||||
|
||||
print '<td width="20%">Barre d\'action</td>';
|
||||
print '<td width="20%" bgcolor="#e0E0E0" align="center">[<a href="fiche.php3?action=edit&id='.$id.'">Editer</a>]</td>';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edition */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'edit') {
|
||||
print '<hr><div class="titre">Edition de l\'utilisateur</div><br>';
|
||||
print '<form action="'.$PHP_SELF.'?id='.$id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<table border="1" cellpadding="3" cellspacing="0">';
|
||||
print '<table width="100%" border="1" cellpadding="3" cellspacing="0">';
|
||||
|
||||
print '<tr><td valign="top">Nom</td>';
|
||||
print '<td>'.$user->id.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">Nom</td>';
|
||||
print '<td><input size="12" type="text" name="ref" value="'.$user->nom.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">Pr<50>nom</td>';
|
||||
print '<td><input size="30" type="text" name="label" value="'.$user->prenom.'"></td></tr>';
|
||||
print '<td bgcolor="#e0e0e0">'.$fuser->nom.'</td>';
|
||||
print '<td valign="top">Pr<50>nom</td>';
|
||||
print '<td>'.$fuser->prenom.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">Login</td>';
|
||||
print '<td><input size="30" type="text" name="label" value="'.$user->login.'"></td></tr>';
|
||||
print '<td bgcolor="#e0e0e0">'.$fuser->login.'</td>';
|
||||
print '<td valign="top">Email</td>';
|
||||
print '<td>'.$fuser->email.'</td></tr>';
|
||||
|
||||
print '<tr><td width="25%" valign="top">Webcal Login</td>';
|
||||
print '<td width="25%" bgcolor="#e0e0e0">'.$fuser->webcal_login.'</td>';
|
||||
print '<td width="25%" valign="top">Administrateur</td>';
|
||||
print '<td width="25%">'.$yn[$fuser->admin].'</td></tr>';
|
||||
|
||||
|
||||
print '<tr><td valign="top">Description</td><td>';
|
||||
print "<textarea name=\"desc\" rows=\"12\" cols=\"40\">";
|
||||
print $user->description;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td align="center" colspan="2"><input value="Enregistrer" type="submit"></td></tr>';
|
||||
print '</form>';
|
||||
print '</table>';
|
||||
|
||||
print '<br><table width="100%" border="1" cellspacing="0" cellpadding="2">';
|
||||
|
||||
print '<td width="25%" bgcolor="#e0E0E0" align="center">[<a href="fiche.php3?action=edit&id='.$id.'">Editer</a>]</td>';
|
||||
print '<td width="25%" align="center">-</td>';
|
||||
print '<td width="25%" align="center">[<a href="fiche.php3?action=password&id='.$id.'">Nouveau mot de passe</a>]</td>';
|
||||
print '<td width="25%" align="center">-</td>';
|
||||
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edition */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'edit' && $user->admin)
|
||||
{
|
||||
print '<hr><div class="titre">Edition de l\'utilisateur</div><br>';
|
||||
print '<form action="'.$PHP_SELF.'?id='.$id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<table border="1" cellpadding="3" cellspacing="0">';
|
||||
|
||||
print '<tr><td valign="top">Id</td>';
|
||||
print '<td>'.$fuser->id.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">Nom</td>';
|
||||
print '<td><input size="30" type="text" name="nom" value="'.$fuser->nom.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">Pr<50>nom</td>';
|
||||
print '<td><input size="20" type="text" name="prenom" value="'.$fuser->prenom.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">Login</td>';
|
||||
print '<td><input size="10" maxlength="8" type="text" name="login" value="'.$fuser->login.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">Email</td>';
|
||||
print '<td><input size="12" type="text" name="email" value="'.$fuser->email.'"></td></tr>';
|
||||
|
||||
|
||||
print '<tr><td valign="top">Description</td><td>';
|
||||
print "<textarea name=\"desc\" rows=\"12\" cols=\"40\">";
|
||||
print $fuser->description;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td align="center" colspan="2"><input value="Enregistrer" type="submit"></td></tr>';
|
||||
print '</form>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user