Derniers fix pour release:
Correction pour rendre generation graph artichow 100% operationnel Suppression librairie xmlrpc Corrections box vides
This commit is contained in:
parent
2c8da42893
commit
f03ccb6fbb
@ -25,7 +25,7 @@
|
||||
/**
|
||||
\file htdocs/adherents/adherent.class.php
|
||||
\ingroup adherent
|
||||
\brief Fichier de la classe permettant la gestion d'un adhérent
|
||||
\brief Fichier de la classe permettant la gestion d'un adherent
|
||||
\author Rodolphe Qiedeville
|
||||
\author Jean-Louis Bergamo
|
||||
\author Laurent Destailleur
|
||||
@ -40,7 +40,7 @@ require_once(DOL_DOCUMENT_ROOT."/adherents/cotisation.class.php");
|
||||
|
||||
/**
|
||||
\class Adherent
|
||||
\brief Classe permettant la gestion d'un adhérent
|
||||
\brief Classe permettant la gestion d'un adherent
|
||||
*/
|
||||
|
||||
class Adherent extends CommonObject
|
||||
@ -74,7 +74,7 @@ class Adherent extends CommonObject
|
||||
var $morphy;
|
||||
var $public;
|
||||
var $commentaire; // Note
|
||||
var $statut; // -1:brouillon, 0:résilié, >=1:validé,payé
|
||||
var $statut; // -1:brouillon, 0:resilie, >=1:valide,paye
|
||||
var $photo;
|
||||
|
||||
var $datec;
|
||||
@ -84,7 +84,7 @@ class Adherent extends CommonObject
|
||||
var $naiss;
|
||||
|
||||
var $typeid; // Id type adherent
|
||||
var $type; // Libellé type adherent
|
||||
var $type; // Libelle type adherent
|
||||
var $need_subscription;
|
||||
|
||||
var $user_id;
|
||||
@ -103,8 +103,8 @@ class Adherent extends CommonObject
|
||||
|
||||
/**
|
||||
\brief Adherent
|
||||
\param DB base de données
|
||||
\param id id de l'adhérent
|
||||
\param DB base de donnees
|
||||
\param id id de l'adherent
|
||||
*/
|
||||
function Adherent($DB)
|
||||
{
|
||||
@ -121,12 +121,12 @@ class Adherent extends CommonObject
|
||||
\brief Fonction envoyant un email a l'adherent avec le texte fourni en parametre.
|
||||
\param text contenu du message
|
||||
\param subject sujet du message
|
||||
\param filename_list tableau de fichiers attachés
|
||||
\param mimetype_list tableau des types des fichiers attachés
|
||||
\param mimefilename_list tableau des noms des fichiers attachés
|
||||
\param filename_list tableau de fichiers attaches
|
||||
\param mimetype_list tableau des types des fichiers attaches
|
||||
\param mimefilename_list tableau des noms des fichiers attaches
|
||||
\param addr_cc email cc
|
||||
\param addr_bcc email bcc
|
||||
\param deliveryreceipt demande accusé réception
|
||||
\param deliveryreceipt demande accuse reception
|
||||
\param msgishtml 1=message is a html message, 0=message is not html, 2=auto detect
|
||||
\return int <0 si ko, >0 si ok
|
||||
\remarks La particularite de cette fonction est de remplacer certains champs
|
||||
@ -239,7 +239,7 @@ class Adherent extends CommonObject
|
||||
|
||||
/**
|
||||
\brief Renvoie le libelle traduit de la nature d'un adherent (physique ou morale)
|
||||
\param morphy Nature physique ou morale de l'adhérent
|
||||
\param morphy Nature physique ou morale de l'adherent
|
||||
*/
|
||||
|
||||
function getmorphylib($morphy='')
|
||||
@ -252,7 +252,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Vérifie les données entrées
|
||||
\brief Verifie les donnees entrees
|
||||
\param minimum
|
||||
*/
|
||||
|
||||
@ -264,7 +264,7 @@ class Adherent extends CommonObject
|
||||
{
|
||||
if ((strlen(trim($this->nom)) + strlen(trim($this->prenom))) == 0)
|
||||
{
|
||||
$error_string[$err] = "Vous devez saisir vos nom et prénom ou le nom de votre société.";
|
||||
$error_string[$err] = "Vous devez saisir vos nom et prenom ou le nom de votre societe.";
|
||||
$err++;
|
||||
}
|
||||
}
|
||||
@ -311,7 +311,7 @@ class Adherent extends CommonObject
|
||||
{
|
||||
if (!isset($map[substr($this->amount, $i, 1)] ))
|
||||
{
|
||||
$error_string[$err] = "Le montant du don contient un/des caractère(s) invalide(s)";
|
||||
$error_string[$err] = "Le montant du don contient un/des caractere(s) invalide(s)";
|
||||
$err++;
|
||||
$amount_invalid = 1;
|
||||
break;
|
||||
@ -352,7 +352,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Fonction qui crée l'adhérent
|
||||
\brief Fonction qui cree l'adherent
|
||||
\param user Objet user qui demande la creation
|
||||
\param notrigger 1 ne declenche pas les triggers, 0 sinon
|
||||
\return int <0 si ko, >0 si ok
|
||||
@ -436,9 +436,9 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
\brief Fonction qui met à jour le commentaire d'un adhérent
|
||||
\brief Fonction qui met e jour le commentaire d'un adherent
|
||||
\param note Note
|
||||
\param user Utilisateur qui réalise la mise a jour
|
||||
\param user Utilisateur qui realise la mise a jour
|
||||
\return int <0 si KO, >0 si OK
|
||||
*/
|
||||
function update_note($note,$user)
|
||||
@ -465,9 +465,9 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Fonction qui met à jour l'adhérent (sauf mot de passe)
|
||||
\param user Utilisateur qui réalise la mise a jour
|
||||
\param notrigger 1=désactive le trigger UPDATE (quand appelé par creation)
|
||||
\brief Fonction qui met e jour l'adherent (sauf mot de passe)
|
||||
\param user Utilisateur qui realise la mise a jour
|
||||
\param notrigger 1=desactive le trigger UPDATE (quand appele par creation)
|
||||
\param nosyncuser Do not synchronize linked user
|
||||
\return int <0 si KO, >0 si OK
|
||||
*/
|
||||
@ -509,8 +509,8 @@ class Adherent extends CommonObject
|
||||
$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 modifié que par effacement cotisation
|
||||
if ($this->datevalid) $sql.= ",datevalid='".$this->db->idate($this->datevalid)."'"; // Ne doit etre modifié que par validation adherent
|
||||
if ($this->datefin) $sql.= ",datefin='".$this->db->idate($this->datefin)."'"; // Ne doit etre modifie que par effacement cotisation
|
||||
if ($this->datevalid) $sql.= ",datevalid='".$this->db->idate($this->datevalid)."'"; // Ne doit etre modifie que par validation adherent
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dolibarr_syslog("Adherent::update sql=".$sql);
|
||||
@ -559,7 +559,7 @@ class Adherent extends CommonObject
|
||||
{
|
||||
if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted)
|
||||
{
|
||||
// Si mot de passe saisi et différent de celui en base
|
||||
// Si mot de passe saisi et different de celui en base
|
||||
$result=$this->password($user,$this->pass,0,$notrigger);
|
||||
|
||||
if (! $nbrowsaffected) $nbrowsaffected++;
|
||||
@ -647,7 +647,7 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
\brief Fonction qui supprime l'adhérent et les données associées
|
||||
\brief Fonction qui supprime l'adherent et les donnees associees
|
||||
\param rowid Id de l'adherent a effacer
|
||||
\return int <0 si KO, 0=rien a effacer, >0 si OK
|
||||
*/
|
||||
@ -725,8 +725,8 @@ class Adherent extends CommonObject
|
||||
/**
|
||||
* \brief Change le mot de passe d'un utilisateur
|
||||
* \param user Object user de l'utilisateur qui fait la modification
|
||||
* \param password Nouveau mot de passe (à générer si non communiqué)
|
||||
* \param isencrypted 0 ou 1 si il faut crypter le mot de passe en base (0 par défaut)
|
||||
* \param password Nouveau mot de passe (e generer si non communique)
|
||||
* \param isencrypted 0 ou 1 si il faut crypter le mot de passe en base (0 par defaut)
|
||||
* \param notrigger 1=Ne declenche pas les triggers
|
||||
* \param nosyncuser Do not synchronize linked user
|
||||
* \return string If OK return clear password, 0 if no change, < 0 if error
|
||||
@ -739,10 +739,10 @@ class Adherent extends CommonObject
|
||||
|
||||
dolibarr_syslog("Adherent::Password user=".$user->id." password=".eregi_replace('.','*',$password)." isencrypted=".$isencrypted);
|
||||
|
||||
// Si nouveau mot de passe non communiqué, on génère par module
|
||||
// Si nouveau mot de passe non communique, on genere par module
|
||||
if (! $password)
|
||||
{
|
||||
// TODO Mettre appel au module de génération de mot de passe
|
||||
// TODO Mettre appel au module de generation de mot de passe
|
||||
$password=creer_pass_aleatoire_1('');
|
||||
//$password=creer_pass_aleatoire_2('');
|
||||
}
|
||||
@ -828,8 +828,8 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Fonction qui récupére l'adhérent depuis son login
|
||||
* \param login login de l'adhérent
|
||||
* \brief Fonction qui recupere l'adherent depuis son login
|
||||
* \param login login de l'adherent
|
||||
*/
|
||||
function fetch_login($login)
|
||||
{
|
||||
@ -853,7 +853,7 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
\brief Fonction qui récupére l'adhérent en donnant son rowid
|
||||
\brief Fonction qui recupere l'adherent en donnant son rowid
|
||||
\param rowid
|
||||
\return int <0 si KO, >0 si OK
|
||||
*/
|
||||
@ -928,7 +928,7 @@ class Adherent extends CommonObject
|
||||
$this->user_id = $obj->user_id;
|
||||
$this->user_login = $obj->user_login;
|
||||
|
||||
// Charge autres propriétés
|
||||
// Charge autres proprietes
|
||||
$result=$this->fetch_subscriptions();
|
||||
|
||||
return $result;
|
||||
@ -947,7 +947,7 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
\brief Fonction qui récupére pour un adhérent les paramètres
|
||||
\brief Fonction qui recupere pour un adherent les parametres
|
||||
firstsubscription_date
|
||||
fistrsubscription_amount
|
||||
lastsubscription_date
|
||||
@ -996,7 +996,7 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
\brief Fonction qui récupére les données optionelles de l'adhérent
|
||||
\brief Fonction qui recupere les donnees optionelles de l'adherent
|
||||
\param rowid
|
||||
*/
|
||||
function fetch_optionals($rowid)
|
||||
@ -1070,18 +1070,18 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Fonction qui insère la cotisation dans la base de données
|
||||
\brief Fonction qui insere la cotisation dans la base de donnees
|
||||
et eventuellement liens dans banques, mailman, etc...
|
||||
\param date Date d'effet de la cotisation
|
||||
\param montant Montant cotisation (accepte 0 pour les adhérents non soumis à cotisation)
|
||||
\param montant Montant cotisation (accepte 0 pour les adherents non soumis e cotisation)
|
||||
\param account_id Id compte bancaire
|
||||
\param operation Type 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)
|
||||
\param emetteur_nom Nom emetteur chèque
|
||||
\param emetteur_banque Nom banque emetteur chèque
|
||||
\param emetteur_nom Nom emetteur cheque
|
||||
\param emetteur_banque Nom banque emetteur cheque
|
||||
\param datesubend Date fin adhesion
|
||||
\return int rowid de l'entrée ajoutée, <0 si erreur
|
||||
\return int rowid de l'entree ajoutee, <0 si erreur
|
||||
*/
|
||||
function cotisation($date, $montant, $accountid=0, $operation='', $label='', $num_chq='', $emetteur_nom='', $emetteur_banque='', $datesubend=0)
|
||||
{
|
||||
@ -1128,7 +1128,7 @@ class Adherent extends CommonObject
|
||||
$result=$adh->add_to_mailman($conf->global->ADHERENT_MAILMAN_LISTS_COTISANT);
|
||||
}
|
||||
|
||||
// Insertion dans la gestion bancaire si configuré pour
|
||||
// Insertion dans la gestion bancaire si configure pour
|
||||
if ($conf->global->ADHERENT_BANK_USE && $accountid)
|
||||
{
|
||||
$acct=new Account($this->db);
|
||||
@ -1169,7 +1169,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Ajout de propriétés pour le triggers
|
||||
// Ajout de proprietes pour le triggers
|
||||
$this->last_subscription_date=$dateop;
|
||||
$this->last_subscription_date_start=$date;
|
||||
$this->last_subscription_date_end=$datefin;
|
||||
@ -1203,8 +1203,8 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fonction qui vérifie que l'utilisateur est valide
|
||||
* \param user user adhérent qui valide
|
||||
* \brief Fonction qui verifie que l'utilisateur est valide
|
||||
* \param user user adherent qui valide
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function validate($user)
|
||||
@ -1244,8 +1244,8 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Fonction qui résilie un adhérent
|
||||
* \param user user adhérent qui résilie
|
||||
* \brief Fonction qui resilie un adherent
|
||||
* \param user user adherent qui resilie
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function resiliate($user)
|
||||
@ -1286,9 +1286,9 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
\brief Fonction qui ajoute l'adhérent au abonnements automatiques
|
||||
\brief Fonction qui ajoute l'adherent au abonnements automatiques
|
||||
\param adht
|
||||
\remarks mailing-list, spip, glasnost, etc...
|
||||
\remarks mailing-list, spip, etc...
|
||||
\return int <0 si KO, >=0 si OK
|
||||
*/
|
||||
function add_to_abo($adht)
|
||||
@ -1305,19 +1305,6 @@ class Adherent extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// glasnost
|
||||
if ($adht->vote == 'yes' &&
|
||||
defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1 &&
|
||||
defined("ADHERENT_USE_GLASNOST_AUTO") && ADHERENT_USE_GLASNOST_AUTO ==1
|
||||
)
|
||||
{
|
||||
$result=$this->add_to_glasnost();
|
||||
if(! $result)
|
||||
{
|
||||
$err+=1;
|
||||
}
|
||||
}
|
||||
|
||||
// spip
|
||||
if (
|
||||
defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
|
||||
@ -1343,9 +1330,9 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
\brief fonction qui supprime l'adhérent des abonnements automatiques
|
||||
\brief fonction qui supprime l'adherent des abonnements automatiques
|
||||
\param adht
|
||||
\remarks mailing-list, spip, glasnost, etc...
|
||||
\remarks mailing-list, spip, etc...
|
||||
*/
|
||||
function del_to_abo($adht)
|
||||
{
|
||||
@ -1357,15 +1344,7 @@ class Adherent extends CommonObject
|
||||
$err+=1;
|
||||
}
|
||||
}
|
||||
if ($adht->vote == 'yes' &&
|
||||
defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1 &&
|
||||
defined("ADHERENT_USE_GLASNOST_AUTO") && ADHERENT_USE_GLASNOST_AUTO ==1
|
||||
)
|
||||
{
|
||||
if(!$this->del_to_glasnost()){
|
||||
$err+=1;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
|
||||
defined("ADHERENT_USE_SPIP_AUTO") && ADHERENT_USE_SPIP_AUTO ==1
|
||||
@ -1385,7 +1364,7 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
\brief fonction qui donne les droits rédacteurs dans spip
|
||||
\brief fonction qui donne les droits redacteurs dans spip
|
||||
\return int =0 si KO, >0 si OK
|
||||
*/
|
||||
function add_to_spip()
|
||||
@ -1419,7 +1398,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
\brief fonction qui enlève les droits rédacteurs dans spip
|
||||
\brief fonction qui enleve les droits redacteurs dans spip
|
||||
*/
|
||||
function del_to_spip()
|
||||
{
|
||||
@ -1446,11 +1425,10 @@ class Adherent extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Fonction qui dit si cet utilisateur est un rédacteur existant dans spip
|
||||
\return int 1=existe, 0=n'existe pas, -1=erreur
|
||||
*/
|
||||
|
||||
/**
|
||||
\brief Fonction qui dit si cet utilisateur est un redacteur existant dans spip
|
||||
\return int 1=existe, 0=n'existe pas, -1=erreur
|
||||
*/
|
||||
function is_in_spip()
|
||||
{
|
||||
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
|
||||
@ -1495,244 +1473,6 @@ class Adherent extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Fonction qui ajoute l'utilisateur dans glasnost
|
||||
\return int =0 si KO, >0 si OK
|
||||
*/
|
||||
function add_to_glasnost()
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/xmlrpc/xmlrpc.php");
|
||||
|
||||
dolibarr_syslog("Adherent::add_to_glasnost");
|
||||
|
||||
if (defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1 &&
|
||||
defined('ADHERENT_GLASNOST_SERVEUR') && ADHERENT_GLASNOST_SERVEUR != '' &&
|
||||
defined('ADHERENT_GLASNOST_USER') && ADHERENT_GLASNOST_USER != '' &&
|
||||
defined('ADHERENT_GLASNOST_PASS') && ADHERENT_GLASNOST_PASS != ''
|
||||
){
|
||||
// application token is not useful here
|
||||
$applicationtoken='';
|
||||
list($success, $response) =
|
||||
XMLRPC_request(ADHERENT_GLASNOST_SERVEUR.':8001',
|
||||
'/RPC2',
|
||||
'callGateway',
|
||||
array(XMLRPC_prepare("glasnost://".ADHERENT_GLASNOST_SERVEUR."/authentication"),
|
||||
XMLRPC_prepare('getUserIdAndToken'),
|
||||
XMLRPC_prepare(array("glasnost://".ADHERENT_GLASNOST_SERVEUR."/authentication","$applicationtoken",ADHERENT_GLASNOST_USER,ADHERENT_GLASNOST_PASS))
|
||||
)
|
||||
);
|
||||
if ($success){
|
||||
$userid=$response[0];
|
||||
$usertoken=$response[1];
|
||||
}else{
|
||||
$this->error=$response['faultString'];
|
||||
return 0;
|
||||
}
|
||||
|
||||
list($success,$response)=
|
||||
XMLRPC_request(ADHERENT_GLASNOST_SERVEUR.':8001',
|
||||
'/RPC2',
|
||||
'callGateway',
|
||||
array(XMLRPC_prepare("glasnost://".ADHERENT_GLASNOST_SERVEUR."/people"),
|
||||
XMLRPC_prepare('addObject'),
|
||||
XMLRPC_prepare(array(
|
||||
"glasnost://".ADHERENT_GLASNOST_SERVEUR."/people",
|
||||
"$applicationtoken",
|
||||
$usertoken,
|
||||
array(
|
||||
'__thingCategory__'=>'object',
|
||||
'__thingName__'=> 'Person',
|
||||
'firstName'=>$this->prenom,
|
||||
'lastName'=>$this->nom,
|
||||
'login'=>$this->login,
|
||||
'email'=>$this->email
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
if ($success){
|
||||
$personid=$response[0];
|
||||
}else{
|
||||
$this->error=$response['faultString'];
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}else{
|
||||
$this->error="Constantes de connexion non definies";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief fonction qui enlève l'utilisateur de glasnost
|
||||
*/
|
||||
function del_to_glasnost()
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/xmlrpc/xmlrpc.php");
|
||||
|
||||
if (defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1 &&
|
||||
defined('ADHERENT_GLASNOST_SERVEUR') && ADHERENT_GLASNOST_SERVEUR != '' &&
|
||||
defined('ADHERENT_GLASNOST_USER') && ADHERENT_GLASNOST_USER != '' &&
|
||||
defined('ADHERENT_GLASNOST_PASS') && ADHERENT_GLASNOST_PASS != ''
|
||||
){
|
||||
// application token is not useful here
|
||||
$applicationtoken='';
|
||||
list($success, $response) =
|
||||
XMLRPC_request(ADHERENT_GLASNOST_SERVEUR.':8001',
|
||||
'/RPC2',
|
||||
'callGateway',
|
||||
array(XMLRPC_prepare("glasnost://".ADHERENT_GLASNOST_SERVEUR."/authentication"),
|
||||
XMLRPC_prepare('getUserIdAndToken'),
|
||||
XMLRPC_prepare(array("glasnost://".ADHERENT_GLASNOST_SERVEUR."/authentication","$applicationtoken",ADHERENT_GLASNOST_USER,ADHERENT_GLASNOST_PASS))
|
||||
)
|
||||
);
|
||||
if ($success){
|
||||
$userid=$response[0];
|
||||
$usertoken=$response[1];
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
// recuperation du personID
|
||||
list($success,$response)=
|
||||
XMLRPC_request(ADHERENT_GLASNOST_SERVEUR.':8001',
|
||||
'/RPC2',
|
||||
'callGateway',
|
||||
array(XMLRPC_prepare("glasnost://".ADHERENT_GLASNOST_SERVEUR."/people"),
|
||||
XMLRPC_prepare('getObjectByLogin'),
|
||||
XMLRPC_prepare(array(
|
||||
"glasnost://".ADHERENT_GLASNOST_SERVEUR."/people",
|
||||
"$applicationtoken",
|
||||
$usertoken,
|
||||
$this->login
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
if ($success){
|
||||
$personid=$response['id'];
|
||||
}else{
|
||||
$this->error=$response['faultString'];
|
||||
return 0;
|
||||
}
|
||||
if (defined('ADHERENT_GLASNOST_DEFAULT_GROUPID') && ADHERENT_GLASNOST_DEFAULT_GROUPID != ''){
|
||||
// recuperation des personne de ce groupe
|
||||
list($success,$response)=
|
||||
XMLRPC_request(ADHERENT_GLASNOST_SERVEUR.':8001',
|
||||
'/RPC2',
|
||||
'callGateway',
|
||||
array(XMLRPC_prepare("glasnost://".ADHERENT_GLASNOST_SERVEUR."/groups"),
|
||||
XMLRPC_prepare('getObject'),
|
||||
XMLRPC_prepare(array(
|
||||
"glasnost://".ADHERENT_GLASNOST_SERVEUR."/groups",
|
||||
"$applicationtoken",
|
||||
$usertoken,
|
||||
ADHERENT_GLASNOST_DEFAULT_GROUPID
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
if ($success){
|
||||
$groupids=$response['membersSet'];
|
||||
}else{
|
||||
$this->error=$response['faultString'];
|
||||
return 0;
|
||||
}
|
||||
// TODO faire la verification que le user n'est pas dans ce
|
||||
// groupe par defaut. si il y ai il faut l'effacer et
|
||||
// modifier le groupe
|
||||
}
|
||||
// suppression du personID
|
||||
list($success,$response)=
|
||||
XMLRPC_request(ADHERENT_GLASNOST_SERVEUR.':8001',
|
||||
'/RPC2',
|
||||
'callGateway',
|
||||
array(XMLRPC_prepare("glasnost://".ADHERENT_GLASNOST_SERVEUR."/people"),
|
||||
XMLRPC_prepare('deleteObject'),
|
||||
XMLRPC_prepare(array(
|
||||
"glasnost://".ADHERENT_GLASNOST_SERVEUR."/people",
|
||||
"$applicationtoken",
|
||||
$usertoken,
|
||||
$personid
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
if ($success){
|
||||
return 1;
|
||||
}else{
|
||||
$this->error=$response['faultString'];
|
||||
return 0;
|
||||
}
|
||||
}else{
|
||||
$this->error="Constantes de connexion non definies";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief fonction qui vérifie si l'utilisateur est dans glasnost
|
||||
*/
|
||||
|
||||
function is_in_glasnost()
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/xmlrpc/xmlrpc.php");
|
||||
|
||||
if (defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1 &&
|
||||
defined('ADHERENT_GLASNOST_SERVEUR') && ADHERENT_GLASNOST_SERVEUR != '' &&
|
||||
defined('ADHERENT_GLASNOST_USER') && ADHERENT_GLASNOST_USER != '' &&
|
||||
defined('ADHERENT_GLASNOST_PASS') && ADHERENT_GLASNOST_PASS != ''
|
||||
){
|
||||
// application token is not useful here
|
||||
$applicationtoken='';
|
||||
list($success, $response) =
|
||||
XMLRPC_request(ADHERENT_GLASNOST_SERVEUR.':8001',
|
||||
'/RPC2',
|
||||
'callGateway',
|
||||
array(XMLRPC_prepare("glasnost://".ADHERENT_GLASNOST_SERVEUR."/authentication"),
|
||||
XMLRPC_prepare('getUserIdAndToken'),
|
||||
XMLRPC_prepare(array("glasnost://".ADHERENT_GLASNOST_SERVEUR."/authentication","$applicationtoken",ADHERENT_GLASNOST_USER,ADHERENT_GLASNOST_PASS))
|
||||
)
|
||||
);
|
||||
if ($success){
|
||||
$userid=$response[0];
|
||||
$usertoken=$response[1];
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
// recuperation du personID
|
||||
list($success,$response)=
|
||||
XMLRPC_request(ADHERENT_GLASNOST_SERVEUR.':8001',
|
||||
'/RPC2',
|
||||
'callGateway',
|
||||
array(XMLRPC_prepare("glasnost://".ADHERENT_GLASNOST_SERVEUR."/people"),
|
||||
XMLRPC_prepare('getObjectByLogin'),
|
||||
XMLRPC_prepare(array(
|
||||
"glasnost://".ADHERENT_GLASNOST_SERVEUR."/people",
|
||||
"$applicationtoken",
|
||||
$usertoken,
|
||||
$this->login
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
if ($success){
|
||||
$personid=$response['id'];
|
||||
return 1;
|
||||
}else{
|
||||
$this->error=$response['faultString'];
|
||||
return 0;
|
||||
}
|
||||
}else{
|
||||
$this->error="Constantes de connexion non definies";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Fonction qui rajoute l'utilisateur dans mailman
|
||||
\return int <0 si KO, >0 si OK
|
||||
@ -1810,8 +1550,8 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Fonction qui désinscrit l'utilisateur de toutes les mailing list mailman
|
||||
\remarks Utilise lors de la résiliation d'adhésion
|
||||
\brief Fonction qui desinscrit l'utilisateur de toutes les mailing list mailman
|
||||
\remarks Utilise lors de la resiliation d'adhesion
|
||||
*/
|
||||
function del_to_mailman($listes='')
|
||||
{
|
||||
@ -1878,7 +1618,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retourne le nom complet de l'adhérent
|
||||
* \brief Retourne le nom complet de l'adherent
|
||||
* \return string Nom complet
|
||||
*/
|
||||
function getFullname()
|
||||
@ -1925,9 +1665,9 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne le libellé du statut d'un adhérent (brouillon, validé, résilié)
|
||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
|
||||
* \return string Libellé
|
||||
* \brief Retourne le libelle du statut d'un adherent (brouillon, valide, resilie)
|
||||
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* \return string Libelle
|
||||
*/
|
||||
function getLibStatut($mode=0)
|
||||
{
|
||||
@ -1935,12 +1675,12 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi le libellé d'un statut donné
|
||||
* \brief Renvoi le libelle d'un statut donne
|
||||
* \param statut Id statut
|
||||
* \param need_subscription 1 si type adherent avec cotisation, 0 sinon
|
||||
* \param date_end_subscription Date fin adhésion
|
||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
|
||||
* \return string Libellé
|
||||
* \param date_end_subscription Date fin adhesion
|
||||
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* \return string Libelle
|
||||
*/
|
||||
function LibStatut($statut,$need_subscription,$date_end_subscription,$mode=0)
|
||||
{
|
||||
@ -2081,13 +1821,13 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Initialise le membre avec valeurs fictives aléatoire
|
||||
* \brief Initialise le membre avec valeurs fictives aleatoire
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
{
|
||||
global $user,$langs;
|
||||
|
||||
// Initialise paramètres
|
||||
// Initialise parametres
|
||||
$this->id=0;
|
||||
$this->specimen=1;
|
||||
$this->nom = 'DOLIBARR';
|
||||
@ -2117,7 +1857,7 @@ class Adherent extends CommonObject
|
||||
$this->datevalid=time();
|
||||
|
||||
$this->typeid=1; // Id type adherent
|
||||
$this->type='Type adherent'; // Libellé type adherent
|
||||
$this->type='Type adherent'; // Libelle type adherent
|
||||
$this->need_subscription=0;
|
||||
|
||||
$this->firstsubscription_date=time();
|
||||
@ -2164,7 +1904,7 @@ class Adherent extends CommonObject
|
||||
if ($this->nom && $conf->global->LDAP_FIELD_NAME) $info[$conf->global->LDAP_FIELD_NAME] = $this->nom;
|
||||
if ($this->prenom && $conf->global->LDAP_FIELD_FIRSTNAME) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = $this->prenom;
|
||||
if ($this->login && $conf->global->LDAP_FIELD_LOGIN) $info[$conf->global->LDAP_FIELD_LOGIN] = $this->login;
|
||||
if ($this->pass && $conf->global->LDAP_FIELD_PASSWORD) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypté
|
||||
if ($this->pass && $conf->global->LDAP_FIELD_PASSWORD) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
|
||||
if ($this->poste && $conf->global->LDAP_FIELD_TITLE) $info[$conf->global->LDAP_FIELD_TITLE] = $this->poste;
|
||||
if ($this->adresse && $conf->global->LDAP_FIELD_ADDRESS) $info[$conf->global->LDAP_FIELD_ADDRESS] = $this->adresse;
|
||||
if ($this->cp && $conf->global->LDAP_FIELD_ZIP) $info[$conf->global->LDAP_FIELD_ZIP] = $this->cp;
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
/**
|
||||
\file htdocs/adherents/fiche.php
|
||||
\ingroup adherent
|
||||
\brief Page d'ajout, edition, suppression d'une fiche adhérent
|
||||
\brief Page d'ajout, edition, suppression d'une fiche adherent
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
@ -264,7 +264,7 @@ if ($user->rights->adherent->creer && $_POST["action"] == 'add')
|
||||
}
|
||||
}
|
||||
|
||||
// Test validite des paramètres
|
||||
// Test validite des parametres
|
||||
if(!isset($type) || $type==''){
|
||||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorMemberTypeNotDefined")."<br>\n";
|
||||
@ -478,36 +478,6 @@ if ($user->rights->adherent->supprimer && $_POST["action"] == 'confirm_resign' &
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->adherent->creer && $_POST["action"] == 'confirm_add_glasnost' && $_POST["confirm"] == 'yes')
|
||||
{
|
||||
$result=$adh->fetch($rowid);
|
||||
$adht = new AdherentType($db);
|
||||
$adht->fetch($adh->typeid);
|
||||
if ($result >= 0 && ! sizeof($adh->errors))
|
||||
{
|
||||
if ($adht->vote == 'yes'){
|
||||
if (!$adh->add_to_glasnost()){
|
||||
$errmsg.="Echec du rajout de l'utilisateur dans glasnost: ".$adh->error."<BR>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->adherent->supprimer && $_POST["action"] == 'confirm_del_glasnost' && $_POST["confirm"] == 'yes')
|
||||
{
|
||||
$result=$adh->fetch($rowid);
|
||||
$adht = new AdherentType($db);
|
||||
$adht->fetch($adh->typeid);
|
||||
if ($result >= 0 && ! sizeof($adh->errors))
|
||||
{
|
||||
if ($adht->vote == 'yes'){
|
||||
if(!$adh->del_to_glasnost()){
|
||||
$errmsg.="Echec de la suppression de l'utilisateur dans glasnost: ".$adh->error."<BR>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->adherent->supprimer && $_POST["action"] == 'confirm_del_spip' && $_POST["confirm"] == 'yes')
|
||||
{
|
||||
$result=$adh->fetch($rowid);
|
||||
@ -637,7 +607,7 @@ if ($action == 'edit')
|
||||
$htmls->select_array("morphy", $morphys, $adh->morphy);
|
||||
print "</td></tr>";
|
||||
|
||||
// Société
|
||||
// Societe
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.$adh->societe.'"></td></tr>';
|
||||
|
||||
// Adresse
|
||||
@ -674,7 +644,7 @@ if ($action == 'edit')
|
||||
print $htmls->selectyesno("public",$adh->public,1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Attributs supplémentaires
|
||||
// Attributs supplementaires
|
||||
foreach($adho->attribute_label as $key=>$value)
|
||||
{
|
||||
print "<tr><td>$value</td><td><input type=\"text\" name=\"options_$key\" size=\"40\" value=\"".$adh->array_options["options_$key"]."\"></td></tr>\n";
|
||||
@ -697,7 +667,7 @@ if ($action == 'create')
|
||||
{
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Fiche création */
|
||||
/* Fiche creation */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -836,7 +806,7 @@ if ($rowid && $action != 'edit')
|
||||
if ($msg) print '<div class="error">'.$msg.'</div>';
|
||||
|
||||
|
||||
// Confirmation de la suppression de l'adhérent
|
||||
// Confirmation de la suppression de l'adherent
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete");
|
||||
@ -846,7 +816,7 @@ if ($rowid && $action != 'edit')
|
||||
// Confirmation de la validation
|
||||
if ($action == 'valid')
|
||||
{
|
||||
// Crée un tableau formulaire
|
||||
// Cree un tableau formulaire
|
||||
$formquestion=array();
|
||||
if ($adh->email) $formquestion[0]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $langs->trans("SendAnEMailToMember",$adh->email), 'value' => 'true');
|
||||
|
||||
@ -861,10 +831,10 @@ if ($rowid && $action != 'edit')
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
// Confirmation de la Résiliation
|
||||
// Confirmation de la Resiliation
|
||||
if ($action == 'resign')
|
||||
{
|
||||
// Crée un tableau formulaire
|
||||
// Cree un tableau formulaire
|
||||
$formquestion=array();
|
||||
if ($adh->email) $formquestion[0]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $langs->trans("SendAnEMailToMember",$adh->email), 'value' => 'false');
|
||||
|
||||
@ -872,30 +842,12 @@ if ($rowid && $action != 'edit')
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de l'ajout dans glasnost
|
||||
*/
|
||||
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>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression dans glasnost
|
||||
*/
|
||||
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>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de l'ajout dans spip
|
||||
*/
|
||||
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");
|
||||
$html->form_confirm("fiche.php?rowid=$rowid","Ajouter dans spip","Etes-vous sur de vouloir ajouter cet adherent dans spip ? (serveur : ".ADHERENT_SPIP_SERVEUR.")","confirm_add_spip");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
@ -904,8 +856,7 @@ if ($rowid && $action != 'edit')
|
||||
*/
|
||||
if ($action == 'del_spip')
|
||||
{
|
||||
$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");
|
||||
$html->form_confirm("fiche.php?rowid=$rowid","Supprimer dans spip","Etes-vous sur de vouloir effacer cet adherent dans spip ? (serveur : ".ADHERENT_SPIP_SERVEUR.")","confirm_del_spip");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
@ -1029,7 +980,7 @@ if ($rowid && $action != 'edit')
|
||||
|
||||
if ($user->rights->adherent->creer)
|
||||
{
|
||||
// Réactiver
|
||||
// Reactiver
|
||||
if ($adh->statut == 0)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=valid\">".$langs->trans("Reenable")."</a>\n";
|
||||
@ -1047,7 +998,7 @@ if ($rowid && $action != 'edit')
|
||||
|
||||
if ($user->rights->adherent->supprimer)
|
||||
{
|
||||
// Résilier
|
||||
// Resilier
|
||||
if ($adh->statut >= 1)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=resign\">".$langs->trans("Resiliate")."</a>\n";
|
||||
@ -1072,22 +1023,6 @@ if ($rowid && $action != 'edit')
|
||||
print "<a class=\"butActionDelete\" href=\"fiche.php?rowid=$adh->id&action=delete\">".$langs->trans("Delete")."</a>\n";
|
||||
}
|
||||
|
||||
// Action Glasnost
|
||||
if ($adht->vote == 'yes' && $conf->global->ADHERENT_USE_GLASNOST)
|
||||
{
|
||||
$isinglasnost=$adh->is_in_glasnost();
|
||||
if ($isinglasnost == 1)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"fiche.php?rowid=$adh->id&action=del_glasnost\">Suppression dans Glasnost</a>\n";
|
||||
}
|
||||
if ($isinglasnost == 0) {
|
||||
print "<a class=\"butAction\" href=\"fiche.php?rowid=$adh->id&action=add_glasnost\">Ajout dans Glasnost</a>\n";
|
||||
}
|
||||
if ($isinglasnost == -1) {
|
||||
print '<br><font class="error">Failed to connect to SPIP: '.$adh->error.'</font>';
|
||||
}
|
||||
}
|
||||
|
||||
// Action SPIP
|
||||
if ($conf->global->ADHERENT_USE_SPIP)
|
||||
{
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
*
|
||||
* 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
|
||||
@ -20,7 +20,6 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -52,7 +51,7 @@ if ($_POST["action"] == 'update' || $_POST["action"] == 'add')
|
||||
}
|
||||
}
|
||||
|
||||
// Action activation d'un sous module du module adhérent
|
||||
// Action activation d'un sous module du module adherent
|
||||
if ($_GET["action"] == 'set')
|
||||
{
|
||||
$result=dolibarr_set_const($db, $_GET["name"],$_GET["value"]);
|
||||
@ -62,7 +61,7 @@ if ($_GET["action"] == 'set')
|
||||
}
|
||||
}
|
||||
|
||||
// Action désactivation d'un sous module du module adhérent
|
||||
// Action desactivation d'un sous module du module adherent
|
||||
if ($_GET["action"] == 'unset')
|
||||
{
|
||||
$result=dolibarr_del_const($db,$_GET["name"]);
|
||||
@ -152,13 +151,13 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 1)
|
||||
'ADHERENT_MAILMAN_UNSUB_URL',
|
||||
'ADHERENT_MAILMAN_URL'
|
||||
);
|
||||
print_fiche_titre("Mailman - Système de mailing listes",$lien);
|
||||
print_fiche_titre("Mailman - Systeme de mailing listes",$lien);
|
||||
form_constantes($constantes);
|
||||
}
|
||||
else
|
||||
{
|
||||
$lien='<a href="adherent.php?action=set&value=1&name=ADHERENT_USE_MAILMAN">'.$langs->trans("Activate").'</a>';
|
||||
print_fiche_titre("Mailman - Système de mailing listes",$lien);
|
||||
print_fiche_titre("Mailman - Systeme de mailing listes",$lien);
|
||||
}
|
||||
|
||||
print "<hr>\n";
|
||||
@ -181,41 +180,13 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 1)
|
||||
'ADHERENT_SPIP_USER',
|
||||
'ADHERENT_SPIP_PASS'
|
||||
);
|
||||
print_fiche_titre("SPIP - Système de publication en ligne",$lien);
|
||||
print_fiche_titre("SPIP - Systeme de publication en ligne",$lien);
|
||||
form_constantes($constantes);
|
||||
}
|
||||
else
|
||||
{
|
||||
$lien='<a href="adherent.php?action=set&value=1&name=ADHERENT_USE_SPIP">'.$langs->trans("Activate").'</a>';
|
||||
print_fiche_titre("SPIP - Système de publication en ligne",$lien);
|
||||
}
|
||||
|
||||
print "<hr>\n";
|
||||
}
|
||||
|
||||
/*
|
||||
* Glasnost
|
||||
*/
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 1)
|
||||
{
|
||||
$var=!$var;
|
||||
if ($conf->global->ADHERENT_USE_GLASNOST)
|
||||
{
|
||||
$lien=img_tick().' ';
|
||||
$lien.='<a href="adherent.php?action=unset&value=0&name=ADHERENT_USE_GLASNOST">'.$langs->trans("Disable").'</a>';
|
||||
// Edition des varibales globales rattache au theme Mailman
|
||||
$constantes=array('ADHERENT_USE_GLASNOST_AUTO',
|
||||
'ADHERENT_GLASNOST_SERVEUR',
|
||||
'ADHERENT_GLASNOST_USER',
|
||||
'ADHERENT_GLASNOST_PASS'
|
||||
);
|
||||
print_fiche_titre("Glasnost - Système de vote en ligne",$lien);
|
||||
form_constantes($constantes);
|
||||
}
|
||||
else
|
||||
{
|
||||
$lien='<a href="adherent.php?action=set&value=1&name=ADHERENT_USE_GLASNOST">'.$langs->trans("Activate").'</a>';
|
||||
print_fiche_titre("Glasnost - Système de vote en ligne",$lien);
|
||||
print_fiche_titre("SPIP - Systeme de publication en ligne",$lien);
|
||||
}
|
||||
|
||||
print "<hr>\n";
|
||||
|
||||
@ -36,6 +36,8 @@ if (!$user->rights->banque->lire)
|
||||
accessforbidden();
|
||||
|
||||
$account = $_GET["account"];
|
||||
$mode='standard';
|
||||
if (isset($_GET["mode"]) && $_GET["mode"] == 'showalltime') $mode='showalltime';
|
||||
$mesg = '';
|
||||
$error=0;
|
||||
|
||||
@ -46,11 +48,16 @@ $form = new Form($db);
|
||||
|
||||
if ($_GET["account"] || $_GET["ref"])
|
||||
{
|
||||
|
||||
// If lib forced
|
||||
if (! empty($_GET["lib"])) $conf->global->MAIN_GRAPH_LIBRARY=$_GET["lib"];
|
||||
|
||||
$datetime = time();
|
||||
$year = strftime("%Y", $datetime);
|
||||
$month = strftime("%m", $datetime);
|
||||
$day = strftime("%d", $datetime);
|
||||
if (! empty($_GET["year"])) $year=sprintf("%04d",$_GET["year"]);
|
||||
if (! empty($_GET["month"])) $month=sprintf("%02d",$_GET["month"]);
|
||||
|
||||
|
||||
$acct = new Account($db);
|
||||
if ($_GET["account"])
|
||||
@ -75,7 +82,7 @@ if ($_GET["account"] || $_GET["ref"])
|
||||
{
|
||||
|
||||
// Definition de $width et $height
|
||||
$width = 800;
|
||||
$width = 768;
|
||||
$height = 200;
|
||||
|
||||
// Calcul de $min et $max
|
||||
@ -99,418 +106,533 @@ if ($_GET["account"] || $_GET["ref"])
|
||||
|
||||
|
||||
// Tableau 1
|
||||
|
||||
|
||||
// Chargement du tableau $amounts
|
||||
// \todo peut etre optimise en virant les date_format
|
||||
$amounts = array();
|
||||
$sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$sql .= " AND date_format(datev,'%Y%m') = '".$year.$month."'";
|
||||
$sql .= " GROUP BY date_format(datev,'%Y%m%d')";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
if ($mode == 'standard')
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
// Chargement du tableau $amounts
|
||||
// \todo peut etre optimise en virant les date_format
|
||||
$amounts = array();
|
||||
$sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$sql .= " AND date_format(datev,'%Y%m') = '".$year.$month."'";
|
||||
$sql .= " GROUP BY date_format(datev,'%Y%m%d')";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$amounts[$row[0]] = $row[1];
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
// Calcul de $solde avant le debut du graphe
|
||||
$solde = 0;
|
||||
$sql = "SELECT sum(amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$sql .= " AND datev < '".$year."-".sprintf("%02s",$month)."-01'";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$amounts[$row[0]] = $row[1];
|
||||
$i++;
|
||||
$solde = $row[0];
|
||||
$db->free($resql);
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
// Calcul de $solde avant le debut du graphe
|
||||
$solde = 0;
|
||||
$sql = "SELECT sum(amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$sql .= " AND datev < '".$year."-".sprintf("%02s",$month)."-01'";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$solde = $row[0];
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
// Chargement de labels et datas pour tableau 1
|
||||
$labels = array();
|
||||
$datas = array();
|
||||
$datamin = array();
|
||||
|
||||
$subtotal = 0;
|
||||
$day = dolibarr_mktime(12,0,0,$month,1,$year);
|
||||
$xmonth = $month;
|
||||
|
||||
$i = 0;
|
||||
while ($xmonth == $month)
|
||||
{
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
// Chargement de labels et datas pour tableau 1
|
||||
$labels = array();
|
||||
$datas = array();
|
||||
$datamin = array();
|
||||
|
||||
$subtotal = 0;
|
||||
$day = dolibarr_mktime(12,0,0,$month,1,$year);
|
||||
$textdate = strftime("%Y%m%d",$day);
|
||||
$xyear = substr($textdate,0,4);
|
||||
$xday = substr($textdate,6,2);
|
||||
$xmonth = substr($textdate,4,2);
|
||||
|
||||
//print strftime ("%e %d %m %y",$day)."\n";
|
||||
$subtotal = $subtotal + (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
|
||||
if ($day > time())
|
||||
|
||||
$i = 0;
|
||||
while ($xmonth == $month)
|
||||
{
|
||||
$datas[$i] = ''; // Valeur sp<73>ciale permettant de ne pas tracer le graph
|
||||
}
|
||||
else
|
||||
{
|
||||
$datas[$i] = $solde + $subtotal;
|
||||
}
|
||||
$datamin[$i] = $acct->min_desired;
|
||||
//$labels[$i] = strftime("%d",$day);
|
||||
$labels[$i] = $xday;
|
||||
$day += 86400;
|
||||
$i++;
|
||||
}
|
||||
//print strftime ("%e %d %m %y",$day)."\n";
|
||||
$subtotal = $subtotal + (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
|
||||
if ($day > time())
|
||||
{
|
||||
$datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph
|
||||
}
|
||||
else
|
||||
{
|
||||
$datas[$i] = $solde + $subtotal;
|
||||
}
|
||||
$datamin[$i] = $acct->min_desired;
|
||||
//$labels[$i] = strftime("%d",$day);
|
||||
$labels[$i] = $xday;
|
||||
|
||||
// Fabrication tableau 1
|
||||
$file= $conf->banque->dir_temp."/balance.$account.$year.$month.png";
|
||||
$title=$langs->transnoentities("Balance").' '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
|
||||
$graph_datas=array();
|
||||
foreach($datas as $i => $val)
|
||||
{
|
||||
if ($acct->min_desired) $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i],$datamin[$i]);
|
||||
else $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
|
||||
}
|
||||
$px = new DolGraph();
|
||||
$px->SetData($graph_datas);
|
||||
if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired")));
|
||||
else $px->SetLegend(array($langs->transnoentities("Balance")));
|
||||
$px->SetLegendWidthMin(180);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
||||
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
||||
$px->SetTitle($title);
|
||||
$px->SetWidth($width);
|
||||
$px->SetHeight($height);
|
||||
$px->SetType('lines');
|
||||
$px->setBgColor('onglet');
|
||||
$px->SetHorizTickIncrement(1);
|
||||
$px->SetPrecisionY(0);
|
||||
$px->draw($file);
|
||||
$day += 86400;
|
||||
$textdate = strftime("%Y%m%d",$day);
|
||||
$xyear = substr($textdate,0,4);
|
||||
$xday = substr($textdate,6,2);
|
||||
$xmonth = substr($textdate,4,2);
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
unset($graph_datas);
|
||||
unset($px);
|
||||
unset($datas);
|
||||
unset($datamin);
|
||||
unset($labels);
|
||||
unset($amounts);
|
||||
|
||||
// Fabrication tableau 1
|
||||
$file= $conf->banque->dir_temp."/balance".$account."-".$year.$month.".png";
|
||||
$title=$langs->transnoentities("Balance").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
|
||||
$graph_datas=array();
|
||||
foreach($datas as $i => $val)
|
||||
{
|
||||
if ($acct->min_desired) $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i],$datamin[$i]);
|
||||
else $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
|
||||
}
|
||||
$px = new DolGraph();
|
||||
$px->SetData($graph_datas);
|
||||
if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired")));
|
||||
else $px->SetLegend(array($langs->transnoentities("Balance")));
|
||||
$px->SetLegendWidthMin(180);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
||||
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
||||
$px->SetTitle($title);
|
||||
$px->SetWidth($width);
|
||||
$px->SetHeight($height);
|
||||
$px->SetType('lines');
|
||||
$px->setBgColor('onglet');
|
||||
$px->SetHorizTickIncrement(1);
|
||||
$px->SetPrecisionY(0);
|
||||
$px->draw($file);
|
||||
|
||||
unset($graph_datas);
|
||||
unset($px);
|
||||
unset($datas);
|
||||
unset($datamin);
|
||||
unset($labels);
|
||||
unset($amounts);
|
||||
}
|
||||
|
||||
// Tableau 2
|
||||
|
||||
|
||||
// Chargement du tableau $amounts
|
||||
// \todo peut etre optimise en virant les date_format
|
||||
$amounts = array();
|
||||
$sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$sql .= " AND date_format(datev,'%Y') = '".$year."'";
|
||||
$sql .= " GROUP BY date_format(datev,'%Y%m%d')";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
if ($mode == 'standard')
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
// Chargement du tableau $amounts
|
||||
// \todo peut etre optimise en virant les date_format
|
||||
$amounts = array();
|
||||
$sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$sql .= " AND date_format(datev,'%Y') = '".$year."'";
|
||||
$sql .= " GROUP BY date_format(datev,'%Y%m%d')";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$amounts[$row[0]] = $row[1];
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
// Calcul de $solde avant le debut du graphe
|
||||
$solde = 0;
|
||||
$sql = "SELECT sum(amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$sql .= " AND datev < '".$year."-01-01'";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$amounts[$row[0]] = $row[1];
|
||||
$i++;
|
||||
$solde = $row[0];
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
// Calcul de $solde avant le debut du graphe
|
||||
$solde = 0;
|
||||
$sql = "SELECT sum(amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$sql .= " AND datev < '".$year."-01-01'";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$solde = $row[0];
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
// Chargement de labels et datas pour tableau 2
|
||||
$labels = array();
|
||||
$datas = array();
|
||||
$datamin = array();
|
||||
|
||||
$subtotal = 0;
|
||||
$now = time();
|
||||
$day = dolibarr_mktime(12,0,0,1,1,$year);
|
||||
$i = 0;
|
||||
$xyear = $year;
|
||||
while ($xyear == $year)
|
||||
{
|
||||
// Chargement de labels et datas pour tableau 2
|
||||
$labels = array();
|
||||
$datas = array();
|
||||
$datamin = array();
|
||||
|
||||
$subtotal = 0;
|
||||
$now = time();
|
||||
$day = dolibarr_mktime(12,0,0,1,1,$year);
|
||||
$textdate = strftime("%Y%m%d",$day);
|
||||
$xyear = substr($textdate,0,4);
|
||||
$xday = substr($textdate,6,2);
|
||||
|
||||
$subtotal = $subtotal + (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
|
||||
if ($day > $now)
|
||||
|
||||
$i = 0;
|
||||
while ($xyear == $year)
|
||||
{
|
||||
$datas[$i] = ''; // Valeur sp<73>ciale permettant de ne pas tracer le graph
|
||||
$subtotal = $subtotal + (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
|
||||
if ($day > $now)
|
||||
{
|
||||
$datas[$i] = ''; // Valeur sp<73>ciale permettant de ne pas tracer le graph
|
||||
}
|
||||
else
|
||||
{
|
||||
$datas[$i] = $solde + $subtotal;
|
||||
}
|
||||
$datamin[$i] = $acct->min_desired;
|
||||
if ($xday == '15')
|
||||
{
|
||||
$labels[$i] = dolibarr_print_date($day,"%b");
|
||||
}
|
||||
$day += 86400;
|
||||
$textdate = strftime("%Y%m%d",$day);
|
||||
$xyear = substr($textdate,0,4);
|
||||
$xday = substr($textdate,6,2);
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Fabrication tableau 2
|
||||
$file= $conf->banque->dir_temp."/balance".$account."-".$year.".png";
|
||||
$title=$langs->transnoentities("Balance").' - '.$langs->transnoentities("Year").': '.$year;
|
||||
$graph_datas=array();
|
||||
foreach($datas as $i => $val)
|
||||
{
|
||||
if ($acct->min_desired) $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i],$datamin[$i]);
|
||||
else $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
|
||||
}
|
||||
$px = new DolGraph();
|
||||
$px->SetData($graph_datas);
|
||||
if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired")));
|
||||
else $px->SetLegend(array($langs->transnoentities("Balance")));
|
||||
$px->SetLegendWidthMin(180);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
||||
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
||||
$px->SetTitle($title);
|
||||
$px->SetWidth($width);
|
||||
$px->SetHeight($height);
|
||||
$px->SetType('lines');
|
||||
$px->setBgColor('onglet');
|
||||
//$px->SetHorizTickIncrement(30.41); // 30.41 jours/mois en moyenne
|
||||
$px->SetPrecisionY(0);
|
||||
$px->draw($file);
|
||||
|
||||
unset($px);
|
||||
unset($graph_datas);
|
||||
unset($datas);
|
||||
unset($datamin);
|
||||
unset($labels);
|
||||
unset($amounts);
|
||||
}
|
||||
|
||||
// Tableau 3 - All time line
|
||||
|
||||
if ($mode == 'showalltime')
|
||||
{
|
||||
// Chargement du tableau $amounts
|
||||
// \todo peut etre optimise en virant les date_format
|
||||
$amounts = array();
|
||||
$sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$sql .= " GROUP BY date_format(datev,'%Y%m%d')";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$amounts[$row[0]] = $row[1];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$datas[$i] = $solde + $subtotal;
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
$datamin[$i] = $acct->min_desired;
|
||||
if ($xday == '15')
|
||||
{
|
||||
$labels[$i] = dolibarr_print_date($day,"%b");
|
||||
}
|
||||
$day += 86400;
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Fabrication tableau 2
|
||||
$file= $conf->banque->dir_temp."/balance.$account.$year.png";
|
||||
$title=$langs->transnoentities("Balance").' '.$langs->transnoentities("Year").': '.$year;
|
||||
$graph_datas=array();
|
||||
foreach($datas as $i => $val)
|
||||
{
|
||||
if ($acct->min_desired) $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i],$datamin[$i]);
|
||||
else $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
|
||||
}
|
||||
$px = new DolGraph();
|
||||
$px->SetData($graph_datas);
|
||||
if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired")));
|
||||
else $px->SetLegend(array($langs->transnoentities("Balance")));
|
||||
$px->SetLegendWidthMin(180);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
||||
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
||||
$px->SetTitle($title);
|
||||
$px->SetWidth($width);
|
||||
$px->SetHeight($height);
|
||||
$px->SetType('lines');
|
||||
$px->setBgColor('onglet');
|
||||
$px->SetHorizTickIncrement(30.41); // 30.41 jours/mois en moyenne
|
||||
$px->SetPrecisionY(0);
|
||||
$px->draw($file);
|
||||
|
||||
unset($px);
|
||||
unset($graph_datas);
|
||||
unset($datas);
|
||||
unset($datamin);
|
||||
unset($labels);
|
||||
unset($amounts);
|
||||
|
||||
|
||||
// Tableau 3
|
||||
|
||||
// Calcul de $solde avant le debut du graphe
|
||||
$solde = 0;
|
||||
|
||||
// Chargement du tableau $amounts
|
||||
// \todo peut etre optimise en virant les date_format
|
||||
$amounts = array();
|
||||
$sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$sql .= " GROUP BY date_format(datev,'%Y%m%d')";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
// Chargement de labels et datas pour tableau 3
|
||||
$labels = array();
|
||||
$datas = array();
|
||||
$datamin = array();
|
||||
|
||||
$subtotal = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$amounts[$row[0]] = $row[1];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
// Calcul de $solde avant le debut du graphe
|
||||
$solde = 0;
|
||||
|
||||
// Chargement de labels et datas pour tableau 3
|
||||
$labels = array();
|
||||
$datas = array();
|
||||
$datamin = array();
|
||||
|
||||
$subtotal = 0;
|
||||
$day = $min;
|
||||
$i = 0;
|
||||
while ($day <= ($max+86400)) // On va au dela du dernier jour
|
||||
{
|
||||
$day = $min;
|
||||
$textdate=strftime("%Y%m%d",$day);
|
||||
|
||||
$subtotal = $subtotal + (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
|
||||
//print strftime ("%e %d %m %y",$day)." ".$subtotal."\n<br>";
|
||||
if ($day > ($max+86400))
|
||||
//print "x".$textdate;
|
||||
$i = 0;
|
||||
while ($day <= ($max+86400)) // On va au dela du dernier jour
|
||||
{
|
||||
$datas[$i] = ''; // Valeur sp<73>ciale permettant de ne pas tracer le graph
|
||||
$subtotal = $subtotal + (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
|
||||
//print strftime ("%e %d %m %y",$day)." ".$subtotal."\n<br>";
|
||||
if ($day > ($max+86400))
|
||||
{
|
||||
$datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph
|
||||
}
|
||||
else
|
||||
{
|
||||
$datas[$i] = '' + $solde + $subtotal;
|
||||
}
|
||||
$datamin[$i] = $acct->min_desired;
|
||||
if (substr($textdate,6,2) == '01' || $i == 0)
|
||||
{
|
||||
$labels[$i] = substr($textdate,4,2);
|
||||
}
|
||||
|
||||
$day += 86400;
|
||||
$textdate=strftime("%Y%m%d",$day);
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Fabrication tableau 3
|
||||
$file= $conf->banque->dir_temp."/balance".$account.".png";
|
||||
$title=$langs->transnoentities("Balance")." - ".$langs->transnoentities("AllTime");
|
||||
$graph_datas=array();
|
||||
foreach($datas as $i => $val)
|
||||
{
|
||||
if ($acct->min_desired) $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i],$datamin[$i]);
|
||||
else $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
|
||||
}
|
||||
$px = new DolGraph();
|
||||
$px->SetData($graph_datas);
|
||||
if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired")));
|
||||
else $px->SetLegend(array($langs->transnoentities("Balance")));
|
||||
$px->SetLegendWidthMin(180);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
||||
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
||||
$px->SetTitle($title);
|
||||
$px->SetWidth($width);
|
||||
$px->SetHeight($height);
|
||||
$px->SetType('lines');
|
||||
$px->setBgColor('onglet');
|
||||
$px->SetPrecisionY(0);
|
||||
$px->draw($file);
|
||||
|
||||
unset($graph_datas);
|
||||
unset($datas);
|
||||
unset($datamin);
|
||||
unset($labels);
|
||||
unset($amounts);
|
||||
}
|
||||
|
||||
// Tableau 4a - Credit/Debit
|
||||
|
||||
if ($mode == 'standard')
|
||||
{
|
||||
// Chargement du tableau $credits, $debits
|
||||
$credits = array();
|
||||
$debits = array();
|
||||
$sql = "SELECT date_format(datev,'%d'), sum(amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$monthnext=$month+1; $yearnext=$year;
|
||||
if ($monthnext > 12) { $monthnext=1; $yearnext++; }
|
||||
$sql .= " AND datev >= '".$year."-".$month."-01 00:00:00'";
|
||||
$sql .= " AND datev < '".$yearnext."-".$monthnext."-01 00:00:00'";
|
||||
$sql .= " AND amount > 0";
|
||||
$sql .= " GROUP BY date_format(datev,'%d')";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$credits[$row[0]] = $row[1];
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$datas[$i] = '' + $solde + $subtotal;
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
$datamin[$i] = $acct->min_desired;
|
||||
if (substr($textdate,6,2) == '01')
|
||||
$sql = "SELECT date_format(datev,'%d'), sum(amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$monthnext=$month+1; $yearnext=$year;
|
||||
if ($monthnext > 12) { $monthnext=1; $yearnext++; }
|
||||
$sql .= " AND datev >= '".$year."-".$month."-01 00:00:00'";
|
||||
$sql .= " AND datev < '".$yearnext."-".$monthnext."-01 00:00:00'";
|
||||
$sql .= " AND amount < 0";
|
||||
$sql .= " GROUP BY date_format(datev,'%d')";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$labels[$i] = substr($textdate,4,2);
|
||||
while ($row = $db->fetch_row($resql))
|
||||
{
|
||||
$debits[$row[0]] = abs($row[1]);
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
$day += 86400;
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Fabrication tableau 3
|
||||
$file= $conf->banque->dir_temp."/balance.$account.png";
|
||||
$title=$langs->transnoentities("Balance");
|
||||
$graph_datas=array();
|
||||
foreach($datas as $i => $val)
|
||||
{
|
||||
if ($acct->min_desired) $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i],$datamin[$i]);
|
||||
else $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
|
||||
}
|
||||
$px = new DolGraph();
|
||||
$px->SetData($graph_datas);
|
||||
if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired")));
|
||||
else $px->SetLegend(array($langs->transnoentities("Balance")));
|
||||
$px->SetLegendWidthMin(180);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
||||
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
||||
$px->SetTitle($title);
|
||||
$px->SetWidth($width);
|
||||
$px->SetHeight($height);
|
||||
$px->SetType('lines');
|
||||
$px->setBgColor('onglet');
|
||||
$px->SetPrecisionY(0);
|
||||
$px->draw($file);
|
||||
|
||||
unset($graph_datas);
|
||||
unset($datas);
|
||||
unset($datamin);
|
||||
unset($labels);
|
||||
unset($amounts);
|
||||
|
||||
|
||||
// Tableau 4
|
||||
|
||||
|
||||
// Chargement du tableau $credits, $debits
|
||||
$credits = array();
|
||||
$debits = array();
|
||||
$sql = "SELECT date_format(datev,'%m'), sum(amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$sql .= " AND date_format(datev,'%Y') = '".$year."'";
|
||||
$sql .= " AND amount > 0";
|
||||
$sql .= " GROUP BY date_format(datev,'%m');";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
else
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$credits[$row[0]] = $row[1];
|
||||
$i++;
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
$sql = "SELECT date_format(datev,'%m'), sum(amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$sql .= " AND date_format(datev,'%Y') = '".$year."'";
|
||||
$sql .= " AND amount < 0";
|
||||
$sql .= " GROUP BY date_format(datev,'%m');";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($row = $db->fetch_row($resql))
|
||||
|
||||
|
||||
// Chargement de labels et data_xxx pour tableau 4 Mouvements
|
||||
$labels = array();
|
||||
$data_credit = array();
|
||||
$data_debit = array();
|
||||
for ($i = 0 ; $i < 31 ; $i++)
|
||||
{
|
||||
$debits[$row[0]] = abs($row[1]);
|
||||
$data_credit[$i] = isset($credits[substr("0".($i+1),-2)]) ? $credits[substr("0".($i+1),-2)] : 0;
|
||||
$data_debit[$i] = isset($debits[substr("0".($i+1),-2)]) ? $debits[substr("0".($i+1),-2)] : 0;
|
||||
$labels[$i] = sprintf("%02d",$i+1);
|
||||
$datamin[$i] = $acct->min_desired;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
|
||||
// Fabrication tableau 4a
|
||||
$file= $conf->banque->dir_temp."/movement".$account."-".$year.$month.".png";
|
||||
$title=$langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
|
||||
$graph_datas=array();
|
||||
foreach($data_credit as $i => $val)
|
||||
{
|
||||
$graph_datas[$i]=array($labels[$i],$data_credit[$i],$data_debit[$i]);
|
||||
}
|
||||
$px = new DolGraph();
|
||||
$px->SetData($graph_datas);
|
||||
$px->SetLegend(array($langs->transnoentities("Credit"),$langs->transnoentities("Debit")));
|
||||
$px->SetLegendWidthMin(180);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
||||
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
||||
$px->SetTitle($title);
|
||||
$px->SetWidth($width);
|
||||
$px->SetHeight($height);
|
||||
$px->SetType('bars');
|
||||
$px->SetShading(3);
|
||||
$px->setBgColor('onglet');
|
||||
$px->SetHorizTickIncrement(1);
|
||||
$px->SetPrecisionY(0);
|
||||
$px->draw($file);
|
||||
|
||||
unset($graph_datas);
|
||||
unset($px);
|
||||
unset($debits);
|
||||
unset($credits);
|
||||
}
|
||||
|
||||
// Tableau 4b - Credit/Debit
|
||||
|
||||
if ($mode == 'standard')
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
// Chargement du tableau $credits, $debits
|
||||
$credits = array();
|
||||
$debits = array();
|
||||
$sql = "SELECT date_format(datev,'%m'), sum(amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$sql .= " AND datev >= '".$year."-01-01 00:00:00'";
|
||||
$sql .= " AND datev <= '".$year."-12-31 23:59:59'";
|
||||
$sql .= " AND amount > 0";
|
||||
$sql .= " GROUP BY date_format(datev,'%m');";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$credits[$row[0]] = $row[1];
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
$sql = "SELECT date_format(datev,'%m'), sum(amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".$account;
|
||||
$sql .= " AND datev >= '".$year."-01-01 00:00:00'";
|
||||
$sql .= " AND datev <= '".$year."-12-31 23:59:59'";
|
||||
$sql .= " AND amount < 0";
|
||||
$sql .= " GROUP BY date_format(datev,'%m');";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($row = $db->fetch_row($resql))
|
||||
{
|
||||
$debits[$row[0]] = abs($row[1]);
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
// Chargement de labels et data_xxx pour tableau 4 Mouvements
|
||||
$labels = array();
|
||||
$data_credit = array();
|
||||
$data_debit = array();
|
||||
for ($i = 0 ; $i < 12 ; $i++)
|
||||
{
|
||||
$data_credit[$i] = isset($credits[substr("0".($i+1),-2)]) ? $credits[substr("0".($i+1),-2)] : 0;
|
||||
$data_debit[$i] = isset($debits[substr("0".($i+1),-2)]) ? $debits[substr("0".($i+1),-2)] : 0;
|
||||
$labels[$i] = strftime("%b",dolibarr_mktime(12,0,0,$i+1,1,2000));
|
||||
$datamin[$i] = $acct->min_desired;
|
||||
}
|
||||
|
||||
// Fabrication tableau 4b
|
||||
$file= $conf->banque->dir_temp."/movement".$account."-".$year.".png";
|
||||
$title=$langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Year").': '.$year;
|
||||
$graph_datas=array();
|
||||
foreach($data_credit as $i => $val)
|
||||
{
|
||||
$graph_datas[$i]=array($labels[$i],$data_credit[$i],$data_debit[$i]);
|
||||
}
|
||||
$px = new DolGraph();
|
||||
$px->SetData($graph_datas);
|
||||
$px->SetLegend(array($langs->transnoentities("Credit"),$langs->transnoentities("Debit")));
|
||||
$px->SetLegendWidthMin(180);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
||||
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
||||
$px->SetTitle($title);
|
||||
$px->SetWidth($width);
|
||||
$px->SetHeight($height);
|
||||
$px->SetType('bars');
|
||||
$px->SetShading(3);
|
||||
$px->setBgColor('onglet');
|
||||
$px->SetHorizTickIncrement(1);
|
||||
$px->SetPrecisionY(0);
|
||||
$px->draw($file);
|
||||
|
||||
unset($graph_datas);
|
||||
unset($px);
|
||||
unset($debits);
|
||||
unset($credits);
|
||||
}
|
||||
|
||||
// Chargement de labels et data_xxx pour tableau 4 Mouvements
|
||||
$labels = array();
|
||||
$data_credit = array();
|
||||
$data_debit = array();
|
||||
for ($i = 0 ; $i < 12 ; $i++)
|
||||
{
|
||||
$data_credit[$i] = isset($credits[substr("0".($i+1),-2)]) ? $credits[substr("0".($i+1),-2)] : 0;
|
||||
$data_debit[$i] = isset($debits[substr("0".($i+1),-2)]) ? $debits[substr("0".($i+1),-2)] : 0;
|
||||
$labels[$i] = strftime("%b",dolibarr_mktime(12,0,0,$i+1,1,2000));
|
||||
$datamin[$i] = $acct->min_desired;
|
||||
}
|
||||
|
||||
// Fabrication tableau 4
|
||||
$file= $conf->banque->dir_temp."/movement.$account.$year.png";
|
||||
$title=$langs->transnoentities("BankMovements").' '.$langs->transnoentities("Year").': '.$year;
|
||||
$graph_datas=array();
|
||||
foreach($data_credit as $i => $val)
|
||||
{
|
||||
$graph_datas[$i]=array($labels[$i],$data_credit[$i],$data_debit[$i]);
|
||||
}
|
||||
$px = new DolGraph();
|
||||
$px->SetData($graph_datas);
|
||||
$px->SetLegend(array($langs->transnoentities("Credit"),$langs->transnoentities("Debit")));
|
||||
$px->SetLegendWidthMin(180);
|
||||
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
|
||||
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
|
||||
$px->SetTitle($title);
|
||||
$px->SetWidth($width);
|
||||
$px->SetHeight($height);
|
||||
$px->SetType('bars');
|
||||
$px->SetShading(3);
|
||||
$px->setBgColor('onglet');
|
||||
$px->SetHorizTickIncrement(1);
|
||||
$px->SetPrecisionY(0);
|
||||
$px->draw($file);
|
||||
|
||||
unset($graph_datas);
|
||||
unset($px);
|
||||
unset($debits);
|
||||
unset($credits);
|
||||
}
|
||||
|
||||
|
||||
// Onglets
|
||||
$head=bank_prepare_head($acct);
|
||||
dolibarr_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0);
|
||||
@ -536,26 +658,36 @@ if ($_GET["account"] || $_GET["ref"])
|
||||
|
||||
print '<table class="notopnoleftnoright" width="100%">';
|
||||
|
||||
print '<tr><td align="center">';
|
||||
$file = "movement.$account.$year.png";
|
||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td align="center">';
|
||||
$file = "balance.$account.$year.$month.png";
|
||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td align="center">';
|
||||
$file = "balance.$account.$year.png";
|
||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td align="center">';
|
||||
$file = "balance.$account.png";
|
||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
||||
print '</td></tr>';
|
||||
if ($mode == 'standard')
|
||||
{
|
||||
print '<tr><td align="center">';
|
||||
$file = "movement".$account."-".$year.$month.".png";
|
||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
||||
|
||||
print '<tr><td align="center">';
|
||||
$file = "balance".$account."-".$year.$month.".png";
|
||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td align="center">';
|
||||
$file = "movement".$account."-".$year.".png";
|
||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td align="center">';
|
||||
$file = "balance".$account."-".$year.".png";
|
||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// All time
|
||||
if ($mode == 'showalltime')
|
||||
{
|
||||
print '<tr><td align="center">';
|
||||
$file = "balance".$account.".png";
|
||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
@ -68,7 +68,6 @@ class DolGraph
|
||||
var $bordercolor; // array(R,G,B)
|
||||
var $bgcolor; // array(R,G,B)
|
||||
var $datacolor; // array(array(R,G,B),...)
|
||||
var $alpha='25'; // % transparancy
|
||||
|
||||
|
||||
/*
|
||||
@ -80,7 +79,7 @@ class DolGraph
|
||||
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
|
||||
|
||||
|
||||
// Test si module GD pr<EFBFBD>sent
|
||||
// Test si module GD present
|
||||
$modules_list = get_loaded_extensions();
|
||||
$isgdinstalled=0;
|
||||
foreach ($modules_list as $module)
|
||||
@ -94,7 +93,7 @@ class DolGraph
|
||||
}
|
||||
|
||||
|
||||
// D<EFBFBD>fini propri<72>t<EFBFBD>s de l'objet graphe
|
||||
// Defini proprietes de l'objet graphe
|
||||
$this->library=$conf->global->MAIN_GRAPH_LIBRARY;
|
||||
|
||||
$this->bordercolor = array(235,235,224);
|
||||
@ -153,7 +152,7 @@ class DolGraph
|
||||
|
||||
// Create graph
|
||||
$class='';
|
||||
if ($this->type == 'bars') $class='BarPlot';
|
||||
if ($this->type == 'bars') $class='BarPlot';
|
||||
if ($this->type == 'lines') $class='LinePlot';
|
||||
include_once DOL_DOCUMENT_ROOT."/../external-libs/Artichow/".$class.".class.php";
|
||||
|
||||
@ -201,6 +200,14 @@ class DolGraph
|
||||
$j++;
|
||||
}
|
||||
|
||||
// Artichow ne gere pas les valeurs inconnues
|
||||
// Donc si inconnu, on la fixe a null
|
||||
$newvalues=array();
|
||||
foreach($values as $val)
|
||||
{
|
||||
$newvalues[]=(is_numeric($val) ? $val : null);
|
||||
}
|
||||
|
||||
|
||||
if ($this->type == 'bars')
|
||||
{
|
||||
@ -208,14 +215,6 @@ class DolGraph
|
||||
//print_r($values);
|
||||
//print '<br>';
|
||||
|
||||
// Artichow ne gere pas les valeurs inconnues
|
||||
// Donc si inconnu, on la fixe a null
|
||||
$newvalues=array();
|
||||
foreach($values as $val)
|
||||
{
|
||||
$newvalues[]=(is_numeric($val) ? $val : null);
|
||||
}
|
||||
|
||||
$color=new Color($this->datacolor[$i][0],$this->datacolor[$i][1],$this->datacolor[$i][2],20);
|
||||
$colorborder=new Color($this->datacolor[$i][0],$this->datacolor[$i][1],$this->datacolor[$i][2]);
|
||||
|
||||
@ -242,36 +241,28 @@ class DolGraph
|
||||
|
||||
if ($this->type == 'lines')
|
||||
{
|
||||
// Artichow ne gere pas les valeurs inconnues
|
||||
// Donc si inconnu, on la fixe a null
|
||||
$newvalues=array();
|
||||
foreach($values as $val)
|
||||
{
|
||||
$newvalues[]=(is_numeric($val) ? $val : null);
|
||||
}
|
||||
|
||||
$color=new Color($this->datacolor[$i][0],$this->datacolor[$i][1],$this->datacolor[$i][2],20);
|
||||
|
||||
$plot = new LinePlot($newvalues);
|
||||
//$plot->setSize(1, 0.96);
|
||||
//$plot->setCenter(0.5, 0.52);
|
||||
|
||||
$color=new Color($this->datacolor[$i][0],$this->datacolor[$i][1],$this->datacolor[$i][2],30);
|
||||
$plot->setColor($color);
|
||||
$plot->setThickness(2);
|
||||
|
||||
// Le mode automatique est plus efficace
|
||||
$plot->SetYMax($this->MaxValue);
|
||||
$plot->SetYMin($this->MinValue);
|
||||
//$plot->setYAxis(0);
|
||||
//$plot->hideLine(true);
|
||||
}
|
||||
|
||||
$plot->reduce(80); // Evite temps d'affichage trop long et nombre de ticks absisce satures
|
||||
//$plot->reduce(80); // Evite temps d'affichage trop long et nombre de ticks absisce satures
|
||||
|
||||
if ($nblot >= 2)
|
||||
if (sizeof($this->Legend))
|
||||
{
|
||||
$group->legend->add($plot, $this->Legend[$i], Legend::BACKGROUND);
|
||||
}
|
||||
else
|
||||
{
|
||||
$plot->xAxis->setLabelText($legends);
|
||||
$plot->xAxis->label->setFont(new Tuffy(7));
|
||||
if ($this->type == 'bars') $group->legend->add($plot, $this->Legend[$i], Legend::BACKGROUND);
|
||||
if ($this->type == 'lines') $group->legend->add($plot, $this->Legend[$i], Legend::LINE);
|
||||
}
|
||||
$group->add($plot);
|
||||
|
||||
@ -735,7 +726,6 @@ class DolGraph
|
||||
$graph->draw($file);
|
||||
}
|
||||
|
||||
|
||||
function BarLineOneYearArtichow($file='', $barvalues, $linevalues, $legends='')
|
||||
{
|
||||
$ok = 0;
|
||||
@ -884,9 +874,4 @@ class DolGraph
|
||||
|
||||
}
|
||||
|
||||
|
||||
function setYear($value) {
|
||||
return $value + 2000;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -18,13 +18,12 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/includes/boxes/box_actions.php
|
||||
\ingroup actions
|
||||
\brief Module de génération de l'affichage de la box actions
|
||||
\brief Module de generation de l'affichage de la box actions
|
||||
*/
|
||||
|
||||
|
||||
@ -57,15 +56,15 @@ class box_actions extends ModeleBoxes {
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Charge les données en mémoire pour affichage ultérieur
|
||||
* \param $max Nombre maximum d'enregistrements à charger
|
||||
* \brief Charge les donn<EFBFBD>es en m<EFBFBD>moire pour affichage ult<EFBFBD>rieur
|
||||
* \param $max Nombre maximum d'enregistrements <EFBFBD> charger
|
||||
*/
|
||||
function loadBox($max=5)
|
||||
{
|
||||
global $user, $langs, $db, $conf;
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php");
|
||||
$actionstatic=new ActionComm($db);
|
||||
$actionstatic=new ActionComm($db);
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastActionsToDo",$max));
|
||||
|
||||
@ -141,12 +140,12 @@ class box_actions extends ModeleBoxes {
|
||||
$this->info_box_contents[$i][5] = array('text'=>' ');
|
||||
|
||||
} else {
|
||||
$this->info_box_contents[$i][0] = array('text'=>' ');
|
||||
$this->info_box_contents[$i][1] = array('text'=>' ');
|
||||
$this->info_box_contents[$i][2] = array('text'=>' ');
|
||||
$this->info_box_contents[$i][3] = array('text'=>' ');
|
||||
$this->info_box_contents[$i][4] = array('text'=>' ');
|
||||
$this->info_box_contents[$i][5] = array('text'=>' ');
|
||||
//$this->info_box_contents[$i][0] = array('text'=>' ');
|
||||
//$this->info_box_contents[$i][1] = array('text'=>' ');
|
||||
//$this->info_box_contents[$i][2] = array('text'=>' ');
|
||||
//$this->info_box_contents[$i][3] = array('text'=>' ');
|
||||
//$this->info_box_contents[$i][4] = array('text'=>' ');
|
||||
//$this->info_box_contents[$i][5] = array('text'=>' ');
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
/**
|
||||
\file htdocs/includes/boxes/box_prospect.php
|
||||
\ingroup commercial
|
||||
\brief Module de génération de l'affichage de la box prospect
|
||||
\brief Module de g<EFBFBD>n<EFBFBD>ration de l'affichage de la box prospect
|
||||
*/
|
||||
|
||||
|
||||
@ -56,8 +56,8 @@ class box_prospect extends ModeleBoxes {
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Charge les données en mémoire pour affichage ultérieur
|
||||
* \param $max Nombre maximum d'enregistrements à charger
|
||||
* \brief Charge les donn<EFBFBD>es en m<EFBFBD>moire pour affichage ult<EFBFBD>rieur
|
||||
* \param $max Nombre maximum d'enregistrements <EFBFBD> charger
|
||||
*/
|
||||
function loadBox($max=5)
|
||||
{
|
||||
@ -117,10 +117,10 @@ class box_prospect extends ModeleBoxes {
|
||||
$this->info_box_contents[$i][2] = array('text'=>' ');
|
||||
$this->info_box_contents[$i][3] = array('text'=>' ');
|
||||
} else {
|
||||
$this->info_box_contents[$i][0] = array('text'=>' ');
|
||||
$this->info_box_contents[$i][1] = array('text'=>' ');
|
||||
$this->info_box_contents[$i][2] = array('text'=>' ');
|
||||
$this->info_box_contents[$i][3] = array('text'=>' ');
|
||||
//$this->info_box_contents[$i][0] = array('text'=>' ');
|
||||
//$this->info_box_contents[$i][1] = array('text'=>' ');
|
||||
//$this->info_box_contents[$i][2] = array('text'=>' ');
|
||||
//$this->info_box_contents[$i][3] = array('text'=>' ');
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
/**
|
||||
\defgroup adherent Module adherents
|
||||
\brief Module pour gérer les adhérents d'une association
|
||||
\brief Module pour g<EFBFBD>rer les adh<EFBFBD>rents d'une association
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -45,7 +45,7 @@ class modAdherent extends DolibarrModules
|
||||
|
||||
/**
|
||||
* \brief Constructeur. Definit les noms, constantes et boites
|
||||
* \param DB handler d'accès base
|
||||
* \param DB handler d'acc<EFBFBD>s base
|
||||
*/
|
||||
function modAdherent($DB)
|
||||
{
|
||||
@ -54,8 +54,8 @@ class modAdherent extends DolibarrModules
|
||||
$this->numero = 310 ;
|
||||
|
||||
$this->family = "hr";
|
||||
$this->name = "Adhérents";
|
||||
$this->description = "Gestion des adhérents d'une association";
|
||||
$this->name = "Adherents";
|
||||
$this->description = "Gestion des adherents d'une association";
|
||||
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
|
||||
$this->const_name = 'MAIN_MODULE_ADHERENT';
|
||||
$this->special = 2;
|
||||
@ -69,7 +69,7 @@ class modAdherent extends DolibarrModules
|
||||
//-------------
|
||||
$this->config_page_url = array("adherent.php");
|
||||
|
||||
// Dépendances
|
||||
// Dependances
|
||||
//------------
|
||||
$this->depends = array();
|
||||
$this->requiredby = array();
|
||||
@ -78,18 +78,14 @@ class modAdherent extends DolibarrModules
|
||||
// Constantes
|
||||
//-----------
|
||||
$this->const = array();
|
||||
$this->const[0]= array("ADHERENT_MAIL_RESIL","texte","Votre adhesion vient d'etre resiliee.\r\nNous esperons vous revoir tres bientot","Mail de résiliation");
|
||||
$this->const[1]=array("ADHERENT_MAIL_VALID","texte","Votre adhesion vient d'etre validee. \r\nVoici le rappel de vos coordonnees (toute information erronee entrainera la non validation de votre inscription) :\r\n\r\n%INFOS%\r\n\r\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l'adresse suivante : \r\n%DOL_MAIN_URL_ROOT%/public/adherents/","Mail de validation");
|
||||
$this->const[3] = array("ADHERENT_MAIL_RESIL","texte","Votre adhesion vient d'etre resilie.\r\nNous esperons vous revoir tres bientot","Mail de résiliation");
|
||||
$this->const[5] = array("ADHERENT_MAIL_VALID_SUBJECT","chaine","Votre adhesion a ete validee","Sujet du mail de validation");
|
||||
$this->const[6] = array("ADHERENT_MAIL_RESIL_SUBJECT","chaine","Resiliation de votre adhesion","Sujet du mail de resiliation");
|
||||
$this->const[9] = array("ADHERENT_GLASNOST_SERVEUR","chaine","","serveur glasnost");
|
||||
$this->const[0] = array("ADHERENT_MAIL_RESIL","texte","Votre adhesion vient d'etre resiliee.\r\nNous esperons vous revoir tres bientot","Mail de resiliation");
|
||||
$this->const[1] = array("ADHERENT_MAIL_VALID","texte","Votre adhesion vient d'etre validee. \r\nVoici le rappel de vos coordonnees (toute information erronee entrainera la non validation de votre inscription) :\r\n\r\n%INFOS%\r\n\r\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l'adresse suivante : \r\n%DOL_MAIN_URL_ROOT%/public/adherents/","Mail de validation");
|
||||
$this->const[3] = array("ADHERENT_MAIL_RESIL","texte","Votre adhesion vient d'etre resilie.\r\nNous esperons vous revoir tres bientot","Mail de resiliation");
|
||||
$this->const[5] = array("ADHERENT_MAIL_VALID_SUBJECT","chaine","Votre adhesion a ete validee","Sujet du mail de validation");
|
||||
$this->const[6] = array("ADHERENT_MAIL_RESIL_SUBJECT","chaine","Resiliation de votre adhesion","Sujet du mail de resiliation");
|
||||
$this->const[10] = array("ADHERENT_MAILMAN_UNSUB_URL","chaine","http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL%","Url de desinscription aux listes mailman");
|
||||
$this->const[11] = array("ADHERENT_MAILMAN_URL","chaine","http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL%","Url pour les inscriptions mailman");
|
||||
$this->const[12] = array("ADHERENT_MAILMAN_LISTS","chaine","","Listes auxquelles les nouveaux adhérents sont inscris");
|
||||
$this->const[13] = array("ADHERENT_GLASNOST_USER","chaine","","Administrateur glasnost");
|
||||
$this->const[14] = array("ADHERENT_GLASNOST_PASS","chaine","","password de l'administrateur");
|
||||
$this->const[15] = array("ADHERENT_USE_GLASNOST_AUTO","yesno","","inscription automatique a glasnost ?");
|
||||
$this->const[12] = array("ADHERENT_MAILMAN_LISTS","chaine","","Listes auxquelles les nouveaux adherents sont inscris");
|
||||
$this->const[16] = array("ADHERENT_USE_SPIP_AUTO","yesno","","Utilisation de SPIP automatiquement");
|
||||
$this->const[17] = array("ADHERENT_SPIP_USER","chaine","","Utilisateur de connexion a la base spip");
|
||||
$this->const[18] = array("ADHERENT_SPIP_PASS","chaine","","Mot de passe de connexion a la base spip");
|
||||
@ -100,7 +96,7 @@ class modAdherent extends DolibarrModules
|
||||
$this->const[23] = array("ADHERENT_MAIL_COTIS_SUBJECT","chaine","Recu de votre cotisation","Sujet du mail de validation de cotisation");
|
||||
$this->const[25] = array("ADHERENT_CARD_HEADER_TEXT","chaine","%ANNEE%","Texte imprime sur le haut de la carte adherent");
|
||||
$this->const[26] = array("ADHERENT_CARD_FOOTER_TEXT","chaine","Association AZERTY","Texte imprime sur le bas de la carte adherent");
|
||||
$this->const[27] = array("ADHERENT_CARD_TEXT","texte","%PRENOM% %NOM%\r\nMembre n° %ID%\r\n%EMAIL%\r\n%ADRESSE%\r\n%CP% %VILLE%\r\n%PAYS%","Texte imprime sur la carte adherent");
|
||||
$this->const[27] = array("ADHERENT_CARD_TEXT","texte","%PRENOM% %NOM%\r\nMembre ne %ID%\r\n%EMAIL%\r\n%ADRESSE%\r\n%CP% %VILLE%\r\n%PAYS%","Texte imprime sur la carte adherent");
|
||||
$this->const[28] = array("ADHERENT_MAILMAN_ADMINPW","chaine","","Mot de passe Admin des liste mailman");
|
||||
$this->const[29] = array("ADHERENT_MAILMAN_SERVER","chaine","","Serveur hebergeant les interfaces d'Admin des listes mailman");
|
||||
$this->const[30] = array("ADHERENT_MAILMAN_LISTS_COTISANT","chaine","","Liste(s) auxquelles les nouveaux cotisants sont inscris automatiquement");
|
||||
@ -120,8 +116,8 @@ class modAdherent extends DolibarrModules
|
||||
$r=0;
|
||||
|
||||
// $this->rights[$r][0] Id permission (unique tous modules confondus)
|
||||
// $this->rights[$r][1] Libellé par défaut si traduction de clé "PermissionXXX" non trouvée (XXX = Id permission)
|
||||
// $this->rights[$r][2] Non utilisé
|
||||
// $this->rights[$r][1] Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission)
|
||||
// $this->rights[$r][2] Non utilise
|
||||
// $this->rights[$r][3] 1=Permis par defaut, 0=Non permis par defaut
|
||||
// $this->rights[$r][4] Niveau 1 pour nommer permission dans code
|
||||
// $this->rights[$r][5] Niveau 2 pour nommer permission dans code
|
||||
@ -135,7 +131,7 @@ class modAdherent extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 72;
|
||||
$this->rights[$r][1] = 'Créer/modifier les adherents';
|
||||
$this->rights[$r][1] = 'Creer/modifier les adherents';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'creer';
|
||||
@ -149,7 +145,7 @@ class modAdherent extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 76;
|
||||
$this->rights[$r][1] = 'Exporter les adhérents';
|
||||
$this->rights[$r][1] = 'Exporter les adherents';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'export';
|
||||
@ -171,7 +167,7 @@ class modAdherent extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 79;
|
||||
$this->rights[$r][1] = 'Créer/modifier/supprimer les cotisations';
|
||||
$this->rights[$r][1] = 'Creer/modifier/supprimer les cotisations';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'cotisation';
|
||||
@ -182,19 +178,19 @@ class modAdherent extends DolibarrModules
|
||||
$r=0;
|
||||
|
||||
// $this->export_code[$r] Code unique identifiant l'export (tous modules confondus)
|
||||
// $this->export_label[$r] Libellé par défaut si traduction de clé "ExportXXX" non trouvée (XXX = Code)
|
||||
// $this->export_label[$r] Libelle par defaut si traduction de cle "ExportXXX" non trouvee (XXX = Code)
|
||||
// $this->export_fields_sql[$r] Liste des champs exportables en codif sql
|
||||
// $this->export_fields_name[$r] Liste des champs exportables en codif traduction
|
||||
// $this->export_sql[$r] Requete sql qui offre les données à l'export
|
||||
// $this->export_sql[$r] Requete sql qui offre les donnees a l'export
|
||||
// $this->export_permission[$r] Liste des codes permissions requis pour faire l'export
|
||||
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->id.'_'.$r;
|
||||
$this->export_label[$r]='Adhérents et adhésions';
|
||||
$this->export_label[$r]='Adherents et adhesions';
|
||||
$this->export_fields_array[$r]=array('a.nom'=>"Lastname",'a.prenom'=>"Firstname",'a.login'=>"Login",'a.morphy'=>'MorPhy','a.adresse'=>"Address",'a.cp'=>"Zip",'a.ville'=>"Town",'a.pays'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.naiss'=>"Birthday",'a.statut'=>"Status",'a.photo'=>"Photo",'a.note'=>"Note",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation','a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel','c.dateadh'=>'DateSubscription','c.cotisation'=>'Amount');
|
||||
$this->export_entities_array[$r]=array('a.nom'=>"member",'a.prenom'=>"member",'a.login'=>"member",'a.morphy'=>'member','a.adresse'=>"member",'a.cp'=>"member",'a.ville'=>"member",'a.pays'=>"member",'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.naiss'=>"member",'a.statut'=>"member",'a.photo'=>"member",'a.note'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member','a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.dateadh'=>'subscription','c.cotisation'=>'subscription');
|
||||
$this->export_alias_array[$r]=array('a.nom'=>"lastname",'a.prenom'=>"firstname",'a.login'=>"login",'a.morphy'=>'morphy','a.adresse'=>"address",'a.cp'=>"zip",'a.ville'=>"town",'a.pays'=>"country",'a.phone'=>"phone",'a.phone_perso'=>"phone_perso",'a.phone_mobile'=>"phone_mobile",'a.email'=>"email",'a.naiss'=>"birthday",'a.statut'=>"status",'a.photo'=>'photo','a.note'=>'note','a.datec'=>'datec','a.datevalid'=>'datevalid','a.tms'=>'datem','a.datefin'=>'dateend','ta.rowid'=>'type_id','ta.libelle'=>'type_label','c.dateadh'=>'date_subscription','c.cotisation'=>'amount_subscription');
|
||||
// On complète avec champs options
|
||||
// On complete avec champs options
|
||||
$sql='SELECT name, label FROM '.MAIN_DB_PREFIX.'adherent_options_label';
|
||||
$resql=$this->db->query($sql);
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
@ -223,8 +219,8 @@ class modAdherent extends DolibarrModules
|
||||
|
||||
|
||||
/**
|
||||
* \brief Fonction appelée lors de l'activation du module. Insère en base les constantes, boites, permissions du module.
|
||||
* Définit également les répertoires de données à créer pour ce module.
|
||||
* \brief Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module.
|
||||
* Definit egalement les repertoires de donnees a creer pour ce module.
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
@ -244,7 +240,7 @@ class modAdherent extends DolibarrModules
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fonction appelée lors de la désactivation d'un module.
|
||||
* \brief Fonction appelee lors de la desactivation d'un module.
|
||||
* Supprime de la base les constantes, boites et permissions du module.
|
||||
*/
|
||||
function remove()
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
/** \defgroup comptabilite_expert Module comptabilite expert
|
||||
\brief Module pour inclure des fonctions de comptabilité (gestion de comptes comptables et rapports)
|
||||
\brief Module pour inclure des fonctions de comptabilit<EFBFBD> (gestion de comptes comptables et rapports)
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -44,7 +44,7 @@ class modComptabiliteExpert extends DolibarrModules
|
||||
|
||||
/**
|
||||
* \brief Constructeur. Definit les noms, constantes et boites
|
||||
* \param DB handler d'accès base
|
||||
* \param DB handler d'acces base
|
||||
*/
|
||||
function modComptabiliteExpert($DB)
|
||||
{
|
||||
@ -56,19 +56,19 @@ class modComptabiliteExpert extends DolibarrModules
|
||||
|
||||
$this->family = "financial";
|
||||
$this->name = "ComptabiliteExpert";
|
||||
$this->description = "Gestion expert de comptabilité (doubles parties)";
|
||||
$this->description = "Gestion expert de comptabilite (doubles parties)";
|
||||
|
||||
// $this->revision = explode(' ','$Revision$');
|
||||
// $this->version = $this->revision[1];
|
||||
$this->version = "development";
|
||||
|
||||
$this->const_name = 'MAIN_MODULE_COMPTABILITE_EXPERT';
|
||||
$this->const_name = 'MAIN_MODULE_COMPTABILITEEXPERT';
|
||||
$this->special = 0;
|
||||
|
||||
// Config pages
|
||||
$this->config_page_url = array("comptaexpert.php");
|
||||
|
||||
// Dépendances
|
||||
// Dependances
|
||||
$this->depends = array("modFacture","modBanque");
|
||||
$this->requiredby = array();
|
||||
$this->conflictwith = array("modComptabilite");
|
||||
@ -77,7 +77,7 @@ class modComptabiliteExpert extends DolibarrModules
|
||||
// Constantes
|
||||
$this->const = array();
|
||||
|
||||
// Répertoires
|
||||
// Repertoires
|
||||
$this->dirs = array();
|
||||
$this->dirs[0] = $conf->comptaexpert->dir_output;
|
||||
$this->dirs[1] = $conf->comptaexpert->dir_output."/rapport";
|
||||
@ -99,7 +99,7 @@ class modComptabiliteExpert extends DolibarrModules
|
||||
$this->rights[1][5] = 'lire';
|
||||
|
||||
$this->rights[2][0] = 132;
|
||||
$this->rights[2][1] = 'Créer/modifier un plan de compte';
|
||||
$this->rights[2][1] = 'Creer/modifier un plan de compte';
|
||||
$this->rights[2][2] = 'w';
|
||||
$this->rights[2][3] = 0;
|
||||
$this->rights[2][4] = 'plancompte';
|
||||
@ -120,14 +120,14 @@ class modComptabiliteExpert extends DolibarrModules
|
||||
$this->rights[4][5] = 'lire';
|
||||
|
||||
$this->rights[5][0] = 142;
|
||||
$this->rights[5][1] = 'Créer/modifier/annuler les mouvements comptables';
|
||||
$this->rights[5][1] = 'Creer/modifier/annuler les mouvements comptables';
|
||||
$this->rights[5][2] = 'w';
|
||||
$this->rights[5][3] = 0;
|
||||
$this->rights[5][4] = 'mouvements';
|
||||
$this->rights[5][5] = 'creer';
|
||||
|
||||
$this->rights[6][0] = 145;
|
||||
$this->rights[6][1] = 'Lire CA, bilans, résultats, journaux, grands livres';
|
||||
$this->rights[6][1] = 'Lire CA, bilans, resultats, journaux, grands livres';
|
||||
$this->rights[6][2] = 'r';
|
||||
$this->rights[6][3] = 0;
|
||||
$this->rights[6][4] = 'comptarapport';
|
||||
@ -137,8 +137,8 @@ class modComptabiliteExpert extends DolibarrModules
|
||||
|
||||
|
||||
/**
|
||||
* \brief Fonction appelée lors de l'activation du module. Insère en base les constantes, boites, permissions du module.
|
||||
* Définit également les répertoires de données à créer pour ce module.
|
||||
* \brief Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module.
|
||||
* Definit egalement les repertoires de donnees e creer pour ce module.
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
@ -151,7 +151,7 @@ class modComptabiliteExpert extends DolibarrModules
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fonction appelée lors de la désactivation d'un module.
|
||||
* \brief Fonction appelee lors de la desactivation d'un module.
|
||||
* Supprime de la base les constantes, boites et permissions du module.
|
||||
*/
|
||||
function remove()
|
||||
|
||||
@ -21,13 +21,13 @@
|
||||
|
||||
/**
|
||||
\defgroup telephonie Module telephonie
|
||||
\brief Module pour gérer la téléphonie
|
||||
\brief Module pour g<EFBFBD>rer la t<EFBFBD>l<EFBFBD>phonie
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/includes/modules/modTelephonie.class.php
|
||||
\ingroup telephonie
|
||||
\brief Fichier de description et activation du module de Téléphonie
|
||||
\brief Fichier de description et activation du module de Telephonie
|
||||
*/
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
|
||||
@ -43,7 +43,7 @@ class modTelephonie extends DolibarrModules
|
||||
|
||||
/**
|
||||
* \brief Constructeur. Definit les noms, constantes et boites
|
||||
* \param DB handler d'accès base
|
||||
* \param DB handler d'acces base
|
||||
*/
|
||||
function modTelephonie($DB)
|
||||
{
|
||||
@ -59,14 +59,13 @@ class modTelephonie extends DolibarrModules
|
||||
$this->version = $this->revision[1];
|
||||
|
||||
$this->const_name = "MAIN_MODULE_TELEPHONIE";
|
||||
$this->const_config = MAIN_MODULE_TELEPHONIE;
|
||||
$this->special = 2;
|
||||
$this->picto='phoning';
|
||||
|
||||
// Dir
|
||||
$this->dirs = array();
|
||||
|
||||
// Dépendances
|
||||
// Dependances
|
||||
$this->depends = array();
|
||||
$this->requiredby = array();
|
||||
|
||||
@ -82,14 +81,14 @@ class modTelephonie extends DolibarrModules
|
||||
|
||||
$this->rights[1][0] = 211; // id de la permission
|
||||
$this->rights[1][1] = 'Consulter la telephonie'; // libelle de la permission
|
||||
$this->rights[1][2] = 'r'; // type de la permission (déprécié à ce jour)
|
||||
$this->rights[1][3] = 1; // La permission est-elle une permission par défaut
|
||||
$this->rights[1][2] = 'r'; // type de la permission (deprecie a ce jour)
|
||||
$this->rights[1][3] = 1; // La permission est-elle une permission par defaut
|
||||
$this->rights[1][4] = 'lire';
|
||||
|
||||
$this->rights[2][0] = 212; // id de la permission
|
||||
$this->rights[2][1] = 'Commander les lignes'; // libelle de la permission
|
||||
$this->rights[2][2] = 'w'; // type de la permission (déprécié à ce jour)
|
||||
$this->rights[2][3] = 0; // La permission est-elle une permission par défaut
|
||||
$this->rights[2][2] = 'w'; // type de la permission (deprecie a ce jour)
|
||||
$this->rights[2][3] = 0; // La permission est-elle une permission par defaut
|
||||
$this->rights[2][4] = 'ligne_commander';
|
||||
|
||||
$this->rights[3][0] = 213;
|
||||
@ -112,14 +111,14 @@ class modTelephonie extends DolibarrModules
|
||||
$this->rights[5][5] = 'config';
|
||||
|
||||
$this->rights[6][0] = 192;
|
||||
$this->rights[6][1] = 'Créer des lignes';
|
||||
$this->rights[6][1] = 'Creer des lignes';
|
||||
$this->rights[6][2] = 'w';
|
||||
$this->rights[6][3] = 0;
|
||||
$this->rights[6][4] = 'ligne';
|
||||
$this->rights[6][5] = 'creer';
|
||||
|
||||
$this->rights[7][0] = 202;
|
||||
$this->rights[7][1] = 'Créer des liaisons ADSL';
|
||||
$this->rights[7][1] = 'Creer des liaisons ADSL';
|
||||
$this->rights[7][2] = 'w';
|
||||
$this->rights[7][3] = 0;
|
||||
$this->rights[7][4] = 'adsl';
|
||||
@ -140,7 +139,7 @@ class modTelephonie extends DolibarrModules
|
||||
$this->rights[9][5] = 'commander';
|
||||
|
||||
$this->rights[10][0] = 205;
|
||||
$this->rights[10][1] = 'Gérer les liaisons';
|
||||
$this->rights[10][1] = 'Gerer les liaisons';
|
||||
$this->rights[10][2] = 'w';
|
||||
$this->rights[10][3] = 0;
|
||||
$this->rights[10][4] = 'adsl';
|
||||
@ -183,7 +182,7 @@ class modTelephonie extends DolibarrModules
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 231;
|
||||
$this->rights[$r][1] = 'Définir le mode de réglement';
|
||||
$this->rights[$r][1] = 'Definir le mode de reglement';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'contrat';
|
||||
@ -191,7 +190,7 @@ class modTelephonie extends DolibarrModules
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 193;
|
||||
$this->rights[$r][1] = 'Résilier des lignes';
|
||||
$this->rights[$r][1] = 'Resilier des lignes';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'ligne';
|
||||
@ -231,7 +230,7 @@ class modTelephonie extends DolibarrModules
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 312;
|
||||
$this->rights[$r][1] = 'Affecter des services à un contrat';
|
||||
$this->rights[$r][1] = 'Affecter des services a un contrat';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'service';
|
||||
@ -264,8 +263,8 @@ class modTelephonie extends DolibarrModules
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fonction appelée lors de l'activation du module. Insère en base les constantes, boites, permissions du module.
|
||||
* Définit également les répertoires de données à créer pour ce module.
|
||||
* \brief Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module.
|
||||
* Definit egalement les repertoires de donnees a creer pour ce module.
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
@ -293,7 +292,7 @@ class modTelephonie extends DolibarrModules
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Fonction appelée lors de la désactivation d'un module.
|
||||
\brief Fonction appelee lors de la desactivation d'un module.
|
||||
Supprime de la base les constantes, boites et permissions du module.
|
||||
*/
|
||||
function remove()
|
||||
@ -342,7 +341,7 @@ class modTelephonie extends DolibarrModules
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
//print "<tr><td>Création de la table $name/td>";
|
||||
//print "<tr><td>Creation de la table $name/td>";
|
||||
$requestnb++;
|
||||
if (@$this->db->query($buffer))
|
||||
{
|
||||
@ -352,7 +351,7 @@ class modTelephonie extends DolibarrModules
|
||||
{
|
||||
if ($this->db->errno() == 'DB_ERROR_TABLE_ALREADY_EXISTS')
|
||||
{
|
||||
//print "<td>Déjà existante</td></tr>";
|
||||
//print "<td>Deje existante</td></tr>";
|
||||
$table_exists = 1;
|
||||
}
|
||||
else
|
||||
@ -375,7 +374,7 @@ class modTelephonie extends DolibarrModules
|
||||
/***************************************************************************************
|
||||
*
|
||||
* Chargement fichiers tables/*.key.sql
|
||||
* A faire après les fichiers *.sql
|
||||
* A faire apres les fichiers *.sql
|
||||
*
|
||||
***************************************************************************************/
|
||||
if ($ok)
|
||||
@ -407,7 +406,7 @@ class modTelephonie extends DolibarrModules
|
||||
{
|
||||
// Version qualified, delete SQL comments
|
||||
$buf=eregi_replace('^-- V([0-9\.]+)','',$buf);
|
||||
//print "Ligne $i qualifiée par version: ".$buf.'<br>';
|
||||
//print "Ligne $i qualifiee par version: ".$buf.'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,496 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
An XML-RPC implementation by Keith Devens, version 2.5f.
|
||||
http://www.keithdevens.com/software/xmlrpc/
|
||||
|
||||
Release history available at:
|
||||
http://www.keithdevens.com/software/xmlrpc/history/
|
||||
|
||||
This code is Open Source, released under terms similar to the Artistic License.
|
||||
Read the license at http://www.keithdevens.com/software/license/
|
||||
|
||||
Note: this code requires version 4.1.0 or higher of PHP.
|
||||
*/
|
||||
|
||||
function & XML_serialize(&$data, $level = 0, $prior_key = NULL){
|
||||
#assumes a hash, keys are the variable names
|
||||
$xml_serialized_string = "";
|
||||
while(list($key, $value) = each($data)){
|
||||
$inline = false;
|
||||
$numeric_array = false;
|
||||
$attributes = "";
|
||||
#echo "My current key is '$key', called with prior key '$prior_key'<br>";
|
||||
if(!strstr($key, " attr")){ #if it's not an attribute
|
||||
if(array_key_exists("$key attr", $data)){
|
||||
while(list($attr_name, $attr_value) = each($data["$key attr"])){
|
||||
#echo "Found attribute $attribute_name with value $attribute_value<br>";
|
||||
$attr_value = &htmlspecialchars($attr_value, ENT_QUOTES);
|
||||
$attributes .= " $attr_name=\"$attr_value\"";
|
||||
}
|
||||
}
|
||||
|
||||
if(is_numeric($key)){
|
||||
#echo "My current key ($key) is numeric. My parent key is '$prior_key'<br>";
|
||||
$key = $prior_key;
|
||||
}else{
|
||||
#you can't have numeric keys at two levels in a row, so this is ok
|
||||
#echo "Checking to see if a numeric key exists in data.";
|
||||
if(is_array($value) and array_key_exists(0, $value)){
|
||||
# echo " It does! Calling myself as a result of a numeric array.<br>";
|
||||
$numeric_array = true;
|
||||
$xml_serialized_string .= XML_serialize($value, $level, $key);
|
||||
}
|
||||
#echo "<br>";
|
||||
}
|
||||
|
||||
if(!$numeric_array){
|
||||
$xml_serialized_string .= str_repeat("\t", $level) . "<$key$attributes>";
|
||||
|
||||
if(is_array($value)){
|
||||
$xml_serialized_string .= "\r\n" . XML_serialize($value, $level+1);
|
||||
}else{
|
||||
$inline = true;
|
||||
$xml_serialized_string .= htmlspecialchars($value);
|
||||
}
|
||||
|
||||
$xml_serialized_string .= (!$inline ? str_repeat("\t", $level) : "") . "</$key>\r\n";
|
||||
}
|
||||
}else{
|
||||
#echo "Skipping attribute record for key $key<bR>";
|
||||
}
|
||||
}
|
||||
if($level == 0){
|
||||
$xml_serialized_string = "<?xml version=\"1.0\" ?>\r\n" . $xml_serialized_string;
|
||||
return $xml_serialized_string;
|
||||
}else{
|
||||
return $xml_serialized_string;
|
||||
}
|
||||
}
|
||||
|
||||
class XML {
|
||||
var $parser; #a reference to the XML parser
|
||||
var $document; #the entire XML structure built up so far
|
||||
var $current; #a pointer to the current item - what is this
|
||||
var $parent; #a pointer to the current parent - the parent will be an array
|
||||
var $parents; #an array of the most recent parent at each level
|
||||
|
||||
var $last_opened_tag;
|
||||
|
||||
function XML($data=null){
|
||||
$this->parser = xml_parser_create();
|
||||
|
||||
xml_parser_set_option ($this->parser, XML_OPTION_CASE_FOLDING, 0);
|
||||
xml_set_object($this->parser, $this);
|
||||
xml_set_element_handler($this->parser, "open", "close");
|
||||
xml_set_character_data_handler($this->parser, "data");
|
||||
# register_shutdown_function(array(&$this, 'destruct'));
|
||||
}
|
||||
|
||||
function destruct(){
|
||||
xml_parser_free($this->parser);
|
||||
}
|
||||
|
||||
function parse($data){
|
||||
$this->document = array();
|
||||
$this->parent = &$this->document;
|
||||
$this->parents = array();
|
||||
$this->last_opened_tag = NULL;
|
||||
xml_parse($this->parser, $data);
|
||||
return $this->document;
|
||||
}
|
||||
|
||||
function open($parser, $tag, $attributes){
|
||||
#echo "Opening tag $tag<br>\n";
|
||||
$this->data = "";
|
||||
$this->last_opened_tag = $tag; #tag is a string
|
||||
if(array_key_exists($tag, $this->parent)){
|
||||
#echo "There's already an instance of '$tag' at the current level ($level)<br>\n";
|
||||
if(is_array($this->parent[$tag]) and array_key_exists(0, $this->parent[$tag])){ #if the keys are numeric
|
||||
#need to make sure they're numeric (account for attributes)
|
||||
$key = count_numeric_items($this->parent[$tag]);
|
||||
#echo "There are $key instances: the keys are numeric.<br>\n";
|
||||
}else{
|
||||
#echo "There is only one instance. Shifting everything around<br>\n";
|
||||
$temp = &$this->parent[$tag];
|
||||
unset($this->parent[$tag]);
|
||||
$this->parent[$tag][0] = &$temp;
|
||||
|
||||
if(array_key_exists("$tag attr", $this->parent)){
|
||||
#shift the attributes around too if they exist
|
||||
$temp = &$this->parent["$tag attr"];
|
||||
unset($this->parent["$tag attr"]);
|
||||
$this->parent[$tag]["0 attr"] = &$temp;
|
||||
}
|
||||
$key = 1;
|
||||
}
|
||||
$this->parent = &$this->parent[$tag];
|
||||
}else{
|
||||
$key = $tag;
|
||||
}
|
||||
if($attributes){
|
||||
$this->parent["$key attr"] = $attributes;
|
||||
}
|
||||
|
||||
$this->parent[$key] = array();
|
||||
$this->parent = &$this->parent[$key];
|
||||
array_unshift($this->parents, $this->parent);
|
||||
}
|
||||
|
||||
function data($parser, $data){
|
||||
#echo "Data is '", htmlspecialchars($data), "'<br>\n";
|
||||
if($this->last_opened_tag != NULL){
|
||||
$this->data .= $data;
|
||||
}
|
||||
}
|
||||
|
||||
function close($parser, $tag){
|
||||
#echo "Close tag $tag<br>\n";
|
||||
if($this->last_opened_tag == $tag){
|
||||
$this->parent = $this->data;
|
||||
$this->last_opened_tag = NULL;
|
||||
}
|
||||
array_shift($this->parents);
|
||||
$this->parent = &$this->parents[0];
|
||||
}
|
||||
}
|
||||
|
||||
function & XML_unserialize(&$xml){
|
||||
$xml_parser = new XML();
|
||||
$data = &$xml_parser->parse($xml);
|
||||
$xml_parser->destruct();
|
||||
return $data;
|
||||
}
|
||||
|
||||
function & XMLRPC_parse(&$request){
|
||||
if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
|
||||
XMLRPC_debug('XMLRPC_parse', "<p>Received the following raw request:</p>" . XMLRPC_show($request, 'print_r', true));
|
||||
}
|
||||
$data = &XML_unserialize($request);
|
||||
if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
|
||||
XMLRPC_debug('XMLRPC_parse', "<p>Returning the following parsed request:</p>" . XMLRPC_show($data, 'print_r', true));
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
function & XMLRPC_prepare($data, $type = NULL){
|
||||
if(is_array($data)){
|
||||
$num_elements = count($data);
|
||||
if((array_key_exists(0, $data) or !$num_elements) and $type != 'struct'){ #it's an array
|
||||
if(!$num_elements){ #if the array is empty
|
||||
$returnvalue = array('array' => array('data' => NULL));
|
||||
}else{
|
||||
$returnvalue['array']['data']['value'] = array();
|
||||
$temp = &$returnvalue['array']['data']['value'];
|
||||
$count = count_numeric_items($data);
|
||||
for($n=0; $n<$count; $n++){
|
||||
$type = NULL;
|
||||
if(array_key_exists("$n type", $data)){
|
||||
$type = $data["$n type"];
|
||||
}
|
||||
$temp[$n] = XMLRPC_prepare($data[$n], $type);
|
||||
}
|
||||
}
|
||||
}else{ #it's a struct
|
||||
if(!$num_elements){ #if the struct is empty
|
||||
$returnvalue = array('struct' => NULL);
|
||||
}else{
|
||||
$returnvalue['struct']['member'] = array();
|
||||
$temp = &$returnvalue['struct']['member'];
|
||||
while(list($key, $value) = each($data)){
|
||||
if(substr($key, -5) != ' type'){ #if it's not a type specifier
|
||||
$type = NULL;
|
||||
if(array_key_exists("$key type", $data)){
|
||||
$type = $data["$key type"];
|
||||
}
|
||||
$temp[] = array('name' => $key, 'value' => XMLRPC_prepare($value, $type));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{ #it's a scalar
|
||||
if(!$type){
|
||||
if(is_int($data)){
|
||||
$returnvalue['int'] = $data;
|
||||
return $returnvalue;
|
||||
}elseif(is_float($data)){
|
||||
$returnvalue['double'] = $data;
|
||||
return $returnvalue;
|
||||
}elseif(is_bool($data)){
|
||||
$returnvalue['boolean'] = ($data ? 1 : 0);
|
||||
return $returnvalue;
|
||||
}elseif(preg_match('/^\d{8}T\d{2}:\d{2}:\d{2}$/', $data, $matches)){ #it's a date
|
||||
$returnvalue['dateTime.iso8601'] = $data;
|
||||
return $returnvalue;
|
||||
}elseif(is_string($data)){
|
||||
$returnvalue['string'] = htmlspecialchars($data);
|
||||
return $returnvalue;
|
||||
}
|
||||
}else{
|
||||
$returnvalue[$type] = htmlspecialchars($data);
|
||||
}
|
||||
}
|
||||
return $returnvalue;
|
||||
}
|
||||
|
||||
function & XMLRPC_adjustValue(&$current_node){
|
||||
if(is_array($current_node)){
|
||||
if(isset($current_node['array'])){
|
||||
if(!is_array($current_node['array']['data'])){
|
||||
#If there are no elements, return an empty array
|
||||
return array();
|
||||
}else{
|
||||
#echo "Getting rid of array -> data -> value<br>\n";
|
||||
$temp = &$current_node['array']['data']['value'];
|
||||
if(is_array($temp) and array_key_exists(0, $temp)){
|
||||
$count = count($temp);
|
||||
for($n=0;$n<$count;$n++){
|
||||
$temp2[$n] = &XMLRPC_adjustValue($temp[$n]);
|
||||
}
|
||||
$temp = &$temp2;
|
||||
}else{
|
||||
$temp2 = &XMLRPC_adjustValue($temp);
|
||||
$temp = array(&$temp2);
|
||||
#I do the temp assignment because it avoids copying,
|
||||
# since I can put a reference in the array
|
||||
#PHP's reference model is a bit silly, and I can't just say:
|
||||
# $temp = array(&XMLRPC_adjustValue(&$temp));
|
||||
}
|
||||
}
|
||||
}elseif(isset($current_node['struct'])){
|
||||
if(!is_array($current_node['struct'])){
|
||||
#If there are no members, return an empty array
|
||||
return array();
|
||||
}else{
|
||||
#echo "Getting rid of struct -> member<br>\n";
|
||||
$temp = &$current_node['struct']['member'];
|
||||
if(is_array($temp) and array_key_exists(0, $temp)){
|
||||
$count = count($temp);
|
||||
for($n=0;$n<$count;$n++){
|
||||
#echo "Passing name {$temp[$n][name]}. Value is: " . show($temp[$n][value], var_dump, true) . "<br>\n";
|
||||
$temp2[$temp[$n]['name']] = &XMLRPC_adjustValue($temp[$n]['value']);
|
||||
#echo "adjustValue(): After assigning, the value is " . show($temp2[$temp[$n]['name']], var_dump, true) . "<br>\n";
|
||||
}
|
||||
}else{
|
||||
#echo "Passing name $temp[name]<br>\n";
|
||||
$temp2[$temp['name']] = &XMLRPC_adjustValue($temp['value']);
|
||||
}
|
||||
$temp = &$temp2;
|
||||
}
|
||||
}else{
|
||||
$types = array('string', 'int', 'i4', 'double', 'dateTime.iso8601', 'base64', 'boolean');
|
||||
$fell_through = true;
|
||||
foreach($types as $type){
|
||||
if(array_key_exists($type, $current_node)){
|
||||
#echo "Getting rid of '$type'<br>\n";
|
||||
$temp = &$current_node[$type];
|
||||
#echo "adjustValue(): The current node is set with a type of $type<br>\n";
|
||||
$fell_through = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($fell_through){
|
||||
$type = 'string';
|
||||
#echo "Fell through! Type is $type<br>\n";
|
||||
}
|
||||
switch ($type){
|
||||
case 'int': case 'i4': $temp = (int)$temp; break;
|
||||
case 'string': $temp = (string)$temp; break;
|
||||
case 'double': $temp = (double)$temp; break;
|
||||
case 'boolean': $temp = (bool)$temp; break;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$temp = (string)$current_node;
|
||||
}
|
||||
return $temp;
|
||||
}
|
||||
|
||||
function XMLRPC_getParams($request){
|
||||
if(!is_array($request['methodCall']['params'])){
|
||||
#If there are no parameters, return an empty array
|
||||
return array();
|
||||
}else{
|
||||
#echo "Getting rid of methodCall -> params -> param<br>\n";
|
||||
$temp = &$request['methodCall']['params']['param'];
|
||||
if(is_array($temp) and array_key_exists(0, $temp)){
|
||||
$count = count($temp);
|
||||
for($n = 0; $n < $count; $n++){
|
||||
#echo "Serializing parameter $n<br>";
|
||||
$temp2[$n] = &XMLRPC_adjustValue($temp[$n]['value']);
|
||||
}
|
||||
}else{
|
||||
$temp2[0] = &XMLRPC_adjustValue($temp['value']);
|
||||
}
|
||||
$temp = &$temp2;
|
||||
return $temp;
|
||||
}
|
||||
}
|
||||
|
||||
function XMLRPC_getMethodName($methodCall){
|
||||
#returns the method name
|
||||
return $methodCall['methodCall']['methodName'];
|
||||
}
|
||||
|
||||
function XMLRPC_request($site, $location, $methodName, $params = NULL, $user_agent = NULL){
|
||||
$site = explode(':', $site);
|
||||
if(isset($site[1]) and is_numeric($site[1])){
|
||||
$port = $site[1];
|
||||
}else{
|
||||
$port = 80;
|
||||
}
|
||||
$site = $site[0];
|
||||
|
||||
$data["methodCall"]["methodName"] = $methodName;
|
||||
$param_count = count($params);
|
||||
if(!$param_count){
|
||||
$data["methodCall"]["params"] = NULL;
|
||||
}else{
|
||||
for($n = 0; $n<$param_count; $n++){
|
||||
$data["methodCall"]["params"]["param"][$n]["value"] = $params[$n];
|
||||
}
|
||||
}
|
||||
$data = XML_serialize($data);
|
||||
|
||||
if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
|
||||
XMLRPC_debug('XMLRPC_request', "<p>Received the following parameter list to send:</p>" . XMLRPC_show($params, 'print_r', true));
|
||||
}
|
||||
$conn = fsockopen ($site, $port); #open the connection
|
||||
if(!$conn){ #if the connection was not opened successfully
|
||||
if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
|
||||
XMLRPC_debug('XMLRPC_request', "<p>Connection failed: Couldn't make the connection to $site.</p>");
|
||||
}
|
||||
return array(false, array('faultCode'=>10532, 'faultString'=>"Connection failed: Couldn't make the connection to $site."));
|
||||
}else{
|
||||
$headers =
|
||||
"POST $location HTTP/1.0\r\n" .
|
||||
"Host: $site\r\n" .
|
||||
"Connection: close\r\n" .
|
||||
($user_agent ? "User-Agent: $user_agent\r\n" : '') .
|
||||
"Content-Type: text/xml\r\n" .
|
||||
"Content-Length: " . strlen($data) . "\r\n\r\n";
|
||||
|
||||
fputs($conn, "$headers");
|
||||
fputs($conn, $data);
|
||||
|
||||
if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
|
||||
XMLRPC_debug('XMLRPC_request', "<p>Sent the following request:</p>\n\n" . XMLRPC_show($headers . $data, 'print_r', true));
|
||||
}
|
||||
|
||||
#socket_set_blocking ($conn, false);
|
||||
$response = "";
|
||||
while(!feof($conn)){
|
||||
$response .= fgets($conn, 1024);
|
||||
}
|
||||
fclose($conn);
|
||||
|
||||
#strip headers off of response
|
||||
$data = XML_unserialize(substr($response, strpos($response, "\r\n\r\n")+4));
|
||||
|
||||
if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
|
||||
XMLRPC_debug('XMLRPC_request', "<p>Received the following response:</p>\n\n" . XMLRPC_show($response, 'print_r', true) . "<p>Which was serialized into the following data:</p>\n\n" . XMLRPC_show($data, 'print_r', true));
|
||||
}
|
||||
if(isset($data['methodResponse']['fault'])){
|
||||
$return = array(false, XMLRPC_adjustValue($data['methodResponse']['fault']['value']));
|
||||
if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
|
||||
XMLRPC_debug('XMLRPC_request', "<p>Returning:</p>\n\n" . XMLRPC_show($return, 'var_dump', true));
|
||||
}
|
||||
return $return;
|
||||
}else{
|
||||
$return = array(true, XMLRPC_adjustValue($data['methodResponse']['params']['param']['value']));
|
||||
if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
|
||||
XMLRPC_debug('XMLRPC_request', "<p>Returning:</p>\n\n" . XMLRPC_show($return, 'var_dump', true));
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function XMLRPC_response($return_value, $server = NULL){
|
||||
$data["methodResponse"]["params"]["param"]["value"] = &$return_value;
|
||||
$return = XML_serialize($data);
|
||||
|
||||
if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
|
||||
XMLRPC_debug('XMLRPC_response', "<p>Received the following data to return:</p>\n\n" . XMLRPC_show($return_value, 'print_r', true));
|
||||
}
|
||||
|
||||
header("Connection: close");
|
||||
header("Content-Length: " . strlen($return));
|
||||
header("Content-Type: text/xml");
|
||||
header("Date: " . date("r"));
|
||||
if($server){
|
||||
header("Server: $server");
|
||||
}
|
||||
|
||||
if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
|
||||
XMLRPC_debug('XMLRPC_response', "<p>Sent the following response:</p>\n\n" . XMLRPC_show($return, 'print_r', true));
|
||||
}
|
||||
echo $return;
|
||||
}
|
||||
|
||||
function XMLRPC_error($faultCode, $faultString, $server = NULL){
|
||||
$array["methodResponse"]["fault"]["value"]["struct"]["member"] = array();
|
||||
$temp = &$array["methodResponse"]["fault"]["value"]["struct"]["member"];
|
||||
$temp[0]["name"] = "faultCode";
|
||||
$temp[0]["value"]["int"] = $faultCode;
|
||||
$temp[1]["name"] = "faultString";
|
||||
$temp[1]["value"]["string"] = $faultString;
|
||||
|
||||
$return = XML_serialize($array);
|
||||
|
||||
header("Connection: close");
|
||||
header("Content-Length: " . strlen($return));
|
||||
header("Content-Type: text/xml");
|
||||
header("Date: " . date("r"));
|
||||
if($server){
|
||||
header("Server: $server");
|
||||
}
|
||||
if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
|
||||
XMLRPC_debug('XMLRPC_error', "<p>Sent the following error response:</p>\n\n" . XMLRPC_show($return, 'print_r', true));
|
||||
}
|
||||
echo $return;
|
||||
}
|
||||
|
||||
function XMLRPC_convert_timestamp_to_iso8601($timestamp){
|
||||
#takes a unix timestamp and converts it to iso8601 required by XMLRPC
|
||||
#an example iso8601 datetime is "20010822T03:14:33"
|
||||
return date("Ymd\TH:i:s", $timestamp);
|
||||
}
|
||||
|
||||
function XMLRPC_convert_iso8601_to_timestamp($iso8601){
|
||||
return strtotime($iso8601);
|
||||
}
|
||||
|
||||
function count_numeric_items(&$array){
|
||||
return is_array($array) ? count(array_filter(array_keys($array), 'is_numeric')) : 0;
|
||||
}
|
||||
|
||||
function XMLRPC_debug($function_name, $debug_message){
|
||||
$GLOBALS['XMLRPC_DEBUG_INFO'][] = array($function_name, $debug_message);
|
||||
}
|
||||
|
||||
function XMLRPC_debug_print(){
|
||||
if($GLOBALS['XMLRPC_DEBUG_INFO']){
|
||||
echo "<table border=\"1\" width=\"100%\">\n";
|
||||
foreach($GLOBALS['XMLRPC_DEBUG_INFO'] as $debug){
|
||||
echo "<tr><th style=\"vertical-align: top\">$debug[0]</th><td>$debug[1]</td></tr>\n";
|
||||
}
|
||||
echo "</table>\n";
|
||||
unset($GLOBALS['XMLRPC_DEBUG_INFO']);
|
||||
}else{
|
||||
echo "<p>No debugging information available yet.</p>";
|
||||
}
|
||||
}
|
||||
|
||||
function XMLRPC_show($data, $func = "print_r", $return_str = false){
|
||||
ob_start();
|
||||
$func($data);
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
if($return_str){
|
||||
return "<pre>" . htmlspecialchars($output) . "</pre>\n";
|
||||
}else{
|
||||
echo "<pre>", htmlspecialchars($output), "</pre>\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -20,11 +20,10 @@
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
--
|
||||
-- $Id$
|
||||
-- $Source$
|
||||
--
|
||||
|
||||
--
|
||||
-- Ne pas place de commentaire en fin de ligne, ce fichier est parsé lors
|
||||
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parse lors
|
||||
-- de l'install et tous les sigles '--' sont supprimés.
|
||||
--
|
||||
|
||||
@ -129,14 +128,6 @@ insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAILM
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAILMAN_SERVER','lists.domain.com','chaine','Serveur hebergeant les interfaces d''Admin des listes mailman',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAILMAN_LISTS_COTISANT','','chaine','Liste(s) auxquelles les nouveaux cotisants sont inscris automatiquement',0);
|
||||
--
|
||||
-- Glasnost
|
||||
--
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_USE_GLASNOST','0','yesno','utilisation de glasnost ?',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_GLASNOST_SERVEUR','glasnost.j1b.org','chaine','serveur glasnost',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_GLASNOST_USER','user','chaine','Administrateur glasnost',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_GLASNOST_PASS','password','chaine','password de l''administrateur',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_USE_GLASNOST_AUTO','0','yesno','inscription automatique a glasnost ?',0);
|
||||
--
|
||||
-- SPIP
|
||||
--
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_USE_SPIP','0','yesno','Utilisation de SPIP ?',0);
|
||||
|
||||
@ -21,11 +21,10 @@
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
--
|
||||
-- $Id$
|
||||
-- $Source$
|
||||
--
|
||||
|
||||
--
|
||||
-- Ne pas place de commentaire en fin de ligne, ce fichier est parsé lors
|
||||
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
|
||||
-- de l'install et tous les sigles '--' sont supprimés.
|
||||
--
|
||||
|
||||
@ -147,14 +146,6 @@ insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAILM
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAILMAN_SERVER','lists.domain.com','chaine','Serveur hebergeant les interfaces d Admin des listes mailman',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAILMAN_LISTS_COTISANT','','chaine','Liste(s) auxquelles les nouveaux cotisants sont inscris automatiquement',0);
|
||||
--
|
||||
-- Glasnost
|
||||
--
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_USE_GLASNOST','0','yesno','utilisation de glasnost ?',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_GLASNOST_SERVEUR','glasnost.j1b.org','chaine','serveur glasnost',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_GLASNOST_USER','user','chaine','Administrateur glasnost',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_GLASNOST_PASS','password','chaine','password de l administrateur',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_USE_GLASNOST_AUTO','0','yesno','inscription automatique a glasnost ?',0);
|
||||
--
|
||||
-- SPIP
|
||||
--
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_USE_SPIP','0','yesno','Utilisation de SPIP ?',0);
|
||||
|
||||
@ -19,11 +19,10 @@
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
--
|
||||
-- $Id$
|
||||
-- $Source$
|
||||
--
|
||||
|
||||
--
|
||||
-- Ne pas place de commentaire en fin de ligne, ce fichier est parsé lors
|
||||
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
|
||||
-- de l'install et tous les sigles '--' sont supprimés.
|
||||
--
|
||||
|
||||
@ -94,14 +93,6 @@ insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAILM
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAILMAN_SERVER','lists.domain.com','chaine','Serveur hebergeant les interfaces d\'Admin des listes mailman',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAILMAN_LISTS_COTISANT','','chaine','Liste(s) auxquelles les nouveaux cotisants sont inscris automatiquement',0);
|
||||
--
|
||||
-- Glasnost
|
||||
--
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_USE_GLASNOST','0','yesno','utilisation de glasnost ?',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_GLASNOST_SERVEUR','glasnost.j1b.org','chaine','serveur glasnost',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_GLASNOST_USER','user','chaine','Administrateur glasnost',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_GLASNOST_PASS','password','chaine','password de l\'administrateur',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_USE_GLASNOST_AUTO','0','yesno','inscription automatique a glasnost ?',0);
|
||||
--
|
||||
-- SPIP
|
||||
--
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_USE_SPIP','0','yesno','Utilisation de SPIP ?',0);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user