Commit 167267ca authored by Feu's avatar Feu
Browse files

script d'init des maling, + debug

parent 3ac69a4d
......@@ -183,7 +183,8 @@ class asso extends stdentity
if ( $this->nom_unix )
{
$this->_ml_create($this->nom_unix."-membres");
if ( !is_null($this->id_parent) )
$this->_ml_create($this->nom_unix."-membres");
$this->_ml_create($this->nom_unix."-bureau");
}
}
......@@ -199,6 +200,36 @@ class asso extends stdentity
if ( is_null($this->dbrw) ) return; // "Read Only" mode
if ( $this->nom_unix != $this->nom_unix )
{
if ( !$this->nom_unix )
{
if ( !is_null($id_parent) )
$this->_ml_create($nom_unix."-membres");
$this->_ml_create($nom_unix."-bureau");
}
else
{
if (!is_null($this->id_parent) && is_null($id_parent) )
$this->_ml_remove($this->nom_unix."-membres");
elseif (is_null($this->id_parent) && !is_null($id_parent) )
$this->_ml_create($nom_unix."-membres");
else
$this->_ml_rename($this->nom_unix."-membres",$nom_unix."-membres");
$this->_ml_rename($this->nom_unix."-bureau",$nom_unix."-bureau");
}
}
elseif ( $this->nom_unix )
{
if (!is_null($this->id_parent) && is_null($id_parent) )
$this->_ml_remove($this->nom_unix."-membres");
elseif (is_null($this->id_parent) && !is_null($id_parent) )
$this->_ml_create($this->nom_unix."-membres");
}
$this->nom = $nom;
$this->nom_unix = $nom_unix;
$this->id_parent = $id_parent;
......@@ -232,19 +263,7 @@ class asso extends stdentity
);
if ( $old_unix != $this->nom_unix )
{
if ( !$old_unix )
{
$this->_ml_create($this->nom_unix."-membres");
$this->_ml_create($this->nom_unix."-bureau");
}
else
{
$this->_ml_rename($old_unix."-membres",$this->nom_unix."-membres");
$this->_ml_rename($old_unix."-bureau",$this->nom_unix."-bureau");
}
}
}
......@@ -546,22 +565,32 @@ class asso extends stdentity
static function _ml_subscribe ( $ml, $email )
{
//TODO: subscribe $email to $ml
echo "$ml SUBSCRIBE $email<br/>";
}
static function _ml_unsubscribe ( $ml, $email )
{
//TODO: unsubscribe $email from $ml
echo "$ml UNSUBSCRIBE $email<br/>";
}
function _ml_create ( $ml )
static function _ml_create ( $ml )
{
//TODO: create $ml
echo "CREATE $ml<br/>";
}
function _ml_rename ( $old, $new )
static function _ml_rename ( $old, $new )
{
//TODO: rename mailing $old to $new
echo "MOVE $old TO $new<br/>";
}
static function _ml_remove ( $ml )
{
//TODO: destroy $ml
echo "DESTROY $ml<br/>";
}
}
......
......@@ -628,7 +628,7 @@ class utilisateur extends stdentity
"WHERE `asso_membre`.`id_utilisateur`='".$this->id."' " .
"AND `asso_membre`.`date_fin` is NULL " .
"AND (`asso`.`id_asso_parent` IS NOT NULL OR `asso_membre`.`role` > 1 ) " .
"ORDER BY `asso`.`nom_asso`");
"ORDER BY `asso`.`nom_unix_asso`");
while ( list($name,$role,$parent) = $req->get_row() )
{
......
<?php
$topdir = "../";
require_once($topdir. "include/site.inc.php");
require_once($topdir. "include/entities/asso.inc.php");
$req = new requete($this->db,
"SELECT ".
"`asso`.`nom_unix_asso`, ".
"`asso`.`id_asso_parent` " .
"FROM `asso` ON `asso`.`id_asso`=`asso_membre`.`id_asso` " .
"ORDER BY `asso`.`nom_unix_asso`");
while ( list($name,$parent) = $req->get_row() )
{
if ( !is_null($parent) )
asso::_ml_create($name."-membres");
asso::_ml_create($name."-bureau");
}
$req = new requete($this->db,
"SELECT ".
"`utilisateurs`.email_utl, ".
"`asso`.`nom_unix_asso`, ".
"`asso_membre`.`role`, ".
"`asso`.`id_asso_parent` " .
"FROM `asso_membre` " .
"INNER JOIN `asso` ON `asso`.`id_asso`=`asso_membre`.`id_asso` " .
"INNER JOIN `utilisateurs` ON `utilisateurs`.`id_utilisateur`=`asso_membre`.`id_utilisateur` " .
"WHERE `asso_membre`.`date_fin` is NULL " .
"AND (`asso`.`id_asso_parent` IS NOT NULL OR `asso_membre`.`role` > 1 ) " .
"ORDER BY `asso`.`nom_unix_asso`");
while ( list($email,$name,$role,$parent) = $req->get_row() )
{
if ( $role > 1 )
asso::_ml_subscribe($name."-bureau",$email);
if( !is_null($parent) )
asso::_ml_subscribe($name."-membres",$email);
}
?>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment