*
@@ -63,6 +63,7 @@ if ($actionsave)
$i+=dolibarr_set_const($db,'PHPWEBCALENDAR_PROPALSTATUS',trim($_POST["phpwebcalendar_propalstatus"]),'chaine',0);
$i+=dolibarr_set_const($db,'PHPWEBCALENDAR_CONTRACTSTATUS',trim($_POST["phpwebcalendar_contractstatus"]),'chaine',0);
$i+=dolibarr_set_const($db,'PHPWEBCALENDAR_BILLSTATUS',trim($_POST["phpwebcalendar_billstatus"]),'chaine',0);
+ $i+=dolibarr_set_const($db,'PHPWEBCALENDAR_MEMBERSTATUS',trim($_POST["phpwebcalendar_memberstatus"]),'chaine',0);
if ($i >= 9)
{
@@ -259,6 +260,18 @@ if ($conf->facture->enabled)
print '';
print '';
}
+if ($conf->adherent->enabled)
+{
+ $var=!$var;
+ print '';
+ print '| '.$langs->trans("WebCalAddEventOnStatusMember").' | ';
+ print '';
+ print '';
+ print ' |
';
+}
print '';
diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php
index f94dfec4369..cec21712ec0 100644
--- a/htdocs/comm/action/fiche.php
+++ b/htdocs/comm/action/fiche.php
@@ -160,7 +160,7 @@ if ($_POST["action"] == 'add_action')
$societe->fetch($_REQUEST["socid"]);
$actioncomm->societe = $societe;
}
- if ($_POST["todo_webcal"] == 'on') $actioncomm->use_webcal=1;
+ if ($_POST["add_webcal"] == 'on') $actioncomm->use_webcal=1;
// On crée l'action
$idaction=$actioncomm->add($user);
@@ -800,7 +800,7 @@ function add_row_for_webcal_link()
if (! $user->webcal_login)
{
print '| '.$langs->trans("AddCalendarEntry").' | ';
- print '';
+ print ' | ';
print ' '.$langs->transnoentities("ErrorWebcalLoginNotDefined","id."\">".$user->login."");
print ' | ';
print '
';
@@ -810,12 +810,12 @@ function add_row_for_webcal_link()
{
if ($conf->global->PHPWEBCALENDAR_SYNCRO == 'always')
{
- print '';
+ print '';
}
else
{
print '| '.$langs->trans("AddCalendarEntry").' | ';
- print 'global->PHPWEBCALENDAR_SYNCRO=='always' || $conf->global->PHPWEBCALENDAR_SYNCRO=='yesbydefault')?' checked':'').'> | ';
+ print 'global->PHPWEBCALENDAR_SYNCRO=='always' || $conf->global->PHPWEBCALENDAR_SYNCRO=='yesbydefault')?' checked':'').'> | ';
print '
';
$nbtr++;
}
diff --git a/htdocs/includes/triggers/interface_webcal.class.php b/htdocs/includes/triggers/interface_webcal.class.php
index d2ae8d29057..dafeb5ff586 100644
--- a/htdocs/includes/triggers/interface_webcal.class.php
+++ b/htdocs/includes/triggers/interface_webcal.class.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2005-2007 Laurent Destailleur
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -141,6 +141,7 @@ class InterfaceWebCal
$this->desc=$libellecal;
}
+ // Third parties
elseif ($action == 'COMPANY_CREATE')
{
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
@@ -157,6 +158,7 @@ class InterfaceWebCal
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
}
+ // Contracts
elseif ($action == 'CONTRACT_VALIDATE')
{
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
@@ -191,6 +193,8 @@ class InterfaceWebCal
$this->desc=$langs->trans("ContractClosedInDolibarr",$object->ref);
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
}
+
+ // Proposals
elseif ($action == 'PROPAL_VALIDATE')
{
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
@@ -225,7 +229,8 @@ class InterfaceWebCal
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
}
- elseif ($action == 'BILL_VALIDATE')
+ // Invoices
+ elseif ($action == 'BILL_VALIDATE')
{
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
@@ -258,6 +263,7 @@ class InterfaceWebCal
$this->desc=$langs->trans("InvoiceCanceledInDolibarr",$object->ref);
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
}
+
// Payments
elseif ($action == 'PAYMENT_CUSTOMER_CREATE')
{
@@ -283,6 +289,70 @@ class InterfaceWebCal
$this->desc.="\n".$langs->trans("AmountTTC").': '.$object->total;
$this->desc.="\n".$langs->trans("Author").': '.$user->code;
}
+
+ // Members
+ elseif ($action == 'MEMBER_CREATE')
+ {
+ }
+ elseif ($action == 'MEMBER_VALIDATE')
+ {
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
+ $langs->load("other");
+ $langs->load("members");
+
+ $this->date=time();
+ $this->duree=0;
+ $this->texte=$langs->trans("MemberValidatedInDolibarr",$object->id);
+ $this->desc=$langs->trans("MemberValidatedInDolibarr",$object->id);
+ $this->desc.="\n".$langs->trans("Name").': '.$object->fullname;
+ $this->desc.="\n".$langs->trans("Type").': '.$object->type;
+ $this->desc.="\n".$langs->trans("Author").': '.$user->code;
+ }
+ elseif ($action == 'MEMBER_SUBSCRIPTION')
+ {
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
+ $langs->load("other");
+ $langs->load("members");
+
+ $this->date=time();
+ $this->duree=0;
+ $this->texte=$langs->trans("MemberSubscriptionInDolibarr",$object->id);
+ $this->desc=$langs->trans("MemberSubscriptionInDolibarr",$object->id);
+ $this->desc.="\n".$langs->trans("Name").': '.$object->fullname;
+ $this->desc.="\n".$langs->trans("Type").': '.$object->type;
+ $this->desc.="\n".$langs->trans("Amount").': '.$object->last_subscription_amount;
+ $this->desc.="\n".$langs->trans("Period").': '.dolibarr_print_date($object->last_subscription_date_start,'day').' - '.dolibarr_print_date($object->last_subscription_date_end,'day');
+ $this->desc.="\n".$langs->trans("Author").': '.$user->code;
+ }
+ elseif ($action == 'MEMBER_RESILIATE')
+ {
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
+ $langs->load("other");
+ $langs->load("members");
+
+ $this->date=time();
+ $this->duree=0;
+ $this->texte=$langs->trans("MemberResiliatedInDolibarr",$object->id);
+ $this->desc=$langs->trans("MemberResiliatedInDolibarr",$object->id);
+ $this->desc.="\n".$langs->trans("Name").': '.$object->fullname;
+ $this->desc.="\n".$langs->trans("Type").': '.$object->type;
+ $this->desc.="\n".$langs->trans("Author").': '.$user->code;
+ }
+ elseif ($action == 'MEMBER_DELETE')
+ {
+ dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
+ $langs->load("other");
+ $langs->load("members");
+
+ $this->date=time();
+ $this->duree=0;
+ $this->texte=$langs->trans("MemberDeletedInDolibarr",$object->id);
+ $this->desc=$langs->trans("MemberDeletedInDolibarr",$object->id);
+ $this->desc.="\n".$langs->trans("Name").': '.$object->fullname;
+ $this->desc.="\n".$langs->trans("Type").': '.$object->type;
+ $this->desc.="\n".$langs->trans("Author").': '.$user->code;
+ }
+
// If not found
/*
else
@@ -301,11 +371,11 @@ class InterfaceWebCal
if (! $webcal->localdb->ok)
{
// Si la creation de l'objet n'as pu se connecter
- $error ="Dolibarr n'a pu se connecter à la base Webcalendar avec les identifiants définis (host=".$conf->webcal->db->host." dbname=".$conf->webcal->db->name." user=".$conf->webcal->db->user.").";
- $error.=" L'option de mise a jour Webcalendar a été ignorée.";
+ $error ="Dolibarr n'a pu se connecter à la base Webcalendar avec les identifiants définis (host=".$conf->webcal->db->host." dbname=".$conf->webcal->db->name." user=".$conf->webcal->db->user."). ";
+ $error.="La mise a jour Webcalendar a été ignorée.";
$this->error=$error;
- dolibarr_syslog("interface_webcal.class.php: ".$this->error);
+ //dolibarr_syslog("interface_webcal.class.php: ".$this->error);
return -1;
}
@@ -321,8 +391,12 @@ class InterfaceWebCal
}
else
{
- $this->error="Echec insertion dans webcal: ".$webcal->error;
- return -1;
+ $error ="Echec insertion dans webcal: ".$webcal->error." ";
+ $error.="La mise a jour Webcalendar a été ignorée.";
+ $this->error=$error;
+
+ //dolibarr_syslog("interface_webcal.class.php: ".$this->error);
+ return -2;
}
}
diff --git a/htdocs/interfaces.class.php b/htdocs/interfaces.class.php
index fcbc6b7f76d..c750f8048e7 100644
--- a/htdocs/interfaces.class.php
+++ b/htdocs/interfaces.class.php
@@ -35,7 +35,8 @@
class Interfaces
{
- var $dir; // Repertoire contenant les fichiers triggers
+ var $dir; // Directory with all trigger files
+ var $errors=array(); // Array for errors
/**
* \brief Constructeur.
@@ -49,20 +50,20 @@ class Interfaces
/**
* \brief Fonction appelée lors du déclenchement d'un évènement Dolibarr.
- * Cette fonction déclenche tous les triggers trouvés
+ * Cette fonction déclenche tous les triggers trouvés actifs.
* \param action Code de l'evenement
* \param object Objet concern
* \param user Objet user
* \param lang Objet lang
* \param conf Objet conf
- * \return int Nbre de triggers déclenchés si pas d'erreurs. Nb en erreur sinon.
+ * \return int Nb triggers déclenchés si pas d'erreurs, -Nb en erreur sinon.
*/
function run_triggers($action,$object,$user,$lang,$conf)
{
$handle=opendir($this->dir);
$modules = array();
- $nbok = $nbko = 0;
+ $nbtotal = $nbok = $nbko = 0;
while (($file = readdir($handle))!==false)
{
@@ -83,13 +84,24 @@ class Interfaces
if ($objMod)
{
$modules[$i] = $modName;
- if ($objMod->run_trigger($action,$object,$user,$lang,$conf) > 0)
+ $result=$objMod->run_trigger($action,$object,$user,$lang,$conf);
+ if ($result > 0)
{
+ // Action OK
+ $nbtotal++;
$nbok++;
}
- else
+ if ($result == 0)
{
+ // Aucune action faite
+ $nbtotal++;
+ }
+ if ($result < 0)
+ {
+ // Action KO
+ $nbtotal++;
$nbko++;
+ $this->errors[]=$objMod->error;
}
$i++;
}
@@ -97,8 +109,15 @@ class Interfaces
}
}
}
- if ($nbko) return $nbko;
- return $nbok;
+ if ($nbko)
+ {
+ dolibarr_syslog("Interfaces::run_triggers Found: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko);
+ return -$nbko;
+ }
+ else
+ {
+ return $nbok;
+ }
}
}
?>
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 14654960225..a62e02e4bbc 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -458,9 +458,10 @@ WebCalTestKo2=Connection to server '%s' with user '%s' failed.
WebCalErrorConnectOkButWrongDatabase=Connection succeeded but database doesn't look to be a Webcalendar database.
WebCalAddEventOnCreateActions=Add calendar event on actions create
WebCalAddEventOnCreateCompany=Add calendar event on companies create
-WebCalAddEventOnStatusPropal=Add calendar event on commercial proposal status change
-WebCalAddEventOnStatusContract=Add calendar event on contract status change
-WebCalAddEventOnStatusBill=Add calendar event on bill status change
+WebCalAddEventOnStatusPropal=Add calendar event on commercial proposals status change
+WebCalAddEventOnStatusContract=Add calendar event on contracts status change
+WebCalAddEventOnStatusBill=Add calendar event on bills status change
+WebCalAddEventOnStatusMember=Add calendar event on members status change
##### Invoices #####
BillsSetup=Invoices module setup
BillsDate=Invoices date
diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang
index 6a397f6f1e1..002fc6d0796 100644
--- a/htdocs/langs/en_US/other.lang
+++ b/htdocs/langs/en_US/other.lang
@@ -80,6 +80,9 @@ InvoiceCanceledInDolibarr=Invoice %s canceled in Dolibarr
PaymentDoneInDolibarr=Payment %s done in Dolibarr
CustomerPaymentDoneInDolibarr=Customer payment %s done in Dolibarr
SupplierPaymentDoneInDolibarr=Supplier payment %s done in Dolibarr
+MemberValidatedInDolibarr=Member %s validated in Dolibarr
+MemberResiliatedInDolibarr=Member %s resiliated in Dolibarr
+MemberDeletedInDolibarr=Member %s deleted from Dolibarr
##### Export #####
ExportsArea=Exports area
AvailableFormats=Available formats
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index ab5e5e345c9..5d9fa8d7dfb 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -460,6 +460,7 @@ WebCalAddEventOnCreateCompany=Ajouter
WebCalAddEventOnStatusPropal=Ajouter évênement dans calendrier sur changement de statut des propositions commerciales
WebCalAddEventOnStatusContract=Ajouter évênement dans calendrier sur changement de statut des contrats
WebCalAddEventOnStatusBill=Ajouter évênement dans calendrier sur changement de statut des factures
+WebCalAddEventOnStatusMember=Ajouter évênement dans calendrier sur changement de statut des adhérents
##### Invoices #####
BillsSetup=Configuration du module Factures
BillsDate=Date des factures
diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang
index 2dcf00ebb5c..6252269e37b 100644
--- a/htdocs/langs/fr_FR/other.lang
+++ b/htdocs/langs/fr_FR/other.lang
@@ -80,6 +80,9 @@ InvoiceCanceledInDolibarr=Facture %s annul
PaymentDoneInDolibarr=Paiement %s réalisé dans Dolibarr
CustomerPaymentDoneInDolibarr=Paiement client %s dans Dolibarr
SupplierPaymentDoneInDolibarr=Paiement fournisseur %s dans Dolibarr
+MemberValidatedInDolibarr=Adhérent %s validé dans Dolibarr
+MemberResiliatedInDolibarr=Adhérent %s résilié dans Dolibarr
+MemberDeletedInDolibarr=Adhérent %s supprimé de Dolibarr
##### Export #####
ExportsArea=Espace exports
AvailableFormats=Formats disponibles
diff --git a/htdocs/lib/webcal.class.php b/htdocs/lib/webcal.class.php
index 22e6cb16cac..2d3b81d788c 100644
--- a/htdocs/lib/webcal.class.php
+++ b/htdocs/lib/webcal.class.php
@@ -78,11 +78,14 @@ class Webcal {
{
global $langs;
- dolibarr_syslog("Webcal::add user=$user");
+ dolibarr_syslog("Webcal::add user=".$user);
// Test si login webcal défini pour le user
- if (! $user->webcal_login) {
- $this->error=$langs->trans("ErrorWebcalLoginNotDefined","id."\">".$user->login."");
+ if (! $user->webcal_login)
+ {
+ $langs->load("other");
+ $this->error=$langs->transnoentities("ErrorWebcalLoginNotDefined","id."\">".$user->login."");
+ dolibarr_syslog("Webcal::add ERROR ".$this->error);
return -4;
}
@@ -109,12 +112,15 @@ class Webcal {
$sql = "INSERT INTO webcal_entry (cal_id, cal_create_by,cal_date,cal_time,cal_mod_date, cal_mod_time,cal_duration,cal_priority,cal_type, cal_access, cal_name,cal_description)";
$sql.= " VALUES ($cal_id, '$cal_create_by', '$cal_date', '$cal_time', '$cal_mod_date', '$cal_mod_time', $cal_duration, $cal_priority, '$cal_type', '$cal_access', '$cal_name','$cal_description')";
- if ($this->localdb->query($sql))
+ dolibarr_syslog("Webcal::add sql=".$sql);
+ $resql=$this->localdb->query($sql);
+ if ($resql)
{
$sql = "INSERT INTO webcal_entry_user (cal_id, cal_login, cal_status)";
$sql .= " VALUES ($cal_id, '$cal_create_by', 'A')";
- if ( $this->localdb->query($sql) )
+ $resql=$this->localdb->query($sql);
+ if ($resql)
{
// OK
$this->localdb->commit();
@@ -124,6 +130,7 @@ class Webcal {
{
$this->localdb->rollback();
$this->error = $this->localdb->error() . '
' .$sql;
+ dolibarr_syslog("Webcal::add ERROR ".$this->error);
return -1;
}
}
@@ -131,6 +138,7 @@ class Webcal {
{
$this->localdb->rollback();
$this->error = $this->localdb->error() . '
' .$sql;
+ dolibarr_syslog("Webcal::add ERROR ".$this->error);
return -2;
}
}
@@ -138,6 +146,7 @@ class Webcal {
{
$this->localdb->rollback();
$this->error = $this->localdb->error() . '
' .$sql;
+ dolibarr_syslog("Webcal::add ERROR ".$this->error);
return -3;
}
}