From 25a4c4cd2e5fd143a10a5268abe72711e8e8a28d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 15:53:54 +0000 Subject: [PATCH 01/24] Fix: Removed warnings --- htdocs/lib/admin.lib.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/lib/admin.lib.php b/htdocs/lib/admin.lib.php index d94fac368e7..6bcab638b91 100644 --- a/htdocs/lib/admin.lib.php +++ b/htdocs/lib/admin.lib.php @@ -849,7 +849,6 @@ function complete_dictionnary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsq $handle=@opendir(dol_osencode($dir)); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) { //print "$i ".$file."\n
"; From b5fa4ade4be075d77282a5d3f7e9a14a9f4fd285 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 16:40:52 +0000 Subject: [PATCH 02/24] Fix: Removed warnings --- htdocs/lib/admin.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/lib/admin.lib.php b/htdocs/lib/admin.lib.php index 6bcab638b91..d94fac368e7 100644 --- a/htdocs/lib/admin.lib.php +++ b/htdocs/lib/admin.lib.php @@ -849,6 +849,7 @@ function complete_dictionnary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsq $handle=@opendir(dol_osencode($dir)); if (is_resource($handle)) { + while (($file = readdir($handle))!==false) { //print "$i ".$file."\n
"; From 9dd5442249302099752ad6a6d9e9353cf5a0774d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 16:56:23 +0000 Subject: [PATCH 03/24] Fix: Removed warnings From 171e2c27e507dd42b619eb0516d0af00500d4c3d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 17:11:14 +0000 Subject: [PATCH 04/24] Qual: Convert non UTF8 into UTF8 without BOM Qual: Removed useless files From 1829a7a261a13146d9c45fc698a33b6f222dc2ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 22:32:11 +0000 Subject: [PATCH 05/24] Fix: Revert patch: Dolibarr must do what user setup to do. If user asked to not decrease stock or to decrease on order, Dolibarr must not force decrease on other event that the one decided by user. So i added a hidden option for people who want to have dolibarr doing the opposite than setup ask to do (I add this option, but who want that ?). From e6d5df22d7245bd889d29f5c45ba79e053dd2791 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 22:58:17 +0000 Subject: [PATCH 06/24] Add space before end of page From 51e4bc6cc17b04e0936b0a516cfc8119373ff1f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 23:28:01 +0000 Subject: [PATCH 07/24] Fix: Removed warnings --- htdocs/comm/action/class/actioncomm.class.php | 45 ++++++++----------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 73f5325a470..cfaa14c3aee 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011 Juanjo Menent * @@ -189,7 +189,7 @@ class ActionComm extends CommonObject $sql.= $conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::add sql=".$sql); + dol_syslog("ActionComm::add sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -219,9 +219,7 @@ class ActionComm extends CommonObject /** * Charge l'objet action depuis la base - * - * @param int $id id de l'action a recuperer - * @return int <0 if KO, >0 if OK + * @param id id de l'action a recuperer */ function fetch($id) { @@ -249,7 +247,7 @@ class ActionComm extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id"; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog("ActionComm::fetch sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -307,15 +305,14 @@ class ActionComm extends CommonObject /** * Supprime l'action de la base - * - * @return int <0 if KO, >0 if OK + * @return int <0 si ko, >0 si ok */ function delete() { $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm"; $sql.= " WHERE id=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog("ActionComm::delete sql=".$sql, LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -330,8 +327,7 @@ class ActionComm extends CommonObject /** * Met a jour l'action en base. * Si percentage = 100, on met a jour date 100% - * - * @return int <0 if KO, >0 if OK + * @return int <0 si ko, >0 si ok */ function update($user) { @@ -376,7 +372,7 @@ class ActionComm extends CommonObject $sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null"); $sql.= " WHERE id=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql); + dol_syslog("ActionComm::update sql=".$sql); if ($this->db->query($sql)) { return 1; @@ -384,7 +380,7 @@ class ActionComm extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); + dol_syslog("ActionComm::update ".$this->error,LOG_ERR); return -1; } } @@ -411,7 +407,7 @@ class ActionComm extends CommonObject } if (! empty($filter)) $sql.= $filter; - dol_syslog(get_class($this)."::getActions sql=".$sql); + dol_syslog("ActionComm::getActions sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -480,9 +476,7 @@ class ActionComm extends CommonObject /** * Charge les informations d'ordre info dans l'objet facture - * - * @param int $id Id de la facture a charger - * @return void + * @param id Id de la facture a charger */ function info($id) { @@ -495,7 +489,7 @@ class ActionComm extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; $sql.= ' WHERE a.id = '.$id; - dol_syslog(get_class($this)."::info sql=".$sql); + dol_syslog("ActionComm::info sql=".$sql); $result=$this->db->query($sql); if ($result) { @@ -530,7 +524,6 @@ class ActionComm extends CommonObject /** * Return label of status - * * @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param hidenastatus 1=Show nothing if status is "Not applicable" * @return string String with status @@ -542,7 +535,6 @@ class ActionComm extends CommonObject /** * Return label of action status - * * @param percent Percent * @param mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Very short label+Picto * @param hidenastatus 1=Show nothing if status is "Not applicable" @@ -653,7 +645,6 @@ class ActionComm extends CommonObject /** * Export events from database into a cal file. - * * @param format 'vcal', 'ical/ics', 'rss' * @param type 'event' or 'journal' * @param cachedelay Do not rebuild file if date older than cachedelay seconds @@ -668,7 +659,7 @@ class ActionComm extends CommonObject require_once (DOL_DOCUMENT_ROOT ."/lib/xcal.lib.php"); require_once (DOL_DOCUMENT_ROOT ."/lib/date.lib.php"); - dol_syslog(get_class($this)."::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); + dol_syslog("ActionComm::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); // Check parameters if (empty($format)) return -1; @@ -698,7 +689,7 @@ class ActionComm extends CommonObject include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); if (dol_filemtime($outputfile) > ($nowgmt - $cachedelay)) { - dol_syslog(get_class($this)."::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); + dol_syslog("ActionComm::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); $buildfile = false; } } @@ -772,7 +763,7 @@ class ActionComm extends CommonObject $sql.= " ORDER by datep"; //print $sql;exit; - dol_syslog(get_class($this)."::build_exportfile select events sql=".$sql); + dol_syslog("ActionComm::build_exportfile select events sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -818,7 +809,7 @@ class ActionComm extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::build_exportfile ".$this->db->lasterror(), LOG_ERR); + dol_syslog("ActionComm::build_exportfile ".$this->db->lasterror(), LOG_ERR); return -1; } @@ -857,14 +848,14 @@ class ActionComm extends CommonObject if (rename($outputfiletmp,$outputfile)) $result=1; else { - dol_syslog(get_class($this)."::build_exportfile failed to rename ".$outputfiletmp." to ".$outputfile, LOG_ERR); + dol_syslog("ActionComm::build_exportfile failed to rename ".$outputfiletmp." to ".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp,0,1); $result=-1; } } else { - dol_syslog(get_class($this)."::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); + dol_syslog("ActionComm::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp,0,1); $langs->load("errors"); $this->error=$langs->trans("ErrorFailToCreateFile",$outputfile); From 87a9061da246517ddc4a9aa6f6ff1b516539a502 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 23:41:42 +0000 Subject: [PATCH 08/24] Uniformize code --- htdocs/comm/action/class/actioncomm.class.php | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index cfaa14c3aee..73f5325a470 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011 Juanjo Menent * @@ -189,7 +189,7 @@ class ActionComm extends CommonObject $sql.= $conf->entity; $sql.= ")"; - dol_syslog("ActionComm::add sql=".$sql); + dol_syslog(get_class($this)."::add sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -219,7 +219,9 @@ class ActionComm extends CommonObject /** * Charge l'objet action depuis la base - * @param id id de l'action a recuperer + * + * @param int $id id de l'action a recuperer + * @return int <0 if KO, >0 if OK */ function fetch($id) { @@ -247,7 +249,7 @@ class ActionComm extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id"; - dol_syslog("ActionComm::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -305,14 +307,15 @@ class ActionComm extends CommonObject /** * Supprime l'action de la base - * @return int <0 si ko, >0 si ok + * + * @return int <0 if KO, >0 if OK */ function delete() { $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm"; $sql.= " WHERE id=".$this->id; - dol_syslog("ActionComm::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -327,7 +330,8 @@ class ActionComm extends CommonObject /** * Met a jour l'action en base. * Si percentage = 100, on met a jour date 100% - * @return int <0 si ko, >0 si ok + * + * @return int <0 if KO, >0 if OK */ function update($user) { @@ -372,7 +376,7 @@ class ActionComm extends CommonObject $sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null"); $sql.= " WHERE id=".$this->id; - dol_syslog("ActionComm::update sql=".$sql); + dol_syslog(get_class($this)."::update sql=".$sql); if ($this->db->query($sql)) { return 1; @@ -380,7 +384,7 @@ class ActionComm extends CommonObject else { $this->error=$this->db->error(); - dol_syslog("ActionComm::update ".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); return -1; } } @@ -407,7 +411,7 @@ class ActionComm extends CommonObject } if (! empty($filter)) $sql.= $filter; - dol_syslog("ActionComm::getActions sql=".$sql); + dol_syslog(get_class($this)."::getActions sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -476,7 +480,9 @@ class ActionComm extends CommonObject /** * Charge les informations d'ordre info dans l'objet facture - * @param id Id de la facture a charger + * + * @param int $id Id de la facture a charger + * @return void */ function info($id) { @@ -489,7 +495,7 @@ class ActionComm extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; $sql.= ' WHERE a.id = '.$id; - dol_syslog("ActionComm::info sql=".$sql); + dol_syslog(get_class($this)."::info sql=".$sql); $result=$this->db->query($sql); if ($result) { @@ -524,6 +530,7 @@ class ActionComm extends CommonObject /** * Return label of status + * * @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param hidenastatus 1=Show nothing if status is "Not applicable" * @return string String with status @@ -535,6 +542,7 @@ class ActionComm extends CommonObject /** * Return label of action status + * * @param percent Percent * @param mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Very short label+Picto * @param hidenastatus 1=Show nothing if status is "Not applicable" @@ -645,6 +653,7 @@ class ActionComm extends CommonObject /** * Export events from database into a cal file. + * * @param format 'vcal', 'ical/ics', 'rss' * @param type 'event' or 'journal' * @param cachedelay Do not rebuild file if date older than cachedelay seconds @@ -659,7 +668,7 @@ class ActionComm extends CommonObject require_once (DOL_DOCUMENT_ROOT ."/lib/xcal.lib.php"); require_once (DOL_DOCUMENT_ROOT ."/lib/date.lib.php"); - dol_syslog("ActionComm::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); + dol_syslog(get_class($this)."::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); // Check parameters if (empty($format)) return -1; @@ -689,7 +698,7 @@ class ActionComm extends CommonObject include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); if (dol_filemtime($outputfile) > ($nowgmt - $cachedelay)) { - dol_syslog("ActionComm::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); + dol_syslog(get_class($this)."::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); $buildfile = false; } } @@ -763,7 +772,7 @@ class ActionComm extends CommonObject $sql.= " ORDER by datep"; //print $sql;exit; - dol_syslog("ActionComm::build_exportfile select events sql=".$sql); + dol_syslog(get_class($this)."::build_exportfile select events sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -809,7 +818,7 @@ class ActionComm extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog("ActionComm::build_exportfile ".$this->db->lasterror(), LOG_ERR); + dol_syslog(get_class($this)."::build_exportfile ".$this->db->lasterror(), LOG_ERR); return -1; } @@ -848,14 +857,14 @@ class ActionComm extends CommonObject if (rename($outputfiletmp,$outputfile)) $result=1; else { - dol_syslog("ActionComm::build_exportfile failed to rename ".$outputfiletmp." to ".$outputfile, LOG_ERR); + dol_syslog(get_class($this)."::build_exportfile failed to rename ".$outputfiletmp." to ".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp,0,1); $result=-1; } } else { - dol_syslog("ActionComm::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); + dol_syslog(get_class($this)."::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp,0,1); $langs->load("errors"); $this->error=$langs->trans("ErrorFailToCreateFile",$outputfile); From b1d534a63b5119041cd14d7907021cae91054c37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 15:53:54 +0000 Subject: [PATCH 09/24] Fix: Removed warnings --- htdocs/lib/admin.lib.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/lib/admin.lib.php b/htdocs/lib/admin.lib.php index d94fac368e7..6bcab638b91 100644 --- a/htdocs/lib/admin.lib.php +++ b/htdocs/lib/admin.lib.php @@ -849,7 +849,6 @@ function complete_dictionnary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsq $handle=@opendir(dol_osencode($dir)); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) { //print "$i ".$file."\n
"; From dd5844f7ec26c2af9bf7a9b3c1b255cf68e93caa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 16:40:52 +0000 Subject: [PATCH 10/24] Fix: Removed warnings --- htdocs/lib/admin.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/lib/admin.lib.php b/htdocs/lib/admin.lib.php index 6bcab638b91..d94fac368e7 100644 --- a/htdocs/lib/admin.lib.php +++ b/htdocs/lib/admin.lib.php @@ -849,6 +849,7 @@ function complete_dictionnary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsq $handle=@opendir(dol_osencode($dir)); if (is_resource($handle)) { + while (($file = readdir($handle))!==false) { //print "$i ".$file."\n
"; From a9aa268af7de2bd401108f620ba60eaf6690733e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 16:56:23 +0000 Subject: [PATCH 11/24] Fix: Removed warnings From 41802f4bbbfb26508d19a97e33fe0f3aa3917831 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 17:11:14 +0000 Subject: [PATCH 12/24] Qual: Convert non UTF8 into UTF8 without BOM Qual: Removed useless files From 60bcc83aa953ecddc6938bafb2217cda54be3b1f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 22:32:11 +0000 Subject: [PATCH 13/24] Fix: Revert patch: Dolibarr must do what user setup to do. If user asked to not decrease stock or to decrease on order, Dolibarr must not force decrease on other event that the one decided by user. So i added a hidden option for people who want to have dolibarr doing the opposite than setup ask to do (I add this option, but who want that ?). From 6f76095e3ba645275c23295ca1b6a75f7e97262d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 22:58:17 +0000 Subject: [PATCH 14/24] Add space before end of page From 6c9b60251a8fa010a97f61d7de4c25996d7f020b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 23:28:01 +0000 Subject: [PATCH 15/24] Fix: Removed warnings --- htdocs/comm/action/class/actioncomm.class.php | 45 ++++++++----------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 73f5325a470..cfaa14c3aee 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011 Juanjo Menent * @@ -189,7 +189,7 @@ class ActionComm extends CommonObject $sql.= $conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::add sql=".$sql); + dol_syslog("ActionComm::add sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -219,9 +219,7 @@ class ActionComm extends CommonObject /** * Charge l'objet action depuis la base - * - * @param int $id id de l'action a recuperer - * @return int <0 if KO, >0 if OK + * @param id id de l'action a recuperer */ function fetch($id) { @@ -249,7 +247,7 @@ class ActionComm extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id"; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog("ActionComm::fetch sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -307,15 +305,14 @@ class ActionComm extends CommonObject /** * Supprime l'action de la base - * - * @return int <0 if KO, >0 if OK + * @return int <0 si ko, >0 si ok */ function delete() { $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm"; $sql.= " WHERE id=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog("ActionComm::delete sql=".$sql, LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -330,8 +327,7 @@ class ActionComm extends CommonObject /** * Met a jour l'action en base. * Si percentage = 100, on met a jour date 100% - * - * @return int <0 if KO, >0 if OK + * @return int <0 si ko, >0 si ok */ function update($user) { @@ -376,7 +372,7 @@ class ActionComm extends CommonObject $sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null"); $sql.= " WHERE id=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql); + dol_syslog("ActionComm::update sql=".$sql); if ($this->db->query($sql)) { return 1; @@ -384,7 +380,7 @@ class ActionComm extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); + dol_syslog("ActionComm::update ".$this->error,LOG_ERR); return -1; } } @@ -411,7 +407,7 @@ class ActionComm extends CommonObject } if (! empty($filter)) $sql.= $filter; - dol_syslog(get_class($this)."::getActions sql=".$sql); + dol_syslog("ActionComm::getActions sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -480,9 +476,7 @@ class ActionComm extends CommonObject /** * Charge les informations d'ordre info dans l'objet facture - * - * @param int $id Id de la facture a charger - * @return void + * @param id Id de la facture a charger */ function info($id) { @@ -495,7 +489,7 @@ class ActionComm extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; $sql.= ' WHERE a.id = '.$id; - dol_syslog(get_class($this)."::info sql=".$sql); + dol_syslog("ActionComm::info sql=".$sql); $result=$this->db->query($sql); if ($result) { @@ -530,7 +524,6 @@ class ActionComm extends CommonObject /** * Return label of status - * * @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param hidenastatus 1=Show nothing if status is "Not applicable" * @return string String with status @@ -542,7 +535,6 @@ class ActionComm extends CommonObject /** * Return label of action status - * * @param percent Percent * @param mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Very short label+Picto * @param hidenastatus 1=Show nothing if status is "Not applicable" @@ -653,7 +645,6 @@ class ActionComm extends CommonObject /** * Export events from database into a cal file. - * * @param format 'vcal', 'ical/ics', 'rss' * @param type 'event' or 'journal' * @param cachedelay Do not rebuild file if date older than cachedelay seconds @@ -668,7 +659,7 @@ class ActionComm extends CommonObject require_once (DOL_DOCUMENT_ROOT ."/lib/xcal.lib.php"); require_once (DOL_DOCUMENT_ROOT ."/lib/date.lib.php"); - dol_syslog(get_class($this)."::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); + dol_syslog("ActionComm::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); // Check parameters if (empty($format)) return -1; @@ -698,7 +689,7 @@ class ActionComm extends CommonObject include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); if (dol_filemtime($outputfile) > ($nowgmt - $cachedelay)) { - dol_syslog(get_class($this)."::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); + dol_syslog("ActionComm::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); $buildfile = false; } } @@ -772,7 +763,7 @@ class ActionComm extends CommonObject $sql.= " ORDER by datep"; //print $sql;exit; - dol_syslog(get_class($this)."::build_exportfile select events sql=".$sql); + dol_syslog("ActionComm::build_exportfile select events sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -818,7 +809,7 @@ class ActionComm extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::build_exportfile ".$this->db->lasterror(), LOG_ERR); + dol_syslog("ActionComm::build_exportfile ".$this->db->lasterror(), LOG_ERR); return -1; } @@ -857,14 +848,14 @@ class ActionComm extends CommonObject if (rename($outputfiletmp,$outputfile)) $result=1; else { - dol_syslog(get_class($this)."::build_exportfile failed to rename ".$outputfiletmp." to ".$outputfile, LOG_ERR); + dol_syslog("ActionComm::build_exportfile failed to rename ".$outputfiletmp." to ".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp,0,1); $result=-1; } } else { - dol_syslog(get_class($this)."::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); + dol_syslog("ActionComm::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp,0,1); $langs->load("errors"); $this->error=$langs->trans("ErrorFailToCreateFile",$outputfile); From 7df7b475529110b6ccdc7cb799cb27b356c2fb0d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 23:41:42 +0000 Subject: [PATCH 16/24] Uniformize code --- htdocs/comm/action/class/actioncomm.class.php | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index cfaa14c3aee..73f5325a470 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011 Juanjo Menent * @@ -189,7 +189,7 @@ class ActionComm extends CommonObject $sql.= $conf->entity; $sql.= ")"; - dol_syslog("ActionComm::add sql=".$sql); + dol_syslog(get_class($this)."::add sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -219,7 +219,9 @@ class ActionComm extends CommonObject /** * Charge l'objet action depuis la base - * @param id id de l'action a recuperer + * + * @param int $id id de l'action a recuperer + * @return int <0 if KO, >0 if OK */ function fetch($id) { @@ -247,7 +249,7 @@ class ActionComm extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id"; - dol_syslog("ActionComm::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -305,14 +307,15 @@ class ActionComm extends CommonObject /** * Supprime l'action de la base - * @return int <0 si ko, >0 si ok + * + * @return int <0 if KO, >0 if OK */ function delete() { $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm"; $sql.= " WHERE id=".$this->id; - dol_syslog("ActionComm::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -327,7 +330,8 @@ class ActionComm extends CommonObject /** * Met a jour l'action en base. * Si percentage = 100, on met a jour date 100% - * @return int <0 si ko, >0 si ok + * + * @return int <0 if KO, >0 if OK */ function update($user) { @@ -372,7 +376,7 @@ class ActionComm extends CommonObject $sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null"); $sql.= " WHERE id=".$this->id; - dol_syslog("ActionComm::update sql=".$sql); + dol_syslog(get_class($this)."::update sql=".$sql); if ($this->db->query($sql)) { return 1; @@ -380,7 +384,7 @@ class ActionComm extends CommonObject else { $this->error=$this->db->error(); - dol_syslog("ActionComm::update ".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); return -1; } } @@ -407,7 +411,7 @@ class ActionComm extends CommonObject } if (! empty($filter)) $sql.= $filter; - dol_syslog("ActionComm::getActions sql=".$sql); + dol_syslog(get_class($this)."::getActions sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -476,7 +480,9 @@ class ActionComm extends CommonObject /** * Charge les informations d'ordre info dans l'objet facture - * @param id Id de la facture a charger + * + * @param int $id Id de la facture a charger + * @return void */ function info($id) { @@ -489,7 +495,7 @@ class ActionComm extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; $sql.= ' WHERE a.id = '.$id; - dol_syslog("ActionComm::info sql=".$sql); + dol_syslog(get_class($this)."::info sql=".$sql); $result=$this->db->query($sql); if ($result) { @@ -524,6 +530,7 @@ class ActionComm extends CommonObject /** * Return label of status + * * @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param hidenastatus 1=Show nothing if status is "Not applicable" * @return string String with status @@ -535,6 +542,7 @@ class ActionComm extends CommonObject /** * Return label of action status + * * @param percent Percent * @param mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Very short label+Picto * @param hidenastatus 1=Show nothing if status is "Not applicable" @@ -645,6 +653,7 @@ class ActionComm extends CommonObject /** * Export events from database into a cal file. + * * @param format 'vcal', 'ical/ics', 'rss' * @param type 'event' or 'journal' * @param cachedelay Do not rebuild file if date older than cachedelay seconds @@ -659,7 +668,7 @@ class ActionComm extends CommonObject require_once (DOL_DOCUMENT_ROOT ."/lib/xcal.lib.php"); require_once (DOL_DOCUMENT_ROOT ."/lib/date.lib.php"); - dol_syslog("ActionComm::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); + dol_syslog(get_class($this)."::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); // Check parameters if (empty($format)) return -1; @@ -689,7 +698,7 @@ class ActionComm extends CommonObject include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); if (dol_filemtime($outputfile) > ($nowgmt - $cachedelay)) { - dol_syslog("ActionComm::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); + dol_syslog(get_class($this)."::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); $buildfile = false; } } @@ -763,7 +772,7 @@ class ActionComm extends CommonObject $sql.= " ORDER by datep"; //print $sql;exit; - dol_syslog("ActionComm::build_exportfile select events sql=".$sql); + dol_syslog(get_class($this)."::build_exportfile select events sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -809,7 +818,7 @@ class ActionComm extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog("ActionComm::build_exportfile ".$this->db->lasterror(), LOG_ERR); + dol_syslog(get_class($this)."::build_exportfile ".$this->db->lasterror(), LOG_ERR); return -1; } @@ -848,14 +857,14 @@ class ActionComm extends CommonObject if (rename($outputfiletmp,$outputfile)) $result=1; else { - dol_syslog("ActionComm::build_exportfile failed to rename ".$outputfiletmp." to ".$outputfile, LOG_ERR); + dol_syslog(get_class($this)."::build_exportfile failed to rename ".$outputfiletmp." to ".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp,0,1); $result=-1; } } else { - dol_syslog("ActionComm::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); + dol_syslog(get_class($this)."::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp,0,1); $langs->load("errors"); $this->error=$langs->trans("ErrorFailToCreateFile",$outputfile); From 28bb87d2ed427a2f0ad20159e95a5cfd85bd7f45 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 15:53:54 +0000 Subject: [PATCH 17/24] Fix: Removed warnings --- htdocs/lib/admin.lib.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/lib/admin.lib.php b/htdocs/lib/admin.lib.php index d94fac368e7..6bcab638b91 100644 --- a/htdocs/lib/admin.lib.php +++ b/htdocs/lib/admin.lib.php @@ -849,7 +849,6 @@ function complete_dictionnary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsq $handle=@opendir(dol_osencode($dir)); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) { //print "$i ".$file."\n
"; From be5e7151d845e59e26664ef9ea99b1980a9bb03b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 16:40:52 +0000 Subject: [PATCH 18/24] Fix: Removed warnings --- htdocs/lib/admin.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/lib/admin.lib.php b/htdocs/lib/admin.lib.php index 6bcab638b91..d94fac368e7 100644 --- a/htdocs/lib/admin.lib.php +++ b/htdocs/lib/admin.lib.php @@ -849,6 +849,7 @@ function complete_dictionnary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsq $handle=@opendir(dol_osencode($dir)); if (is_resource($handle)) { + while (($file = readdir($handle))!==false) { //print "$i ".$file."\n
"; From 415a5566fd3ae4b20eba29191c9f823af1b68f39 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 16:56:23 +0000 Subject: [PATCH 19/24] Fix: Removed warnings From 7d29b341134a32413254823604ea0539b906be73 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 17:11:14 +0000 Subject: [PATCH 20/24] Qual: Convert non UTF8 into UTF8 without BOM Qual: Removed useless files From 7d33044815a8a76d005642e6cc27195a0f894225 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 22:32:11 +0000 Subject: [PATCH 21/24] Fix: Revert patch: Dolibarr must do what user setup to do. If user asked to not decrease stock or to decrease on order, Dolibarr must not force decrease on other event that the one decided by user. So i added a hidden option for people who want to have dolibarr doing the opposite than setup ask to do (I add this option, but who want that ?). From d61abff915d381b05c0af200a1076074aafbafdc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 22:58:17 +0000 Subject: [PATCH 22/24] Add space before end of page From 058de48e1debeecca694ee0633149dfe8bfccf74 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 23:28:01 +0000 Subject: [PATCH 23/24] Fix: Removed warnings --- htdocs/comm/action/class/actioncomm.class.php | 45 ++++++++----------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 73f5325a470..cfaa14c3aee 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011 Juanjo Menent * @@ -189,7 +189,7 @@ class ActionComm extends CommonObject $sql.= $conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::add sql=".$sql); + dol_syslog("ActionComm::add sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -219,9 +219,7 @@ class ActionComm extends CommonObject /** * Charge l'objet action depuis la base - * - * @param int $id id de l'action a recuperer - * @return int <0 if KO, >0 if OK + * @param id id de l'action a recuperer */ function fetch($id) { @@ -249,7 +247,7 @@ class ActionComm extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id"; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog("ActionComm::fetch sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -307,15 +305,14 @@ class ActionComm extends CommonObject /** * Supprime l'action de la base - * - * @return int <0 if KO, >0 if OK + * @return int <0 si ko, >0 si ok */ function delete() { $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm"; $sql.= " WHERE id=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog("ActionComm::delete sql=".$sql, LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -330,8 +327,7 @@ class ActionComm extends CommonObject /** * Met a jour l'action en base. * Si percentage = 100, on met a jour date 100% - * - * @return int <0 if KO, >0 if OK + * @return int <0 si ko, >0 si ok */ function update($user) { @@ -376,7 +372,7 @@ class ActionComm extends CommonObject $sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null"); $sql.= " WHERE id=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql); + dol_syslog("ActionComm::update sql=".$sql); if ($this->db->query($sql)) { return 1; @@ -384,7 +380,7 @@ class ActionComm extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); + dol_syslog("ActionComm::update ".$this->error,LOG_ERR); return -1; } } @@ -411,7 +407,7 @@ class ActionComm extends CommonObject } if (! empty($filter)) $sql.= $filter; - dol_syslog(get_class($this)."::getActions sql=".$sql); + dol_syslog("ActionComm::getActions sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -480,9 +476,7 @@ class ActionComm extends CommonObject /** * Charge les informations d'ordre info dans l'objet facture - * - * @param int $id Id de la facture a charger - * @return void + * @param id Id de la facture a charger */ function info($id) { @@ -495,7 +489,7 @@ class ActionComm extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; $sql.= ' WHERE a.id = '.$id; - dol_syslog(get_class($this)."::info sql=".$sql); + dol_syslog("ActionComm::info sql=".$sql); $result=$this->db->query($sql); if ($result) { @@ -530,7 +524,6 @@ class ActionComm extends CommonObject /** * Return label of status - * * @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param hidenastatus 1=Show nothing if status is "Not applicable" * @return string String with status @@ -542,7 +535,6 @@ class ActionComm extends CommonObject /** * Return label of action status - * * @param percent Percent * @param mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Very short label+Picto * @param hidenastatus 1=Show nothing if status is "Not applicable" @@ -653,7 +645,6 @@ class ActionComm extends CommonObject /** * Export events from database into a cal file. - * * @param format 'vcal', 'ical/ics', 'rss' * @param type 'event' or 'journal' * @param cachedelay Do not rebuild file if date older than cachedelay seconds @@ -668,7 +659,7 @@ class ActionComm extends CommonObject require_once (DOL_DOCUMENT_ROOT ."/lib/xcal.lib.php"); require_once (DOL_DOCUMENT_ROOT ."/lib/date.lib.php"); - dol_syslog(get_class($this)."::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); + dol_syslog("ActionComm::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); // Check parameters if (empty($format)) return -1; @@ -698,7 +689,7 @@ class ActionComm extends CommonObject include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); if (dol_filemtime($outputfile) > ($nowgmt - $cachedelay)) { - dol_syslog(get_class($this)."::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); + dol_syslog("ActionComm::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); $buildfile = false; } } @@ -772,7 +763,7 @@ class ActionComm extends CommonObject $sql.= " ORDER by datep"; //print $sql;exit; - dol_syslog(get_class($this)."::build_exportfile select events sql=".$sql); + dol_syslog("ActionComm::build_exportfile select events sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -818,7 +809,7 @@ class ActionComm extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::build_exportfile ".$this->db->lasterror(), LOG_ERR); + dol_syslog("ActionComm::build_exportfile ".$this->db->lasterror(), LOG_ERR); return -1; } @@ -857,14 +848,14 @@ class ActionComm extends CommonObject if (rename($outputfiletmp,$outputfile)) $result=1; else { - dol_syslog(get_class($this)."::build_exportfile failed to rename ".$outputfiletmp." to ".$outputfile, LOG_ERR); + dol_syslog("ActionComm::build_exportfile failed to rename ".$outputfiletmp." to ".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp,0,1); $result=-1; } } else { - dol_syslog(get_class($this)."::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); + dol_syslog("ActionComm::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp,0,1); $langs->load("errors"); $this->error=$langs->trans("ErrorFailToCreateFile",$outputfile); From fb76f4c2cbaa8ec9dadd95a46ae601f18f58c94f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 23:41:42 +0000 Subject: [PATCH 24/24] Uniformize code --- htdocs/comm/action/class/actioncomm.class.php | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index cfaa14c3aee..73f5325a470 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011 Juanjo Menent * @@ -189,7 +189,7 @@ class ActionComm extends CommonObject $sql.= $conf->entity; $sql.= ")"; - dol_syslog("ActionComm::add sql=".$sql); + dol_syslog(get_class($this)."::add sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -219,7 +219,9 @@ class ActionComm extends CommonObject /** * Charge l'objet action depuis la base - * @param id id de l'action a recuperer + * + * @param int $id id de l'action a recuperer + * @return int <0 if KO, >0 if OK */ function fetch($id) { @@ -247,7 +249,7 @@ class ActionComm extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id"; - dol_syslog("ActionComm::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -305,14 +307,15 @@ class ActionComm extends CommonObject /** * Supprime l'action de la base - * @return int <0 si ko, >0 si ok + * + * @return int <0 if KO, >0 if OK */ function delete() { $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm"; $sql.= " WHERE id=".$this->id; - dol_syslog("ActionComm::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -327,7 +330,8 @@ class ActionComm extends CommonObject /** * Met a jour l'action en base. * Si percentage = 100, on met a jour date 100% - * @return int <0 si ko, >0 si ok + * + * @return int <0 if KO, >0 if OK */ function update($user) { @@ -372,7 +376,7 @@ class ActionComm extends CommonObject $sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null"); $sql.= " WHERE id=".$this->id; - dol_syslog("ActionComm::update sql=".$sql); + dol_syslog(get_class($this)."::update sql=".$sql); if ($this->db->query($sql)) { return 1; @@ -380,7 +384,7 @@ class ActionComm extends CommonObject else { $this->error=$this->db->error(); - dol_syslog("ActionComm::update ".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); return -1; } } @@ -407,7 +411,7 @@ class ActionComm extends CommonObject } if (! empty($filter)) $sql.= $filter; - dol_syslog("ActionComm::getActions sql=".$sql); + dol_syslog(get_class($this)."::getActions sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -476,7 +480,9 @@ class ActionComm extends CommonObject /** * Charge les informations d'ordre info dans l'objet facture - * @param id Id de la facture a charger + * + * @param int $id Id de la facture a charger + * @return void */ function info($id) { @@ -489,7 +495,7 @@ class ActionComm extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; $sql.= ' WHERE a.id = '.$id; - dol_syslog("ActionComm::info sql=".$sql); + dol_syslog(get_class($this)."::info sql=".$sql); $result=$this->db->query($sql); if ($result) { @@ -524,6 +530,7 @@ class ActionComm extends CommonObject /** * Return label of status + * * @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param hidenastatus 1=Show nothing if status is "Not applicable" * @return string String with status @@ -535,6 +542,7 @@ class ActionComm extends CommonObject /** * Return label of action status + * * @param percent Percent * @param mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Very short label+Picto * @param hidenastatus 1=Show nothing if status is "Not applicable" @@ -645,6 +653,7 @@ class ActionComm extends CommonObject /** * Export events from database into a cal file. + * * @param format 'vcal', 'ical/ics', 'rss' * @param type 'event' or 'journal' * @param cachedelay Do not rebuild file if date older than cachedelay seconds @@ -659,7 +668,7 @@ class ActionComm extends CommonObject require_once (DOL_DOCUMENT_ROOT ."/lib/xcal.lib.php"); require_once (DOL_DOCUMENT_ROOT ."/lib/date.lib.php"); - dol_syslog("ActionComm::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); + dol_syslog(get_class($this)."::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); // Check parameters if (empty($format)) return -1; @@ -689,7 +698,7 @@ class ActionComm extends CommonObject include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); if (dol_filemtime($outputfile) > ($nowgmt - $cachedelay)) { - dol_syslog("ActionComm::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); + dol_syslog(get_class($this)."::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); $buildfile = false; } } @@ -763,7 +772,7 @@ class ActionComm extends CommonObject $sql.= " ORDER by datep"; //print $sql;exit; - dol_syslog("ActionComm::build_exportfile select events sql=".$sql); + dol_syslog(get_class($this)."::build_exportfile select events sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -809,7 +818,7 @@ class ActionComm extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog("ActionComm::build_exportfile ".$this->db->lasterror(), LOG_ERR); + dol_syslog(get_class($this)."::build_exportfile ".$this->db->lasterror(), LOG_ERR); return -1; } @@ -848,14 +857,14 @@ class ActionComm extends CommonObject if (rename($outputfiletmp,$outputfile)) $result=1; else { - dol_syslog("ActionComm::build_exportfile failed to rename ".$outputfiletmp." to ".$outputfile, LOG_ERR); + dol_syslog(get_class($this)."::build_exportfile failed to rename ".$outputfiletmp." to ".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp,0,1); $result=-1; } } else { - dol_syslog("ActionComm::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); + dol_syslog(get_class($this)."::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp,0,1); $langs->load("errors"); $this->error=$langs->trans("ErrorFailToCreateFile",$outputfile);