Log file for error messages use LOG_ERR level.

This commit is contained in:
Laurent Destailleur
2009-03-12 22:49:05 +00:00
parent 439a0f3260
commit 1f3f2b8c44
34 changed files with 323 additions and 324 deletions

View File

@@ -45,7 +45,7 @@ class Cotisation extends CommonObject
var $note; var $note;
var $fk_bank; var $fk_bank;
/** /**
\brief Cotisation \brief Cotisation
\param DB Handler base de donn<6E>es \param DB Handler base de donn<6E>es
@@ -69,7 +69,7 @@ class Cotisation extends CommonObject
$this->error="Error: Bad value for datef or dateh"; $this->error="Error: Bad value for datef or dateh";
return -1; return -1;
} }
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, datec, dateadh, datef, cotisation, note)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, datec, dateadh, datef, cotisation, note)";
$sql.= " VALUES (".$this->fk_adherent.", ".$this->db->idate(mktime()).","; $sql.= " VALUES (".$this->fk_adherent.", ".$this->db->idate(mktime()).",";
$sql.= " ".$this->db->idate($this->dateh).","; $sql.= " ".$this->db->idate($this->dateh).",";
@@ -85,7 +85,7 @@ class Cotisation extends CommonObject
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog($this->error); dol_syslog($this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -149,7 +149,7 @@ class Cotisation extends CommonObject
function update($user,$notrigger=0) function update($user,$notrigger=0)
{ {
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."cotisation SET "; $sql = "UPDATE ".MAIN_DB_PREFIX."cotisation SET ";
$sql .= " fk_adherent = ".$this->fk_adherent.","; $sql .= " fk_adherent = ".$this->fk_adherent.",";
$sql .= " note=".($this->note ? "'".addslashes($this->note)."'" : 'null').","; $sql .= " note=".($this->note ? "'".addslashes($this->note)."'" : 'null').",";
@@ -175,7 +175,7 @@ class Cotisation extends CommonObject
{ {
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Cotisation::update ".$this->error); dol_syslog("Cotisation::update ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -249,22 +249,22 @@ class Cotisation extends CommonObject
function getNomUrl($withpicto=0) function getNomUrl($withpicto=0)
{ {
global $langs; global $langs;
$result=''; $result='';
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$this->id.'">'; $lien = '<a href="'.DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$this->id.'">';
$lienfin='</a>'; $lienfin='</a>';
$picto='payment'; $picto='payment';
$label=$langs->trans("ShowSubscription"); $label=$langs->trans("ShowSubscription");
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
$result.=$lien.$this->ref.$lienfin; $result.=$lien.$this->ref.$lienfin;
return $result; return $result;
} }
/** /**
* \brief Charge les informations d'ordre info dans l'objet cotisation * \brief Charge les informations d'ordre info dans l'objet cotisation
* \param id Id adhesion a charger * \param id Id adhesion a charger
@@ -275,7 +275,7 @@ class Cotisation extends CommonObject
$sql.= ' '.$this->db->pdate('c.tms').' as datem'; $sql.= ' '.$this->db->pdate('c.tms').' as datem';
$sql.= ' FROM '.MAIN_DB_PREFIX.'cotisation as c'; $sql.= ' FROM '.MAIN_DB_PREFIX.'cotisation as c';
$sql.= ' WHERE c.rowid = '.$id; $sql.= ' WHERE c.rowid = '.$id;
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)
{ {
@@ -295,6 +295,6 @@ class Cotisation extends CommonObject
{ {
dol_print_error($this->db); dol_print_error($this->db);
} }
} }
} }
?> ?>

View File

@@ -957,8 +957,7 @@ class Categorie
else else
{ {
$this->error=$this->db->error().' sql='.$sql; $this->error=$this->db->error().' sql='.$sql;
//dol_syslog($this->error); dol_syslog("Categorie::rechercher ".$this->error, LOG_ERR);
dol_print_error('',$this->error);
return -1; return -1;
} }
} }

View File

@@ -726,7 +726,7 @@ class Commande extends CommonObject
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Error sql=$sql, error=".$this->error); dol_syslog("Error sql=$sql, error=".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@@ -1066,7 +1066,7 @@ class Commande extends CommonObject
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog('Commande::fetch_lines: Error '.$this->error); dol_syslog('Commande::fetch_lines: Error '.$this->error, LOG_ERR);
return -3; return -3;
} }
} }
@@ -2259,7 +2259,7 @@ class CommandeLigne
else else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
dol_syslog("CommandeLigne::delete ".$this->error); dol_syslog("CommandeLigne::delete ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -2356,7 +2356,7 @@ class CommandeLigne
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("CommandeLigne::insert Error ".$this->error); dol_syslog("CommandeLigne::insert Error ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
@@ -2389,7 +2389,7 @@ class CommandeLigne
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("CommandeLigne::update_total Error ".$this->error); dol_syslog("CommandeLigne::update_total Error ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }

View File

@@ -222,7 +222,7 @@ class Account extends CommonObject
$this->db->begin(); $this->db->begin();
$datev = $date; $datev = $date;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, dateo, datev, label, amount, fk_user_author, num_chq, fk_account, fk_type,emetteur,banque)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, dateo, datev, label, amount, fk_user_author, num_chq, fk_account, fk_type,emetteur,banque)";
@@ -315,12 +315,12 @@ class Account extends CommonObject
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{ {
$this->error=$langs->trans("ErrorBankLabelAlreadyExists"); $this->error=$langs->trans("ErrorBankLabelAlreadyExists");
dol_syslog($this->error); dol_syslog($this->error, LOG_ERR);
return -1; return -1;
} }
else { else {
$this->error=$this->db->error()." sql=".$sql; $this->error=$this->db->error()." sql=".$sql;
dol_syslog($this->error); dol_syslog($this->error, LOG_ERR);
return -2; return -2;
} }
} }
@@ -338,11 +338,11 @@ class Account extends CommonObject
// Check parameters // Check parameters
if (! $this->min_allowed) $this->min_allowed=0; if (! $this->min_allowed) $this->min_allowed=0;
if (! $this->min_desired) $this->min_desired=0; if (! $this->min_desired) $this->min_desired=0;
if (! $this->ref) if (! $this->ref)
{ {
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Ref")); $this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Ref"));
dol_syslog("Account::update ".$this->error); dol_syslog("Account::update ".$this->error, LOG_ERR);
return -1; return -1;
} }
if (! $this->label) $this->label = "???"; if (! $this->label) $this->label = "???";
@@ -375,7 +375,7 @@ class Account extends CommonObject
else else
{ {
$this->error=$this->db.' sql='.$sql; $this->error=$this->db.' sql='.$sql;
dol_print_error($this->error); dol_print_error($this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -425,7 +425,7 @@ class Account extends CommonObject
else else
{ {
$this->error=$this->db.' sql='.$sql; $this->error=$this->db.' sql='.$sql;
dol_print_error($this->error); dol_print_error($this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -604,7 +604,7 @@ class Account extends CommonObject
return $this->error; return $this->error;
} }
/** /**
* \brief Return current sold * \brief Return current sold
* \param option 1=Exclude future operation date (this is to exclude input made in advance and have real account sold) * \param option 1=Exclude future operation date (this is to exclude input made in advance and have real account sold)
* \return int Current sold (value date <= today) * \return int Current sold (value date <= today)
@@ -750,18 +750,18 @@ class Account extends CommonObject
function getCountryCode() function getCountryCode()
{ {
global $mysoc; global $mysoc;
if (! empty($this->iban)) if (! empty($this->iban))
{ {
// If IBAN defined, we can know country of account from it // If IBAN defined, we can know country of account from it
if (eregi("^([a-zA-Z][a-zA-Z])",$this->iban,$reg)) return $reg[1]; if (eregi("^([a-zA-Z][a-zA-Z])",$this->iban,$reg)) return $reg[1];
} }
// We return country code // We return country code
if (! empty($mysoc->pays_code)) return $mysoc->pays_code; if (! empty($mysoc->pays_code)) return $mysoc->pays_code;
return ''; return '';
} }
/** /**
* \brief Return if a bank account is defined with detailed information (bank code, desk code, number and key) * \brief Return if a bank account is defined with detailed information (bank code, desk code, number and key)
@@ -773,10 +773,10 @@ class Account extends CommonObject
if ($country_code == 'FR') return true; if ($country_code == 'FR') return true;
if ($country_code == 'ES') return true; if ($country_code == 'ES') return true;
return false; return false;
} }
} }
@@ -803,10 +803,10 @@ class AccountLine
var $num_releve; var $num_releve;
var $num_chq; var $num_chq;
var $rappro; var $rappro;
var $bank_account_label; var $bank_account_label;
/** /**
* Constructeur * Constructeur
*/ */
@@ -949,7 +949,7 @@ class AccountLine
{ {
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("AccountLine::update ".$this->error); dol_syslog("AccountLine::update ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -981,12 +981,12 @@ class AccountLine
dol_syslog("AccountLine::update_conciliation sql=".$sql, LOG_DEBUG); dol_syslog("AccountLine::update_conciliation sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
// No error check. Can fail if category already affected // No error check. Can fail if category already affected
} }
$bankline->rappro=1; $bankline->rappro=1;
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
@@ -994,9 +994,9 @@ class AccountLine
{ {
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }
/** /**
* \brief Charge les informations d'ordre info dans l'objet facture * \brief Charge les informations d'ordre info dans l'objet facture
* \param id Id de la facture a charger * \param id Id de la facture a charger
@@ -1040,7 +1040,7 @@ class AccountLine
} }
} }
/** /**
* \brief Renvoie nom clicable (avec eventuellement le picto) * \brief Renvoie nom clicable (avec eventuellement le picto)
* \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
@@ -1070,12 +1070,12 @@ class AccountLine
$result.=$accountstatic->getNomUrl(0).', '; $result.=$accountstatic->getNomUrl(0).', ';
$result.=$langs->trans("BankLineConciliated").': '; $result.=$langs->trans("BankLineConciliated").': ';
$result.=yn($this->rappro); $result.=yn($this->rappro);
$result.=')'; $result.=')';
} }
return $result; return $result;
} }
} }
?> ?>

View File

@@ -248,7 +248,7 @@ class FactureRec extends Facture
if ($result < 0) if ($result < 0)
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog('Facture::Fetch Error '.$this->error); dol_syslog('Facture::Fetch Error '.$this->error, LOG_ERR);
return -3; return -3;
} }
return 1; return 1;
@@ -256,14 +256,14 @@ class FactureRec extends Facture
else else
{ {
$this->error='Bill with id '.$rowid.' not found sql='.$sql; $this->error='Bill with id '.$rowid.' not found sql='.$sql;
dol_syslog('Facture::Fetch Error '.$this->error); dol_syslog('Facture::Fetch Error '.$this->error, LOG_ERR);
return -2; return -2;
} }
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog('Facture::Fetch Error '.$this->error); dol_syslog('Facture::Fetch Error '.$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -328,7 +328,7 @@ class FactureRec extends Facture
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog('Facture::fetch_lines: Error '.$this->error); dol_syslog('Facture::fetch_lines: Error '.$this->error, LOG_ERR);
return -3; return -3;
} }
} }

View File

@@ -48,14 +48,14 @@ class BonPrelevement extends CommonObject
var $total; var $total;
var $_fetched; var $_fetched;
function BonPrelevement($DB, $filename='') function BonPrelevement($DB, $filename='')
{ {
$error = 0; $error = 0;
$this->db = $DB; $this->db = $DB;
$this->filename=$filename; $this->filename=$filename;
$this->date_echeance = time(); $this->date_echeance = time();
$this->raison_sociale = ""; $this->raison_sociale = "";
$this->reference_remise = ""; $this->reference_remise = "";
@@ -262,7 +262,7 @@ class BonPrelevement extends CommonObject
function set_credite() function set_credite()
{ {
global $user; global $user;
$error == 0; $error == 0;
if ($this->db->begin()) if ($this->db->begin())
@@ -501,7 +501,7 @@ class BonPrelevement extends CommonObject
$arr_mime = array(); $arr_mime = array();
$arr_name = array(); $arr_name = array();
$msgishtml=0; $msgishtml=0;
if ($joinfile == 1) if ($joinfile == 1)
{ {
$arr_file = array(DOL_DATA_ROOT.'/prelevement/bon/'.$this->ref.'.ps'); $arr_file = array(DOL_DATA_ROOT.'/prelevement/bon/'.$this->ref.'.ps');
@@ -641,12 +641,12 @@ class BonPrelevement extends CommonObject
else else
{ {
$this->error="BonPrelevement::SommeAPrelever Erreur -1 sql=".$this->db->error(); $this->error="BonPrelevement::SommeAPrelever Erreur -1 sql=".$this->db->error();
dol_syslog($this->error); dol_syslog($this->error, LOG_ERR);
return -1; return -1;
} }
} }
/** /**
* \brief Create a withdraw * \brief Create a withdraw
* \return int <0 if KO, nbre of invoice withdrawed if OK * \return int <0 if KO, nbre of invoice withdrawed if OK
@@ -654,7 +654,7 @@ class BonPrelevement extends CommonObject
function Create($banque=0, $guichet=0) function Create($banque=0, $guichet=0)
{ {
global $conf; global $conf;
dol_syslog("BonPrelevement::Create banque=$banque guichet=$guichet"); dol_syslog("BonPrelevement::Create banque=$banque guichet=$guichet");
require_once (DOL_DOCUMENT_ROOT."/compta/prelevement/bon-prelevement.class.php"); require_once (DOL_DOCUMENT_ROOT."/compta/prelevement/bon-prelevement.class.php");
@@ -833,7 +833,7 @@ class BonPrelevement extends CommonObject
$dir=$conf->prelevement->dir_output.'/bon'; $dir=$conf->prelevement->dir_output.'/bon';
$file=$filebonprev; $file=$filebonprev;
if (! is_dir($dir)) create_exdir($dir); if (! is_dir($dir)) create_exdir($dir);
$bonprev = new BonPrelevement($this->db, $dir."/".$file); $bonprev = new BonPrelevement($this->db, $dir."/".$file);
$bonprev->id = $prev_id; $bonprev->id = $prev_id;
} }
@@ -1000,7 +1000,7 @@ class BonPrelevement extends CommonObject
} }
} }
/** /**
* \brief Renvoie nom clicable (avec eventuellement le picto) * \brief Renvoie nom clicable (avec eventuellement le picto)
* \param withpicto Inclut le picto dans le lien * \param withpicto Inclut le picto dans le lien
@@ -1025,9 +1025,9 @@ class BonPrelevement extends CommonObject
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowWithdraw"),'payment').$lienfin.' '); if ($withpicto) $result.=($lien.img_object($langs->trans("ShowWithdraw"),'payment').$lienfin.' ');
$result.=$lien.$this->ref.$lienfin; $result.=$lien.$this->ref.$lienfin;
return $result; return $result;
} }
/** /**
* *
* *
@@ -1106,7 +1106,7 @@ class BonPrelevement extends CommonObject
function Generate() function Generate()
{ {
global $conf; global $conf;
$result = -1; $result = -1;
$this->file = fopen ($this->filename,"w"); $this->file = fopen ($this->filename,"w");
@@ -1160,9 +1160,9 @@ class BonPrelevement extends CommonObject
$this->EnregTotal($this->total); $this->EnregTotal($this->total);
fclose($this->file); fclose($this->file);
if (! empty($conf->global->MAIN_UMASK)) if (! empty($conf->global->MAIN_UMASK))
@chmod($this->file, octdec($conf->global->MAIN_UMASK)); @chmod($this->file, octdec($conf->global->MAIN_UMASK));
return $result; return $result;
} }

View File

@@ -127,7 +127,7 @@ class Contact extends CommonObject
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Contact::create ".$this->error); dol_syslog("Contact::create ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -529,7 +529,7 @@ class Contact extends CommonObject
else else
{ {
$this->error=$this->db->error()." - ".$sql; $this->error=$this->db->error()." - ".$sql;
dol_syslog("Contact::load_ref_elements Error ".$this->error); dol_syslog("Contact::load_ref_elements Error ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }

View File

@@ -123,7 +123,7 @@ class Contrat extends CommonObject
else else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
dol_syslog("Contrat::active_line error ".$this->error); dol_syslog("Contrat::active_line error ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@@ -564,7 +564,7 @@ class Contrat extends CommonObject
else else
{ {
$this->error=$interface->error; $this->error=$interface->error;
dol_syslog("Contrat::create - 30 - ".$this->error); dol_syslog("Contrat::create - 30 - ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
@@ -573,7 +573,7 @@ class Contrat extends CommonObject
else else
{ {
$this->error="Failed to add contact"; $this->error="Failed to add contact";
dol_syslog("Contrat::create - 20 - ".$this->error); dol_syslog("Contrat::create - 20 - ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
@@ -582,7 +582,7 @@ class Contrat extends CommonObject
else else
{ {
$this->error=$langs->trans("UnknownError: ".$this->db->error()." - sql=".$sql); $this->error=$langs->trans("UnknownError: ".$this->db->error()." - sql=".$sql);
dol_syslog("Contrat::create - 10 - ".$this->error); dol_syslog("Contrat::create - 10 - ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
@@ -739,7 +739,7 @@ class Contrat extends CommonObject
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Contrat::delete ERROR ".$this->error); dol_syslog("Contrat::delete ERROR ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }

View File

@@ -159,7 +159,7 @@ class DiscountAbsolute
else else
{ {
$this->error=$this->db->lasterror().' - sql='.$sql; $this->error=$this->db->lasterror().' - sql='.$sql;
dol_syslog("DiscountAbsolute::create ".$this->error); dol_syslog("DiscountAbsolute::create ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }

View File

@@ -386,7 +386,7 @@ class Expedition extends CommonObject
{ {
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->error()." - sql=$sql"; $this->error=$this->db->error()." - sql=$sql";
dol_syslog("Expedition::valid ".$this->error); dol_syslog("Expedition::valid ".$this->error, LOG_ERR);
return -3; return -3;
} }
@@ -398,7 +398,7 @@ class Expedition extends CommonObject
{ {
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->error()." - sql=$sql"; $this->error=$this->db->error()." - sql=$sql";
dol_syslog("Expedition::valid ".$this->error); dol_syslog("Expedition::valid ".$this->error, LOG_ERR);
return -2; return -2;
} }
} }
@@ -430,7 +430,7 @@ class Expedition extends CommonObject
{ {
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Expedition::valid ".$this->error); dol_syslog("Expedition::valid ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -438,7 +438,7 @@ class Expedition extends CommonObject
{ {
$this->db->rollback(); $this->db->rollback();
$this->error="Non autorise"; $this->error="Non autorise";
dol_syslog("Expedition::valid ".$this->error); dol_syslog("Expedition::valid ".$this->error, LOG_ERR);
return -1; return -1;
} }
@@ -633,7 +633,7 @@ class Expedition extends CommonObject
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog('Expedition::fetch_lines: Error '.$this->error); dol_syslog('Expedition::fetch_lines: Error '.$this->error, LOG_ERR);
return -3; return -3;
} }
} }

View File

@@ -268,14 +268,14 @@ class Export
else else
{ {
$this->error=$objmodel->error; $this->error=$objmodel->error;
dol_syslog("Error: ".$this->error); dol_syslog("Export::build_file Error: ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
else else
{ {
$this->error=$this->db->error()." - sql=".$sql; $this->error=$this->db->error()." - sql=".$sql;
dol_syslog("Error: ".$this->error); dol_syslog("Export::build_file Error: ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }

View File

@@ -316,7 +316,7 @@ class Facture extends CommonObject
} }
else else
{ {
dol_syslog("Facture::create error ".$this->error); dol_syslog("Facture::create error ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
@@ -324,7 +324,7 @@ class Facture extends CommonObject
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Facture::create error ".$this->error." sql=".$sql); dol_syslog("Facture::create error ".$this->error." sql=".$sql, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@@ -581,7 +581,7 @@ class Facture extends CommonObject
if ($result < 0) if ($result < 0)
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog('Facture::Fetch Error '.$this->error); dol_syslog('Facture::Fetch Error '.$this->error, LOG_ERR);
return -3; return -3;
} }
return 1; return 1;
@@ -589,14 +589,14 @@ class Facture extends CommonObject
else else
{ {
$this->error='Bill with id '.$rowid.' not found sql='.$sql; $this->error='Bill with id '.$rowid.' not found sql='.$sql;
dol_syslog('Facture::Fetch Error '.$this->error); dol_syslog('Facture::Fetch Error '.$this->error, LOG_ERR);
return -2; return -2;
} }
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog('Facture::Fetch Error '.$this->error); dol_syslog('Facture::Fetch Error '.$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -940,7 +940,7 @@ class Facture extends CommonObject
if (! $this->db->query($sql)) if (! $this->db->query($sql))
{ {
$this->error=$this->db->error()." sql=".$sql; $this->error=$this->db->error()." sql=".$sql;
dol_syslog("Facture.class::delete ".$this->error); dol_syslog("Facture.class::delete ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -5; return -5;
} }
@@ -966,7 +966,7 @@ class Facture extends CommonObject
else else
{ {
$this->error=$this->db->error()." sql=".$sql; $this->error=$this->db->error()." sql=".$sql;
dol_syslog("Facture.class::delete ".$this->error); dol_syslog("Facture.class::delete ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -6; return -6;
} }
@@ -974,7 +974,7 @@ class Facture extends CommonObject
else else
{ {
$this->error=$this->db->error()." sql=".$sql; $this->error=$this->db->error()." sql=".$sql;
dol_syslog("Facture.class::delete ".$this->error); dol_syslog("Facture.class::delete ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -4; return -4;
} }
@@ -982,7 +982,7 @@ class Facture extends CommonObject
else else
{ {
$this->error=$this->db->error()." sql=".$sql; $this->error=$this->db->error()." sql=".$sql;
dol_syslog("Facture.class::delete ".$this->error); dol_syslog("Facture.class::delete ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
} }
@@ -990,7 +990,7 @@ class Facture extends CommonObject
else else
{ {
$this->error=$this->db->error()." sql=".$sql; $this->error=$this->db->error()." sql=".$sql;
dol_syslog("Facture.class::delete ".$this->error); dol_syslog("Facture.class::delete ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
@@ -1746,7 +1746,7 @@ class Facture extends CommonObject
if (! $result) if (! $result)
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Facture::Deleteline Error ".$this->error); dol_syslog("Facture::Deleteline Error ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@@ -1758,7 +1758,7 @@ class Facture extends CommonObject
if (! $result) if (! $result)
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Facture::Deleteline Error ".$this->error); dol_syslog("Facture::Deleteline Error ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@@ -2421,7 +2421,7 @@ class Facture extends CommonObject
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Facture::list_replacable_invoices ".$this->error); dol_syslog("Facture::list_replacable_invoices ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -2474,7 +2474,7 @@ class Facture extends CommonObject
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Facture::list_avoir_invoices ".$this->error); dol_syslog("Facture::list_avoir_invoices ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -3099,7 +3099,7 @@ class FactureLigne
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("FactureLigne::update_total Error ".$this->error); dol_syslog("FactureLigne::update_total Error ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }

View File

@@ -226,11 +226,11 @@ class Fichinter extends CommonObject
if ($this->statut != 0) if ($this->statut != 0)
{ {
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter"; $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
$sql.= " SET fk_statut = 0"; $sql.= " SET fk_statut = 0";
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
dol_syslog("Fichinter::setDraft sql=".$sql); dol_syslog("Fichinter::setDraft sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
@@ -245,9 +245,9 @@ class Fichinter extends CommonObject
dol_syslog("Fichinter::setDraft ".$this->error,LOG_ERR); dol_syslog("Fichinter::setDraft ".$this->error,LOG_ERR);
return -1; return -1;
} }
} }
} }
/** /**
* \brief Valide une fiche intervention * \brief Valide une fiche intervention
* \param user User qui valide * \param user User qui valide
@@ -260,11 +260,11 @@ class Fichinter extends CommonObject
if ($this->statut != 1) if ($this->statut != 1)
{ {
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter"; $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
$sql.= " SET fk_statut = 1, date_valid=".$this->db->idate(mktime()).", fk_user_valid=".$user->id; $sql.= " SET fk_statut = 1, date_valid=".$this->db->idate(mktime()).", fk_user_valid=".$user->id;
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
dol_syslog("Fichinter::setValid sql=".$sql); dol_syslog("Fichinter::setValid sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
@@ -275,7 +275,7 @@ class Fichinter extends CommonObject
$result=$interface->run_triggers('FICHEINTER_VALIDATE',$this,$user,$langs,$conf); $result=$interface->run_triggers('FICHEINTER_VALIDATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers
if (! $error) if (! $error)
{ {
$this->db->commit(); $this->db->commit();
@@ -364,7 +364,7 @@ class Fichinter extends CommonObject
} }
} }
} }
/** /**
* \brief Renvoie la reference de fiche intervention suivante non utilisee en fonction du module * \brief Renvoie la reference de fiche intervention suivante non utilisee en fonction du module
@@ -474,7 +474,7 @@ class Fichinter extends CommonObject
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Fichinter::set_project Error ".$this->error); dol_syslog("Fichinter::set_project Error ".$this->error, LOG_ERR);
} }
} }
else else
@@ -613,19 +613,19 @@ class Fichinter extends CommonObject
function addline($fichinterid, $desc, $date_intervention, $duration) function addline($fichinterid, $desc, $date_intervention, $duration)
{ {
dol_syslog("Fichinter::Addline $fichinterid, $desc, $date_intervention, $duration"); dol_syslog("Fichinter::Addline $fichinterid, $desc, $date_intervention, $duration");
if ($this->statut == 0) if ($this->statut == 0)
{ {
$this->db->begin(); $this->db->begin();
// Insertion ligne // Insertion ligne
$ligne=new FichinterLigne($this->db); $ligne=new FichinterLigne($this->db);
$ligne->fk_fichinter = $fichinterid; $ligne->fk_fichinter = $fichinterid;
$ligne->desc = $desc; $ligne->desc = $desc;
$ligne->datei = $date_intervention; $ligne->datei = $date_intervention;
$ligne->duration = $duration; $ligne->duration = $duration;
$result=$ligne->insert(); $result=$ligne->insert();
if ($result > 0) if ($result > 0)
{ {
@@ -635,7 +635,7 @@ class Fichinter extends CommonObject
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Error sql=$sql, error=".$this->error); dol_syslog("Error sql=$sql, error=".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@@ -813,7 +813,7 @@ class FichinterLigne
else else
{ {
$this->error=$this->db->error().' sql='.$sql; $this->error=$this->db->error().' sql='.$sql;
dol_print_error($this->db,$this->error); dol_print_error($this->db,$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -877,7 +877,7 @@ class FichinterLigne
else else
{ {
$this->error=$this->db->error()." sql=".$sql; $this->error=$this->db->error()." sql=".$sql;
dol_syslog("FichinterLigne::insert Error ".$this->error); dol_syslog("FichinterLigne::insert Error ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@@ -913,7 +913,7 @@ class FichinterLigne
else else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
dol_syslog("FichinterLigne::update Error ".$this->error); dol_syslog("FichinterLigne::update Error ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@@ -921,7 +921,7 @@ class FichinterLigne
else else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
dol_syslog("FichinterLigne::update Error ".$this->error); dol_syslog("FichinterLigne::update Error ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@@ -944,7 +944,7 @@ class FichinterLigne
$obj=$this->db->fetch_object($resql); $obj=$this->db->fetch_object($resql);
$total_duration=0; $total_duration=0;
if ($obj) $total_duration = $obj->total_duration; if ($obj) $total_duration = $obj->total_duration;
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter"; $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
$sql.= " SET duree = ".$total_duration; $sql.= " SET duree = ".$total_duration;
$sql.= " WHERE rowid = ".$this->fk_fichinter; $sql.= " WHERE rowid = ".$this->fk_fichinter;
@@ -959,7 +959,7 @@ class FichinterLigne
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("FichinterLigne::update_total Error ".$this->error); dol_syslog("FichinterLigne::update_total Error ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
@@ -967,7 +967,7 @@ class FichinterLigne
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("FichinterLigne::update Error ".$this->error); dol_syslog("FichinterLigne::update Error ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@@ -983,7 +983,7 @@ class FichinterLigne
{ {
dol_syslog("FichinterLigne::delete_line lineid=".$this->rowid); dol_syslog("FichinterLigne::delete_line lineid=".$this->rowid);
$this->db->begin(); $this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE rowid = ".$this->rowid; $sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE rowid = ".$this->rowid;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
dol_syslog("FichinterLigne::delete_line sql=".$sql); dol_syslog("FichinterLigne::delete_line sql=".$sql);
@@ -1005,7 +1005,7 @@ class FichinterLigne
else else
{ {
$this->error=$this->db->error()." sql=".$sql; $this->error=$this->db->error()." sql=".$sql;
dol_syslog("FichinterLigne::delete_line Error ".$this->error); dol_syslog("FichinterLigne::delete_line Error ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }

View File

@@ -120,7 +120,7 @@ class PaiementFourn
function create($user) function create($user)
{ {
global $langs,$conf; global $langs,$conf;
$error = 0; $error = 0;
// Clean parameters // Clean parameters
@@ -134,16 +134,16 @@ class PaiementFourn
} }
$this->total = price2num($this->total); $this->total = price2num($this->total);
$this->db->begin(); $this->db->begin();
if ($this->total <> 0) // On accepte les montants negatifs if ($this->total <> 0) // On accepte les montants negatifs
{ {
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn ('; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn (';
$sql.= 'datec, datep, amount, fk_paiement, num_paiement, note, fk_user_author, fk_bank)'; $sql.= 'datec, datep, amount, fk_paiement, num_paiement, note, fk_user_author, fk_bank)';
$sql.= ' VALUES ('.$this->db->idate(mktime()).','; $sql.= ' VALUES ('.$this->db->idate(mktime()).',';
$sql.= " ".$this->db->idate($this->datepaye).", '".$this->total."', ".$this->paiementid.", '".$this->num_paiement."', '".addslashes($this->note)."', ".$user->id.", 0)"; $sql.= " ".$this->db->idate($this->datepaye).", '".$this->total."', ".$this->paiementid.", '".$this->num_paiement."', '".addslashes($this->note)."', ".$user->id.", 0)";
dol_syslog("PaiementFourn::create sql=".$sql); dol_syslog("PaiementFourn::create sql=".$sql);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@@ -330,7 +330,7 @@ class PaiementFourn
else else
{ {
$this->error='Paiement::Valide Error -1 '.$this->db->error(); $this->error='Paiement::Valide Error -1 '.$this->db->error();
dol_syslog('PaiementFourn::valide error '.$this->error); dol_syslog('PaiementFourn::valide error '.$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -431,7 +431,7 @@ class PaiementFourn
function LibStatut($status,$mode=0) function LibStatut($status,$mode=0)
{ {
global $langs; global $langs;
$langs->load('compta'); $langs->load('compta');
if ($mode == 0) if ($mode == 0)
{ {
@@ -465,8 +465,8 @@ class PaiementFourn
} }
return $langs->trans('Unknown'); return $langs->trans('Unknown');
} }
/** /**
* \brief Renvoie nom clicable (avec eventuellement le picto) * \brief Renvoie nom clicable (avec eventuellement le picto)
* \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
@@ -476,7 +476,7 @@ class PaiementFourn
function getNomUrl($withpicto=0,$option='') function getNomUrl($withpicto=0,$option='')
{ {
global $langs; global $langs;
$result=''; $result='';
$lien = '<a href="'.DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$this->id.'">'; $lien = '<a href="'.DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$this->id.'">';
@@ -490,14 +490,14 @@ class PaiementFourn
/** /**
* \brief Updates the payment number * \brief Updates the payment number
* \param string New num * \param string New num
* \return int -1 on error, 0 otherwise * \return int -1 on error, 0 otherwise
*/ */
function update_num($num) function update_num($num)
{ {
if(!empty($num) && $this->statut!=1) if(!empty($num) && $this->statut!=1)
{ {
$sql = 'UPDATE '.MAIN_DB_PREFIX.'paiementfourn SET num_paiement = \''.$this->db->escape($num).'\' WHERE rowid = '.$this->id; $sql = 'UPDATE '.MAIN_DB_PREFIX.'paiementfourn SET num_paiement = \''.$this->db->escape($num).'\' WHERE rowid = '.$this->id;
dol_syslog("PaiementFourn::update_num sql=".$sql); dol_syslog("PaiementFourn::update_num sql=".$sql);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
@@ -508,7 +508,7 @@ class PaiementFourn
else else
{ {
$this->error='PaiementFourn::update_num Error -1 '.$this->db->error(); $this->error='PaiementFourn::update_num Error -1 '.$this->db->error();
dol_syslog('PaiementFourn::update_num error '.$this->error); dol_syslog('PaiementFourn::update_num error '.$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -517,7 +517,7 @@ class PaiementFourn
/** /**
* \brief Updates the payment date * \brief Updates the payment date
* \param string New date * \param string New date
* \return int -1 on error, 0 otherwise * \return int -1 on error, 0 otherwise
*/ */
function update_date($date) function update_date($date)
{ {
@@ -535,11 +535,11 @@ class PaiementFourn
else else
{ {
$this->error='PaiementFourn::update_date Error -1 '.$this->db->error(); $this->error='PaiementFourn::update_date Error -1 '.$this->db->error();
dol_syslog('PaiementFourn::update_date error '.$this->error); dol_syslog('PaiementFourn::update_date error '.$this->error, LOG_ERR);
return -1; return -1;
} }
} }
return -1; //no date given or already validated return -1; //no date given or already validated
} }
} }
?> ?>

View File

@@ -285,7 +285,7 @@ class CommandeFournisseur extends Commande
else else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
dol_syslog("CommandeFournisseur::valid ".$this->error); dol_syslog("CommandeFournisseur::valid ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@@ -293,7 +293,7 @@ class CommandeFournisseur extends Commande
else else
{ {
$this->error='Not Authorized'; $this->error='Not Authorized';
dol_syslog("CommandeFournisseur::valid ".$this->error); dol_syslog("CommandeFournisseur::valid ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -731,7 +731,7 @@ class CommandeFournisseur extends Commande
else else
{ {
$this->error=$this->db->error()." - ".$sql; $this->error=$this->db->error()." - ".$sql;
dol_syslog("CommandeFournisseur::Create: Failed -2 - ".$this->error); dol_syslog("CommandeFournisseur::Create: Failed -2 - ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
@@ -739,7 +739,7 @@ class CommandeFournisseur extends Commande
else else
{ {
$this->error=$this->db->error()." - ".$sql; $this->error=$this->db->error()." - ".$sql;
dol_syslog("CommandeFournisseur::Create: Failed -1 - ".$this->error); dol_syslog("CommandeFournisseur::Create: Failed -1 - ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@@ -945,7 +945,7 @@ class CommandeFournisseur extends Commande
if ($result < 0) if ($result < 0)
{ {
$this->error=$this->db->error()." - sql=$sql"; $this->error=$this->db->error()." - sql=$sql";
dol_syslog("CommandeFournisseur::DispatchProduct".$this->error); dol_syslog("CommandeFournisseur::DispatchProduct".$this->error, LOG_ERR);
$error = -2; $error = -2;
} }
$i++; $i++;
@@ -1198,7 +1198,7 @@ class CommandeFournisseur extends Commande
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("CommandeFournisseur::UpdateNote "+$this->error); dol_syslog("CommandeFournisseur::UpdateNote "+$this->error, LOG_ERR);
$result = -1; $result = -1;
} }
@@ -1324,7 +1324,7 @@ class CommandeFournisseur extends Commande
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("CommandeFournisseur::updateline ".$this->error); dol_syslog("CommandeFournisseur::updateline ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@@ -1332,7 +1332,7 @@ class CommandeFournisseur extends Commande
else else
{ {
$this->error="Order status makes operation forbidden"; $this->error="Order status makes operation forbidden";
dol_syslog("CommandeFournisseur::updateline ".$this->error); dol_syslog("CommandeFournisseur::updateline ".$this->error, LOG_ERR);
return -2; return -2;
} }
} }
@@ -1519,7 +1519,7 @@ class CommandeFournisseurLigne extends CommandeLigne
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("CommandeFournisseurLigne.class.php::update_total Error ".$this->error); dol_syslog("CommandeFournisseurLigne.class.php::update_total Error ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }

View File

@@ -59,9 +59,9 @@ class ProductFournisseur extends Product
function remove_fournisseur($id_fourn) function remove_fournisseur($id_fourn)
{ {
$ok=1; $ok=1;
$this->db->begin(); $this->db->begin();
// Search all links // Search all links
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur";
@@ -76,7 +76,7 @@ class ProductFournisseur extends Product
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
$sql.= " WHERE fk_product_fournisseur = ".$obj->rowid; $sql.= " WHERE fk_product_fournisseur = ".$obj->rowid;
dol_syslog("ProductFournisseur::remove_fournisseur sql=".$sql); dol_syslog("ProductFournisseur::remove_fournisseur sql=".$sql);
$resql2=$this->db->query($sql); $resql2=$this->db->query($sql);
if (! $resql2) if (! $resql2)
@@ -86,11 +86,11 @@ class ProductFournisseur extends Product
$ok=0; $ok=0;
} }
} }
// Now delete all link supplier-product (they have no more childs) // Now delete all link supplier-product (they have no more childs)
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur";
$sql.= " WHERE fk_product = ".$this->id." AND fk_soc = ".$id_fourn; $sql.= " WHERE fk_product = ".$this->id." AND fk_soc = ".$id_fourn;
dol_syslog("ProductFournisseur::remove_fournisseur sql=".$sql); dol_syslog("ProductFournisseur::remove_fournisseur sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if (! $resql) if (! $resql)
@@ -99,7 +99,7 @@ class ProductFournisseur extends Product
dol_syslog("ProductFournisseur::remove_fournisseur ".$this->error, LOG_ERR); dol_syslog("ProductFournisseur::remove_fournisseur ".$this->error, LOG_ERR);
$ok=0; $ok=0;
} }
if ($ok) if ($ok)
{ {
$this->db->commit(); $this->db->commit();
@@ -126,7 +126,7 @@ class ProductFournisseur extends Product
$sql.= " WHERE rowid = ".$rowid; $sql.= " WHERE rowid = ".$rowid;
dol_syslog("ProductFournisseur::remove_product_fournisseur sql=".$sql); dol_syslog("ProductFournisseur::remove_product_fournisseur sql=".$sql);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
return 1; return 1;
@@ -149,8 +149,8 @@ class ProductFournisseur extends Product
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
$sql.= " WHERE rowid = ".$rowid; $sql.= " WHERE rowid = ".$rowid;
dol_syslog("ProductFournisseur::remove_product_fournisseur_price sql=".$sql); dol_syslog("ProductFournisseur::remove_product_fournisseur_price sql=".$sql);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
// Remove all entries with no childs // Remove all entries with no childs
$sql = "SELECT pf.rowid"; $sql = "SELECT pf.rowid";
@@ -158,19 +158,19 @@ class ProductFournisseur extends Product
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.fk_product_fournisseur = pf.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.fk_product_fournisseur = pf.rowid";
$sql.= " WHERE pfp.rowid IS NULL"; $sql.= " WHERE pfp.rowid IS NULL";
dol_syslog("ProductFournisseur::remove_product_fournisseur_price sql=".$sql); dol_syslog("ProductFournisseur::remove_product_fournisseur_price sql=".$sql);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$ok=1; $ok=1;
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$rowidpf=$obj->rowid; $rowidpf=$obj->rowid;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur";
$sql.= " WHERE rowid = ".$rowidpf; $sql.= " WHERE rowid = ".$rowidpf;
dol_syslog("ProductFournisseur::remove_product_fournisseur_price sql=".$sql); dol_syslog("ProductFournisseur::remove_product_fournisseur_price sql=".$sql);
$resql2 = $this->db->query($sql); $resql2 = $this->db->query($sql);
if (! $resql2) if (! $resql2)
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
@@ -178,7 +178,7 @@ class ProductFournisseur extends Product
$ok=0; $ok=0;
} }
} }
if ($ok) if ($ok)
{ {
$this->db->commit(); $this->db->commit();
@@ -206,13 +206,13 @@ class ProductFournisseur extends Product
return -1; return -1;
} }
} }
/* /*
* *
* *
*/ */
function update($ref, $qty, $buyprice, $user) function update($ref, $qty, $buyprice, $user)
{ {
$this->fourn_ref = $ref; $this->fourn_ref = $ref;
@@ -225,7 +225,7 @@ class ProductFournisseur extends Product
$sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur "; $sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur ";
$sql .= " SET ref_fourn = '" . $this->fourn_ref ."'"; $sql .= " SET ref_fourn = '" . $this->fourn_ref ."'";
$sql .= " WHERE fk_product = " . $this->id; $sql .= " WHERE fk_product = " . $this->id;
$sql .=" AND fk_soc = ".$this->fourn->id; $sql .=" AND fk_soc = ".$this->fourn->id;
$resql = $this->db->query($sql) ; $resql = $this->db->query($sql) ;
} }
@@ -242,12 +242,12 @@ class ProductFournisseur extends Product
function update_buyprice($qty, $buyprice, $user, $price_base_type='HT', $fourn) function update_buyprice($qty, $buyprice, $user, $price_base_type='HT', $fourn)
{ {
global $mysoc; global $mysoc;
$buyprice=price2num($buyprice); $buyprice=price2num($buyprice);
$error=0; $error=0;
$this->db->begin(); $this->db->begin();
// Supprime prix courant du fournisseur pour cette quantit<69> // Supprime prix courant du fournisseur pour cette quantit<69>
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price "; $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price ";
if ($this->product_fourn_price_id) if ($this->product_fourn_price_id)
@@ -258,7 +258,7 @@ class ProductFournisseur extends Product
{ {
$sql .= " WHERE fk_product_fournisseur = ".$this->product_fourn_id." AND quantity = ".$qty; $sql .= " WHERE fk_product_fournisseur = ".$this->product_fourn_id." AND quantity = ".$qty;
} }
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
if ($price_base_type == 'TTC') if ($price_base_type == 'TTC')
@@ -352,7 +352,7 @@ class ProductFournisseur extends Product
return $result; return $result;
} }
/** /**
* \brief Charge les informations relatives <20> un fournisseur * \brief Charge les informations relatives <20> un fournisseur
* \param fournid id du fournisseur * \param fournid id du fournisseur
@@ -377,11 +377,11 @@ class ProductFournisseur extends Product
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Product::fetch_fourn_data error=".$this->error); dol_syslog("Product::fetch_fourn_data error=".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
/** /**
* \brief Charge les informations relatives <20> un prix de fournisseur * \brief Charge les informations relatives <20> un prix de fournisseur
* \param rowid id ligne * \param rowid id ligne

View File

@@ -168,7 +168,7 @@ class ModeleExports
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Error: sql=$sql ".$this->error); dol_syslog("Error: sql=$sql ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }

View File

@@ -477,7 +477,7 @@ class pdf_crabe extends ModelePDFFactures
else else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
dol_syslog($this->db,$this->error); dol_syslog($this->db,$this->error, LOG_ERR);
return -1; return -1;
} }
@@ -536,7 +536,7 @@ class pdf_crabe extends ModelePDFFactures
else else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
dol_syslog($this->db,$this->error); dol_syslog($this->db,$this->error, LOG_ERR);
return -1; return -1;
} }

View File

@@ -130,7 +130,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
if ($type == 'supplier') $sql.= "code_compta_fournisseur"; if ($type == 'supplier') $sql.= "code_compta_fournisseur";
$sql.= " = '".$code."'"; $sql.= " = '".$code."'";
$sql.= " AND rowid != ".$societe->id; $sql.= " AND rowid != ".$societe->id;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
@@ -148,7 +148,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
else else
{ {
$this->error=$db->error()." sql=".$sql; $this->error=$db->error()." sql=".$sql;
dol_syslog("mod_codecompta_aquarium::verif error".$this->error); dol_syslog("mod_codecompta_aquarium::verif error".$this->error, LOG_ERR);
return -1; // Erreur return -1; // Erreur
} }
} }

View File

@@ -514,7 +514,7 @@ class InterfaceLogevents
$error ="Failed to insert security event: ".$event->error; $error ="Failed to insert security event: ".$event->error;
$this->error=$error; $this->error=$error;
dol_syslog("interface_all_Logevents.class.php: ".$this->error); dol_syslog("interface_all_Logevents.class.php: ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }

View File

@@ -19,7 +19,7 @@
/** /**
\file htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php \file htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php
\ingroup core \ingroup core
\brief Trigger file for \brief Trigger file for
\version $Id$ \version $Id$
*/ */
@@ -33,12 +33,12 @@ class InterfaceActionsAuto
{ {
var $db; var $db;
var $error; var $error;
var $date; var $date;
var $duree; var $duree;
var $texte; var $texte;
var $desc; var $desc;
/** /**
* \brief Constructeur. * \brief Constructeur.
* \param DB Handler d'acces base * \param DB Handler d'acces base
@@ -46,7 +46,7 @@ class InterfaceActionsAuto
function InterfaceActionsAuto($DB) function InterfaceActionsAuto($DB)
{ {
$this->db = $DB ; $this->db = $DB ;
$this->name = eregi_replace('^Interface','',get_class($this)); $this->name = eregi_replace('^Interface','',get_class($this));
$this->family = "agenda"; $this->family = "agenda";
$this->description = "Triggers of this module add actions in agenda according to setup made in agenda setup."; $this->description = "Triggers of this module add actions in agenda according to setup made in agenda setup.";
@@ -61,7 +61,7 @@ class InterfaceActionsAuto
{ {
return $this->name; return $this->name;
} }
/** /**
* \brief Renvoi descriptif du lot de triggers * \brief Renvoi descriptif du lot de triggers
* \return string Descriptif du lot de triggers * \return string Descriptif du lot de triggers
@@ -101,7 +101,7 @@ class InterfaceActionsAuto
$key='MAIN_AGENDA_ACTIONAUTO_'.$action; $key='MAIN_AGENDA_ACTIONAUTO_'.$action;
//dol_syslog("xxxxxxxxxxx".$key); //dol_syslog("xxxxxxxxxxx".$key);
if (empty($conf->global->$key)) return 0; // Log events not enabled for this action if (empty($conf->global->$key)) return 0; // Log events not enabled for this action
// Following properties must be filled: // Following properties must be filled:
// $object->actiontypecode; // $object->actiontypecode;
// $object->actionmsg (note, long text) // $object->actionmsg (note, long text)
@@ -112,9 +112,9 @@ class InterfaceActionsAuto
// $object->facid // $object->facid
// $object->propalrowid // $object->propalrowid
// $object->orderrowid // $object->orderrowid
$ok=0; $ok=0;
// Actions // Actions
if ($action == 'COMPANY_CREATE') if ($action == 'COMPANY_CREATE')
{ {
@@ -173,7 +173,7 @@ class InterfaceActionsAuto
$langs->load("propal"); $langs->load("propal");
$langs->load("agenda"); $langs->load("agenda");
$ok=1; $ok=1;
// Parameters $object->xxx defined by caller // Parameters $object->xxx defined by caller
} }
elseif ($action == 'PROPAL_CLOSE_SIGNED') elseif ($action == 'PROPAL_CLOSE_SIGNED')
@@ -207,13 +207,13 @@ class InterfaceActionsAuto
$object->propalrowid=$object->id; $object->propalrowid=$object->id;
$object->facid=$object->orderrowid=0; $object->facid=$object->orderrowid=0;
$ok=1; $ok=1;
} }
elseif ($action == 'ORDER_VALIDATE') elseif ($action == 'ORDER_VALIDATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("orders"); $langs->load("orders");
$langs->load("agenda"); $langs->load("agenda");
$object->actiontypecode='AC_OTH'; $object->actiontypecode='AC_OTH';
$object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref);
$object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref);
@@ -257,7 +257,7 @@ class InterfaceActionsAuto
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda"); $langs->load("agenda");
$ok=1; $ok=1;
// Parameters $object->xxx defined by caller // Parameters $object->xxx defined by caller
} }
elseif ($action == 'BILL_PAYED') elseif ($action == 'BILL_PAYED')
@@ -299,7 +299,7 @@ class InterfaceActionsAuto
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("orders"); $langs->load("orders");
$langs->load("agenda"); $langs->load("agenda");
$object->actiontypecode='AC_OTH'; $object->actiontypecode='AC_OTH';
$object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref);
$object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref);
@@ -327,7 +327,7 @@ class InterfaceActionsAuto
$object->orderrowid=$object->propalrowid=0; $object->orderrowid=$object->propalrowid=0;
$ok=1; $ok=1;
} }
// Members // Members
elseif ($action == 'MEMBER_VALIDATE') elseif ($action == 'MEMBER_VALIDATE')
{ {
@@ -342,7 +342,7 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->fullname; $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->fullname;
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$object->facid=0; // Supplier invoice not yet supported $object->facid=0; // Supplier invoice not yet supported
$object->orderrowid=$object->propalrowid=0; $object->orderrowid=$object->propalrowid=0;
@@ -363,7 +363,7 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount; $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
$object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start,'day').' - '.dol_print_date($object->last_subscription_date_end,'day'); $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start,'day').' - '.dol_print_date($object->last_subscription_date_end,'day');
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$object->facid=$object->orderrowid=$object->propalrowid=0; $object->facid=$object->orderrowid=$object->propalrowid=0;
$ok=1; $ok=1;
@@ -385,7 +385,7 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->fullname; $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->fullname;
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$object->facid=$object->orderrowid=$object->propalrowid=0; $object->facid=$object->orderrowid=$object->propalrowid=0;
$ok=1; $ok=1;
@@ -403,12 +403,12 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->fullname; $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->fullname;
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type; $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$object->facid=$object->orderrowid=$object->propalrowid=0; $object->facid=$object->orderrowid=$object->propalrowid=0;
$ok=1; $ok=1;
} }
// If not found // If not found
/* /*
else else
@@ -422,7 +422,7 @@ class InterfaceActionsAuto
if ($ok) if ($ok)
{ {
$now=time(); $now=time();
// Insertion action // Insertion action
require_once(DOL_DOCUMENT_ROOT.'/contact.class.php'); require_once(DOL_DOCUMENT_ROOT.'/contact.class.php');
require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php'); require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php');
@@ -453,7 +453,7 @@ class InterfaceActionsAuto
$error ="Failed to insert : ".$actioncomm->error." "; $error ="Failed to insert : ".$actioncomm->error." ";
$this->error=$error; $this->error=$error;
dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error); dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }

View File

@@ -36,12 +36,12 @@ class InterfacePhenixsynchro
{ {
var $db; var $db;
var $error; var $error;
var $date; var $date;
var $duree; var $duree;
var $texte; var $texte;
var $desc; var $desc;
/** /**
* \brief Constructeur. * \brief Constructeur.
* \param DB Handler d'acc<63>s base * \param DB Handler d'acc<63>s base
@@ -49,13 +49,13 @@ class InterfacePhenixsynchro
function InterfacePhenixsynchro($DB) function InterfacePhenixsynchro($DB)
{ {
$this->db = $DB ; $this->db = $DB ;
$this->name = eregi_replace('Interface','',get_class($this)); $this->name = eregi_replace('Interface','',get_class($this));
$this->family = "phenix"; $this->family = "phenix";
$this->description = "Triggers of this module allows to add an event inside Phenix calenar for each Dolibarr business event."; $this->description = "Triggers of this module allows to add an event inside Phenix calenar for each Dolibarr business event.";
$this->version = 'experimental'; // 'experimental' or 'dolibarr' or version $this->version = 'experimental'; // 'experimental' or 'dolibarr' or version
} }
/** /**
* \brief Renvoi nom du lot de triggers * \brief Renvoi nom du lot de triggers
* \return string Nom du lot de triggers * \return string Nom du lot de triggers
@@ -64,7 +64,7 @@ class InterfacePhenixsynchro
{ {
return $this->name; return $this->name;
} }
/** /**
* \brief Renvoi descriptif du lot de triggers * \brief Renvoi descriptif du lot de triggers
* \return string Descriptif du lot de triggers * \return string Descriptif du lot de triggers
@@ -141,7 +141,7 @@ class InterfacePhenixsynchro
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
// Initialisation donnees (date,duree,texte,desc) // Initialisation donnees (date,duree,texte,desc)
$this->date=time(); $this->date=time();
$this->duree=0; $this->duree=0;
@@ -223,7 +223,7 @@ class InterfacePhenixsynchro
$this->desc=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); $this->desc=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref);
$this->desc.="\n".$langs->transnoentities("Author").': '.$user->login; $this->desc.="\n".$langs->transnoentities("Author").': '.$user->login;
} }
// Invoices // Invoices
elseif ($action == 'BILL_VALIDATE') elseif ($action == 'BILL_VALIDATE')
{ {
@@ -394,8 +394,8 @@ class InterfacePhenixsynchro
$error ="Dolibarr n'a pu se connecter <20> la base Phenix avec les identifiants d<>finis (host=".$conf->phenix->db->host." dbname=".$conf->phenix->db->name." user=".$conf->phenix->db->user."). "; $error ="Dolibarr n'a pu se connecter <20> la base Phenix avec les identifiants d<>finis (host=".$conf->phenix->db->host." dbname=".$conf->phenix->db->name." user=".$conf->phenix->db->user."). ";
$error.="La mise a jour Webcalendar a <20>t<EFBFBD> ignor<6F>e."; $error.="La mise a jour Webcalendar a <20>t<EFBFBD> ignor<6F>e.";
$this->error=$error; $this->error=$error;
//dol_syslog("interface_phenix.class.php: ".$this->error); //dol_syslog("interface_phenix.class.php: ".$this->error, LOG_ERR);
return -1; return -1;
} }
@@ -415,7 +415,7 @@ class InterfacePhenixsynchro
$error.="La mise a jour Phenix a <20>t<EFBFBD> ignor<6F>e."; $error.="La mise a jour Phenix a <20>t<EFBFBD> ignor<6F>e.";
$this->error=$error; $this->error=$error;
//dol_syslog("interface_phenix.class.php: ".$this->error); //dol_syslog("interface_phenix.class.php: ".$this->error, LOG_ERR);
return -2; return -2;
} }
} }

View File

@@ -35,12 +35,12 @@ class InterfaceWebcalsynchro
{ {
var $db; var $db;
var $error; var $error;
var $date; var $date;
var $duree; var $duree;
var $texte; var $texte;
var $desc; var $desc;
/** /**
* \brief Constructeur. * \brief Constructeur.
* \param DB Handler d'acc<63>s base * \param DB Handler d'acc<63>s base
@@ -48,13 +48,13 @@ class InterfaceWebcalsynchro
function InterfaceWebcalsynchro($DB) function InterfaceWebcalsynchro($DB)
{ {
$this->db = $DB ; $this->db = $DB ;
$this->name = eregi_replace('Interface','',get_class($this)); $this->name = eregi_replace('Interface','',get_class($this));
$this->family = "webcal"; $this->family = "webcal";
$this->description = "Triggers of this module allows to add an event inside Webcalendar for each Dolibarr business event."; $this->description = "Triggers of this module allows to add an event inside Webcalendar for each Dolibarr business event.";
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
} }
/** /**
* \brief Renvoi nom du lot de triggers * \brief Renvoi nom du lot de triggers
* \return string Nom du lot de triggers * \return string Nom du lot de triggers
@@ -63,7 +63,7 @@ class InterfaceWebcalsynchro
{ {
return $this->name; return $this->name;
} }
/** /**
* \brief Renvoi descriptif du lot de triggers * \brief Renvoi descriptif du lot de triggers
* \return string Descriptif du lot de triggers * \return string Descriptif du lot de triggers
@@ -140,7 +140,7 @@ class InterfaceWebcalsynchro
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
// Initialisation donnees (date,duree,texte,desc) // Initialisation donnees (date,duree,texte,desc)
$this->date=time(); $this->date=time();
$this->duree=0; $this->duree=0;
@@ -200,7 +200,7 @@ class InterfaceWebcalsynchro
$this->desc=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); $this->desc=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref);
$this->desc.="\n".$langs->transnoentities("Author").': '.$user->login; $this->desc.="\n".$langs->transnoentities("Author").': '.$user->login;
} }
// Invoices // Invoices
elseif ($action == 'BILL_VALIDATE') elseif ($action == 'BILL_VALIDATE')
{ {
@@ -371,8 +371,8 @@ class InterfaceWebcalsynchro
$error ="Dolibarr n'a pu se connecter <20> la base Webcalendar avec les identifiants d<>finis (host=".$conf->webcal->db->host." dbname=".$conf->webcal->db->name." user=".$conf->webcal->db->user."). "; $error ="Dolibarr n'a pu se connecter <20> 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 <20>t<EFBFBD> ignor<6F>e."; $error.="La mise a jour Webcalendar a <20>t<EFBFBD> ignor<6F>e.";
$this->error=$error; $this->error=$error;
//dol_syslog("interface_webcal.class.php: ".$this->error); //dol_syslog("interface_webcal.class.php: ".$this->error, LOG_ERR);
return -1; return -1;
} }
@@ -392,7 +392,7 @@ class InterfaceWebcalsynchro
$error.="La mise a jour Webcalendar a <20>t<EFBFBD> ignor<6F>e."; $error.="La mise a jour Webcalendar a <20>t<EFBFBD> ignor<6F>e.";
$this->error=$error; $this->error=$error;
//dol_syslog("interface_webcal.class.php: ".$this->error); //dol_syslog("interface_webcal.class.php: ".$this->error, LOG_ERR);
return -2; return -2;
} }
} }

View File

@@ -329,7 +329,7 @@ class CMailFile
else else
{ {
$this->error='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; $this->error='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
dol_syslog("CMailFile::sendfile: ".$this->error); dol_syslog("CMailFile::sendfile: ".$this->error, LOG_WARN);
} }
error_reporting($errorlevel); // Reactive niveau erreur origine error_reporting($errorlevel); // Reactive niveau erreur origine

View File

@@ -158,7 +158,7 @@ class Livraison extends CommonObject
{ {
$error++; $error++;
$this->error=$this->db->lasterror()." - sql=".$this->db->lastqueryerror; $this->error=$this->db->lasterror()." - sql=".$this->db->lastqueryerror;
dol_syslog("Livraison::create Error -3 ".$this->error); dol_syslog("Livraison::create Error -3 ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
} }
@@ -167,7 +167,7 @@ class Livraison extends CommonObject
{ {
$error++; $error++;
$this->error=$this->db->lasterror()." - sql=".$this->db->lastqueryerror; $this->error=$this->db->lasterror()." - sql=".$this->db->lastqueryerror;
dol_syslog("Livraison::create Error -2 ".$this->error); dol_syslog("Livraison::create Error -2 ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
@@ -176,7 +176,7 @@ class Livraison extends CommonObject
{ {
$error++; $error++;
$this->error=$this->db->lasterror()." - sql=".$this->db->lastqueryerror; $this->error=$this->db->lasterror()." - sql=".$this->db->lastqueryerror;
dol_syslog("Livraison::create Error -1 ".$this->error); dol_syslog("Livraison::create Error -1 ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@@ -298,13 +298,13 @@ class Livraison extends CommonObject
else else
{ {
$this->error='Delivery with id '.$rowid.' not found sql='.$sql; $this->error='Delivery with id '.$rowid.' not found sql='.$sql;
dol_syslog('Livraison::Fetch Error '.$this->error); dol_syslog('Livraison::Fetch Error '.$this->error, LOG_ERR);
return -2; return -2;
} }
} }
else else
{ {
dol_syslog('Livraison::Fetch Error '.$this->error); dol_syslog('Livraison::Fetch Error '.$this->error, LOG_ERR);
$this->error=$this->db->error(); $this->error=$this->db->error();
return -1; return -1;
} }
@@ -398,7 +398,7 @@ class Livraison extends CommonObject
{ {
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->error()." - sql=$sql"; $this->error=$this->db->error()." - sql=$sql";
dol_syslog("livraison.class.php::valid ".$this->error); dol_syslog("livraison.class.php::valid ".$this->error, LOG_ERR);
return -3; return -3;
} }
$i++; $i++;
@@ -409,7 +409,7 @@ class Livraison extends CommonObject
{ {
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->error()." - sql=$sql"; $this->error=$this->db->error()." - sql=$sql";
dol_syslog("livraison.class.php::valid ".$this->error); dol_syslog("livraison.class.php::valid ".$this->error, LOG_ERR);
return -2; return -2;
} }
@@ -445,7 +445,7 @@ class Livraison extends CommonObject
{ {
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->error()." - sql=$sql"; $this->error=$this->db->error()." - sql=$sql";
dol_syslog("livraison.class.php::valid ".$this->error); dol_syslog("livraison.class.php::valid ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -454,7 +454,7 @@ class Livraison extends CommonObject
else else
{ {
$this->error="Non autorise"; $this->error="Non autorise";
dol_syslog("livraison.class.php::valid ".$this->error); dol_syslog("livraison.class.php::valid ".$this->error, LOG_ERR);
return -1; return -1;
} }
@@ -463,7 +463,7 @@ class Livraison extends CommonObject
return 1; return 1;
} }
/** \brief Cr<43><72> le bon de livraison depuis une exp<EFBFBD>dition existante /** \brief Cr<43><72> le bon de livraison depuis une expedition existante
* \param user Utilisateur qui cr<63>e * \param user Utilisateur qui cr<63>e
* \param sending_id Id de l'exp<78>dition qui sert de mod<6F>le * \param sending_id Id de l'exp<78>dition qui sert de mod<6F>le
*/ */

View File

@@ -43,23 +43,23 @@ class Osc_Categorie
var $db; var $db;
var $error=''; var $error='';
var $errors=array(); var $errors=array();
var $id; var $id;
var $dolicatid; var $dolicatid;
var $osccatid; var $osccatid;
/** /**
* \brief Constructor * \brief Constructor
* \param DB Database handler * \param DB Database handler
*/ */
function Osc_Categorie($DB) function Osc_Categorie($DB)
{ {
$this->db = $DB; $this->db = $DB;
return 1; return 1;
} }
/** /**
* \brief Create in database * \brief Create in database
* \param user User that create * \param user User that create
@@ -68,7 +68,7 @@ class Osc_Categorie
function create($user) function create($user)
{ {
global $conf, $langs; global $conf, $langs;
// Clean parameters // Clean parameters
$this->dolicatid=trim($this->dolicatid); $this->dolicatid=trim($this->dolicatid);
$this->ocscatid=trim($this->ocscatid); $this->ocscatid=trim($this->ocscatid);
@@ -86,7 +86,7 @@ class Osc_Categorie
if ($resql) if ($resql)
{ {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."osc_categories"); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."osc_categories");
/* $resql=$this->update($user, 1); /* $resql=$this->update($user, 1);
if ($resql < 0) if ($resql < 0)
{ {
@@ -109,7 +109,7 @@ class Osc_Categorie
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
$this->error .= "erreur ".$sql; $this->error .= "erreur ".$sql;
dol_syslog("Osc_Categorie.class::create ".$this->error); dol_syslog("Osc_Categorie.class::create ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -123,7 +123,7 @@ class Osc_Categorie
function update($user=0, $notrigger=0) function update($user=0, $notrigger=0)
{ {
global $conf, $langs; global $conf, $langs;
// Clean parameters // Clean parameters
$this->dolicatid=trim($this->dolicatid); $this->dolicatid=trim($this->dolicatid);
$this->ocscatid=trim($this->ocscatid); $this->ocscatid=trim($this->ocscatid);
@@ -134,7 +134,7 @@ class Osc_Categorie
$sql.= " osccatid='".addslashes($this->osccatid)."'"; $sql.= " osccatid='".addslashes($this->osccatid)."'";
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
dol_syslog("Osc_Categorie.class::update sql=".$sql,LOG_DEBUG); dol_syslog("Osc_Categorie.class::update sql=".$sql,LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) if (! $resql)
{ {
@@ -154,8 +154,8 @@ class Osc_Categorie
return 1; return 1;
} }
/* /*
* \brief Load object in memory from database * \brief Load object in memory from database
* \param id id object * \param id id object
@@ -168,7 +168,7 @@ class Osc_Categorie
$sql = "SELECT t.rowid, t.dolicatid, t.osccatid"; $sql = "SELECT t.rowid, t.dolicatid, t.osccatid";
$sql.= " FROM ".MAIN_DB_PREFIX."osc_categories as t"; $sql.= " FROM ".MAIN_DB_PREFIX."osc_categories as t";
$sql.= " WHERE c.rowid = ".$id; $sql.= " WHERE c.rowid = ".$id;
dol_syslog("Osc_Categorie.class::fetch sql=".$sql); dol_syslog("Osc_Categorie.class::fetch sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
@@ -176,23 +176,23 @@ class Osc_Categorie
if ($this->db->num_rows($resql)) if ($this->db->num_rows($resql))
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->dolicatid = $obj->dolicatid; $this->dolicatid = $obj->dolicatid;
$this->ocscatid = $obj->osccatid; $this->ocscatid = $obj->osccatid;
} }
$this->db->free($resql); $this->db->free($resql);
return 1; return 1;
} }
else else
{ {
$this->error="Error ".$this->db->lasterror(); $this->error="Error ".$this->db->lasterror();
dol_syslog("Osc_Categorie.class::fetch ".$this->error); dol_syslog("Osc_Categorie.class::fetch ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
/* /*
* \brief Load object in memory from database * \brief Load object in memory from database
* \param id id object * \param id id object
@@ -205,7 +205,7 @@ class Osc_Categorie
$sql = "SELECT t.rowid, t.dolicatid, t.osccatid"; $sql = "SELECT t.rowid, t.dolicatid, t.osccatid";
$sql.= " FROM ".MAIN_DB_PREFIX."osc_categories as t"; $sql.= " FROM ".MAIN_DB_PREFIX."osc_categories as t";
$sql.= " WHERE t.osccatid = ".$oscid; $sql.= " WHERE t.osccatid = ".$oscid;
dol_syslog("Osc_Categorie.class::fetch_osccat sql=".$sql); dol_syslog("Osc_Categorie.class::fetch_osccat sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
@@ -213,25 +213,25 @@ class Osc_Categorie
if ($this->db->num_rows($resql)) if ($this->db->num_rows($resql))
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->dolicatid = $obj->dolicatid; $this->dolicatid = $obj->dolicatid;
$this->osccatid = $obj->osccatid; $this->osccatid = $obj->osccatid;
} }
else else
$this->initAsSpecimen(); $this->initAsSpecimen();
$this->db->free($resql); $this->db->free($resql);
return 1; return 1;
} }
else else
{ {
$this->error="Error ".$this->db->lasterror(); $this->error="Error ".$this->db->lasterror();
dol_syslog("Osc_Categorie.class::fetch_osccat ".$this->error); dol_syslog("Osc_Categorie.class::fetch_osccat ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
/* /*
* \brief Load object in memory from database * \brief Load object in memory from database
* \param id id object * \param id id object
@@ -244,7 +244,7 @@ class Osc_Categorie
$sql = "SELECT t.rowid, t.dolicatid, t.osccatid"; $sql = "SELECT t.rowid, t.dolicatid, t.osccatid";
$sql.= " FROM ".MAIN_DB_PREFIX."osc_categories as t"; $sql.= " FROM ".MAIN_DB_PREFIX."osc_categories as t";
$sql.= " WHERE t.dolicatid = ".$doliid; $sql.= " WHERE t.dolicatid = ".$doliid;
dol_syslog("Osc_Categorie.class::fetch_dolicat sql=".$sql); dol_syslog("Osc_Categorie.class::fetch_dolicat sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
@@ -252,23 +252,23 @@ class Osc_Categorie
if ($this->db->num_rows($resql)) if ($this->db->num_rows($resql))
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->dolicatid = $obj->dolicatid; $this->dolicatid = $obj->dolicatid;
$this->ocscatid = $obj->osccatid; $this->ocscatid = $obj->osccatid;
} }
$this->db->free($resql); $this->db->free($resql);
return 1; return 1;
} }
else else
{ {
$this->error="Error ".$this->db->lasterror(); $this->error="Error ".$this->db->lasterror();
dol_syslog("Osc_Categorie.class::fetch_dolicat ".$this->error); dol_syslog("Osc_Categorie.class::fetch_dolicat ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
/* /*
* \brief Delete object in database * \brief Delete object in database
* \param user User that delete * \param user User that delete
@@ -277,10 +277,10 @@ class Osc_Categorie
function delete($user) function delete($user)
{ {
global $conf, $langs; global $conf, $langs;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."osc_categories"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."osc_categories";
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
dol_syslog("Osc_Categorie.class::delete sql=".$sql); dol_syslog("Osc_Categorie.class::delete sql=".$sql);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) if (! $resql)
@@ -288,7 +288,7 @@ class Osc_Categorie
$this->error=$this->db->lasterror().' sql='.$sql; $this->error=$this->db->lasterror().' sql='.$sql;
return -1; return -1;
} }
// Appel des triggers // Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
@@ -299,7 +299,7 @@ class Osc_Categorie
return 1; return 1;
} }
/** /**
* \brief Initialise object with example values * \brief Initialise object with example values
* \remarks id must be 0 if object instance is a specimen. * \remarks id must be 0 if object instance is a specimen.
@@ -310,6 +310,6 @@ class Osc_Categorie
$this->dolicatid=0; $this->dolicatid=0;
$this->osccatid=0; $this->osccatid=0;
} }
} }
?> ?>

View File

@@ -35,16 +35,16 @@
*/ */
class Phenix { class Phenix {
var $localdb; var $localdb;
var $error; var $error;
var $date; var $date;
var $duree = 0; /* Secondes */ var $duree = 0; /* Secondes */
var $texte; var $texte;
var $desc; var $desc;
/** /**
\brief Constructeur de la classe d'interface <20> Phenix \brief Constructeur de la classe d'interface <20> Phenix
*/ */
@@ -80,23 +80,23 @@ class Phenix {
function add($user) function add($user)
{ {
global $langs; global $langs;
dol_syslog("Phenix::add user=".$user->id); dol_syslog("Phenix::add user=".$user->id);
// Test si login phenix d<>fini pour le user // Test si login phenix d<>fini pour le user
if (! $user->phenix_login) if (! $user->phenix_login)
{ {
$langs->load("other"); $langs->load("other");
$this->error=$langs->transnoentities("ErrorPhenixLoginNotDefined","<a href=\"".DOL_URL_ROOT."/user/fiche.php?id=".$user->id."\">".$user->login."</a>"); $this->error=$langs->transnoentities("ErrorPhenixLoginNotDefined","<a href=\"".DOL_URL_ROOT."/user/fiche.php?id=".$user->id."\">".$user->login."</a>");
dol_syslog("Phenix::add ERROR ".$this->error); dol_syslog("Phenix::add ERROR ".$this->error, LOG_ERR);
return -4; return -4;
} }
$this->localdb->begin(); $this->localdb->begin();
// Recup<75>re l'id max+1 dans la base webcalendar // Recup<75>re l'id max+1 dans la base webcalendar
$id = $this->get_next_id(); $id = $this->get_next_id();
if ($id > 0) if ($id > 0)
{ {
$age_id = $id; $age_id = $id;
@@ -116,26 +116,26 @@ class Phenix {
$sql = "INSERT INTO px_agenda (age_id, age_createur_id, cal_date, cal_time, cal_mod_date, cal_mod_time, cal_duration, cal_priority, cal_type, cal_access, cal_name,cal_description)"; $sql = "INSERT INTO px_agenda (age_id, age_createur_id, cal_date, cal_time, cal_mod_date, cal_mod_time, cal_duration, cal_priority, cal_type, cal_access, cal_name,cal_description)";
$sql.= " VALUES ($age_id, '$age_createur_id', '$cal_date', '$cal_time', '$cal_mod_date', '$cal_mod_time', $cal_duration, $cal_priority, '$cal_type', '$cal_access', '$cal_name','$cal_description')"; $sql.= " VALUES ($age_id, '$age_createur_id', '$cal_date', '$cal_time', '$cal_mod_date', '$cal_mod_time', $cal_duration, $cal_priority, '$cal_type', '$cal_access', '$cal_name','$cal_description')";
dol_syslog("Phenix::add sql=".$sql); dol_syslog("Phenix::add sql=".$sql);
$resql=$this->localdb->query($sql); $resql=$this->localdb->query($sql);
if ($resql) if ($resql)
{ {
$sql = "INSERT INTO webcal_entry_user (cal_id, cal_login, cal_status)"; $sql = "INSERT INTO webcal_entry_user (cal_id, cal_login, cal_status)";
$sql .= " VALUES ($cal_id, '$cal_create_by', 'A')"; $sql .= " VALUES ($cal_id, '$cal_create_by', 'A')";
$resql=$this->localdb->query($sql); $resql=$this->localdb->query($sql);
if ($resql) if ($resql)
{ {
// OK // OK
$this->localdb->commit(); $this->localdb->commit();
return 1; return 1;
} }
else else
{ {
$this->localdb->rollback(); $this->localdb->rollback();
$this->error = $this->localdb->error() . '<br>' .$sql; $this->error = $this->localdb->error() . '<br>' .$sql;
dol_syslog("Phenix::add ERROR ".$this->error); dol_syslog("Phenix::add ERROR ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -143,7 +143,7 @@ class Phenix {
{ {
$this->localdb->rollback(); $this->localdb->rollback();
$this->error = $this->localdb->error() . '<br>' .$sql; $this->error = $this->localdb->error() . '<br>' .$sql;
dol_syslog("Phenix::add ERROR ".$this->error); dol_syslog("Phenix::add ERROR ".$this->error, LOG_ERR);
return -2; return -2;
} }
} }
@@ -151,11 +151,11 @@ class Phenix {
{ {
$this->localdb->rollback(); $this->localdb->rollback();
$this->error = $this->localdb->error() . '<br>' .$sql; $this->error = $this->localdb->error() . '<br>' .$sql;
dol_syslog("Phenix::add ERROR ".$this->error); dol_syslog("Phenix::add ERROR ".$this->error, LOG_ERR);
return -3; return -3;
} }
} }
/** /**
\brief Obtient l'id suivant dans phenix \brief Obtient l'id suivant dans phenix
@@ -177,6 +177,6 @@ class Phenix {
return -1; return -1;
} }
} }
} }
?> ?>

View File

@@ -893,7 +893,7 @@ class Product extends CommonObject
if (! $id && ! $ref) if (! $id && ! $ref)
{ {
$this->error=$langs->trans('ErrorWrongParameters'); $this->error=$langs->trans('ErrorWrongParameters');
dol_print_error("Product::fetch ".$this->error); dol_print_error("Product::fetch ".$this->error, LOG_ERR);
return -1; return -1;
} }

View File

@@ -155,7 +155,7 @@ class Entrepot extends CommonObject
{ {
$this->error=$this->db->error()." sql=$sql";; $this->error=$this->db->error()." sql=$sql";;
dol_syslog("Entrepot::Update return -1"); dol_syslog("Entrepot::Update return -1");
dol_syslog("Entrepot::Update ".$this->error); dol_syslog("Entrepot::Update ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -175,7 +175,7 @@ class Entrepot extends CommonObject
if ($result) if ($result)
{ {
$obj=$this->db->fetch_object($result); $obj=$this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->libelle = $obj->label; $this->libelle = $obj->label;
@@ -186,7 +186,7 @@ class Entrepot extends CommonObject
$this->cp = $obj->cp; $this->cp = $obj->cp;
$this->ville = $obj->ville; $this->ville = $obj->ville;
$this->pays_id = $obj->fk_pays; $this->pays_id = $obj->fk_pays;
if ($this->pays_id) if ($this->pays_id)
{ {
$sqlp = "SELECT libelle from ".MAIN_DB_PREFIX."c_pays where rowid = ".$this->pays_id; $sqlp = "SELECT libelle from ".MAIN_DB_PREFIX."c_pays where rowid = ".$this->pays_id;
@@ -201,7 +201,7 @@ class Entrepot extends CommonObject
} }
$this->pays=$objp->libelle; $this->pays=$objp->libelle;
} }
$this->db->free($result); $this->db->free($result);
return 1; return 1;
} }
@@ -250,7 +250,7 @@ class Entrepot extends CommonObject
$this->date_modification = $obj->datem; $this->date_modification = $obj->datem;
} }
$this->db->free($result); $this->db->free($result);
} }
@@ -308,14 +308,14 @@ class Entrepot extends CommonObject
{ {
$sql.= ' AND IFNULL(c.visible,1)=1'; $sql.= ' AND IFNULL(c.visible,1)=1';
} }
$result = $this->db->query($sql) ; $result = $this->db->query($sql) ;
if ( $result ) if ( $result )
{ {
$row = $this->db->fetch_row(0); $row = $this->db->fetch_row(0);
return $row[0]; return $row[0];
$this->db->free(); $this->db->free();
} }
else else

View File

@@ -65,7 +65,7 @@ class MouvementStock
} }
else else
{ {
dol_syslog("MouvementStock::_create ".$this->error); dol_syslog("MouvementStock::_create ".$this->error, LOG_ERR);
$error = -1; $error = -1;
} }
@@ -83,7 +83,7 @@ class MouvementStock
} }
else else
{ {
dol_syslog("MouvementStock::_create echec update ".$this->error); dol_syslog("MouvementStock::_create echec update ".$this->error, LOG_ERR);
$error = -2; $error = -2;
} }
} }
@@ -165,7 +165,7 @@ class MouvementStock
{ {
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
dol_syslog("MouvementStock::_create ".$this->error); dol_syslog("MouvementStock::_create ".$this->error, LOG_ERR);
return -2; return -2;
} }
} }
@@ -239,7 +239,7 @@ class MouvementStock
} }
else else
{ {
dol_syslog("MouvementStock::_Create echec update ".$this->error); dol_syslog("MouvementStock::_Create echec update ".$this->error, LOG_ERR);
return -1; return -1;
} }
@@ -432,7 +432,7 @@ class MouvementStock
} }
else else
{ {
dol_syslog("MouvementStock::CalculateValoPmp ERRORSQL[1] ".$this->error); dol_syslog("MouvementStock::CalculateValoPmp ERRORSQL[1] ".$this->error, LOG_ERR);
$error = -16; $error = -16;
} }
} }
@@ -478,7 +478,7 @@ class MouvementStock
} }
else else
{ {
dol_syslog("MouvementStock::CalculateValoPmp ERRORSQL[2] insert ".$this->error); dol_syslog("MouvementStock::CalculateValoPmp ERRORSQL[2] insert ".$this->error, LOG_ERR);
$error = -17; $error = -17;
} }
} }

View File

@@ -464,7 +464,7 @@ class Propal extends CommonObject
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
$this->db->rollback(); $this->db->rollback();
dol_syslog("Propal::UpdateLine Erreur sql=$sql, error=".$this->error); dol_syslog("Propal::UpdateLine Error=".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -611,7 +611,7 @@ class Propal extends CommonObject
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Propal::Create -2 ".$this->error); dol_syslog("Propal::Create -2 ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
@@ -621,13 +621,13 @@ class Propal extends CommonObject
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Propal::Create -1 ".$this->error); dol_syslog("Propal::Create -1 ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
$this->db->commit(); $this->db->commit();
dol_syslog("Propal::Create done id=".$this->id); dol_syslog("Propal::Create done id=".$this->id, LOG_ERR);
return $this->id; return $this->id;
} }

View File

@@ -710,7 +710,7 @@ class Societe extends CommonObject
else else
{ {
$this->error .= $this->db->lasterror(); $this->error .= $this->db->lasterror();
dol_syslog("Societe::Delete erreur -1 ".$this->error); dol_syslog("Societe::Delete erreur -1 ".$this->error, LOG_ERR);
return -1; return -1;
} }
@@ -755,7 +755,7 @@ class Societe extends CommonObject
else else
{ {
$this->error .= $this->db->lasterror(); $this->error .= $this->db->lasterror();
dol_syslog("Societe::Delete erreur -1 ".$this->error); dol_syslog("Societe::Delete erreur -1 ".$this->error, LOG_ERR);
} }
// Update link in member table // Update link in member table
@@ -769,7 +769,7 @@ class Societe extends CommonObject
else else
{ {
$this->error .= $this->db->lasterror(); $this->error .= $this->db->lasterror();
dol_syslog("Societe::Delete erreur -1 ".$this->error); dol_syslog("Societe::Delete erreur -1 ".$this->error, LOG_ERR);
} }
// Remove ban // Remove ban
@@ -783,7 +783,7 @@ class Societe extends CommonObject
else else
{ {
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
dol_syslog("Societe::Delete erreur -2 ".$this->error); dol_syslog("Societe::Delete erreur -2 ".$this->error, LOG_ERR);
} }
// Remove third party // Remove third party
@@ -797,7 +797,7 @@ class Societe extends CommonObject
else else
{ {
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
dol_syslog("Societe::Delete erreur -3 ".$this->error); dol_syslog("Societe::Delete erreur -3 ".$this->error, LOG_ERR);
} }
if ($sqr == 4) if ($sqr == 4)

View File

@@ -885,7 +885,7 @@ class User extends CommonObject
else else
{ {
// $this->error deja positionne // $this->error deja positionne
dol_syslog("User::create_from_member - 2 - ".$this->error); dol_syslog("User::create_from_member - 2 - ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return $result; return $result;

View File

@@ -33,7 +33,7 @@
*/ */
class Webcal { class Webcal {
var $localdb; var $localdb;
var $error; var $error;
var $version; /* Version string from webcalendar. Not defined in 1.0 */ var $version; /* Version string from webcalendar. Not defined in 1.0 */
@@ -41,9 +41,9 @@ class Webcal {
var $duree = 0; /* Secondes */ var $duree = 0; /* Secondes */
var $texte; var $texte;
var $desc; var $desc;
/** /**
\brief Constructeur de la classe d'interface <20> Webcalendar \brief Constructeur de la classe d'interface <20> Webcalendar
*/ */
@@ -75,7 +75,7 @@ class Webcal {
function add($user) function add($user)
{ {
global $langs; global $langs;
dol_syslog("Webcal::add user=".$user->id); dol_syslog("Webcal::add user=".$user->id);
// Test si login webcal d<>fini pour le user // Test si login webcal d<>fini pour le user
@@ -83,15 +83,15 @@ class Webcal {
{ {
$langs->load("other"); $langs->load("other");
$this->error=$langs->transnoentities("ErrorWebcalLoginNotDefined","<a href=\"".DOL_URL_ROOT."/user/fiche.php?id=".$user->id."\">".$user->login."</a>"); $this->error=$langs->transnoentities("ErrorWebcalLoginNotDefined","<a href=\"".DOL_URL_ROOT."/user/fiche.php?id=".$user->id."\">".$user->login."</a>");
dol_syslog("Webcal::add ERROR ".$this->error); dol_syslog("Webcal::add ERROR ".$this->error, LOG_ERR);
return -4; return -4;
} }
$this->localdb->begin(); $this->localdb->begin();
// Recup<75>re l'id max+1 dans la base webcalendar // Recup<75>re l'id max+1 dans la base webcalendar
$id = $this->get_next_id(); $id = $this->get_next_id();
if ($id > 0) if ($id > 0)
{ {
$cal_id = $id; $cal_id = $id;
@@ -118,19 +118,19 @@ class Webcal {
{ {
$sql = "INSERT INTO webcal_entry_user (cal_id, cal_login, cal_status)"; $sql = "INSERT INTO webcal_entry_user (cal_id, cal_login, cal_status)";
$sql .= " VALUES ($cal_id, '$cal_create_by', 'A')"; $sql .= " VALUES ($cal_id, '$cal_create_by', 'A')";
$resql=$this->localdb->query($sql); $resql=$this->localdb->query($sql);
if ($resql) if ($resql)
{ {
// OK // OK
$this->localdb->commit(); $this->localdb->commit();
return 1; return 1;
} }
else else
{ {
$this->localdb->rollback(); $this->localdb->rollback();
$this->error = $this->localdb->error() . '<br>' .$sql; $this->error = $this->localdb->error() . '<br>' .$sql;
dol_syslog("Webcal::add ERROR ".$this->error); dol_syslog("Webcal::add ERROR ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@@ -138,7 +138,7 @@ class Webcal {
{ {
$this->localdb->rollback(); $this->localdb->rollback();
$this->error = $this->localdb->error() . '<br>' .$sql; $this->error = $this->localdb->error() . '<br>' .$sql;
dol_syslog("Webcal::add ERROR ".$this->error); dol_syslog("Webcal::add ERROR ".$this->error, LOG_ERR);
return -2; return -2;
} }
} }
@@ -146,7 +146,7 @@ class Webcal {
{ {
$this->localdb->rollback(); $this->localdb->rollback();
$this->error = $this->localdb->error() . '<br>' .$sql; $this->error = $this->localdb->error() . '<br>' .$sql;
dol_syslog("Webcal::add ERROR ".$this->error); dol_syslog("Webcal::add ERROR ".$this->error, LOG_ERR);
return -3; return -3;
} }
} }
@@ -173,12 +173,12 @@ class Webcal {
} }
} }
/** /**
\brief Export fichier cal depuis base webcalendar \brief Export fichier cal depuis base webcalendar
\param format 'ical' or 'vcal' \param format 'ical' or 'vcal'
\param type 'event' or 'journal' \param type 'event' or 'journal'
\param cachedelay Do not rebuild file if date older than cachedelay seconds \param cachedelay Do not rebuild file if date older than cachedelay seconds
\param filename Force filename \param filename Force filename
\param filters Array of filters \param filters Array of filters
\return int <0 if error, nb of events in new file if ok \return int <0 if error, nb of events in new file if ok
@@ -186,7 +186,7 @@ class Webcal {
function build_calfile($format,$type,$cachedelay,$filename,$filters) function build_calfile($format,$type,$cachedelay,$filename,$filters)
{ {
global $conf,$langs; global $conf,$langs;
require_once (DOL_DOCUMENT_ROOT ."/lib/xcal.lib.php"); require_once (DOL_DOCUMENT_ROOT ."/lib/xcal.lib.php");
dol_syslog("webcal::build_calfile Build cal file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".sizeof($filters), LOG_DEBUG); dol_syslog("webcal::build_calfile Build cal file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".sizeof($filters), LOG_DEBUG);
@@ -201,22 +201,22 @@ class Webcal {
if ($format == 'ical') $extension='ics'; if ($format == 'ical') $extension='ics';
$filename=$format.'.'.$extension; $filename=$format.'.'.$extension;
} }
create_exdir($conf->webcal->dir_temp); create_exdir($conf->webcal->dir_temp);
$outputfile=$conf->webcal->dir_temp.'/'.$filename; $outputfile=$conf->webcal->dir_temp.'/'.$filename;
$result=0; $result=0;
$buildfile=true; $buildfile=true;
if ($cachedelay) if ($cachedelay)
{ {
// \TODO Check cache // \TODO Check cache
} }
if ($buildfile) if ($buildfile)
{ {
// Build event array // Build event array
$eventarray=array(); $eventarray=array();
$sql = "SELECT cal_id, cal_create_by, "; $sql = "SELECT cal_id, cal_create_by, ";
$sql.= " cal_date, cal_time, cal_mod_date,"; $sql.= " cal_date, cal_time, cal_mod_date,";
$sql.= " cal_mod_time, cal_duration, cal_priority, cal_type, cal_access, cal_name, cal_description"; $sql.= " cal_mod_time, cal_duration, cal_priority, cal_type, cal_access, cal_name, cal_description";
@@ -230,7 +230,7 @@ class Webcal {
while ($obj=$this->localdb->fetch_object($resql)) while ($obj=$this->localdb->fetch_object($resql))
{ {
$qualified=true; $qualified=true;
// 'eid','startdate','duration','enddate','title','summary','category','email','url','desc','author' // 'eid','startdate','duration','enddate','title','summary','category','email','url','desc','author'
$event=array(); $event=array();
$event['uid']='dolibarrwebcal-'.$this->localdb->database_name.'-'.$obj->cal_id."@".$_SERVER["SERVER_NAME"]; $event['uid']='dolibarrwebcal-'.$this->localdb->database_name.'-'.$obj->cal_id."@".$_SERVER["SERVER_NAME"];
@@ -264,7 +264,7 @@ class Webcal {
if (! eregi('\/$',$url)) $url.='/'; if (! eregi('\/$',$url)) $url.='/';
$url.='view_entry.php?id='.$obj->cal_id; $url.='view_entry.php?id='.$obj->cal_id;
$event['url']=$url; $event['url']=$url;
if ($qualified) if ($qualified)
{ {
$eventarray[$datestart]=$event; $eventarray[$datestart]=$event;
@@ -276,15 +276,15 @@ class Webcal {
dol_syslog("webcal::build_calfile ".$this->localdb->lasterror()); dol_syslog("webcal::build_calfile ".$this->localdb->lasterror());
return -1; return -1;
} }
// Write file // Write file
$title='Webcalendar events '; $title='Webcalendar events ';
$desc='Webcalendar events for database '.$this->localdb->database_name.' - built by Dolibarr'; $desc='Webcalendar events for database '.$this->localdb->database_name.' - built by Dolibarr';
$result=build_calfile($format,$title,$desc,$eventarray,$outputfile); $result=build_calfile($format,$title,$desc,$eventarray,$outputfile);
} }
return $result; return $result;
} }
} }
?> ?>