Fix: Validation adhrent caput
This commit is contained in:
parent
213556ae63
commit
e7e2e6a399
@ -69,9 +69,14 @@ class Adherent
|
||||
var $public;
|
||||
var $commentaire;
|
||||
var $statut; // -1=brouillon, 0=résilié, 1=validé,payé
|
||||
var $naiss;
|
||||
var $photo;
|
||||
|
||||
var $datec;
|
||||
var $datem;
|
||||
var $datefin;
|
||||
var $datevalid;
|
||||
var $naiss;
|
||||
|
||||
var $typeid; // Id type adherent
|
||||
var $type; // Libellé type adherent
|
||||
var $need_subscription;
|
||||
@ -373,7 +378,7 @@ class Adherent
|
||||
|
||||
|
||||
/**
|
||||
\brief fonction qui met à jour l'adhérent
|
||||
\brief Fonction qui met à jour l'adhérent
|
||||
\param notrigger 1=désactive le trigger UPDATE (quand appelé par creation)
|
||||
\return int <0 si KO, >0 si OK
|
||||
*/
|
||||
@ -407,12 +412,15 @@ class Adherent
|
||||
$sql .= ",phone_perso=" .($this->phone_perso?"'".addslashes($this->phone_perso)."'":"null");
|
||||
$sql .= ",phone_mobile=" .($this->phone_mobile?"'".addslashes($this->phone_mobile)."'":"null");
|
||||
$sql .= ",note=" .($this->commentaire?"'".addslashes($this->commentaire)."'":"null");
|
||||
$sql .= ",naiss=" .($this->naiss?"'".$this->db->idate($this->naiss)."'":"null");
|
||||
$sql .= ",photo=" .($this->photo?"'".$this->photo."'":"null");
|
||||
$sql .= ",public='" .$this->public."'";
|
||||
$sql .= ",statut=" .$this->statut;
|
||||
$sql .= ",fk_adherent_type=".$this->typeid;
|
||||
$sql .= ",morphy='" .$this->morphy."'";
|
||||
|
||||
$sql .= ",naiss=" .($this->naiss?"'".$this->db->idate($this->naiss)."'":"null");
|
||||
if ($this->datefin) $sql .= ",datefin='".$this->db->idate($this->datefin)."'"; // Ne doit etre vidé que par effacement cotisation
|
||||
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dolibarr_syslog("Adherent::update sql=$sql");
|
||||
@ -565,8 +573,13 @@ class Adherent
|
||||
|
||||
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.statut, d.public, d.adresse, d.cp, d.ville, d.note,";
|
||||
$sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,";
|
||||
$sql.= " d.naiss, d.photo, d.fk_adherent_type, d.morphy,";
|
||||
$sql.= " ".$this->db->pdate("d.datefin")." as datefin, d.pays,";
|
||||
$sql.= " d.photo, d.fk_adherent_type, d.morphy,";
|
||||
$sql.= " ".$this->db->pdate("d.datec")." as datec,";
|
||||
$sql.= " ".$this->db->pdate("d.tms")." as datem,";
|
||||
$sql.= " ".$this->db->pdate("d.datefin")." as datefin,";
|
||||
$sql.= " ".$this->db->pdate("d.naiss")." as datenaiss,";
|
||||
$sql.= " ".$this->db->pdate("d.datevalid")." as datev,";
|
||||
$sql.= " d.pays,";
|
||||
$sql.= " p.rowid as pays_id, p.code as pays_code, p.libelle as pays_lib,";
|
||||
$sql.= " t.libelle as type, t.cotisation as cotisation";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
|
||||
@ -600,11 +613,17 @@ class Adherent
|
||||
$this->phone_perso = $obj->phone_perso;
|
||||
$this->phone_mobile = $obj->phone_mobile;
|
||||
$this->email = $obj->email;
|
||||
$this->naiss = $obj->naiss;
|
||||
|
||||
$this->photo = $obj->photo;
|
||||
$this->statut = $obj->statut;
|
||||
$this->public = $obj->public;
|
||||
|
||||
$this->datec = $obj->datec;
|
||||
$this->datem = $obj->datem;
|
||||
$this->datefin = $obj->datefin;
|
||||
$this->datevalid = $obj->datevalid;
|
||||
$this->naiss = $obj->datenaiss;
|
||||
|
||||
$this->commentaire = $obj->note;
|
||||
$this->morphy = $obj->morphy;
|
||||
|
||||
@ -700,7 +719,7 @@ class Adherent
|
||||
/**
|
||||
\brief Fonction qui insère la cotisation dans la base de données
|
||||
et eventuellement liens dans banques, mailman, etc...
|
||||
\param date Date cotisation
|
||||
\param date Date d'effet de la cotisation
|
||||
\param montant Montant cotisation
|
||||
\param account_id Id compte bancaire
|
||||
\param operation Type operation (si Id compte bancaire fourni)
|
||||
@ -718,8 +737,8 @@ class Adherent
|
||||
$sql .= " VALUES (".$this->id.", now(), ".$this->db->idate($date).", ".$montant.")";
|
||||
|
||||
dolibarr_syslog("Adherent.class::cotisation sql=".$sql);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$rowid=$this->db->last_insert_id(MAIN_DB_PREFIX."cotisation");
|
||||
// datefin = date + 1 an
|
||||
@ -729,10 +748,9 @@ class Adherent
|
||||
$sql.= " WHERE rowid =". $this->id;
|
||||
|
||||
dolibarr_syslog("Adherent.class::cotisation sql=".$sql);
|
||||
$resql=$this->db->query( $sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
// Rajout du nouveau cotisant dans les listes qui vont bien
|
||||
if ($conf->global->ADHERENT_MAILMAN_LISTS_COTISANT && ! $adh->datefin)
|
||||
{
|
||||
@ -807,15 +825,16 @@ class Adherent
|
||||
* \param userid userid adhérent à valider
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function validate($userid)
|
||||
function validate($user)
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql.= " statut=1, datevalid = now(),";
|
||||
$sql.= " fk_user_valid=".$userid;
|
||||
$sql.= " WHERE rowid = $this->id";
|
||||
$sql.= " fk_user_valid=".$user->id;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dolibarr_syslog("Adherent.class::validate sql=".$sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -284,10 +284,10 @@ if ($_POST["action"] == 'add')
|
||||
$public=0;
|
||||
if (isset($public)) $public=1;
|
||||
|
||||
if (!$error)
|
||||
if (! $error)
|
||||
{
|
||||
// Email a peu pres correct et le login n'existe pas
|
||||
if ($adh->create($user->id))
|
||||
if ($adh->create($user) > 0)
|
||||
{
|
||||
if ($cotisation > 0)
|
||||
{
|
||||
@ -350,8 +350,8 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
|
||||
|
||||
if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == 'yes')
|
||||
{
|
||||
$adh->rowid=$rowid;
|
||||
$adh->validate($user->id);
|
||||
$adh->id=$rowid;
|
||||
$adh->validate($user);
|
||||
$adh->fetch($rowid);
|
||||
|
||||
$adht = new AdherentType($db);
|
||||
@ -377,7 +377,7 @@ if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == 'yes')
|
||||
|
||||
if ($_POST["action"] == 'confirm_resign' && $_POST["confirm"] == 'yes')
|
||||
{
|
||||
$adh->rowid=$rowid;
|
||||
$adh->id=$rowid;
|
||||
$adh->resiliate($user->id);
|
||||
$adh->fetch($rowid);
|
||||
|
||||
@ -396,7 +396,7 @@ if ($_POST["action"] == 'confirm_resign' && $_POST["confirm"] == 'yes')
|
||||
|
||||
if ($_POST["action"] == 'confirm_add_glasnost' && $_POST["confirm"] == 'yes')
|
||||
{
|
||||
$adh->rowid=$rowid;
|
||||
$adh->id=$rowid;
|
||||
$adh->fetch($rowid);
|
||||
$adht = new AdherentType($db);
|
||||
$adht->fetch($adh->typeid);
|
||||
@ -411,7 +411,7 @@ if ($_POST["action"] == 'confirm_add_glasnost' && $_POST["confirm"] == 'yes')
|
||||
|
||||
if ($_POST["action"] == 'confirm_del_glasnost' && $_POST["confirm"] == 'yes')
|
||||
{
|
||||
$adh->rowid=$rowid;
|
||||
$adh->id=$rowid;
|
||||
$adh->fetch($rowid);
|
||||
$adht = new AdherentType($db);
|
||||
$adht->fetch($adh->typeid);
|
||||
@ -426,7 +426,7 @@ if ($_POST["action"] == 'confirm_del_glasnost' && $_POST["confirm"] == 'yes')
|
||||
|
||||
if ($_POST["action"] == 'confirm_del_spip' && $_POST["confirm"] == 'yes')
|
||||
{
|
||||
$adh->rowid=$rowid;
|
||||
$adh->id=$rowid;
|
||||
$adh->fetch($rowid);
|
||||
if(!$adh->del_to_spip()){
|
||||
$errmsg.="Echec de la suppression de l'utilisateur dans spip: ".$adh->error."<BR>\n";
|
||||
@ -435,7 +435,7 @@ if ($_POST["action"] == 'confirm_del_spip' && $_POST["confirm"] == 'yes')
|
||||
|
||||
if ($_POST["action"] == 'confirm_add_spip' && $_POST["confirm"] == 'yes')
|
||||
{
|
||||
$adh->rowid=$rowid;
|
||||
$adh->id=$rowid;
|
||||
$adh->fetch($rowid);
|
||||
if (!$adh->add_to_spip())
|
||||
{
|
||||
@ -889,10 +889,16 @@ if ($rowid && $action != 'edit')
|
||||
print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=edit\">".$langs->trans("Edit")."</a>";
|
||||
|
||||
// Valider
|
||||
if ($adh->statut < 1)
|
||||
if ($adh->statut == -1)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=valid\">".$langs->trans("Validate")."</a>\n";
|
||||
}
|
||||
|
||||
// Réactiver
|
||||
if ($adh->statut == 0)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=valid\">".$langs->trans("Restore")."</a>\n";
|
||||
}
|
||||
|
||||
// Envoi fiche par mail
|
||||
if ($adh->statut >= 1)
|
||||
|
||||
@ -126,15 +126,15 @@ if ($result)
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),"liste.php","d.nom",$param,"","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("Type"),"liste.php","t.libelle",$param,"","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("EMail"),"liste.php","d.email",$param,"","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("Person"),"liste.php","d.morphy",$param,"","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("EMail"),"liste.php","d.email",$param,"","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("Status"),"liste.php","d.statut",$param,"","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("EndSubscription"),"liste.php","t.cotisation",$param,"","",$sortfield);
|
||||
print '<td width="60" align="center">'.$langs->trans("Action")."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
{
|
||||
if ($_GET["type"] && $i==0)
|
||||
{
|
||||
|
||||
@ -140,13 +140,25 @@ if ($result >= 0)
|
||||
$member->phone_mobile=$ldapuser[$conf->global->LDAP_FIELD_MOBILE][0];
|
||||
$member->email=$ldapuser[$conf->global->LDAP_FIELD_MAIL][0];
|
||||
|
||||
$member->naiss=dolibarr_mktime($ldapuser[$conf->global->LDAP_FIELD_BIRTHDATE][0]);
|
||||
$member->commentaire=$ldapuser[$conf->global->LDAP_FIELD_DESCRIPTION][0];
|
||||
$member->morphy='phy';
|
||||
//$member->photo;
|
||||
$member->public=1;
|
||||
$member->statut=-1; // Par defaut, statut brouillon
|
||||
if (isset($ldapuser["prnxstatus"][0])) $member->statut=($ldapuser["prnxstatus"][0]==1 ? 1 : 0);
|
||||
if (isset($ldapuser["prnxstatus"][0]))
|
||||
{
|
||||
if ($ldapuser["prnxstatus"][0]==1)
|
||||
{
|
||||
$member->statut=1;
|
||||
$member->datev=time();
|
||||
}
|
||||
else
|
||||
{
|
||||
$member->statut=0;
|
||||
}
|
||||
}
|
||||
$member->naiss=dolibarr_mktime($ldapuser[$conf->global->LDAP_FIELD_BIRTHDATE][0]);
|
||||
$member->datefin=dolibarr_mktime($ldapuser["prnxlastcontribution"][0]),1,'y');
|
||||
|
||||
// Propriete type membre
|
||||
$member->typeid=$typeid;
|
||||
@ -181,7 +193,7 @@ if ($result >= 0)
|
||||
if ($datelast)
|
||||
{
|
||||
$price=price2num($ldapuser["prnxlastcontributionprice"][0]);
|
||||
$crowid=$member->cotisation($datelast, $price, 0, $operation, $label, $num_chq);
|
||||
$crowid=$member->cotisation(dolibarr_time_plus_duree($datelast,-1,'y'), $price, 0, $operation, $label, $num_chq);
|
||||
}
|
||||
|
||||
//----------------------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user