New: Les triggers webcalendar grent les modif d'tat du module adhrent.

Qual: Amlioration de la gestion d'erreur des triggers. La totalit des erreurs de chaque triggers est remonte dans un tableau.
This commit is contained in:
Laurent Destailleur 2007-02-11 16:32:29 +00:00
parent b33e19c7a9
commit fe7df68ef4
11 changed files with 277 additions and 78 deletions

View File

@ -85,6 +85,7 @@ class Adherent
var $array_options;
var $error;
var $errors=array();
/**
@ -364,25 +365,25 @@ class Adherent
return -1;
}
$this->use_webcal=($conf->global->PHPWEBCALENDAR_MEMBERSTATUS=='always'?1:0);
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('MEMBER_CREATE',$this,$user,$langs,$conf);
if ($result < 0) $error++;
if ($result < 0) $this->errors=$interface->errors;
// Fin appel triggers
if ($error)
if (sizeof($this->errors))
{
$this->error=$interface->error;
$this->db->rollback();
return -1;
}
else
{
$this->db->commit();
return $this->id;
}
return $this->id;
}
else
{
@ -486,11 +487,13 @@ class Adherent
if (! $notrigger)
{
// Appel des triggers
$this->use_webcal=($conf->global->PHPWEBCALENDAR_MEMBERSTATUS=='always'?1:0);
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('MEMBER_MODIFY',$this,$user,$langs,$conf);
if ($result < 0) $error++;
if ($result < 0) $this->errors=$interface->errors;
// Fin appel triggers
}
@ -503,7 +506,7 @@ class Adherent
/**
\brief Fonction qui supprime l'adhérent et les données associées
\param rowid
\return int <0 si KO, >0 si OK
\return int <0 si KO, 0 = rien a effacer, >0 si OK
*/
function delete($rowid)
{
@ -522,38 +525,50 @@ class Adherent
$resql=$this->db->query( $sql);
if ($resql)
{
}
else
{
dolibarr_print_error($this->db);
return -1;
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".$rowid;
dolibarr_syslog("Adherent.class::delete sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
if ($this->db->affected_rows($resql))
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".$rowid;
dolibarr_syslog("Adherent.class::delete sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('MEMBER_DELETE',$this,$user,$langs,$conf);
if ($result < 0) $error++;
// Fin appel triggers
if ($this->db->affected_rows($resql))
{
$this->use_webcal=($conf->global->PHPWEBCALENDAR_MEMBERSTATUS=='always'?1:0);
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('MEMBER_DELETE',$this,$user,$langs,$conf);
if ($result < 0) $this->errors=$interface->errors;
// Fin appel triggers
$this->db->commit();
return 1;
}
else
{
// Rien a effacer
$this->db->rollback();
return 0;
}
}
else
{
$this->error=$this->db->error();
$this->db->rollback();
return -3;
}
}
else
{
dolibarr_print_error($this->db);
return -1;
$this->error=$this->db->error();
$this->db->rollback();
return -2;
}
}
else
{
dolibarr_print_error($this->db);
$this->error=$this->db->error();
$this->db->rollback();
return -1;
}
@ -824,11 +839,18 @@ class Adherent
}
}
// Ajout de propriétés pour le triggers
$this->last_subscription_date=$dateop;
$this->last_subscription_date_start=$date;
$this->last_subscription_date_end=$datefin;
$this->last_subscription_amount=$montant;
$this->use_webcal=($conf->global->PHPWEBCALENDAR_MEMBERSTATUS=='always'?1:0);
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('MEMBER_SUBSCRIPTION',$this,$user,$langs,$conf);
if ($result < 0) $error++;
if ($result < 0) $this->errors=$interface->errors;
// Fin appel triggers
$this->db->commit();
@ -869,11 +891,13 @@ class Adherent
$result = $this->db->query($sql);
if ($result)
{
$this->use_webcal=($conf->global->PHPWEBCALENDAR_MEMBERSTATUS=='always'?1:0);
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('MEMBER_VALIDATE',$this,$user,$langs,$conf);
if ($result < 0) $error++;
if ($result < 0) $this->errors=$interface->errors;
// Fin appel triggers
$this->db->commit();
@ -907,10 +931,13 @@ class Adherent
$result = $this->db->query($sql);
if ($result)
{
$this->use_webcal=($conf->global->PHPWEBCALENDAR_MEMBERSTATUS=='always'?1:0);
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('MEMBER_RESILIATE',$this,$user,$langs,$conf);
if ($result < 0) $this->errors=$interface->errors;
// Fin appel triggers
$this->db->commit();

View File

@ -62,7 +62,11 @@ if ($_POST["action"] == 'confirm_sendinfo' && $_POST["confirm"] == 'yes')
{
$adh->id = $rowid;
$adh->fetch($rowid);
$adh->send_an_email($adh->email,"Voici le contenu de votre fiche\n\n%INFOS%\n\n","Contenu de votre fiche adherent");
if ($adh->email)
{
$result=$adh->send_an_email($adh->email,"Voici le contenu de votre fiche\n\n%INFOS%\n\n","Contenu de votre fiche adherent");
}
}
if ($_POST["action"] == 'cotisation')
@ -115,7 +119,7 @@ if ($_POST["action"] == 'cotisation')
$db->commit();
// Envoi mail
if ($conf->global->ADHERENT_MAIL_COTIS)
if ($adh->email && $conf->global->ADHERENT_MAIL_COTIS)
{
$adh->send_an_email($adh->email,$conf->global->ADHERENT_MAIL_COTIS,$conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
}
@ -183,14 +187,27 @@ if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"])
$adh->array_options[$key]=addslashes($_POST[$key]);
}
}
if ($adh->update($user,0) >= 0)
$result=$adh->update($user,0);
if ($result >= 0 && ! sizeof($adh->errors))
{
Header("Location: fiche.php?rowid=".$adh->id);
exit;
}
else
{
$errmsg=$adh->error;
if ($adh->error)
{
$errmsg=$adh->error;
}
else
{
foreach($adh->errors as $error)
{
if ($errmsg) $errmsg.='<br>';
$errmsg.=$error;
}
}
$action='';
}
}
@ -363,21 +380,50 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == 'yes')
{
$adh->id=$rowid;
$adh->validate($user);
$adh->fetch($rowid);
$adht = new AdherentType($db);
$adht->fetch($adh->typeid);
if (isset($adht->mail_valid) && $adht->mail_valid)
{
$result=$adh->send_an_email($adh->email,$adht->mail_valid,$conf->adherent->email_valid_subject);
}
else
{
$result=$adh->send_an_email($adh->email,$conf->global->ADHERENT_MAIL_VALID,$conf->global->ADHERENT_MAIL_VALID_SUBJECT);
}
$result=$adh->validate($user);
if ($result >= 0 && ! sizeof($adh->errors))
{
}
else
{
if ($adh->error)
{
$errmsg=$adh->error;
}
else
{
foreach($adh->errors as $error)
{
if ($errmsg) $errmsg.='<br>';
$errmsg.=$error;
}
}
$action='';
}
// Envoi mail validation (selon param du type adherent sinon generique)
if ($adh->email)
{
if (isset($adht->mail_valid) && $adht->mail_valid)
{
$result=$adh->send_an_email($adh->email,$adht->mail_valid,$conf->adherent->email_valid_subject);
}
else
{
$result=$adh->send_an_email($adh->email,$conf->global->ADHERENT_MAIL_VALID,$conf->global->ADHERENT_MAIL_VALID_SUBJECT);
}
if ($result < 0)
{
$errmsg.=$adh->error;
}
}
// Rajoute l'utilisateur dans les divers abonnements (mailman, spip, etc...)
if ($adh->add_to_abo($adht) < 0)
{
@ -396,8 +442,11 @@ if ($_POST["action"] == 'confirm_resign' && $_POST["confirm"] == 'yes')
$adht = new AdherentType($db);
$adht->fetch($adh->typeid);
$adh->send_an_email($adh->email,$conf->adherent->email_resil,$conf->adherent->email_resil_subject);
if ($adh->email)
{
$result=$adh->send_an_email($adh->email,$conf->adherent->email_resil,$conf->adherent->email_resil_subject);
}
// supprime l'utilisateur des divers abonnements ..
if (! $adh->del_to_abo($adht))
{

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Éric Seigne <erics@rycks.com>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* 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>
*
@ -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 '</select>';
print '</td></tr>';
}
if ($conf->adherent->enabled)
{
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("WebCalAddEventOnStatusMember").'</td>';
print '<td>';
print '<select name="phpwebcalendar_memberstatus" class="flat">';
print '<option value="always"'.($conf->global->PHPWEBCALENDAR_MEMBERSTATUS=='always'?' selected="true"':'').'>'.$langs->trans("WebCalAllways").'</option>';
print '<option value="never"'.(! $conf->global->PHPWEBCALENDAR_MEMBERSTATUS || $conf->global->PHPWEBCALENDAR_MEMBERSTATUS=='never'?' selected="true"':'').'>'.$langs->trans("WebCalNever").'</option>';
print '</select>';
print '</td></tr>';
}
print '</table>';

View File

@ -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 '<tr><td width="25%" nowrap>'.$langs->trans("AddCalendarEntry").'</td>';
print '<td><input type="checkbox" disabled name="todo_webcal">';
print '<td><input type="checkbox" disabled name="add_webcal">';
print ' '.$langs->transnoentities("ErrorWebcalLoginNotDefined","<a href=\"".DOL_URL_ROOT."/user/fiche.php?id=".$user->id."\">".$user->login."</a>");
print '</td>';
print '</tr>';
@ -810,12 +810,12 @@ function add_row_for_webcal_link()
{
if ($conf->global->PHPWEBCALENDAR_SYNCRO == 'always')
{
print '<input type="hidden" name="todo_webcal" value="on">';
print '<input type="hidden" name="add_webcal" value="on">';
}
else
{
print '<tr><td width="25%" nowrap>'.$langs->trans("AddCalendarEntry").'</td>';
print '<td><input type="checkbox" name="todo_webcal"'.(($conf->global->PHPWEBCALENDAR_SYNCRO=='always' || $conf->global->PHPWEBCALENDAR_SYNCRO=='yesbydefault')?' checked':'').'></td>';
print '<td><input type="checkbox" name="add_webcal"'.(($conf->global->PHPWEBCALENDAR_SYNCRO=='always' || $conf->global->PHPWEBCALENDAR_SYNCRO=='yesbydefault')?' checked':'').'></td>';
print '</tr>';
$nbtr++;
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005-2007 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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;
}
}

View File

@ -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;
}
}
}
?>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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","<a href=\"".DOL_URL_ROOT."/user/fiche.php?id=".$user->id."\">".$user->login."</a>");
if (! $user->webcal_login)
{
$langs->load("other");
$this->error=$langs->transnoentities("ErrorWebcalLoginNotDefined","<a href=\"".DOL_URL_ROOT."/user/fiche.php?id=".$user->id."\">".$user->login."</a>");
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() . '<br>' .$sql;
dolibarr_syslog("Webcal::add ERROR ".$this->error);
return -1;
}
}
@ -131,6 +138,7 @@ class Webcal {
{
$this->localdb->rollback();
$this->error = $this->localdb->error() . '<br>' .$sql;
dolibarr_syslog("Webcal::add ERROR ".$this->error);
return -2;
}
}
@ -138,6 +146,7 @@ class Webcal {
{
$this->localdb->rollback();
$this->error = $this->localdb->error() . '<br>' .$sql;
dolibarr_syslog("Webcal::add ERROR ".$this->error);
return -3;
}
}