diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php
index 40f142617c3..5f445ee3bbe 100644
--- a/htdocs/adherents/adherent.class.php
+++ b/htdocs/adherents/adherent.class.php
@@ -337,10 +337,17 @@ class Adherent
$this->error = $langs->trans("ErrorBadEMail",$this->email);
return -1;
}
-
+ if (! $this->datec) $this->datec=time();
+
+ $this->db->begin();
+
// Insertion membre
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent (datec,login)";
- $sql.= " VALUES (now(),'".$this->login."')";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent";
+ $sql.= " (datec,login)";
+ $sql.= " VALUES (";
+ $sql.= " '".$this->db->idate($this->datec)."',";
+ $sql.= " '".addslashes($this->login)."'";
+ $sql.= ")";
dolibarr_syslog("Adherent.class::create sql=".$sql);
$result = $this->db->query($sql);
@@ -353,7 +360,12 @@ class Adherent
// Mise a jour
$result=$this->update($user,1);
-
+ if ($result < 0)
+ {
+ $this->db->rollback();
+ return -1;
+ }
+
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db);
@@ -361,17 +373,30 @@ class Adherent
if ($result < 0) $error++;
// Fin appel triggers
+ if ($error)
+ {
+ $this->error=$interface->error;
+ $this->db->rollback();
+ return -1;
+ }
+ else
+ {
+ $this->db->commit();
+ }
+
return $this->id;
}
else
{
- dolibarr_print_error($this->db,'Failed to get last insert id');
+ $this->error='Failed to get last insert id';
+ $this->db->rollback();
return -1;
}
}
else
{
$this->error=$this->db->error();
+ $this->db->rollback();
return -1;
}
}
@@ -379,6 +404,7 @@ class Adherent
/**
\brief Fonction qui met à jour l'adhérent
+ \param user Utilisateur qui réalise la mise a jour
\param notrigger 1=désactive le trigger UPDATE (quand appelé par creation)
\return int <0 si KO, >0 si OK
*/
@@ -386,7 +412,7 @@ class Adherent
{
global $conf,$langs;
- dolibarr_syslog("Adherent.class::update $notrigger");
+ dolibarr_syslog("Adherent.class::update user=".$user." notrigger=".$notrigger);
// Verification parametres
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! ValidEMail($this->email))
@@ -398,28 +424,29 @@ class Adherent
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
- $sql .= " prenom = '".$this->prenom ."'";
- $sql .= ",nom='" .$this->nom."'";
- $sql .= ",login='" .$this->login."'";
- $sql .= ",pass='" .$this->pass."'";
- $sql .= ",societe='".$this->societe."'";
+ $sql .= " prenom = ".($this->prenom?"'".addslashes($this->prenom)."'":"null");
+ $sql .= ",nom=" .($this->nom?"'".addslashes($this->nom)."'":"null");
+ $sql .= ",login=" .($this->login?"'".addslashes($this->login)."'":"null");
+ $sql .= ",pass=" .($this->pass?"'".addslashes($this->pass)."'":"null");
+ $sql .= ",societe=" .($this->societe?"'".addslashes($this->societe)."'":"null");
$sql .= ",adresse=" .($this->adresse?"'".addslashes($this->adresse)."'":"null");
- $sql .= ",cp='" .$this->cp."'";
- $sql .= ",ville='" .$this->ville."'";
- $sql .= ",pays='" .$this->pays_id."'";
- $sql .= ",email='" .$this->email."'";
+ $sql .= ",cp=" .($this->cp?"'".addslashes($this->cp)."'":"null");
+ $sql .= ",ville=" .($this->ville?"'".addslashes($this->ville)."'":"null");
+ $sql .= ",pays=" ."'".$this->pays_id."'";
+ $sql .= ",email=" ."'".$this->email."'";
$sql .= ",phone=" .($this->phone?"'".addslashes($this->phone)."'":"null");
$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 .= ",photo=" .($this->photo?"'".$this->photo."'":"null");
- $sql .= ",public='" .$this->public."'";
+ $sql .= ",public=" ."'".$this->public."'";
$sql .= ",statut=" .$this->statut;
$sql .= ",fk_adherent_type=".$this->typeid;
- $sql .= ",morphy='" .$this->morphy."'";
+ $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
+ if ($this->datefin) $sql .= ",datefin='".$this->db->idate($this->datefin)."'"; // Ne doit etre modifié que par effacement cotisation
+ if ($this->datevalid) $sql .= ",datevalid='".$this->db->idate($this->datevalid)."'"; // Ne doit etre modifié que par validation adherent
$sql .= " WHERE rowid = ".$this->id;
@@ -723,11 +750,11 @@ class Adherent
\param montant Montant cotisation
\param account_id Id compte bancaire
\param operation Type operation (si Id compte bancaire fourni)
- \param operation Label operation (si Id compte bancaire fourni)
+ \param label Label operation (si Id compte bancaire fourni)
\param num_chq Numero cheque (si Id compte bancaire fourni)
\return int rowid de l'entrée ajoutée, <0 si erreur
*/
- function cotisation($date, $montant, $accountid, $operation, $label, $num_chq)
+ function cotisation($date, $montant, $accountid=0, $operation='', $label='', $num_chq='')
{
global $conf,$langs,$user;
@@ -800,6 +827,7 @@ class Adherent
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('MEMBER_SUBSCRIPTION',$this,$user,$langs,$conf);
+ if ($result < 0) $error++;
// Fin appel triggers
$this->db->commit();
@@ -1765,5 +1793,61 @@ class Adherent
return $info;
}
+
+
+ /**
+ * \brief Charge les informations d'ordre info dans l'objet adherent
+ * \param id Id du membre a charger
+ */
+ function info($id)
+ {
+ $sql = 'SELECT a.rowid, '.$this->db->pdate('a.datec').' as datec,';
+ $sql.= ' '.$this->db->pdate('a.datevalid').' as datev,';
+ $sql.= ' '.$this->db->pdate('a.tms').' as datem,';
+ $sql.= ' a.fk_user_author, a.fk_user_valid, a.fk_user_mod';
+ $sql.= ' FROM '.MAIN_DB_PREFIX.'adherent as a';
+ $sql.= ' WHERE a.rowid = '.$id;
+ $result=$this->db->query($sql);
+ if ($result)
+ {
+ if ($this->db->num_rows($result))
+ {
+ $obj = $this->db->fetch_object($result);
+ $this->id = $obj->rowid;
+ if ($obj->fk_user_author)
+ {
+ $cuser = new User($this->db, $obj->fk_user_author);
+ $cuser->fetch();
+ $this->user_creation = $cuser;
+ }
+
+ if ($obj->fk_user_valid)
+ {
+ $vuser = new User($this->db, $obj->fk_user_valid);
+ $vuser->fetch();
+ $this->user_validation = $vuser;
+ }
+
+ if ($obj->fk_user_mod)
+ {
+ $muser = new User($this->db, $obj->fk_user_mod);
+ $muser->fetch();
+ $this->user_modification = $mluser;
+ }
+
+ $this->date_creation = $obj->datec;
+ $this->date_validation = $obj->datev;
+ $this->date_modification = $obj->datem;
+ }
+
+ $this->db->free($result);
+
+ }
+ else
+ {
+ dolibarr_print_error($this->db);
+ }
+ }
+
}
?>
diff --git a/htdocs/adherents/cotisation.class.php b/htdocs/adherents/cotisation.class.php
index 12085203430..a4348925259 100644
--- a/htdocs/adherents/cotisation.class.php
+++ b/htdocs/adherents/cotisation.class.php
@@ -435,6 +435,27 @@ class Cotisation
}
}
+ /**
+ * \brief Renvoie nom clicable (avec eventuellement le picto)
+ * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
+ * \return string Chaine avec URL
+ */
+ function getNomUrl($withpicto=0)
+ {
+ global $langs;
+
+ $result='';
+// $lien = '';
+// $lienfin='';
+
+ $picto='payment';
+ $label=$langs->trans("ShowSubscription");
+
+ if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
+ if ($withpicto && $withpicto != 2) $result.=' ';
+ $result.=$lien.$this->ref.$lienfin;
+ return $result;
+ }
}
?>
diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php
index 52478bd9193..ac71718f3ca 100644
--- a/htdocs/adherents/cotisations.php
+++ b/htdocs/adherents/cotisations.php
@@ -29,6 +29,8 @@
*/
require("./pre.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/cotisation.class.php");
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php");
$sortorder=$_GET["sortorder"];
@@ -109,10 +111,6 @@ if ($_POST["action"] == '2bank' && $_POST["rowid"] !='')
llxHeader();
-$params="&select_date=".$select_date;
-print_barre_liste($langs->trans("ListOfSubscriptions"), $page, "cotisations.php", $params, $sortfield, $sortorder,'',$num);
-
-
// 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,";
@@ -120,11 +118,12 @@ $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 != '')
+if (isset($date_select) && $date_select != '')
{
- $sql .= " AND dateadh LIKE '$date_select%'";
+ $sql.= " AND dateadh LIKE '$date_select%'";
}
-$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
+$sql.= " ORDER BY $sortfield $sortorder";
+$sql.= $db->plimit($conf->liste_limit+1, $offset);
$result = $db->query($sql);
if ($result)
@@ -132,10 +131,15 @@ if ($result)
$num = $db->num_rows($result);
$i = 0;
+
+ $param.="&statut=$statut&date_select=$date_select";
+ print_barre_liste($langs->trans("ListOfSubscriptions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num);
+
+
print '
';
- $param="&page=$page&statut=$statut&date_select=$date_select";
print '';
+ print_liste_field_titre($langs->trans("Ref"),"cotisations.php","c.rowid",$param,"","",$sortfield);
print_liste_field_titre($langs->trans("Date"),"cotisations.php","c.dateadh",$param,"","",$sortfield);
print_liste_field_titre($langs->trans("Name"),"cotisations.php","d.nom",$param,"","",$sortfield);
print_liste_field_titre($langs->trans("Amount"),"cotisations.php","c.cotisation",$param,"","align=\"right\"",$sortfield);
@@ -147,15 +151,24 @@ if ($result)
$var=true;
$total=0;
- while ($i < $num)
+ while ($i < $num && $i < $conf->liste_limit)
{
$objp = $db->fetch_object($result);
$total+=price($objp->cotisation);
+ $cotisation=new Cotisation($db);
+ $cotisation->ref=$objp->crowid;
+ $cotisation->id=$objp->crowid;
+
+ $adherent=new Adherent($db);
+ $adherent->ref=trim($objp->prenom.' '.$objp->nom);
+ $adherent->id=$objp->rowid;
+
$var=!$var;
print "
";
- print "| ".dolibarr_print_date($objp->dateadh)." | \n";
- print "rowid&action=edit\">".img_object($langs->trans("ShowMember"),"user").' '.stripslashes($objp->prenom)." ".stripslashes($objp->nom)." | \n";
+ print ''.$cotisation->getNomUrl(1).' | ';
+ print ''.dolibarr_print_date($objp->dateadh)." | \n";
+ print ''.$adherent->getNomUrl(1).' | ';
print ''.price($objp->cotisation).' | ';
if ($conf->global->ADHERENT_BANK_USE)
{
@@ -190,6 +203,7 @@ if ($result)
print '
';
print "| ".$langs->trans("Total")." | \n";
print " | \n";
+ print " | \n";
print "".price($total)." | \n";
if ($conf->global->ADHERENT_BANK_USE)
{
diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index 507e0964d20..27adbb7f12d 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -33,6 +33,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/member.lib.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/cotisation.class.php");
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php");
require_once(DOL_DOCUMENT_ROOT."/includes/xmlrpc/xmlrpc.php");
@@ -117,71 +118,63 @@ if ($_POST["action"] == 'cotisation')
}
}
-if ($_REQUEST["action"] == 'update')
+if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"])
{
- if ($_POST["bouton"] == $langs->trans("Save"))
+ $datenaiss='';
+ if (isset($_POST["naissday"]) && $_POST["naissday"]
+ && isset($_POST["naissmonth"])
+ && isset($_POST["naissyear"]) && $_POST["naissyear"])
{
- $datenaiss='';
- if (isset($_POST["naissday"]) && $_POST["naissday"]
- && isset($_POST["naissmonth"])
- && isset($_POST["naissyear"]) && $_POST["naissyear"])
+ $datenaiss=@mktime(12, 0 , 0, $_POST["naissmonth"], $_POST["naissday"], $_POST["naissyear"]);
+ }
+
+ $adh->id = $_POST["rowid"];
+ $adh->prenom = $_POST["prenom"];
+ $adh->nom = $_POST["nom"];
+ $adh->fullname = trim($adh->prenom.' '.$adh->nom);
+ $adh->login = $_POST["login"];
+ $adh->pass = $_POST["pass"];
+
+ $adh->societe = $_POST["societe"];
+ $adh->adresse = $_POST["adresse"];
+ $adh->cp = $_POST["cp"];
+ $adh->ville = $_POST["ville"];
+ $adh->pays_id = $_POST["pays"];
+
+ $adh->phone = $_POST["phone"];
+ $adh->phone_perso = $_POST["phone_perso"];
+ $adh->phone_mobile= $_POST["phone_mobile"];
+ $adh->email = $_POST["email"];
+ $adh->naiss = $datenaiss;
+ $adh->date = $datenaiss; // A virer
+ $adh->photo = $_POST["photo"];
+
+ $adh->typeid = $_POST["type"];
+ $adh->commentaire = $_POST["comment"];
+ $adh->morphy = $_POST["morphy"];
+
+ $adh->amount = $_POST["amount"];
+
+ // recuperation du statut et public
+ $adh->statut = $_POST["statut"];
+ $adh->public = $_POST["public"];
+
+ foreach($_POST as $key => $value)
+ {
+ if (ereg("^options_",$key))
{
- $datenaiss=@mktime(12, 0 , 0, $_POST["naissmonth"], $_POST["naissday"], $_POST["naissyear"]);
- }
-
- $adh->id = $_POST["rowid"];
- $adh->prenom = $_POST["prenom"];
- $adh->nom = $_POST["nom"];
- $adh->fullname = trim($adh->prenom.' '.$adh->nom);
- $adh->login = $_POST["login"];
- $adh->pass = $_POST["pass"];
-
- $adh->societe = $_POST["societe"];
- $adh->adresse = $_POST["adresse"];
- $adh->cp = $_POST["cp"];
- $adh->ville = $_POST["ville"];
- $adh->pays_id = $_POST["pays"];
-
- $adh->phone = $_POST["phone"];
- $adh->phone_perso = $_POST["phone_perso"];
- $adh->phone_mobile= $_POST["phone_mobile"];
- $adh->email = $_POST["email"];
- $adh->naiss = $datenaiss;
- $adh->date = $datenaiss; // A virer
- $adh->photo = $_POST["photo"];
-
- $adh->typeid = $_POST["type"];
- $adh->commentaire = $_POST["comment"];
- $adh->morphy = $_POST["morphy"];
-
- $adh->amount = $_POST["amount"];
-
- // recuperation du statut et public
- $adh->statut = $_POST["statut"];
- $adh->public = $_POST["public"];
-
- foreach($_POST as $key => $value)
- {
- if (ereg("^options_",$key))
- {
- $adh->array_options[$key]=$_POST[$key];
- }
- }
- if ($adh->update($user,0) >= 0)
- {
- Header("Location: fiche.php?rowid=".$adh->id);
- exit;
- }
- else
- {
- $errmsg=$adh->error;
- $action='';
+ $adh->array_options[$key]=$_POST[$key];
}
}
+ if ($adh->update($user,0) >= 0)
+ {
+ Header("Location: fiche.php?rowid=".$adh->id);
+ exit;
+ }
else
{
- Header("Location: fiche.php?rowid=".$rowid);
- exit;
+ $errmsg=$adh->error;
+ $action='';
}
}
@@ -482,17 +475,12 @@ if ($action == 'edit')
$adht = new AdherentType($db);
- /*
- * Affichage onglets
- */
- $h = 0;
-
- $head[$h][0] = DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$rowid;
- $head[$h][1] = $langs->trans("Card");
- $hselected=$h;
- $h++;
-
- dolibarr_fiche_head($head, $hselected, $langs->trans("MemberCard"));
+ /*
+ * Affichage onglets
+ */
+ $head = member_prepare_head($adh);
+
+ dolibarr_fiche_head($head, 'general', $langs->trans("Member").": ".$adh->fullname);
print '
';
// Login
print '| '.$langs->trans("Login").' | |
';
@@ -574,10 +562,18 @@ if ($action == 'edit')
{
print "| $value | array_options["options_$key"]."\"> |
\n";
}
- print '| ';
- print ' ';
- print '';
+
+ // Profil public
+ print " |
| ".$langs->trans("Public")." | \n";
+ $htmls->select_YesNo($adh->public);
+ print " |
\n";
+
+ print '| ';
+ print '';
+ print ' ';
+ print '';
print ' |
';
+
print '
';
print '';
@@ -857,7 +853,7 @@ if ($rowid && $action != 'edit')
print '| '.$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'*':'').' | '.$adh->email.' |
';
// Date naissance
- print '| '.$langs->trans("Birthday").' | '.$adh->naiss.' |
';
+ print '| '.$langs->trans("Birthday").' | '.dolibarr_print_date($adh->naiss,'day').' |
';
// URL
print '| URL Photo | '.$adh->photo.' |
';
@@ -897,7 +893,7 @@ if ($rowid && $action != 'edit')
// Réactiver
if ($adh->statut == 0)
{
- print "".$langs->trans("Restore")."\n";
+ print "".$langs->trans("Reenable")."\n";
}
// Envoi fiche par mail
@@ -972,9 +968,10 @@ if ($rowid && $action != 'edit')
* Liste des cotisations
*
*/
- $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, 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 AND d.rowid=$rowid";
+ $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe,";
+ $sql.= " c.rowid as crowid, 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 AND d.rowid=".$rowid;
$result = $db->query($sql);
if ($result)
@@ -985,6 +982,7 @@ if ($rowid && $action != 'edit')
print "\n";
print '';
+ print '| '.$langs->trans("Ref").' | ';
print ''.$langs->trans("DateSubscription").' | ';
print "".$langs->trans("Amount")." | \n";
print "
\n";
@@ -995,6 +993,10 @@ if ($rowid && $action != 'edit')
$objp = $db->fetch_object($result);
$var=!$var;
print "";
+ $cotisation=new Cotisation($db);
+ $cotisation->ref=$objp->crowid;
+ $cotisation->id=$objp->crowid;
+ print '| '.$cotisation->getNomUrl(1).' | ';
print "".dolibarr_print_date($objp->dateadh)." | \n";
print ''.price($objp->cotisation).' | ';
print "
";
diff --git a/htdocs/adherents/htpasswd.php b/htdocs/adherents/htpasswd.php
index 33516b2de27..12d305106e3 100644
--- a/htdocs/adherents/htpasswd.php
+++ b/htdocs/adherents/htpasswd.php
@@ -1,6 +1,7 @@
- * Copyright (C) 2003 Jean-Louis Bergamo
+ * Copyright (C) 2003 Jean-Louis Bergamo
+ * Copyright (C) 2006 Laurent Destailleur
*
* 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
@@ -18,10 +19,10 @@
*
* $Id$
* $Source$
- *
*/
-/*! \file htdocs/adherents/htpasswd.php
+/**
+ \file htdocs/adherents/htpasswd.php
\ingroup adherent
\brief Page d'export htpasswd du fichier des adherents
\author Rodolphe Quiedeville
@@ -34,7 +35,6 @@ llxHeader();
if ($sortorder == "") { $sortorder="ASC"; }
if ($sortfield == "") { $sortfield="d.login"; }
-
if (! isset($statut))
{
$statut = 1 ;
@@ -45,40 +45,44 @@ if (! isset($cotis))
// par defaut les adherents doivent etre a jour de cotisation
$cotis=1;
}
+
+
+
$sql = "SELECT d.login, d.pass, ".$db->pdate("d.datefin")." as datefin";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
$sql .= " WHERE d.statut = $statut ";
-if ($cotis==1){
- $sql .= " AND datefin > now() ";
-}
-$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
-
-$result = $db->query($sql);
-if ($result)
+if ($cotis==1)
{
- $num = $db->num_rows();
- $i = 0;
-
- print "
Export au format htpasswd des login des adhérents
\n";
- //print_barre_liste("Export au format htpasswd des login des adhérents", $page, "htpasswd.php", "");
- print "
\n";
- while ($i < $num)
- {
- $objp = $db->fetch_object($result);
- $htpass=crypt($objp->pass,makesalt());
- print $objp->login.":".$htpass."
\n";
- $i++;
- }
- print "
\n";
+ $sql .= " AND datefin > now() ";
+}
+$sql.= " ORDER BY $sortfield $sortorder";
+//$sql.=$db->plimit($conf->liste_limit, $offset);
+
+$resql = $db->query($sql);
+if ($resql)
+{
+ $num = $db->num_rows($resql);
+ $i = 0;
+
+ print_barre_liste($langs->trans("HTPasswordExport"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',0);
+
+ print "
\n";
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object($result);
+ $htpass=crypt($objp->pass,makesalt());
+ print $objp->login.":".$htpass."
\n";
+ $i++;
+ }
+ print "
\n";
}
else
{
- print $sql;
- print $db->error();
+ dolibarr_print_error($db);
}
$db->close();
-llxFooter("Dernière modification $Date$ révision $Revision$");
+llxFooter('$Date$ - $Revision$');
?>
diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php
index ba19d69ca72..3ae52ebeee8 100644
--- a/htdocs/adherents/index.php
+++ b/htdocs/adherents/index.php
@@ -266,7 +266,7 @@ print '';
print '| '.$langs->trans("Year").' | ';
print ''.$langs->trans("Subscriptions").' | ';
print ''.$langs->trans("Number").' | ';
-print ''.$langs->trans("Average").' | ';
+print ''.$langs->trans("AmountAverage").' | ';
print "
\n";
$var=true;
diff --git a/htdocs/adherents/liste.php b/htdocs/adherents/liste.php
index ee97856bade..06eecaee44c 100644
--- a/htdocs/adherents/liste.php
+++ b/htdocs/adherents/liste.php
@@ -57,8 +57,10 @@ $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, d.fk_adherent_type as type_id, t.libelle as type, d.morphy, d.statut, t.cotisation";
+$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, ";
+$sql.= " ".$db->pdate("d.datefin")." as datefin,";
+$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
+$sql.= " t.libelle as type, 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 ($sall)
@@ -172,29 +174,32 @@ if ($result)
print "";
// Date fin cotisation
- print "";
- if ($objp->cotisation == 'yes')
+ if ($objp->datefin)
{
- if ($objp->datefin)
+ print ' | ';
+ if ($objp->datefin < time() && $objp->statut > 0)
{
- if ($objp->datefin < time() && $objp->statut > 0)
- {
- print dolibarr_print_date($objp->datefin)." - ".$langs->trans("SubscriptionLate")." ".img_warning()." | \n";
- }
- else
- {
- print dolibarr_print_date($objp->datefin)."\n";
- }
+ print dolibarr_print_date($objp->datefin)." - ".$langs->trans("SubscriptionLate")." ".img_warning();
}
- else {
- print $langs->trans("SubscriptionNotReceived");
- if ($objp->statut > 0) print " ".img_warning();
- print "\n";
+ else
+ {
+ print dolibarr_print_date($objp->datefin);
}
+ print '';
}
else
{
- print " ";
+ print '';
+ if ($objp->cotisation == 'yes')
+ {
+ print $langs->trans("SubscriptionNotReceived");
+ if ($objp->statut > 0) print " ".img_warning();
+ }
+ else
+ {
+ print ' ';
+ }
+ print ' | ';
}
// Actions
diff --git a/htdocs/includes/menus/barre_left/eldy_backoffice.php b/htdocs/includes/menus/barre_left/eldy_backoffice.php
index 43b1664132c..c75fc58cc23 100644
--- a/htdocs/includes/menus/barre_left/eldy_backoffice.php
+++ b/htdocs/includes/menus/barre_left/eldy_backoffice.php
@@ -635,10 +635,10 @@ class MenuLeft {
$newmenu->add_submenu(DOL_URL_ROOT."/compta/bank/index.php?leftmenu=accountancy",$langs->trans("Banks"),0,$user->rights->adherent->lire);
$newmenu->add(DOL_URL_ROOT."/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Exports"),0,$user->rights->adherent->export);
- if ($leftmenu=="export") $newmenu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export);
+ if ($conf->export->enabled && $leftmenu=="export") $newmenu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export);
if ($leftmenu=="export") $newmenu->add_submenu(DOL_URL_ROOT."/adherents/htpasswd.php?leftmenu=export",$langs->trans("Filehtpasswd"),1,$user->rights->adherent->export);
- if ($leftmenu=="export") $newmenu->add_submenu(DOL_URL_ROOT."/adherents/cartes/carte.php?leftmenu=export",$langs->trans("MembersCards"),1,$user->rights->adherent->export);
- if ($leftmenu=="export") $newmenu->add_submenu(DOL_URL_ROOT."/adherents/cartes/etiquette.php?leftmenu=export","Etiquettes d'adhérents",1,$user->rights->adherent->export);
+ if ($leftmenu=="export") $newmenu->add_submenu(DOL_URL_ROOT."/adherents/cartes/carte.php?leftmenu=export",$langs->trans("MembersCards"),1,$user->rights->adherent->export,'_new');
+ if ($leftmenu=="export") $newmenu->add_submenu(DOL_URL_ROOT."/adherents/cartes/etiquette.php?leftmenu=export","Etiquettes d'adhérents",1,$user->rights->adherent->export,'_new');
$newmenu->add(DOL_URL_ROOT."/public/adherents/index.php?leftmenu=member_public",$langs->trans("MemberPublicLinks"));
/*
@@ -686,7 +686,8 @@ class MenuLeft {
for ($i = 0 ; $i < sizeof($this->menu_array) ; $i++)
{
$alt++;
- if ($this->menu_array[$i]['level']==0) {
+ if ($this->menu_array[$i]['level']==0)
+ {
if (($alt%2==0))
{
print '\n";
}
}
diff --git a/htdocs/includes/triggers/interface_demo.class.php b/htdocs/includes/triggers/interface_demo.class.php
index 085cf730be3..082afb4d0b7 100644
--- a/htdocs/includes/triggers/interface_demo.class.php
+++ b/htdocs/includes/triggers/interface_demo.class.php
@@ -154,151 +154,151 @@ class InterfaceDemo
// Products
elseif ($action == 'PRODUCT_CREATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PRODUCT_MODIFY')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PRODUCT_DELETE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Customer orders
elseif ($action == 'ORDER_CREATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_VALIDATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_DELETE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Supplier orders
elseif ($action == 'ORDER_SUPPLIER_CREATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_SUPPLIER_VALIDATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Proposals
elseif ($action == 'PROPAL_CREATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROPAL_MODIFY')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROPAL_VALIDATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROPAL_CLOSE_SIGNED')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROPAL_CLOSE_REFUSED')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Contracts
elseif ($action == 'CONTRACT_CREATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'CONTRACT_MODIFY')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'CONTRACT_ACTIVATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'CONTRACT_CANCEL')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'CONTRACT_CLOSE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'CONTRACT_DELETE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Bills
elseif ($action == 'BILL_CREATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_MODIFY')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_VALIDATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_CANCEL')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_DELETE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Payments
elseif ($action == 'PAYMENT_CUSTOMER_CREATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PAYMENT_SUPPLIER_CREATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Interventions
elseif ($action == 'FICHEINTER_VALIDATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Members
elseif ($action == 'MEMBER_CREATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'MEMBER_VALIDATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'MEMBER_SUBSCRIPTION')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'MEMBER_MODIFY')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'MEMBER_RESILIATE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'MEMBER_DELETE')
{
- dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
return 0;
diff --git a/htdocs/includes/triggers/interface_ldap.class.php b/htdocs/includes/triggers/interface_ldap.class.php
index a092bdde5fd..d25553e93c5 100644
--- a/htdocs/includes/triggers/interface_ldap.class.php
+++ b/htdocs/includes/triggers/interface_ldap.class.php
@@ -113,7 +113,7 @@ class InterfaceLdap
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
- $ldap->add($dn,$info,$user);
+ return $ldap->add($dn,$info,$user);
}
}
elseif ($action == 'USER_MODIFY')
@@ -127,7 +127,7 @@ class InterfaceLdap
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
- $ldap->update($dn,$info,$user);
+ return $ldap->update($dn,$info,$user);
}
}
elseif ($action == 'USER_NEW_PASSWORD')
@@ -149,7 +149,7 @@ class InterfaceLdap
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
- $ldap->delete($dn,$info,$user);
+ return $ldap->delete($dn,$info,$user);
}
}
@@ -164,7 +164,7 @@ class InterfaceLdap
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
- $ldap->add($dn,$info,$user);
+ return $ldap->add($dn,$info,$user);
}
}
elseif ($action == 'GROUP_MODIFY')
@@ -177,7 +177,7 @@ class InterfaceLdap
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
- $ldap->update($dn,$info,$user);
+ return $ldap->update($dn,$info,$user);
}
}
elseif ($action == 'GROUP_DELETE')
@@ -190,7 +190,7 @@ class InterfaceLdap
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
- $ldap->delete($dn,$info,$user);
+ return $ldap->delete($dn,$info,$user);
}
}
@@ -206,7 +206,7 @@ class InterfaceLdap
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
- $ldap->add($dn,$info,$user);
+ return $ldap->add($dn,$info,$user);
}
}
elseif ($action == 'CONTACT_MODIFY')
@@ -220,7 +220,7 @@ class InterfaceLdap
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
- $ldap->update($dn,$info,$user);
+ return $ldap->update($dn,$info,$user);
}
}
elseif ($action == 'CONTACT_DELETE')
@@ -234,7 +234,7 @@ class InterfaceLdap
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
- $ldap->delete($dn,$info,$user);
+ return $ldap->delete($dn,$info,$user);
}
}
@@ -246,19 +246,26 @@ class InterfaceLdap
{
$ldap=new Ldap();
$ldap->connect_bind();
+
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
- $ldap->add($dn,$info,$user);
+ return $ldap->add($dn,$info,$user);
}
}
elseif ($action == 'MEMBER_VALIDATE')
{
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
+ if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE)
+ {
+ }
}
elseif ($action == 'MEMBER_SUBSCRIPTION')
{
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
+ if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE)
+ {
+ }
}
elseif ($action == 'MEMBER_MODIFY')
{
@@ -271,12 +278,15 @@ class InterfaceLdap
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
- $ldap->update($dn,$info,$user);
+ return $ldap->update($dn,$info,$user);
}
}
elseif ($action == 'MEMBER_RESILIATE')
{
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
+ if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE)
+ {
+ }
}
elseif ($action == 'MEMBER_DELETE')
{
@@ -289,7 +299,7 @@ class InterfaceLdap
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
- $ldap->delete($dn,$info,$user);
+ return $ldap->delete($dn,$info,$user);
}
}
diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php
index 71538684e54..372ffc8b085 100644
--- a/htdocs/lib/functions.inc.php
+++ b/htdocs/lib/functions.inc.php
@@ -478,7 +478,9 @@ function dolibarr_print_ca($ca)
*/
function dolibarr_time_plus_duree($time,$duration_value,$duration_unit)
{
- $deltastring="+$duration_value";
+ if ($duration_value == 0) return $time;
+ if ($duration_value > 0) $deltastring="+".abs($duration_value);
+ if ($duration_value < 0) $deltastring="-".abs($duration_value);
if ($duration_unit == 'd') { $deltastring.=" day"; }
if ($duration_unit == 'm') { $deltastring.=" month"; }
if ($duration_unit == 'y') { $deltastring.=" year"; }
diff --git a/htdocs/lib/member.lib.php b/htdocs/lib/member.lib.php
index 7b3115736ce..423f62df25e 100644
--- a/htdocs/lib/member.lib.php
+++ b/htdocs/lib/member.lib.php
@@ -50,6 +50,11 @@ function member_prepare_head($member)
$h++;
}
+ $head[$h][0] = DOL_URL_ROOT.'/adherents/info.php?id='.$member->id;
+ $head[$h][1] = $langs->trans("Info");
+ $head[$h][2] = 'info';
+ $h++;
+
return $head;
}
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index fecc6161634..7fd034f44a0 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -635,7 +635,7 @@ function llxFooter($foot='',$limitIEbug=1)
global $conf, $dolibarr_auto_user, $micro_start_time;
print "\n\n".''."\n";
- print "\n\n".'';
+ print "\n\n".''."\n";
if (isset($_SERVER['DOL_TUNING']))
{
diff --git a/htdocs/menu.class.php b/htdocs/menu.class.php
index bf8ce4c0cb5..5e1e031f741 100644
--- a/htdocs/menu.class.php
+++ b/htdocs/menu.class.php
@@ -18,7 +18,6 @@
*
* $Id$
* $Source$
- *
*/
/**
@@ -60,14 +59,16 @@ class Menu {
* \param titre Libelle menu à afficher
* \param level Niveau du menu à ajouter
* \param enabled Menu actif ou non
+ * \param target Target lien
*/
- function add($url, $titre, $level=0, $enabled=1)
+ function add($url, $titre, $level=0, $enabled=1, $target='')
{
$i = sizeof($this->liste);
$this->liste[$i]['url'] = $url;
$this->liste[$i]['titre'] = $titre;
$this->liste[$i]['level'] = $level;
$this->liste[$i]['enabled'] = $enabled;
+ $this->liste[$i]['target'] = $target;
}
/**
@@ -76,11 +77,12 @@ class Menu {
* \param titre Libelle menu à afficher
* \param level Niveau du menu à ajouter
* \param enabled Menu actif ou non
+ * \param target Target lien
*/
- function add_submenu($url, $titre, $level=1, $enabled=1)
+ function add_submenu($url, $titre, $level=1, $enabled=1, $target='')
{
$i = sizeof($this->liste) - 1;
- $this->add($url, $titre, $level, $enabled);
+ $this->add($url, $titre, $level, $enabled, $target);
}
}
diff --git a/scripts/adherents/sync_member_ldap2dolibarr.php b/scripts/adherents/sync_member_ldap2dolibarr.php
index 684e208859b..5d6f9d86db6 100644
--- a/scripts/adherents/sync_member_ldap2dolibarr.php
+++ b/scripts/adherents/sync_member_ldap2dolibarr.php
@@ -54,10 +54,11 @@ require_once(DOL_DOCUMENT_ROOT."/adherents/cotisation.class.php");
$error=0;
-print "***** $script_file ($version) *****\n";
+if ($argv[2]) $conf->global->LDAP_SERVER_HOST=$argv[2];
-if ($argv[2]) $conf->global->LDAP_SERVER_HOST=$argv[2];
-if ($argv[2]) $conf->global->LDAP_SERVER_HOST=$argv[2];
+print "***** $script_file ($version) *****\n";
+print 'DN='.$conf->global->LDAP_MEMBER_DN."\n";
+print 'Filter=('.$conf->global->LDAP_KEY_MEMBERS.'=*)'."\n";
/*
if (! $conf->global->LDAP_MEMBER_ACTIVE)
@@ -100,15 +101,19 @@ else
exit;
}
+
+
$ldap = new Ldap();
$result = $ldap->connect_bind();
if ($result >= 0)
{
$justthese=array();
- print 'DN='.$conf->global->LDAP_MEMBER_DN."\n";
- print 'Filter=('.$conf->global->LDAP_KEY_MEMBERS.'=*)'."\n";
-
+
+ // On désactive la synchro Dolibarr vers LDAP
+ $conf->global->LDAP_MEMBER_ACTIVE=0;
+
+
$ldaprecords = $ldap->search($conf->global->LDAP_MEMBER_DN, '('.$conf->global->LDAP_KEY_MEMBERS.'=*)');
if (is_array($ldaprecords))
{
@@ -142,22 +147,24 @@ if ($result >= 0)
$member->commentaire=$ldapuser[$conf->global->LDAP_FIELD_DESCRIPTION][0];
$member->morphy='phy';
- //$member->photo;
+ $member->photo='';
$member->public=1;
$member->statut=-1; // Par defaut, statut brouillon
+ $member->naiss=dolibarr_mktime($ldapuser[$conf->global->LDAP_FIELD_BIRTHDATE][0]);
+ // Cas particulier (on ne rentre jamais dans ce if)
if (isset($ldapuser["prnxstatus"][0]))
{
+ $member->datec=dolibarr_mktime($ldapuser["prnxfirtscontribution"][0]);
+ $member->datevalid=dolibarr_mktime($ldapuser["prnxfirtscontribution"][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]);
// Propriete type membre
$member->typeid=$typeid;
@@ -187,13 +194,14 @@ if ($result >= 0)
$datelast=dolibarr_mktime($ldapuser["prnxlastcontribution"][0]);
if ($datefirst)
{
- $crowid=$member->cotisation($datefirst, 0, 0, $operation, $label, $num_chq);
+ $crowid=$member->cotisation($datefirst, 0, 0);
}
if ($datelast)
{
// Cree derniere cotisation et met a jour datefin dans adherent
$price=price2num($ldapuser["prnxlastcontributionprice"][0]);
- $crowid=$member->cotisation(dolibarr_time_plus_duree($datelast,-1,'y'), $price, 0, $operation, $label, $num_chq);
+ //print "xx".$datelast."-".dolibarr_time_plus_duree($datelast,-1,'y')."\n";
+ $crowid=$member->cotisation(dolibarr_time_plus_duree($datelast,-1,'y'), $price, 0);
}
//----------------------------