Dbuggage et amliorations divers du modules adhrents
This commit is contained in:
parent
4164a70d94
commit
f8be595425
@ -52,6 +52,8 @@ class Adherent
|
||||
var $adresse;
|
||||
var $cp;
|
||||
var $ville;
|
||||
var $pays_id;
|
||||
var $pays_code;
|
||||
var $pays;
|
||||
var $typeid;
|
||||
var $morphy;
|
||||
@ -98,6 +100,7 @@ class Adherent
|
||||
\remarks %INFOS% : l'ensemble des attributs de cet adherent
|
||||
\remarks %SERVEUR% : URL du serveur web
|
||||
\remarks etc..
|
||||
\todo Utiliser classe CMailFile
|
||||
*/
|
||||
|
||||
function send_an_email($recipients,$text,$subject="Vos coordonnees sur %SERVEUR%")
|
||||
@ -169,21 +172,22 @@ class Adherent
|
||||
|
||||
|
||||
/**
|
||||
\brief fonction qui renvoie la nature physique ou morale d'un adherent
|
||||
\param morphy nature physique ou morale de l'adhérent
|
||||
\brief Renvoie le libelle traduit de la nature d'un adherent (physique ou morale)
|
||||
\param morphy Nature physique ou morale de l'adhérent
|
||||
*/
|
||||
|
||||
function getmorphylib($morphy='')
|
||||
{
|
||||
global $langs;
|
||||
if (! $morphy) { $morphy=$this->morphy; }
|
||||
if ($morphy == 'phy') { return "Physique"; }
|
||||
if ($morphy == 'mor') { return "Morale"; }
|
||||
if ($morphy == 'phy') { return $langs->trans("Physical"); }
|
||||
if ($morphy == 'mor') { return $langs->trans("Moral"); }
|
||||
return $morphy;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief fonction qui vérifie les données entrées
|
||||
\param minimum
|
||||
\brief Vérifie les données entrées
|
||||
\param minimum
|
||||
*/
|
||||
|
||||
function check($minimum=0)
|
||||
@ -318,8 +322,8 @@ class Adherent
|
||||
function update()
|
||||
{
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET ";
|
||||
$sql .= "prenom = '".$this->prenom ."'";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql .= " prenom = '".$this->prenom ."'";
|
||||
$sql .= ",nom='" .$this->nom."'";
|
||||
$sql .= ",societe='".$this->societe."'";
|
||||
$sql .= ",adresse='".$this->adresse."'";
|
||||
@ -330,7 +334,8 @@ class Adherent
|
||||
$sql .= ",email='" .$this->email."'";
|
||||
$sql .= ",login='" .$this->login."'";
|
||||
$sql .= ",pass='" .$this->pass."'";
|
||||
$sql .= ",naiss='" .$this->naiss."'";
|
||||
if ($this->naiss) $sql .= ",naiss='" .$this->naiss."'";
|
||||
else $sql .= ",naiss=null";
|
||||
$sql .= ",photo='" .$this->photo."'";
|
||||
$sql .= ",public='" .$this->public."'";
|
||||
$sql .= ",statut=" .$this->statut;
|
||||
@ -454,55 +459,61 @@ class Adherent
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief fonction qui récupére l'adhérent en donnant son rowid
|
||||
\param rowid
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.statut, d.public, d.adresse, d.cp, d.ville, d.pays, d.note, d.email, d.login, d.pass, d.naiss, d.photo, d.fk_adherent_type, d.morphy, t.libelle as type";
|
||||
$sql .= ",".$this->db->pdate("d.datefin")." as datefin";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE d.rowid = $rowid AND d.fk_adherent_type = t.rowid";
|
||||
|
||||
$result=$this->db->query( $sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->typeid = $obj->fk_adherent_type;
|
||||
$this->type = $obj->type;
|
||||
$this->statut = $obj->statut;
|
||||
$this->public = $obj->public;
|
||||
$this->date = $obj->datedon;
|
||||
$this->prenom = stripslashes($obj->prenom);
|
||||
$this->nom = stripslashes($obj->nom);
|
||||
$this->societe = stripslashes($obj->societe);
|
||||
$this->adresse = stripslashes($obj->adresse);
|
||||
$this->cp = stripslashes($obj->cp);
|
||||
$this->ville = stripslashes($obj->ville);
|
||||
$this->email = stripslashes($obj->email);
|
||||
$this->login = stripslashes($obj->login);
|
||||
$this->pass = stripslashes($obj->pass);
|
||||
$this->naiss = stripslashes($obj->naiss);
|
||||
$this->photo = stripslashes($obj->photo);
|
||||
$this->pays = stripslashes($obj->pays);
|
||||
$this->datefin = $obj->datefin;
|
||||
$this->commentaire = stripslashes($obj->note);
|
||||
$this->morphy = $obj->morphy;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
/**
|
||||
\brief fonction qui récupére l'adhérent en donnant son rowid
|
||||
\param rowid
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.statut, d.public, d.adresse, d.cp, d.ville, d.note, d.email, d.login, d.pass, d.naiss, d.photo, d.fk_adherent_type, d.morphy, t.libelle as type";
|
||||
$sql .= ",".$this->db->pdate("d.datefin")." as datefin";
|
||||
$sql .= ", d.pays, p.rowid as pays_id, p.code as pays_code, p.libelle as pays_lib";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON d.pays = p.rowid";
|
||||
$sql .= " WHERE d.rowid = $rowid AND d.fk_adherent_type = t.rowid";
|
||||
|
||||
}
|
||||
$result=$this->db->query( $sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->typeid = $obj->fk_adherent_type;
|
||||
$this->type = $obj->type;
|
||||
$this->statut = $obj->statut;
|
||||
$this->public = $obj->public;
|
||||
$this->date = $obj->datedon;
|
||||
$this->prenom = stripslashes($obj->prenom);
|
||||
$this->nom = stripslashes($obj->nom);
|
||||
$this->societe = stripslashes($obj->societe);
|
||||
$this->adresse = stripslashes($obj->adresse);
|
||||
$this->cp = stripslashes($obj->cp);
|
||||
$this->ville = stripslashes($obj->ville);
|
||||
$this->pays_id = $obj->pays_id;
|
||||
$this->pays_code = $obj->pays_code;
|
||||
if ($langs->trans("Country".$obj->pays_code) != "Country".$obj->pays_code) $this->pays = $langs->trans("Country".$obj->pays_code);
|
||||
elseif ($obj->pays_lib) $this->pays=$obj->pays_lib;
|
||||
else $this->pays=$obj->pays;
|
||||
$this->email = stripslashes($obj->email);
|
||||
$this->login = stripslashes($obj->login);
|
||||
$this->pass = stripslashes($obj->pass);
|
||||
$this->naiss = stripslashes($obj->naiss);
|
||||
$this->photo = stripslashes($obj->photo);
|
||||
$this->datefin = $obj->datefin;
|
||||
$this->commentaire = stripslashes($obj->note);
|
||||
$this->morphy = $obj->morphy;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -580,49 +591,57 @@ class Adherent
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
\brief fonction qui insère la cotisation dans la base de données
|
||||
\param date
|
||||
\param montant
|
||||
*/
|
||||
|
||||
function cotisation($date, $montant)
|
||||
|
||||
{
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, dateadh, cotisation)";
|
||||
$sql .= " VALUES ($this->id, ".$this->db->idate($date).", $montant)";
|
||||
|
||||
$result=$this->db->query( $sql);
|
||||
|
||||
if ($result)
|
||||
/**
|
||||
\brief Fonction qui insère la cotisation dans la base de données
|
||||
\param date Date cotisation
|
||||
\param montant Montant cotisation
|
||||
\return int rowid de l'entrée ajoutée, <0 si erreur
|
||||
*/
|
||||
function cotisation($date, $montant)
|
||||
{
|
||||
if ( $this->db->affected_rows() )
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, datec, dateadh, cotisation)";
|
||||
$sql .= " VALUES ($this->id, now(), ".$this->db->idate($date).", $montant)";
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$rowid=$this->db->last_insert_id(MAIN_DB_PREFIX."cotisation");
|
||||
$datefin = mktime(12, 0 , 0,
|
||||
strftime("%m",$date),
|
||||
strftime("%d",$date),
|
||||
strftime("%Y",$date)+1) - (24 * 3600);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET datefin = ".$this->db->idate($datefin)." WHERE rowid =". $this->id;
|
||||
|
||||
if ( $this->db->query( $sql) )
|
||||
if ( $this->db->affected_rows($result) )
|
||||
{
|
||||
return $rowid;
|
||||
$rowid=$this->db->last_insert_id(MAIN_DB_PREFIX."cotisation");
|
||||
$datefin = mktime(12, 0 , 0,
|
||||
strftime("%m",$date),
|
||||
strftime("%d",$date),
|
||||
strftime("%Y",$date)+1) - (24 * 3600);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET datefin = ".$this->db->idate($datefin)." WHERE rowid =". $this->id;
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
$this->db->commit();
|
||||
return $rowid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief fonction qui vérifie que l'utilisateur est valide
|
||||
|
||||
@ -30,118 +30,95 @@
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php");
|
||||
|
||||
$sortorder=$_GET["sortorder"];
|
||||
$sortfield=$_GET["sortfield"];
|
||||
$page=$_GET["page"];
|
||||
$filter=$_GET["filter"];
|
||||
$statut=isset($_GET["statut"])?$_GET["statut"]:1;
|
||||
|
||||
if (! $sortorder) { $sortorder="DESC"; }
|
||||
if (! $sortfield) { $sortfield="c.dateadh"; }
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$date_select=isset($_GET["date_select"])?$_GET["date_select"]:$_POST["date_select"];
|
||||
|
||||
|
||||
|
||||
// Insertion de la cotisation dans le compte banquaire
|
||||
if ($_POST["action"] == '2bank' && $_POST["rowid"] !='')
|
||||
{
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0)
|
||||
{
|
||||
|
||||
// \todo Créer une facture et enregistrer son paiement
|
||||
|
||||
|
||||
$dateop=strftime("%Y%m%d",time());
|
||||
$sql="SELECT cotisation FROM ".MAIN_DB_PREFIX."cotisation WHERE rowid=".$_POST["rowid"]." ";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
if ($num>0)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$amount=$objp->cotisation;
|
||||
$acct=new Account($db,ADHERENT_BANK_ACCOUNT);
|
||||
$insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"],ADHERENT_BANK_CATEGORIE,$user);
|
||||
if ($insertid == '')
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
else
|
||||
{
|
||||
// met a jour la table cotisation
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=$insertid WHERE rowid=".$_POST["rowid"]." ";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
//Header("Location: cotisations.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
|
||||
// \todo Cette partie de code semble non utilisée
|
||||
if ($action == 'add') {
|
||||
$datepaye = $db->idate(mktime(12, 0 , 0, $pmonth, $pday, $pyear));
|
||||
|
||||
$paiement = new Paiement($db);
|
||||
|
||||
$paiement->facid = $facid;
|
||||
$paiement->datepaye = $datepaye;
|
||||
$paiement->amount = $amount;
|
||||
$paiement->author = $author;
|
||||
$paiement->paiementid = $paiementid;
|
||||
$paiement->num_paiement = $num_paiement;
|
||||
$paiement->note = $note;
|
||||
|
||||
$paiement->create();
|
||||
|
||||
$action = '';
|
||||
|
||||
}
|
||||
$params="&select_date=".$select_date;
|
||||
print_barre_liste($langs->trans("ListOfSubscriptions"), $page, "cotisations.php", $params, $sortfield, $sortorder,'',$num);
|
||||
|
||||
|
||||
// Insertion de la cotisation dans le compte banquaire
|
||||
if ($_POST["action"] == '2bank' && $_POST["rowid"] !=''){
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0){
|
||||
|
||||
// \todo Créer une facture et enregistrer son paiement
|
||||
|
||||
|
||||
$dateop=strftime("%Y%m%d",time());
|
||||
$sql="SELECT cotisation FROM ".MAIN_DB_PREFIX."cotisation WHERE rowid=".$_POST["rowid"]." ";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
if ($num>0)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$amount=$objp->cotisation;
|
||||
$acct=new Account($db,ADHERENT_BANK_ACCOUNT);
|
||||
$insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"],ADHERENT_BANK_CATEGORIE,$user);
|
||||
if ($insertid == '')
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
else
|
||||
{
|
||||
// met a jour la table cotisation
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=$insertid WHERE rowid=".$_POST["rowid"]." ";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
//Header("Location: cotisations.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($sortorder == "") { $sortorder="DESC"; }
|
||||
if ($sortfield == "") { $sortfield="c.dateadh"; }
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$sql = "SELECT c.cotisation, ".$db->pdate("c.dateadh")." as dateadh";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
|
||||
$sql .= " WHERE d.rowid = c.fk_adherent";
|
||||
if(isset($date_select) && $date_select != ''){
|
||||
$sql .= " AND dateadh LIKE '$date_select%'";
|
||||
}
|
||||
$result = $db->query($sql);
|
||||
$Total=array();
|
||||
$Number=array();
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$Total[strftime("%Y",$objp->dateadh)]+=price($objp->cotisation);
|
||||
$Number[strftime("%Y",$objp->dateadh)]+=1;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, c.cotisation, ".$db->pdate("c.dateadh")." as dateadh, c.fk_bank as bank, c.rowid as crowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
|
||||
$sql .= " WHERE d.rowid = c.fk_adherent";
|
||||
// Liste des cotisations
|
||||
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, b.fk_account,";
|
||||
$sql.= " c.cotisation, ".$db->pdate("c.dateadh")." as dateadh, c.fk_bank as bank, c.rowid as crowid,";
|
||||
$sql.= " b.fk_account";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank=b.rowid";
|
||||
$sql.= " WHERE d.rowid = c.fk_adherent";
|
||||
if(isset($date_select) && $date_select != ''){
|
||||
$sql .= " AND dateadh LIKE '$date_select%'";
|
||||
}
|
||||
@ -152,86 +129,66 @@ if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print_barre_liste($langs->trans("ListOfSubscriptions"), $page, "cotisations.php", "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield");
|
||||
|
||||
print "<table class=\"noborder\">\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Year").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Amount").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Number").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Average").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
foreach ($Total as $key=>$value){
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]><td><A HREF=\"cotisations.php?statut=$statut&date_select=$key\">$key</A></td><td align=\"right\">".price($value)."</td><td align=\"right\">".$Number[$key]."</td><td align=\"right\">".price($value/$Number[$key])."</td></tr>\n";
|
||||
}
|
||||
print "</table><br>\n";
|
||||
|
||||
|
||||
// Liste des cotisations
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Name"),"cotisations.php","d.nom","&page=$page&statut=$statut");
|
||||
print_liste_field_titre($langs->trans("Date"),"cotisations.php","c.dateadh","&page=$page&statut=$statut");
|
||||
print_liste_field_titre($langs->trans("Amount"),"cotisations.php","c.cotisation","&page=$page&statut=$statut","","align=\"right\"");
|
||||
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0){
|
||||
print '<td>';
|
||||
// print_liste_field_titre("Bank","cotisations.php","c.fk_bank","&page=$page&statut=$statut");
|
||||
print 'Bank<br>(Type,Numéro,Libelle)';
|
||||
print "</td>\n";
|
||||
print_liste_field_titre($langs->trans("Date"),"cotisations.php","c.dateadh","&page=$page&statut=$statut","","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("Name"),"cotisations.php","d.nom","&page=$page&statut=$statut","","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("Amount"),"cotisations.php","c.cotisation","&page=$page&statut=$statut","","align=\"right\"",$sortfield);
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0)
|
||||
{
|
||||
print_liste_field_titre($langs->trans("Bank"),"cotisations.php","b.fk_account","&page=$page&statut=$statut","","",$sortfield);
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
$var=true;
|
||||
$total=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$total+=price($objp->cotisation);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td>".dolibarr_print_date($objp->dateadh)."</td>\n";
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".img_object($langs->trans("ShowMember"),"user").' '.stripslashes($objp->prenom)." ".stripslashes($objp->nom)."</a></td>\n";
|
||||
print '<td align="right">'.price($objp->cotisation).'</td>';
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$total+=price($objp->cotisation);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".stripslashes($objp->prenom)." ".stripslashes($objp->nom)."</a></td>\n";
|
||||
print "<td>".strftime("%d %B %Y",$objp->dateadh)."</td>\n";
|
||||
print '<td align="right">'.price($objp->cotisation).'</td>';
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0){
|
||||
if ($objp->bank !='' ){
|
||||
print "<td>Deposé</td>";
|
||||
}else{
|
||||
print "<td>";
|
||||
print "<form method=\"post\" action=\"cotisations.php\">";
|
||||
print '<input type="hidden" name="action" value="2bank">';
|
||||
print '<input type="hidden" name="rowid" value="'.$objp->crowid.'">';
|
||||
print '<select name="operation">';
|
||||
print '<option value="CHQ" selected>CHQ';
|
||||
print '<option value="CB">CB';
|
||||
print '<option value="DEP">DEP';
|
||||
print '<option value="TIP">TIP';
|
||||
print '<option value="PRE">PRE';
|
||||
print '<option value="VIR">VIR';
|
||||
print '</select>';
|
||||
print '<input name="num_chq" type="text" size="6"> - ';
|
||||
print "<input name=\"label\" type=\"text\" size=20 value=\"Cotisation ".stripslashes($objp->prenom)." ".stripslashes($objp->nom)." ".strftime("%Y",$objp->dateadh)."\" >\n";
|
||||
// print "<td><input name=\"debit\" type=\"text\" size=8></td>";
|
||||
// print "<td><input name=\"credit\" type=\"text\" size=8></td>";
|
||||
print '<input type="submit" value="Dépot">';
|
||||
print "</form>\n";
|
||||
print "</td>\n";
|
||||
}
|
||||
}
|
||||
print "</tr>";
|
||||
$i++;
|
||||
if ($objp->fk_account)
|
||||
{
|
||||
$acc=new Account($db);
|
||||
$acc->fetch($objp->fk_account);
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$objp->fk_account.'">'.$acc->label.'</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td>";
|
||||
print "<form method=\"post\" action=\"cotisations.php\">";
|
||||
print '<input type="hidden" name="action" value="2bank">';
|
||||
print '<input type="hidden" name="rowid" value="'.$objp->crowid.'">';
|
||||
$html = new Form($db);
|
||||
$html->select_types_paiements();
|
||||
print '<input name="num_chq" type="text" size="6"> - ';
|
||||
print "<input name=\"label\" type=\"text\" size=20 value=\"".$langs->trans("Subscriptions").' '.stripslashes($objp->prenom)." ".stripslashes($objp->nom)." ".strftime("%Y",$objp->dateadh)."\" >\n";
|
||||
// print "<td><input name=\"debit\" type=\"text\" size=8></td>";
|
||||
// print "<td><input name=\"credit\" type=\"text\" size=8></td>";
|
||||
print '<input type="submit" value="'.$langs->trans("Save").'">';
|
||||
print "</form>\n";
|
||||
print "</td>\n";
|
||||
}
|
||||
}
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<tr class="liste_total">';
|
||||
print "<td>".$langs->trans("Total")."</td>\n";
|
||||
print "<td align=\"right\"> </td>\n";
|
||||
print "<td align=\"right\">".price($total)."</td>\n";
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
print "</table>";
|
||||
print "<br>\n";
|
||||
@ -246,5 +203,5 @@ else
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -128,7 +128,19 @@ if ($rowid)
|
||||
|
||||
$adht = new AdherentType($db);
|
||||
|
||||
print_titre($langs->trans("EditMember"));
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$rowid;
|
||||
$head[$h][1] = $langs->trans("MemberCard");
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $adh->fullname);
|
||||
|
||||
|
||||
print "<form action=\"edit.php\" method=\"post\">";
|
||||
print '<table class="border" width="100%">';
|
||||
@ -147,10 +159,10 @@ if ($rowid)
|
||||
|
||||
print '<td valign="top" width="50%">'.$langs->trans("Comments").'</td></tr>';
|
||||
|
||||
$morphys["phy"] = "Physique";
|
||||
$morphys["mor"] = "Morale";
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Morale");
|
||||
|
||||
print "<tr><td>Personne</td><td>";
|
||||
print "<tr><td>".$langs->trans("Person")."</td><td>";
|
||||
$htmls->select_array("morphy", $morphys, $adh->morphy);
|
||||
print "</td>";
|
||||
|
||||
@ -164,13 +176,15 @@ if ($rowid)
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.$adh->societe.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="3">'.$adh->adresse.'</textarea></td></tr>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="2">'.$adh->adresse.'</textarea></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Zip").'/'.$langs->trans("Town").'</td><td><input type="text" name="cp" size="6" value="'.$adh->cp.'"> <input type="text" name="ville" size="20" value="'.$adh->ville.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td><input type="text" name="pays" size="40" value="'.$adh->pays.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td>';
|
||||
$htmls->select_pays($adh->pays_id?$adh->pays_id:MAIN_INFO_SOCIETE_PAYS,'pays');
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" size="40" value="'.$adh->email.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Login").'</td><td><input type="text" name="login" size="40" value="'.$adh->login.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Password").'</td><td><input type="password" name="pass" size="40" value="'.$adh->pass.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Birthday").'<BR>Format AAAA-MM-JJ</td><td><input type="text" name="naiss" size="40" value="'.$adh->naiss.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Birthday").'</td><td><input type="text" name="naiss" size="10" value="'.$adh->naiss.'"> ('.$langs->trans("DateFormatYYYYMMDD").')</td></tr>';
|
||||
print '<tr><td>URL photo</td><td><input type="text" name="photo" size="40" value="'.$adh->photo.'"></td></tr>';
|
||||
// $myattr=$adho->fetch_name_optionals();
|
||||
foreach($adho->attribute_label as $key=>$value){
|
||||
@ -181,12 +195,13 @@ if ($rowid)
|
||||
print '<input type="submit" name="bouton" value="'.$langs->trans("Save").'"> ';
|
||||
print '<input type="submit" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td></tr>';
|
||||
print '</form>';
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
@ -67,27 +67,30 @@ if ($_POST["action"] == 'cotisation')
|
||||
$adh = new Adherent($db);
|
||||
$adh->id = $rowid;
|
||||
$adh->fetch($rowid);
|
||||
if ($cotisation >= 0)
|
||||
if ($cotisation > 0)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
// rajout du nouveau cotisant dans les listes qui vont bien
|
||||
// if (defined("ADHERENT_MAILMAN_LISTS_COTISANT") && ADHERENT_MAILMAN_LISTS_COTISANT!='' && $adh->datefin == "0000-00-00 00:00:00"){
|
||||
if (defined("ADHERENT_MAILMAN_LISTS_COTISANT") && ADHERENT_MAILMAN_LISTS_COTISANT!='' && $adh->datefin == 0){
|
||||
$adh->add_to_mailman(ADHERENT_MAILMAN_LISTS_COTISANT);
|
||||
}
|
||||
|
||||
$crowid=$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation);
|
||||
if (defined("ADHERENT_MAIL_COTIS") && defined("ADHERENT_MAIL_COTIS_SUBJECT")){
|
||||
$adh->send_an_email($adh->email,ADHERENT_MAIL_COTIS,ADHERENT_MAIL_COTIS_SUBJECT);
|
||||
}
|
||||
|
||||
// insertion dans la gestion banquaire si configure pour
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 &&
|
||||
defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE)
|
||||
{
|
||||
$acct=new Account($db,$_POST["accountid"]);
|
||||
|
||||
$dateop=strftime("%Y%m%d",time());
|
||||
$amount=$cotisation;
|
||||
$acct=new Account($db,ADHERENT_BANK_ACCOUNT);
|
||||
$insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"],ADHERENT_BANK_CATEGORIE,$user);
|
||||
if ($insertid == '')
|
||||
$insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"], '', $user);
|
||||
if ($insertid <= 0)
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
$db->rollback();
|
||||
dolibarr_print_error($db,$acct->error);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -96,14 +99,25 @@ if ($_POST["action"] == 'cotisation')
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$db->commit();
|
||||
//Header("Location: fiche.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
|
||||
if (defined("ADHERENT_MAIL_COTIS") && defined("ADHERENT_MAIL_COTIS_SUBJECT")){
|
||||
$adh->send_an_email($adh->email,ADHERENT_MAIL_COTIS,ADHERENT_MAIL_COTIS_SUBJECT);
|
||||
}
|
||||
|
||||
}
|
||||
$action = "edit";
|
||||
}
|
||||
@ -117,13 +131,13 @@ if ($_POST["action"] == 'add')
|
||||
$adresse=$_POST["adresse"];
|
||||
$cp=$_POST["cp"];
|
||||
$ville=$_POST["ville"];
|
||||
$naiss=$_POST["pays"];
|
||||
$pays=$_POST["pays"];
|
||||
$email=$_POST["email"];
|
||||
$login=$_POST["login"];
|
||||
$pass=$_POST["pass"];
|
||||
$naiss=$_POST["naiss"];
|
||||
$naiss=$_POST["photo"];
|
||||
$naiss=$_POST["note"];
|
||||
$photo=$_POST["photo"];
|
||||
$note=$_POST["note"];
|
||||
$comment=$_POST["comment"];
|
||||
$morphy=$_POST["morphy"];
|
||||
$reday=$_POST["reday"];
|
||||
@ -138,13 +152,13 @@ if ($_POST["action"] == 'add')
|
||||
$adh->adresse = $adresse;
|
||||
$adh->cp = $cp;
|
||||
$adh->ville = $ville;
|
||||
$adh->pays = $pays;
|
||||
$adh->email = $email;
|
||||
$adh->login = $login;
|
||||
$adh->pass = $pass;
|
||||
$adh->naiss = $naiss;
|
||||
$adh->photo = $photo;
|
||||
$adh->note = $note;
|
||||
$adh->pays = $pays;
|
||||
$adh->typeid = $type;
|
||||
$adh->commentaire = $comment;
|
||||
$adh->morphy = $morphy;
|
||||
@ -202,8 +216,9 @@ if ($_POST["action"] == 'add')
|
||||
} else {
|
||||
$public=0;
|
||||
}
|
||||
if (!$error) {
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
// Email a peu pres correct et le login n'existe pas
|
||||
if ($adh->create($user->id))
|
||||
{
|
||||
@ -211,12 +226,12 @@ if ($_POST["action"] == 'add')
|
||||
{
|
||||
$crowid=$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation);
|
||||
// insertion dans la gestion banquaire si configure pour
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 &&
|
||||
defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE)
|
||||
{
|
||||
$dateop=strftime("%Y%m%d",time());
|
||||
$amount=$cotisation;
|
||||
$acct=new Account($db,ADHERENT_BANK_ACCOUNT);
|
||||
$insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"],ADHERENT_BANK_CATEGORIE);
|
||||
$acct=new Account($db,$_POST["accountid"]);
|
||||
$insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"], '', $user);
|
||||
if ($insertid == '')
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
@ -401,59 +416,58 @@ if ($action == 'create')
|
||||
$htmls->select_array("morphy", $morphys);
|
||||
print "</td>\n";
|
||||
|
||||
print '<td valign="top" rowspan="13"><textarea name="comment" wrap="soft" cols="40" rows="25"></textarea></td></tr>';
|
||||
print '<td valign="top" rowspan="12"><textarea name="comment" wrap="soft" cols="40" rows="16"></textarea></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Firstname").'*</td><td><input type="text" name="prenom" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Lastname").'*</td><td><input type="text" name="nom" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="3"></textarea></td></tr>';
|
||||
print '<tr><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><td>'.$langs->trans("Country").'</td><td><input type="text" name="pays" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("EMail").(ADHERENT_MAIL_REQUIRED&&ADHERENT_MAIL_REQUIRED==1?'*':'').'</td><td><input type="text" name="email" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Login").'*</td><td><input type="text" name="login" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Password").'*</td><td><input type="password" name="pass" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Birthday").'<br>('.$langs->trans("DateFormatYYYYMMDD").')</td><td><input type="text" name="naiss" size="10"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Firstname").'*</td><td><input type="text" name="prenom" size="40" value="'.$adh->prenom.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Lastname").'*</td><td><input type="text" name="nom" value="'.$adh->nom.'" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.$adh->societe.'"></td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="2"></textarea></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td><input type="text" name="cp" size="8"> <input type="text" name="ville" size="40" value="'.$adh->ville.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td>';
|
||||
$htmls->select_pays($adh->pays?$adh->pays:MAIN_INFO_SOCIETE_PAYS,'pays');
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("EMail").(ADHERENT_MAIL_REQUIRED&&ADHERENT_MAIL_REQUIRED==1?'*':'').'</td><td><input type="text" name="email" size="40" value="'.$adh->email.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Login").'*</td><td><input type="text" name="login" size="40" value="'.$adh->login.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Password").'*</td><td><input type="password" name="pass" size="40" value="'.$adh->password.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Birthday").'</td><td><input type="text" name="naiss" size="10"> ('.$langs->trans("DateFormatYYYYMMDD").')</td></tr>';
|
||||
print '<tr><td>Url photo</td><td><input type="text" name="photo" size="40"></td></tr>';
|
||||
foreach($adho->attribute_label as $key=>$value){
|
||||
print "<tr><td>$value</td><td><input type=\"text\" name=\"options_$key\" size=\"40\"></td></tr>\n";
|
||||
}
|
||||
print "</table>\n";
|
||||
print '<br>';
|
||||
|
||||
// Boite cotisations
|
||||
print '<table class="border" width="100%">';
|
||||
print "<tr><td>".$langs->trans("DateSubscription")."</td><td>\n";
|
||||
$htmls->select_date();
|
||||
print "</td></tr>\n";
|
||||
print '<tr><td>Mode de paiment</td><td>';
|
||||
|
||||
print '<select name="operation">';
|
||||
print '<option value="CHQ" selected>Chèque';
|
||||
print '<option value="CB">Carte Bleue';
|
||||
print '<option value="DEP">Espece';
|
||||
print '<option value="TIP">TIP';
|
||||
print '<option value="PRE">PRE';
|
||||
print '<option value="VIR">Virement';
|
||||
print '</select>';
|
||||
// $paiement = new Paiement($db);
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("PaymentMode").'</td><td>';
|
||||
$htmls->select_types_paiements('','operation');
|
||||
print "</td></tr>\n";
|
||||
|
||||
// $paiement->select("modepaiement","crédit");
|
||||
print '<tr><td>'.$langs->trans("FinancialAccount").'</td><td>';
|
||||
$htmls->select_comptes('','accountid');
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "</td></tr>\n";
|
||||
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 &&
|
||||
defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){
|
||||
print "<tr><td>Numero de cheque</td><td>\n";
|
||||
print '<tr><td>'.$langs->trans("Numero").'</td><td>';
|
||||
print '<input name="num_chq" type="text" size="6">';
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
print '<tr><td>'.$langs->trans("Subscription").'</td><td><input type="text" name="cotisation" size="6">'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 && defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input name="label" type="text" size=20 value="'.$langs->trans("Subscription").' " ></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input name="label" type="text" size="50" value="'.$langs->trans("Subscription").' " ></td></tr>';
|
||||
}
|
||||
print '<tr><td>'.$langs->trans("Subscription").'</td><td><input type="text" name="cotisation" size="6"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" value="'.$langs->trans("AddMember").'"></td></tr>';
|
||||
print "</form>\n";
|
||||
print "</table>\n";
|
||||
print '<br>';
|
||||
|
||||
print '<center><input type="submit" value="'.$langs->trans("AddMember").'"></center>';
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
}
|
||||
|
||||
@ -476,12 +490,12 @@ if ($rowid)
|
||||
$html = new Form($db);
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
* Affichage onglets
|
||||
*/
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$rowid;
|
||||
$head[$h][1] = $langs->trans("Member");
|
||||
$head[$h][1] = $langs->trans("MemberCard");
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
@ -492,7 +506,8 @@ if ($rowid)
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$html->form_confirm("fiche.php?rowid=$rowid","Supprimer un adhérent","Etes-vous sûr de vouloir supprimer cet adhérent (La suppression d'un adhérent entraine la suppression de toutes ses cotisations !)","confirm_delete");
|
||||
$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_delete");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
@ -500,7 +515,8 @@ if ($rowid)
|
||||
*/
|
||||
if ($action == 'valid')
|
||||
{
|
||||
$html->form_confirm("fiche.php?rowid=$rowid","Valider un adhérent","Etes-vous sûr de vouloir valider cet adhérent ?","confirm_valid");
|
||||
$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
@ -508,7 +524,8 @@ if ($rowid)
|
||||
*/
|
||||
if ($action == 'resign')
|
||||
{
|
||||
$html->form_confirm("fiche.php?rowid=$rowid","Résilier une adhésion","Etes-vous sûr de vouloir résilier cet adhérent ?","confirm_resign");
|
||||
$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
@ -517,6 +534,7 @@ if ($rowid)
|
||||
if ($action == 'add_glasnost')
|
||||
{
|
||||
$html->form_confirm("fiche.php?rowid=$rowid","Ajouter dans glasnost","Etes-vous sur de vouloir ajouter cet adhérent dans glasnost ? (serveur : ".ADHERENT_GLASNOST_SERVEUR.")","confirm_add_glasnost");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
@ -525,6 +543,7 @@ if ($rowid)
|
||||
if ($action == 'del_glasnost')
|
||||
{
|
||||
$html->form_confirm("fiche.php?rowid=$rowid","Supprimer dans glasnost","Etes-vous sur de vouloir effacer cet adhérent dans glasnost ? (serveur : ".ADHERENT_GLASNOST_SERVEUR.")","confirm_del_glasnost");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
@ -533,6 +552,7 @@ if ($rowid)
|
||||
if ($action == 'add_spip')
|
||||
{
|
||||
$html->form_confirm("fiche.php?rowid=$rowid","Ajouter dans spip","Etes-vous sur de vouloir ajouter cet adhérent dans spip ? (serveur : ".ADHERENT_SPIP_SERVEUR.")","confirm_add_spip");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
@ -542,6 +562,7 @@ if ($rowid)
|
||||
{
|
||||
$html->form_confirm("fiche.php?rowid=$rowid","Supprimer dans spip","Etes-vous sur de vouloir effacer cet adhérent dans spip ? (serveur : ".ADHERENT_SPIP_SERVEUR.")","confirm_del_spip");
|
||||
$html->form_confirm("fiche.php?rowid=$rowid","Ajouter dans glasnost","Etes-vous sur de vouloir ajouter cet adhérent dans glasnost ? (serveur : ".ADHERENT_GLASNOST_SERVEUR.")","confirm_del_spip");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
@ -556,7 +577,7 @@ if ($rowid)
|
||||
print '<td rowspan="'.(14+count($adh->array_options)).'" valign="top" width="50%">';
|
||||
print nl2br($adh->commentaire).' </td></tr>';
|
||||
|
||||
print '<tr><td>Personne</td><td class="valeur">'.$adh->getmorphylib().' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Person").'</td><td class="valeur">'.$adh->getmorphylib().' </td></tr>';
|
||||
|
||||
print '<tr><td width="15%">'.$langs->trans("Firstname").'*</td><td class="valeur" width="35%">'.$adh->prenom.' </td></tr>';
|
||||
|
||||
@ -565,7 +586,7 @@ if ($rowid)
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$adh->societe.' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">'.nl2br($adh->adresse).' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.$adh->cp.' '.$adh->ville.' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">'.$adh->pays.' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">'.$adh->pays.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("EMail").(ADHERENT_MAIL_REQUIRED&&ADHERENT_MAIL_REQUIRED==1?'*':'').'</td><td class="valeur">'.$adh->email.' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Login").'*</td><td class="valeur">'.$adh->login.' </td></tr>';
|
||||
// print '<tr><td>Pass</td><td class="valeur">'.$adh->pass.' </td></tr>';
|
||||
@ -583,7 +604,6 @@ if ($rowid)
|
||||
|
||||
print '</form>';
|
||||
print "</table>\n";
|
||||
print "<br>";
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
@ -595,26 +615,26 @@ if ($rowid)
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
|
||||
print "<a class=\"tabAction\" href=\"edit.php?rowid=$rowid\">".$langs->trans("Edit")."</a>";
|
||||
print "<a class=\"butAction\" href=\"edit.php?rowid=$rowid\">".$langs->trans("Edit")."</a>";
|
||||
|
||||
// Valider
|
||||
if ($adh->statut < 1)
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$rowid&action=valid\">".$langs->trans("Validate")."</a>\n";
|
||||
print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=valid\">".$langs->trans("Validate")."</a>\n";
|
||||
}
|
||||
|
||||
// Envoi fiche par mail
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=sendinfo\">".$langs->trans("SendCardByMail")."</a>\n";
|
||||
print "<a class=\"butAction\" href=\"fiche.php?rowid=$adh->id&action=sendinfo\">".$langs->trans("SendCardByMail")."</a>\n";
|
||||
|
||||
// Résilier
|
||||
if ($adh->statut == 1)
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$rowid&action=resign\">".$langs->trans("Resiliate")."</a>\n";
|
||||
print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=resign\">".$langs->trans("Resiliate")."</a>\n";
|
||||
}
|
||||
|
||||
// Supprimer
|
||||
if ($user->admin) {
|
||||
print "<a class=\"butDelete\" href=\"fiche.php?rowid=$adh->id&action=delete\">".$langs->trans("Delete")."</a>\n";
|
||||
print "<a class=\"butActionDelete\" href=\"fiche.php?rowid=$adh->id&action=delete\">".$langs->trans("Delete")."</a>\n";
|
||||
}
|
||||
|
||||
// Action Glasnost
|
||||
@ -684,7 +704,7 @@ if ($rowid)
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print "<td>Date cotisations</td>\n";
|
||||
print '<td>'.$langs->trans("DateSubscription").'</td>';
|
||||
print "<td align=\"right\">".$langs->trans("Amount")."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
@ -711,10 +731,8 @@ if ($rowid)
|
||||
|
||||
/*
|
||||
* Ajout d'une nouvelle cotisation
|
||||
*
|
||||
*/
|
||||
// \todo Ajout du droit adherent cotisation
|
||||
if ($user->rights->adherent->cotisation || 1==1)
|
||||
if ($user->rights->adherent->cotisation->creer)
|
||||
{
|
||||
print "<table class=\"border\" width=\"100%\">\n";
|
||||
|
||||
@ -723,22 +741,28 @@ if ($rowid)
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
|
||||
print '<tr><td width="15%">'.$langs->trans("SubscriptionEndDate").'</td>';
|
||||
if ($adh->datefin < time())
|
||||
print '<td width="35%">';
|
||||
if ($adh->datefin)
|
||||
{
|
||||
print '<td width="35%">';
|
||||
print dolibarr_print_date($adh->datefin)." ".img_warning($langs->trans("Late"));
|
||||
if ($adh->datefin < time())
|
||||
{
|
||||
print dolibarr_print_date($adh->datefin)." ".img_warning($langs->trans("Late"));
|
||||
}
|
||||
else
|
||||
{
|
||||
print dolibarr_print_date($adh->datefin);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td width="35%">';
|
||||
print dolibarr_print_date($adh->datefin);
|
||||
print $langs->trans("SubscriptionNotReceived")." ".img_warning($langs->trans("Late"));
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td colspan="2">'.$langs->trans("NewCotisation").'</td></tr>';
|
||||
print '<tr><td colspan="2"><b>'.$langs->trans("NewCotisation").'</b></td></tr>';
|
||||
|
||||
print "<tr><td>Date de cotisation</td><td>\n";
|
||||
print '<tr><td>'.$langs->trans("DateSubscription").'</td><td>';
|
||||
if ($adh->datefin > 0)
|
||||
{
|
||||
$html->select_date($adh->datefin + (3600*24));
|
||||
@ -750,21 +774,25 @@ if ($rowid)
|
||||
print "</td></tr>";
|
||||
|
||||
|
||||
print "<tr><td>Mode de paiement</td><td>\n";
|
||||
print_type_paiement_select($db,'operation');
|
||||
print "</td></tr>\n";
|
||||
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 &&
|
||||
defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){
|
||||
print "<tr><td>Numero de cheque</td><td>\n";
|
||||
print '<input name="num_chq" type="text" size="6">';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td><input type="text" name="cotisation" size="6"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("PaymentMode").'</td><td>';
|
||||
$html->select_types_paiements('','operation');
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td>'.$langs->trans("FinancialAccount").'</td><td>';
|
||||
$html->select_comptes('','accountid');
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td>'.$langs->trans("Numero").'</td><td>';
|
||||
print '<input name="num_chq" type="text" size="8">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input name="label" type="text" size="50" value="'.$langs->trans("Subscription").' '.stripslashes($adh->prenom).' '.stripslashes($adh->nom).' '.strftime("%Y",$adh->datefin).'" ></td></tr>';
|
||||
}
|
||||
print '<tr><td>'.$langs->trans("Subscription").'</td><td><input type="text" name="cotisation" size="6"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 &&
|
||||
defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2"><input name="label" type="text" size=20 value="Cotisation '.stripslashes($adh->prenom).' '.stripslashes($adh->nom).' '.strftime("%Y",$adh->datefin).'" ></td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" value="'.$langs->trans("Save").'"</td></tr>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
@ -23,9 +23,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/adherents/index.php
|
||||
\ingroup adherent
|
||||
\brief Page accueil module adherents
|
||||
\file htdocs/adherents/index.php
|
||||
\ingroup adherent
|
||||
\brief Page accueil module adherents
|
||||
*/
|
||||
|
||||
|
||||
@ -38,10 +38,15 @@ $langs->load("members");
|
||||
llxHeader();
|
||||
|
||||
|
||||
print_titre($langs->trans("MembersArea"));
|
||||
print '<br>';
|
||||
print_fiche_titre($langs->trans("MembersArea"));
|
||||
|
||||
print '<table class="noborder">';
|
||||
print '<table border="0" width="100%" class="notopnoleftnoright">';
|
||||
|
||||
print '<tr><td valign="top" width="100%" colspan="2" class="notopnoleft">';
|
||||
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align=right width="80">'.$langs->trans("MembersStatusToValid").'</td>';
|
||||
@ -112,19 +117,18 @@ $SommeD=0;
|
||||
foreach ($AdherentsAll as $key=>$value){
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="liste.php?type='.$AdherentsAll[$key].'">'.$key.'</a></td>';
|
||||
print '<td align="right">'.$AdherentsAValider[$key].'</td>';
|
||||
print '<td align="right">'.$Adherents[$key].'</td>';
|
||||
print '<td align="right">'.$Cotisants[$key].'</td>';
|
||||
print '<td align="right">'.($AdherentsResilies[$key]?$AdherentsResilies[$key]:0).'</td>';
|
||||
print '<td><a href="type.php?rowid='.$AdherentsAll[$key].'">'.img_object($langs->trans("ShowType"),"group").' '.$key.'</a></td>';
|
||||
print '<td align="right">'.(isset($AdherentsAValider[$key])?$AdherentsAValider[$key]:'').'</td>';
|
||||
print '<td align="right">'.(isset($Adherents[$key])?$Adherents[$key]:'').'</td>';
|
||||
print '<td align="right">'.(isset($Cotisants[$key])?$Cotisants[$key]:'').'</td>';
|
||||
print '<td align="right">'.(isset($AdherentsResilies[$key])?$AdherentsResilies[$key]:'').'</td>';
|
||||
print "</tr>\n";
|
||||
$SommeA+=$AdherentsAValider[$key];
|
||||
$SommeB+=$Adherents[$key];
|
||||
$SommeC+=$Cotisants[$key];
|
||||
$SommeD+=$AdherentsResilies[$key];
|
||||
$SommeA+=isset($AdherentsAValider[$key])?$AdherentsAValider[$key]:0;
|
||||
$SommeB+=isset($Adherents[$key])?$Adherents[$key]:0;
|
||||
$SommeC+=isset($Cotisants[$key])?$Cotisants[$key]:0;
|
||||
$SommeD+=isset($AdherentsResilies[$key])?$AdherentsResilies[$key]:0;
|
||||
}
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<tr class="liste_total">';
|
||||
print '<td> <b>'.$langs->trans("Total").'</b> </td>';
|
||||
print '<td align="right"><b>'.$SommeA.'</b></td>';
|
||||
print '<td align="right"><b>'.$SommeB.'</b></td>';
|
||||
@ -136,24 +140,80 @@ print "</table>";
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '</td></tr>';
|
||||
print '<tr><td width="30%" class="notopnoleft" valign="top">';
|
||||
|
||||
|
||||
// Formulaire recherche adhérent
|
||||
print '<form action="liste.php" method="post">';
|
||||
print '<input type="hidden" name="action" value="search">';
|
||||
print '<table class="noborder" cellspacing="0" cellpadding="3">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("SearchAMember").'</td>';
|
||||
print '<td colspan="2">'.$langs->trans("SearchAMember").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=false;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>';
|
||||
|
||||
print $langs->trans("Lastname").'/'.$langs->trans("Firstname").' <input type="text" name="search" class="flat" size="20">';
|
||||
print $langs->trans("Name").' <input type="text" name="search" class="flat" size="16">';
|
||||
|
||||
print ' <input class="button" type="submit" value="'.$langs->trans("Search").'">';
|
||||
print '</td><td><input class="button" type="submit" value="'.$langs->trans("Search").'">';
|
||||
print '</td></tr>';
|
||||
print "</table></form>";
|
||||
|
||||
|
||||
print '</td><td class="notopnoleftnoright">';
|
||||
|
||||
$sql = "SELECT c.cotisation, ".$db->pdate("c.dateadh")." as dateadh";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
|
||||
$sql.= " WHERE d.rowid = c.fk_adherent";
|
||||
if(isset($date_select) && $date_select != ''){
|
||||
$sql .= " AND dateadh LIKE '$date_select%'";
|
||||
}
|
||||
$result = $db->query($sql);
|
||||
$Total=array();
|
||||
$Number=array();
|
||||
$tot=0;
|
||||
$numb=0;
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$year=strftime("%Y",$objp->dateadh);
|
||||
$Total[$year]+=$objp->cotisation;
|
||||
$Number[$year]+=1;
|
||||
$tot+=$objp->cotisation;
|
||||
$numb+=1;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Year").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Subscriptions").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Number").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Average").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=true;
|
||||
foreach ($Total as $key=>$value)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]><td><a href=\"cotisations.php?date_select=$key\">$key</a></td><td align=\"right\">".price($value)."</td><td align=\"right\">".$Number[$key]."</td><td align=\"right\">".price($value/$Number[$key])."</td></tr>\n";
|
||||
}
|
||||
|
||||
// Total
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.price($tot)."</td><td align=\"right\">".$numb."</td><td align=\"right\">".price($tot/$numb)."</td></tr>\n";
|
||||
print "</table><br>\n";
|
||||
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
@ -39,20 +39,18 @@ llxHeader();
|
||||
$sortorder=$_GET["sortorder"];
|
||||
$sortfield=$_GET["sortfield"];
|
||||
$page=$_GET["page"];
|
||||
$filter=$_GET["filter"];
|
||||
$statut=isset($_GET["statut"])?$_GET["statut"]:1;
|
||||
|
||||
if (! $sortorder) { $sortorder="ASC"; }
|
||||
if (! $sortfield) { $sortfield="d.nom"; }
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, ".$db->pdate("d.datefin")." as datefin";
|
||||
$sql .= " , d.email, t.libelle as type, d.morphy, d.statut, t.cotisation";
|
||||
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, ".$db->pdate("d.datefin")." as datefin,";
|
||||
$sql .= " d.email, d.fk_adherent_type as type_id, t.libelle as type, d.morphy, d.statut, t.cotisation";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE d.fk_adherent_type = t.rowid ";
|
||||
if ($_GET["type"]) {
|
||||
@ -64,111 +62,119 @@ if (isset($_GET["statut"])) {
|
||||
if ( $_POST["action"] == 'search')
|
||||
{
|
||||
if (isset($_POST['search']) && $_POST['search'] != ''){
|
||||
$sql .= " AND (d.prenom LIKE '%".$_POST['search']."%' OR d.nom LIKE '%".$_POST['search']."%')";
|
||||
$sql.= " AND (d.prenom LIKE '%".$_POST['search']."%' OR d.nom LIKE '%".$_POST['search']."%')";
|
||||
}
|
||||
}
|
||||
if ($filter == 'uptodate') {
|
||||
$sql.=" AND datefin >= sysdate()";
|
||||
}
|
||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
$titre=$langs->trans("MembersList");
|
||||
if (isset($_GET["statut"])) {
|
||||
if ($statut == -1) { $titre=$langs->trans("MembersListToValid"); }
|
||||
if ($statut == 1) { $titre=$langs->trans("MembersListValid"); }
|
||||
if ($statut == 0) { $titre=$langs->trans("MembersListResiliated"); }
|
||||
}
|
||||
elseif ($_POST["action"] == 'search') {
|
||||
$titre="Liste des adhérents répondant aux critères";
|
||||
}
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
if ($_GET["type"]) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$titre.=" (".$objp->type.")";
|
||||
}
|
||||
|
||||
print_barre_liste($titre, $page, "liste.php", "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",$sortfield,$sortorder,'',$num);
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),"liste.php","d.nom","&page=$page&statut=$statut","","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("DateAbonment"),"liste.php","t.cotisation","&page=$page&statut=$statut","","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("EMail"),"liste.php","d.email","&page=$page&statut=$statut","","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("Type"),"liste.php","t.libelle","&page=$page&statut=$statut","","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("Person"),"liste.php","d.morphy","&page=$page&statut=$statut","","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("Status"),"liste.php","d.statut","&page=$page&statut=$statut","","",$sortfield);
|
||||
print "<td>".$langs->trans("Action")."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
if ($_GET["type"] && $i==0) { # Fetch deja fait
|
||||
} else {
|
||||
$objp = $db->fetch_object($result);
|
||||
}
|
||||
|
||||
$adh=new Adherent($db);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
if ($objp->societe != ''){
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".stripslashes($objp->prenom)." ".stripslashes($objp->nom)." / ".stripslashes($objp->societe)."</a></td>\n";
|
||||
}else{
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".stripslashes($objp->prenom)." ".stripslashes($objp->nom)."</a></td>\n";
|
||||
}
|
||||
print "<td>";
|
||||
if ($objp->cotisation == 'yes')
|
||||
{
|
||||
if ($objp->datefin < time())
|
||||
{
|
||||
print dolibarr_print_date($objp->datefin)." - Cotisation non recue ".img_warning()."</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print dolibarr_print_date($objp->datefin)."</td>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print " </td>";
|
||||
}
|
||||
|
||||
print "<td>$objp->email</td>\n";
|
||||
print "<td>$objp->type</td>\n";
|
||||
print "<td>".$adh->getmorphylib($objp->morphy)."</td>\n";
|
||||
print "<td>";
|
||||
|
||||
if ($objp->statut == -1) print '<a href="fiche.php?rowid='.$objp->rowid.'">';
|
||||
print $adh->LibStatut($objp->statut);
|
||||
if ($objp->statut == -1) print '</a>';
|
||||
|
||||
print "</td>";
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".img_edit()."</a> ";
|
||||
print "<a href=\"fiche.php?rowid=$objp->rowid&action=resign\">".img_disable($langs->trans("Resiliate"))."</a> <a href=\"fiche.php?rowid=$objp->rowid&action=delete\">".img_delete()."</a></td>\n";
|
||||
print "</tr>";
|
||||
$i++;
|
||||
$titre=$langs->trans("MembersList");
|
||||
if (isset($_GET["statut"])) {
|
||||
if ($statut == -1) { $titre=$langs->trans("MembersListToValid"); }
|
||||
if ($statut == 1) { $titre=$langs->trans("MembersListValid"); }
|
||||
if ($statut == 0) { $titre=$langs->trans("MembersListResiliated"); }
|
||||
}
|
||||
elseif ($_POST["action"] == 'search') {
|
||||
$titre="Liste des adhérents répondant aux critères";
|
||||
}
|
||||
print "</table><br>\n";
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
print_barre_liste("", $page, "liste.php", "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",$sortfield,$sortorder,'',$num);
|
||||
|
||||
print "</table><br>\n";
|
||||
if ($_GET["type"]) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$titre.=" (".$objp->type.")";
|
||||
}
|
||||
|
||||
}
|
||||
print_barre_liste($titre, $page, "liste.php", "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",$sortfield,$sortorder,'',$num);
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),"liste.php","d.nom","&page=$page&statut=$statut","","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("DateAbonment"),"liste.php","t.cotisation","&page=$page&statut=$statut","","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("EMail"),"liste.php","d.email","&page=$page&statut=$statut","","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("Type"),"liste.php","t.libelle","&page=$page&statut=$statut","","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("Person"),"liste.php","d.morphy","&page=$page&statut=$statut","","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("Status"),"liste.php","d.statut","&page=$page&statut=$statut","","",$sortfield);
|
||||
print "<td>".$langs->trans("Action")."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
if ($_GET["type"] && $i==0) { # Fetch deja fait
|
||||
} else {
|
||||
$objp = $db->fetch_object($result);
|
||||
}
|
||||
|
||||
$adh=new Adherent($db);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
if ($objp->societe != ''){
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".img_object($langs->trans("ShowAdherent"),"user").' '.stripslashes($objp->prenom)." ".stripslashes($objp->nom)." / ".stripslashes($objp->societe)."</a></td>\n";
|
||||
}else{
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".img_object($langs->trans("ShowAdherent"),"user").' '.stripslashes($objp->prenom)." ".stripslashes($objp->nom)."</a></td>\n";
|
||||
}
|
||||
print "<td>";
|
||||
if ($objp->cotisation == 'yes')
|
||||
{
|
||||
if ($objp->datefin)
|
||||
{
|
||||
if ($objp->datefin < time())
|
||||
{
|
||||
print dolibarr_print_date($objp->datefin)." - ".$langs->trans("SubscriptionLate")." ".img_warning()."</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print dolibarr_print_date($objp->datefin)."</td>\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
print $langs->trans("SubscriptionNotReceived")." ".img_warning()."</td>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print " </td>";
|
||||
}
|
||||
|
||||
print "<td>$objp->email</td>\n";
|
||||
print '<td><a href="type.php?rowid='.$objp->type_id.'">'.img_object($langs->trans("ShowType"),"group").' '.$objp->type.'</a></td>';
|
||||
print "<td>".$adh->getmorphylib($objp->morphy)."</td>\n";
|
||||
|
||||
// Statut
|
||||
print "<td>";
|
||||
print $adh->LibStatut($objp->statut);
|
||||
print "</td>";
|
||||
|
||||
print "<td><a href=\"edit.php?rowid=$objp->rowid&action=edit\">".img_edit()."</a> ";
|
||||
print "<a href=\"fiche.php?rowid=$objp->rowid&action=resign\">".img_disable($langs->trans("Resiliate"))."</a> <a href=\"fiche.php?rowid=$objp->rowid&action=delete\">".img_delete()."</a></td>\n";
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>\n";
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
print_barre_liste("", $page, "liste.php", "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",$sortfield,$sortorder,'',$num);
|
||||
|
||||
print "</table><br>\n";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print $sql;
|
||||
print $db->error();
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
?>
|
||||
|
||||
@ -35,6 +35,9 @@ require(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php");
|
||||
|
||||
$langs->load("members");
|
||||
|
||||
$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
|
||||
|
||||
|
||||
|
||||
if ($_POST["action"] == 'add' && $user->admin)
|
||||
{
|
||||
@ -62,7 +65,7 @@ if ($_POST["action"] == 'update' && $user->admin)
|
||||
{
|
||||
if ($_POST["button"] != $langs->trans("Cancel")) {
|
||||
$adht = new AdherentType($db);
|
||||
$adht->id = $_POST["rowid"];;
|
||||
$adht->id = $_POST["rowid"];
|
||||
$adht->libelle = $_POST["libelle"];
|
||||
$adht->cotisation = $yesno[$_POST["cotisation"]];
|
||||
$adht->commentaire = $_POST["comment"];
|
||||
@ -70,8 +73,10 @@ if ($_POST["action"] == 'update' && $user->admin)
|
||||
$adht->vote = $yesno[$_POST["vote"]];
|
||||
|
||||
$adht->update($user->id);
|
||||
|
||||
Header("Location: type.php?rowid=".$_POST["rowid"]);
|
||||
exit;
|
||||
}
|
||||
Header("Location: type.php");
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'delete')
|
||||
@ -99,7 +104,7 @@ llxHeader();
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($_GET["action"] != 'create' && $_GET["action"] != 'edit') {
|
||||
if (! $rowid && $_GET["action"] != 'create' && $_GET["action"] != 'edit') {
|
||||
|
||||
print_titre($langs->trans("MembersTypeSetup"));
|
||||
print '<br>';
|
||||
@ -117,7 +122,7 @@ if ($_GET["action"] != 'create' && $_GET["action"] != 'edit') {
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print "<td>Id</td>";
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td><td align="center">'.$langs->trans("SubscriptionRequired").'</td>';
|
||||
print '<td align="center">'.$langs->trans("VoteAllowed").'</td><td> </td>';
|
||||
print "</tr>\n";
|
||||
@ -128,7 +133,7 @@ if ($_GET["action"] != 'create' && $_GET["action"] != 'edit') {
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td>".$objp->rowid."</td>\n";
|
||||
print '<td><a href="type.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShwoType"),'group').' '.$objp->rowid.'</a></td>';
|
||||
print '<td>'.$objp->libelle.'</td>';
|
||||
print '<td align="center">'.$langs->trans($objp->cotisation).'</td>';
|
||||
print '<td align="center">'.$langs->trans($objp->vote).'</td>';
|
||||
@ -157,7 +162,7 @@ if ($_GET["action"] != 'create' && $_GET["action"] != 'edit') {
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Création d'une fiche don */
|
||||
/* Création d'un type adherent */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -202,47 +207,106 @@ if ($_GET["action"] == 'create') {
|
||||
/* Edition de la fiche */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($_GET["rowid"] > 0 && $_GET["action"] == 'edit')
|
||||
if ($rowid > 0)
|
||||
{
|
||||
$htmls = new Form($db);
|
||||
if ($_GET["action"] != 'edit')
|
||||
{
|
||||
$adht = new AdherentType($db);
|
||||
$adht->id = $rowid;
|
||||
$adht->fetch($rowid);
|
||||
|
||||
$adht = new AdherentType($db);
|
||||
$adht->id = $_GET["rowid"];
|
||||
$adht->fetch($_GET["rowid"]);
|
||||
|
||||
print_titre($langs->trans("EditType"));
|
||||
print '<br>';
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$_GET["rowid"].'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$_GET["rowid"].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<table class="border" width="100%">';
|
||||
$h=0;
|
||||
|
||||
$head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id;
|
||||
$head[$h][1] = $langs->trans("MemberType").': '.$adht->libelle;
|
||||
$h++;
|
||||
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40" value="'.$adht->libelle.'"></td></tr>';
|
||||
dolibarr_fiche_head($head, 0, '');
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
$htmls->selectyesnonum("cotisation",$adht->cotisation);
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
$htmls->selectyesnonum("vote",$adht->vote);
|
||||
print '</tr>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td>'.$adht->id.'</td></tr>';
|
||||
print '<tr><td width="15%">'.$langs->trans("Label").'</td><td>'.$adht->libelle.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print $adht->cotisation;
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
print $adht->vote;
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>';
|
||||
print nl2br($adht->commentaire)."</td></tr>";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
print nl2br($adht->mail_valid)."</td></tr>";
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>';
|
||||
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"60\" rows=\"3\">".$adht->commentaire."</textarea></td></tr>";
|
||||
print '</div>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
print "<textarea name=\"mail_valid\" wrap=\"soft\" cols=\"60\" rows=\"15\">".$adht->mail_valid."</textarea></td></tr>";
|
||||
/*
|
||||
* Barre d'actions
|
||||
*
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"tabAction\" href=\"type.php?action=edit&rowid=".$adht->id."\">".$langs->trans("Edit")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
$htmls = new Form($db);
|
||||
|
||||
$adht = new AdherentType($db);
|
||||
$adht->id = $rowid;
|
||||
$adht->fetch($rowid);
|
||||
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" value="'.$langs->trans("Save").'"> ';
|
||||
print '<input type="submit" name="button" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print "</form>";
|
||||
|
||||
$h=0;
|
||||
|
||||
$head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id;
|
||||
$head[$h][1] = $langs->trans("MemberType").': '.$adht->libelle;
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, 0, '');
|
||||
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td>'.$adht->id.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40" value="'.$adht->libelle.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
$htmls->selectyesnonum("cotisation",$adht->cotisation);
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
$htmls->selectyesnonum("vote",$adht->vote);
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>';
|
||||
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"60\" rows=\"3\">".$adht->commentaire."</textarea></td></tr>";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
print "<textarea name=\"mail_valid\" wrap=\"soft\" cols=\"60\" rows=\"15\">".$adht->mail_valid."</textarea></td></tr>";
|
||||
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" value="'.$langs->trans("Save").'"> ';
|
||||
print '<input type="submit" name="button" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print "</form>";
|
||||
}
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user