New: Ajout des triggers sur la gestion des adhérents
This commit is contained in:
parent
7ced62b0d5
commit
815e4eeec7
@ -54,7 +54,6 @@ class Adherent
|
|||||||
var $pays_id;
|
var $pays_id;
|
||||||
var $pays_code;
|
var $pays_code;
|
||||||
var $pays;
|
var $pays;
|
||||||
var $typeid;
|
|
||||||
var $morphy;
|
var $morphy;
|
||||||
var $email;
|
var $email;
|
||||||
var $public;
|
var $public;
|
||||||
@ -64,6 +63,10 @@ class Adherent
|
|||||||
var $pass;
|
var $pass;
|
||||||
var $naiss;
|
var $naiss;
|
||||||
var $photo;
|
var $photo;
|
||||||
|
|
||||||
|
var $typeid; // Id type adherent
|
||||||
|
var $type; // Libellé type adherent
|
||||||
|
|
||||||
// var $public;
|
// var $public;
|
||||||
var $array_options;
|
var $array_options;
|
||||||
|
|
||||||
@ -307,12 +310,11 @@ class Adherent
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Fonction qui crée l'adhérent
|
\brief Fonction qui crée l'adhérent
|
||||||
\param userid userid de l'adhérent
|
|
||||||
\return int <0 si ko, >0 si ok
|
\return int <0 si ko, >0 si ok
|
||||||
*/
|
*/
|
||||||
function create($userid)
|
function create()
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs,$user;
|
||||||
|
|
||||||
// Verification parametres
|
// Verification parametres
|
||||||
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! ValidEMail($this->email)) {
|
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! ValidEMail($this->email)) {
|
||||||
@ -330,7 +332,15 @@ class Adherent
|
|||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent");
|
||||||
return $this->update();
|
$result=$this->update(1);
|
||||||
|
|
||||||
|
// Appel des triggers
|
||||||
|
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||||
|
$interface=new Interfaces($this->db);
|
||||||
|
$result=$interface->run_triggers('MEMBER_CREATE',$this,$user,$langs,$conf);
|
||||||
|
// Fin appel triggers
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -342,18 +352,23 @@ class Adherent
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
\brief fonction qui met à jour l'adhérent
|
\brief fonction qui met à jour l'adhérent
|
||||||
|
\param disable_triggers 1=désactive le trigger UPDATE (quand appelé par creation)
|
||||||
\return int <0 si ko, >0 si ok
|
\return int <0 si ko, >0 si ok
|
||||||
*/
|
*/
|
||||||
function update()
|
function update($disable_trigger=0)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs,$user;
|
||||||
|
|
||||||
|
dolibarr_syslog("Adherent.class.php::update $disable_trigger");
|
||||||
|
|
||||||
// Verification parametres
|
// Verification parametres
|
||||||
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! ValidEMail($this->email)) {
|
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! ValidEMail($this->email))
|
||||||
|
{
|
||||||
$this->error = $langs->trans("ErrorBadEMail",$this->email);
|
$this->error = $langs->trans("ErrorBadEMail",$this->email);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||||
$sql .= " prenom = '".$this->prenom ."'";
|
$sql .= " prenom = '".$this->prenom ."'";
|
||||||
@ -376,10 +391,10 @@ class Adherent
|
|||||||
$sql .= " WHERE rowid = ".$this->id;
|
$sql .= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if (! $result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
dolibarr_print_error($this->db);
|
$this->error=$this->db->error();
|
||||||
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,25 +413,30 @@ class Adherent
|
|||||||
$sql .= ") VALUES ($this->id";
|
$sql .= ") VALUES ($this->id";
|
||||||
foreach($this->array_options as $key => $value)
|
foreach($this->array_options as $key => $value)
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql.=",'".$this->array_options[$key]."'";
|
$sql.=",'".$this->array_options[$key]."'";
|
||||||
}
|
}
|
||||||
$sql.=");";
|
$sql.=");";
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
if (! $result)
|
||||||
if ($result)
|
|
||||||
{
|
{
|
||||||
return 1;
|
$this->error=$this->db->error();
|
||||||
}
|
$this->db->rollback();
|
||||||
else
|
|
||||||
{
|
|
||||||
dolibarr_print_error($this->db);
|
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! $disable_trigger)
|
||||||
|
{
|
||||||
|
// Appel des triggers
|
||||||
|
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||||
|
$interface=new Interfaces($this->db);
|
||||||
|
$result=$interface->run_triggers('MEMBER_MODIFY',$this,$user,$langs,$conf);
|
||||||
|
// Fin appel triggers
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,12 +645,16 @@ class Adherent
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Fonction qui insère la cotisation dans la base de données
|
\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 cotisation
|
||||||
\param montant Montant cotisation
|
\param montant Montant cotisation
|
||||||
\return int rowid de l'entrée ajoutée, <0 si erreur
|
\return int rowid de l'entrée ajoutée, <0 si erreur
|
||||||
*/
|
*/
|
||||||
function cotisation($date, $montant)
|
function cotisation($date, $montant, $accountid, $operation, $label, $num_chq)
|
||||||
{
|
{
|
||||||
|
global $conf,$langs,$user;
|
||||||
|
|
||||||
|
dolibarr_syslog("Adherent.class.php::cotisation $date, $montant, $accountid, $operation, $label, $num_chq");
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, datec, dateadh, cotisation)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, datec, dateadh, cotisation)";
|
||||||
@ -638,20 +662,54 @@ class Adherent
|
|||||||
|
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
|
||||||
if ( $this->db->affected_rows($result) )
|
|
||||||
{
|
{
|
||||||
$rowid=$this->db->last_insert_id(MAIN_DB_PREFIX."cotisation");
|
$rowid=$this->db->last_insert_id(MAIN_DB_PREFIX."cotisation");
|
||||||
$datefin = mktime(12, 0 , 0,
|
// datefin = date + 1 an
|
||||||
strftime("%m",$date),
|
$datefin = mktime(12, 0 , 0, strftime("%m",$date), strftime("%d",$date),
|
||||||
strftime("%d",$date),
|
|
||||||
strftime("%Y",$date)+1) - (24 * 3600);
|
strftime("%Y",$date)+1) - (24 * 3600);
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET datefin = ".$this->db->idate($datefin)." WHERE rowid =". $this->id;
|
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET datefin = ".$this->db->idate($datefin);
|
||||||
if ( $this->db->query( $sql) )
|
$sql.= " WHERE rowid =". $this->id;
|
||||||
|
$resql=$this->db->query( $sql);
|
||||||
|
if ($resql)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
|
||||||
return $rowid;
|
// Rajout du nouveau cotisant dans les listes qui vont bien
|
||||||
|
if ($conf->global->ADHERENT_MAILMAN_LISTS_COTISANT && ! $adh->datefin)
|
||||||
|
{
|
||||||
|
$adh->add_to_mailman($conf->global->ADHERENT_MAILMAN_LISTS_COTISANT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insertion dans la gestion bancaire si configuré pour
|
||||||
|
if ($conf->global->ADHERENT_BANK_USE && $accountid)
|
||||||
|
{
|
||||||
|
$acct=new Account($this->db,$accountid);
|
||||||
|
|
||||||
|
$dateop=strftime("%Y%m%d",time());
|
||||||
|
$amount=$cotisation;
|
||||||
|
|
||||||
|
$insertid=$acct->addline($dateop, $operation, $label, $amount, $num_chq, '', $user);
|
||||||
|
if ($insertid > 0)
|
||||||
|
{
|
||||||
|
$inserturlid=$acct->add_url_line($insertid, $adh->id, DOL_URL_ROOT.'/adherents/fiche.php?rowid=', $adh->getFullname(), 'member');
|
||||||
|
if ($inserturlid > 0)
|
||||||
|
{
|
||||||
|
// Met a jour la table cotisation
|
||||||
|
$sql="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=".$insertid." WHERE rowid=".$crowid;
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
$this->db->rollback();
|
||||||
|
return -5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$acct->error();
|
||||||
|
$this->db->rollback();
|
||||||
|
return -4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -660,6 +718,16 @@ class Adherent
|
|||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Appel des triggers
|
||||||
|
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||||
|
$interface=new Interfaces($this->db);
|
||||||
|
$result=$interface->run_triggers('MEMBER_SUBSCRIPTION',$this,$user,$langs,$conf);
|
||||||
|
// Fin appel triggers
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
|
return $rowid;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
@ -676,56 +744,73 @@ class Adherent
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief fonction qui vérifie que l'utilisateur est valide
|
* \brief Fonction qui vérifie que l'utilisateur est valide
|
||||||
\param userid userid de l'adhérent
|
* \param userid userid adhérent à valider
|
||||||
|
* \return int <0 si ko, >0 si ok
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function validate($userid)
|
function validate($userid)
|
||||||
{
|
{
|
||||||
|
global $user,$langs,$conf;
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||||
$sql .= "statut=1";
|
$sql.= " statut=1,";
|
||||||
$sql .= ",fk_user_valid=".$userid;
|
$sql.= " fk_user_valid=".$userid;
|
||||||
|
|
||||||
$sql.= " WHERE rowid = $this->id";
|
$sql.= " WHERE rowid = $this->id";
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
// Appel des triggers
|
||||||
|
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||||
|
$interface=new Interfaces($this->db);
|
||||||
|
$result=$interface->run_triggers('MEMBER_VALIDATE',$this,$user,$langs,$conf);
|
||||||
|
// Fin appel triggers
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_print_error($this->db);
|
$this->error=$this->db->error();
|
||||||
return 0;
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief fonction qui résilie un adhérent
|
* \brief Fonction qui résilie un adhérent
|
||||||
\param userid userid de de l'adhérent
|
* \param userid userid adhérent à résilier
|
||||||
|
* \return int <0 si ko, >0 si ok
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function resiliate($userid)
|
function resiliate($userid)
|
||||||
{
|
{
|
||||||
|
global $user,$langs,$conf;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET ";
|
||||||
$sql .= "statut=0";
|
$sql .= "statut=0";
|
||||||
$sql .= ",fk_user_valid=".$userid;
|
$sql .= ",fk_user_valid=".$userid;
|
||||||
|
$sql .= " WHERE rowid = ".$this->id;
|
||||||
$sql .= " WHERE rowid = $this->id";
|
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
// Appel des triggers
|
||||||
|
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||||
|
$interface=new Interfaces($this->db);
|
||||||
|
$result=$interface->run_triggers('MEMBER_RESILIATE',$this,$user,$langs,$conf);
|
||||||
|
// Fin appel triggers
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_print_error($this->db);
|
$this->error=$this->db->error();
|
||||||
return 0;
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -45,6 +45,7 @@ $errmsg='';
|
|||||||
|
|
||||||
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
|
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
|
||||||
$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
|
$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
|
||||||
|
$typeid=isset($_GET["typeid"])?$_GET["typeid"]:$_POST["typeid"];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -62,79 +63,43 @@ if ($_POST["action"] == 'sendinfo')
|
|||||||
|
|
||||||
if ($_POST["action"] == 'cotisation')
|
if ($_POST["action"] == 'cotisation')
|
||||||
{
|
{
|
||||||
$reday=$_POST["reday"];
|
|
||||||
$remonth=$_POST["remonth"];
|
|
||||||
$reyear=$_POST["reyear"];
|
|
||||||
$cotisation=$_POST["cotisation"];
|
|
||||||
|
|
||||||
if ($cotisation > 0)
|
|
||||||
{
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$adh = new Adherent($db);
|
$adh = new Adherent($db);
|
||||||
$adh->id = $rowid;
|
$adh->id = $rowid;
|
||||||
$adh->fetch($rowid);
|
$adh->fetch($rowid);
|
||||||
|
|
||||||
// Rajout du nouveau cotisant dans les listes qui vont bien
|
$reday=$_POST["reday"];
|
||||||
// if (defined("ADHERENT_MAILMAN_LISTS_COTISANT") && ADHERENT_MAILMAN_LISTS_COTISANT!='' && $adh->datefin == "0000-00-00 00:00:00"){
|
$remonth=$_POST["remonth"];
|
||||||
if ($conf->global->ADHERENT_MAILMAN_LISTS_COTISANT && $adh->datefin == 0)
|
$reyear=$_POST["reyear"];
|
||||||
|
$datecotisation=@mktime(12, 0 , 0, $remonth, $reday, $reyear);
|
||||||
|
$cotisation=$_POST["cotisation"];
|
||||||
|
|
||||||
|
$accountid=$_POST["accountid"];
|
||||||
|
$operation=$_POST["operation"];
|
||||||
|
$label=$_POST["label"];
|
||||||
|
$num_chq=$_POST["num_chq"];
|
||||||
|
|
||||||
|
|
||||||
|
if (! $datecotisation)
|
||||||
{
|
{
|
||||||
$adh->add_to_mailman($conf->global->ADHERENT_MAILMAN_LISTS_COTISANT);
|
$errmsg=$langs->trans("BadDateFormat");
|
||||||
|
$action='';
|
||||||
}
|
}
|
||||||
|
|
||||||
$crowid=$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation);
|
if (! $cotisation > 0)
|
||||||
|
{
|
||||||
|
$errmsg=$langs->trans("ErrorFieldRequired",$langs->trans("Amount"));
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action)
|
||||||
|
{
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
$crowid=$adh->cotisation($datecotisation, $cotisation, $accountid, $operation, $label, $num_chq);
|
||||||
|
|
||||||
if ($crowid > 0)
|
if ($crowid > 0)
|
||||||
{
|
|
||||||
// Insertion dans la gestion banquaire si configuré pour
|
|
||||||
if ($conf->global->ADHERENT_BANK_USE)
|
|
||||||
{
|
|
||||||
$acct=new Account($db,$_POST["accountid"]);
|
|
||||||
|
|
||||||
$dateop=strftime("%Y%m%d",time());
|
|
||||||
$amount=$cotisation;
|
|
||||||
|
|
||||||
$insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"], '', $user);
|
|
||||||
if ($insertid > 0)
|
|
||||||
{
|
|
||||||
$inserturlid=$acct->add_url_line($insertid, $adh->id, DOL_URL_ROOT.'/adherents/fiche.php?rowid=', $adh->getFullname(), 'member');
|
|
||||||
if ($inserturlid > 0)
|
|
||||||
{
|
|
||||||
// Met a jour la table cotisation
|
|
||||||
$sql="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=".$insertid." WHERE rowid=".$crowid;
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
//Header("Location: fiche.php");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
dolibarr_print_error($db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
dolibarr_print_error($db,$acct->error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
dolibarr_print_error($db,$acct->error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
dolibarr_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Envoi mail
|
// Envoi mail
|
||||||
if ($conf->global->ADHERENT_MAIL_COTIS)
|
if ($conf->global->ADHERENT_MAIL_COTIS)
|
||||||
@ -144,13 +109,10 @@ if ($_POST["action"] == 'cotisation')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$adh = new Adherent($db);
|
$db->rollback();
|
||||||
$adh->id = $rowid;
|
dolibarr_print_error($db,$adh->error);
|
||||||
$adh->fetch($rowid);
|
}
|
||||||
}
|
}
|
||||||
$errmsg=$langs->trans("FieldRequired",$langs->trans("Amount"));
|
|
||||||
|
|
||||||
$action = "edit";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'update')
|
if ($action == 'update')
|
||||||
@ -184,12 +146,14 @@ if ($action == 'update')
|
|||||||
$adh->statut = $_POST["statut"];
|
$adh->statut = $_POST["statut"];
|
||||||
$adh->public = $_POST["public"];
|
$adh->public = $_POST["public"];
|
||||||
|
|
||||||
foreach($_POST as $key => $value){
|
foreach($_POST as $key => $value)
|
||||||
if (ereg("^options_",$key)){
|
{
|
||||||
|
if (ereg("^options_",$key))
|
||||||
|
{
|
||||||
$adh->array_options[$key]=$_POST[$key];
|
$adh->array_options[$key]=$_POST[$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($adh->update($user->id)>=0)
|
if ($adh->update(0) >= 0)
|
||||||
{
|
{
|
||||||
Header("Location: fiche.php?rowid=".$adh->id);
|
Header("Location: fiche.php?rowid=".$adh->id);
|
||||||
exit;
|
exit;
|
||||||
@ -463,7 +427,7 @@ if ($_POST["action"] == 'confirm_add_spip' && $_POST["confirm"] == 'yes')
|
|||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
|
|
||||||
if ($errmsg != '')
|
if ($errmsg)
|
||||||
{
|
{
|
||||||
print '<div class="error">'.$errmsg.'</div>';
|
print '<div class="error">'.$errmsg.'</div>';
|
||||||
print "\n";
|
print "\n";
|
||||||
@ -590,7 +554,7 @@ if ($action == 'create')
|
|||||||
print '<tr><td width="15%">'.$langs->trans("MemberType").'</td><td width="35%">';
|
print '<tr><td width="15%">'.$langs->trans("MemberType").'</td><td width="35%">';
|
||||||
$listetype=$adht->liste_array();
|
$listetype=$adht->liste_array();
|
||||||
if (sizeof($listetype)) {
|
if (sizeof($listetype)) {
|
||||||
$htmls->select_array("type", $listetype);
|
$htmls->select_array("type", $listetype, $typeid);
|
||||||
} else {
|
} else {
|
||||||
print '<font class="error">'.$langs->trans("NoTypeDefinedGoToSetup").'</font>';
|
print '<font class="error">'.$langs->trans("NoTypeDefinedGoToSetup").'</font>';
|
||||||
}
|
}
|
||||||
@ -686,6 +650,7 @@ if ($rowid && $action != 'edit')
|
|||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Affichage onglets
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -153,7 +153,9 @@ if (! $rowid && $_GET["action"] != 'create' && $_GET["action"] != 'edit') {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
print "<a class=\"tabAction\" href=\"type.php?action=create\">".$langs->trans("NewType")."</a>";
|
|
||||||
|
print "<a class=\"butAction\" href=\"type.php?action=create\">".$langs->trans("NewType")."</a>";
|
||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -230,11 +232,11 @@ if ($rowid > 0)
|
|||||||
print '<tr><td width="15%">'.$langs->trans("Label").'</td><td>'.$adht->libelle.'</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 '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||||
print $adht->cotisation;
|
print yn($adht->cotisation);
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||||
print $adht->vote;
|
print yn($adht->vote);
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>';
|
print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>';
|
||||||
@ -252,7 +254,11 @@ if ($rowid > 0)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
print "<a class=\"tabAction\" href=\"type.php?action=edit&rowid=".$adht->id."\">".$langs->trans("Edit")."</a>";
|
|
||||||
|
print "<a class=\"butAction\" href=\"type.php?action=edit&rowid=".$adht->id."\">".$langs->trans("Edit")."</a>";
|
||||||
|
|
||||||
|
print "<a class=\"butAction\" href=\"fiche.php?action=create&typeid=".$adht->id."\">".$langs->trans("AddMember")."</a>";
|
||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
|
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -21,9 +22,10 @@
|
|||||||
* $Source$
|
* $Source$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file htdocs/admin/boutique.php
|
/**
|
||||||
|
\file htdocs/admin/boutique.php
|
||||||
\ingroup boutique
|
\ingroup boutique
|
||||||
\brief Page d'administration/configuration du module Boutique
|
\brief Page d'administration/configuration du module OsCommerce
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -35,103 +37,35 @@ if (!$user->admin)
|
|||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
llxHeader();
|
/*
|
||||||
|
* Actions
|
||||||
$dir = "../includes/modules/facture/";
|
*/
|
||||||
|
|
||||||
//
|
|
||||||
// \todo mettre cette section dans la base de données
|
|
||||||
//
|
|
||||||
$modules["BOUTIQUE_LIVRE"][0] = "Livres";
|
|
||||||
$modules["BOUTIQUE_LIVRE"][1] = "BOUTIQUE_LIVRE";
|
|
||||||
$modules["BOUTIQUE_LIVRE"][2] = BOUTIQUE_LIVRE;
|
|
||||||
$modules["BOUTIQUE_LIVRE"][3] = "Module de gestion des livres";
|
|
||||||
|
|
||||||
$modules["BOUTIQUE_ALBUM"][0] = "Albums";
|
|
||||||
$modules["BOUTIQUE_ALBUM"][1] = "BOUTIQUE_ALBUM";
|
|
||||||
$modules["BOUTIQUE_ALBUM"][2] = BOUTIQUE_ALBUM;
|
|
||||||
$modules["BOUTIQUE_ALBUM"][3] = "Module de gestion des albums";
|
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'set')
|
if ($action == 'set')
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$value."';";
|
dolibarr_set_const($db,'XXX',$value);
|
||||||
$db->query($sql);
|
|
||||||
$sql ='';
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES ('".$value."','1',0) ; ";
|
|
||||||
|
|
||||||
//$sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = '".$value."', value='1', visible = 0";
|
|
||||||
|
|
||||||
if ($db->query($sql))
|
|
||||||
{
|
|
||||||
$modules[$value][2] = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'reset')
|
if ($action == 'reset')
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$value."';";
|
dolibarr_del_const($db,'XXX');
|
||||||
$db->query($sql);
|
}
|
||||||
$sql = '';
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES ('".$value."','0',0) ; ";
|
|
||||||
//$sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = '".$value."', value='0', visible = 0";
|
|
||||||
|
/*
|
||||||
|
* Affichage page
|
||||||
|
*/
|
||||||
|
|
||||||
|
llxHeader();
|
||||||
|
|
||||||
|
print_titre($langs->trans("OSCommerceSetup"));
|
||||||
|
|
||||||
|
|
||||||
|
print $langs->trans("ToDo");
|
||||||
|
|
||||||
if ($db->query($sql))
|
|
||||||
{
|
|
||||||
$modules[$value][2] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
print_titre("Boutique");
|
llxFooter('$Date$ - $Revision$');
|
||||||
|
|
||||||
print '<table border="1" cellpadding="3" cellspacing="0">';
|
|
||||||
print '<TR class="liste_titre">';
|
|
||||||
print '<td>Nom</td>';
|
|
||||||
print '<td>Info</td>';
|
|
||||||
print '<td align="center">Activé</td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print "</TR>\n";
|
|
||||||
|
|
||||||
foreach ($modules as $key => $value)
|
|
||||||
{
|
|
||||||
$titre = $modules[$key][0];
|
|
||||||
$const_name = $modules[$key][1];
|
|
||||||
$const_value = $modules[$key][2];
|
|
||||||
$desc = $modules[$key][3];
|
|
||||||
|
|
||||||
|
|
||||||
print '<tr><td>';
|
|
||||||
echo "$titre";
|
|
||||||
print "</td><td>\n";
|
|
||||||
echo "$desc";
|
|
||||||
print '</td><td align="center">';
|
|
||||||
|
|
||||||
if ($const_value == 1)
|
|
||||||
{
|
|
||||||
print img_tick();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print " ";
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</td><td align="center">';
|
|
||||||
|
|
||||||
if ($const_value == 1)
|
|
||||||
{
|
|
||||||
print '<a href="boutique.php?action=reset&value='.$const_name.'">'.$langs->trans("Disable").'</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<a href="boutique.php?action=set&value='.$const_name.'">'.$langs->trans("Activate").'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
llxFooter();
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -219,6 +219,31 @@ class InterfaceDemo
|
|||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||||
}
|
}
|
||||||
|
// Members
|
||||||
|
elseif ($action == 'MEMBER_CREATE')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||||
|
}
|
||||||
|
elseif ($action == 'MEMBER_VALIDATE')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||||
|
}
|
||||||
|
elseif ($action == 'MEMBER_SUBSCRIPTION')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||||
|
}
|
||||||
|
elseif ($action == 'MEMBER_MODIFY')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||||
|
}
|
||||||
|
elseif ($action == 'MEMBER_RESILIATE')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||||
|
}
|
||||||
|
elseif ($action == 'MEMBER_DELETE')
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' was ran but no handler found for this action.");
|
dolibarr_syslog("Trigger '".$this->name."' for action '$action' was ran but no handler found for this action.");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user