diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 1e8f6dadc18..9cbb86cf017 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -33,8 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
/**
- * \class Adherent
- * \brief Class to manage members of a foundation
+ * Class to manage members of a foundation
*/
class Adherent extends CommonObject
{
diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php
index d6a0ed1ce91..2c05f71a5da 100644
--- a/htdocs/adherents/class/adherent_type.class.php
+++ b/htdocs/adherents/class/adherent_type.class.php
@@ -28,8 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/**
- * \class AdherentType
- * \brief Class to manage members type
+ * Class to manage members type
*/
class AdherentType extends CommonObject
{
diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php
index 52d73691cb8..c1a2537aa3a 100755
--- a/htdocs/adherents/class/adherentstats.class.php
+++ b/htdocs/adherents/class/adherentstats.class.php
@@ -28,8 +28,7 @@ include_once DOL_DOCUMENT_ROOT . '/adherents/class/cotisation.class.php';
/**
- * \class AdherentStats
- * \brief Classe permettant la gestion des stats des adherents
+ * Class to manage statistics of members
*/
class AdherentStats extends Stats
{
diff --git a/htdocs/adherents/class/cotisation.class.php b/htdocs/adherents/class/cotisation.class.php
index f08b2257a7d..f333a6fbb98 100644
--- a/htdocs/adherents/class/cotisation.class.php
+++ b/htdocs/adherents/class/cotisation.class.php
@@ -26,8 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/**
- * \class Cotisation
- * \brief Class to manage subscriptions of foundation members
+ * Class to manage subscriptions of foundation members
*/
class Cotisation extends CommonObject
{
diff --git a/htdocs/bookmarks/class/bookmark.class.php b/htdocs/bookmarks/class/bookmark.class.php
index 088d4751d2e..277e6318590 100644
--- a/htdocs/bookmarks/class/bookmark.class.php
+++ b/htdocs/bookmarks/class/bookmark.class.php
@@ -23,8 +23,7 @@
/**
- * \class Bookmark
- * \brief Class to manage bookmarks
+ * Class to manage bookmarks
*/
class Bookmark
{
diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php
index 2081bda8cbb..79a018546c5 100644
--- a/htdocs/comm/mailing/cibles.php
+++ b/htdocs/comm/mailing/cibles.php
@@ -136,7 +136,7 @@ if ($action == 'delete')
$classname = "MailingTargets";
$obj = new $classname($db);
$obj->update_nb($id);
-
+
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
@@ -298,7 +298,7 @@ if ($object->fetch($id) >= 0)
}
print '
';
- if (! $obj->picto) $obj->picto='generic';
+ if (empty($obj->picto)) $obj->picto='generic';
print img_object($langs->trans("Module").': '.get_class($obj),$obj->picto).' '.$obj->getDesc();
print '
';
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index 0f9758cd427..4e2d80e7bd1 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -29,8 +29,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
/**
- * \class Contact
- * \brief Classe permettant la gestion des contacts
+ * Class to manage contact/addresses
*/
class Contact extends CommonObject
{
diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php
index dfca755bcac..4c06cbb2099 100644
--- a/htdocs/core/lib/price.lib.php
+++ b/htdocs/core/lib/price.lib.php
@@ -177,8 +177,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
}
// if there's some localtax without vat, we calculate localtaxes (we will add them at end)
- $apply_tax = false;
-
+
//If price is 'TTC' we need to have the totals without VAT for a correct calculation
if ($price_base_type=='TTC')
{
@@ -186,7 +185,8 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
$tot_avec_remise= price2num($tot_avec_remise / (1 + ($txtva / 100)),'MU');
}
- switch($localtax1_type) {
+ $apply_tax = false;
+ switch($localtax1_type) {
case '1': // localtax on product or service
$apply_tax = true;
break;
diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php
index fc3f02d3250..2b5d0b7a60c 100644
--- a/htdocs/core/modules/DolibarrModules.class.php
+++ b/htdocs/core/modules/DolibarrModules.class.php
@@ -415,6 +415,9 @@ abstract class DolibarrModules
global $db,$conf;
$error=0;
+ $dirfound=0;
+
+ if (empty($reldir)) return 1;
include_once DOL_DOCUMENT_ROOT .'/core/lib/admin.lib.php';
@@ -426,11 +429,13 @@ abstract class DolibarrModules
$dir = $dirroot.$reldir;
$ok = 0;
- // Run llx_mytable.sql files
$handle=@opendir($dir); // Dir may not exists
if (is_resource($handle))
{
- while (($file = readdir($handle))!==false)
+ $dirfound++;
+
+ // Run llx_mytable.sql files
+ while (($file = readdir($handle))!==false)
{
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
{
@@ -438,14 +443,11 @@ abstract class DolibarrModules
if ($result <= 0) $error++;
}
}
- closedir($handle);
- }
+
+ rewinddir($handle);
- // Run llx_mytable.key.sql files (Must be done after llx_mytable.sql)
- $handle=@opendir($dir); // Dir may not exist
- if (is_resource($handle))
- {
- while (($file = readdir($handle))!==false)
+ // Run llx_mytable.key.sql files (Must be done after llx_mytable.sql)
+ while (($file = readdir($handle))!==false)
{
if (preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
{
@@ -453,14 +455,11 @@ abstract class DolibarrModules
if ($result <= 0) $error++;
}
}
- closedir($handle);
- }
- // Run data_xxx.sql files (Must be done after llx_mytable.key.sql)
- $handle=@opendir($dir); // Dir may not exist
- if (is_resource($handle))
- {
- while (($file = readdir($handle))!==false)
+ rewinddir($handle);
+
+ // Run data_xxx.sql files (Must be done after llx_mytable.key.sql)
+ while (($file = readdir($handle))!==false)
{
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'data')
{
@@ -468,14 +467,11 @@ abstract class DolibarrModules
if ($result <= 0) $error++;
}
}
- closedir($handle);
- }
-
- // Run update_xxx.sql files
- $handle=@opendir($dir); // Dir may not exist
- if (is_resource($handle))
- {
- while (($file = readdir($handle))!==false)
+
+ rewinddir($handle);
+
+ // Run update_xxx.sql files
+ while (($file = readdir($handle))!==false)
{
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,6) == 'update')
{
@@ -483,6 +479,7 @@ abstract class DolibarrModules
if ($result <= 0) $error++;
}
}
+
closedir($handle);
}
@@ -493,6 +490,7 @@ abstract class DolibarrModules
}
}
+ if (! $dirfound) dol_syslog("A module ask to load sql files into ".$reldir." but this directory was not found.", LOG_WARNING);
return $ok;
}
diff --git a/htdocs/core/modules/modGravatar.class.php b/htdocs/core/modules/modGravatar.class.php
index 7379b817396..c41c196e2ed 100644
--- a/htdocs/core/modules/modGravatar.class.php
+++ b/htdocs/core/modules/modGravatar.class.php
@@ -220,7 +220,7 @@ class modGravatar extends DolibarrModules
*/
function load_tables()
{
- return $this->_load_tables('/mymodule/sql/');
+ return $this->_load_tables('');
}
}
diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php
index 9ba4bf27d67..967e4178fb7 100644
--- a/htdocs/core/modules/modWorkflow.class.php
+++ b/htdocs/core/modules/modWorkflow.class.php
@@ -173,7 +173,7 @@ class modWorkflow extends DolibarrModules
*/
function load_tables()
{
- return $this->_load_tables('/workflow/sql/');
+ return $this->_load_tables('');
}
}
?>
diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php
index e16cbc29229..81390c9f0b0 100644
--- a/htdocs/holiday/class/holiday.class.php
+++ b/htdocs/holiday/class/holiday.class.php
@@ -89,6 +89,12 @@ class Holiday extends CommonObject
global $conf, $langs;
$error=0;
+ $now=dol_now();
+
+ // Check parameters
+ if (empty($this->fk_user) || ! is_numeric($this->fk_user) || $this->fk_user < 0) { $this->error="ErrorBadParameter"; return -1; }
+ if (empty($this->fk_validator) || ! is_numeric($this->fk_validator) || $this->fk_validator < 0) { $this->error="ErrorBadParameter"; return -1; }
+
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday(";
@@ -103,22 +109,13 @@ class Holiday extends CommonObject
$sql.= ") VALUES (";
// User
- if(!empty($this->fk_user)) {
- $sql.= "'".$this->fk_user."',";
- } else {
- $error++;
- }
- $sql.= " NOW(),";
+ $sql.= "'".$this->fk_user."',";
+ $sql.= " '".$this->db->idate($now)."',";
$sql.= " '".addslashes($this->description)."',";
$sql.= " '".$this->db->idate($this->date_debut)."',";
$sql.= " '".$this->db->idate($this->date_fin)."',";
$sql.= " '1',";
- if(is_numeric($this->fk_validator)) {
- $sql.= " '".$this->fk_validator."'";
- }
- else {
- $error++;
- }
+ $sql.= " '".$this->fk_validator."'";
$sql.= ")";
@@ -183,7 +180,6 @@ class Holiday extends CommonObject
$sql.= " cp.fk_user_cancel,";
$sql.= " cp.detail_refuse";
-
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp";
$sql.= " WHERE cp.rowid = ".$id;
@@ -226,12 +222,12 @@ class Holiday extends CommonObject
}
/**
- * Liste les congés payés pour un utilisateur
+ * List holidays for a particular user
*
- * @param int $user_id ID de l'utilisateur à lister
- * @param string $order Filtrage par ordre
- * @param string $filter Filtre de séléction
- * @return int -1 si erreur, 1 si OK et 2 si pas de résultat
+ * @param int $user_id ID of user to list
+ * @param string $order Sort order
+ * @param string $filter SQL Filter
+ * @return int -1 if KO, 1 if OK, 2 if no result
*/
function fetchByUser($user_id,$order='',$filter='')
{
@@ -321,11 +317,11 @@ class Holiday extends CommonObject
}
/**
- * Liste les congés payés de tout les utilisateurs
+ * List all holidays of all users
*
- * @param string $order Filtrage par ordre
- * @param string $filter Filtre de séléction
- * @return int -1 si erreur, 1 si OK et 2 si pas de résultat
+ * @param string $order Sort order
+ * @param string $filter SQL Filter
+ * @return int -1 if KO, 1 if OK, 2 if no result
*/
function fetchAll($order,$filter)
{
@@ -1595,5 +1591,27 @@ class Holiday extends CommonObject
}
}
+ /**
+ * Initialise an instance with random values.
+ * Used to build previews or test instances.
+ * id must be 0 if object instance is a specimen.
+ *
+ * @return void
+ */
+ function initAsSpecimen()
+ {
+ global $user,$langs;
+
+ // Initialise parameters
+ $this->id=0;
+ $this->specimen=1;
+
+ $this->fk_user=1;
+ $this->description='SPECIMEN description';
+ $this->date_debut=dol_now();
+ $this->date_fin=dol_now()+(24*3600);
+ $this->fk_validator=1;
+ }
+
}
?>
diff --git a/htdocs/holiday/fiche.php b/htdocs/holiday/fiche.php
index 38911ca13da..f564a1893e6 100644
--- a/htdocs/holiday/fiche.php
+++ b/htdocs/holiday/fiche.php
@@ -574,6 +574,9 @@ if ($action == 'confirm_cancel' && $_GET['confirm'] == 'yes')
* View
****************************************************/
+$form = new Form($db);
+
+
llxHeader(array(),$langs->trans('CPTitreMenu'));
if (empty($id) || $action == 'add' || $action == 'request')
@@ -621,7 +624,6 @@ if (empty($id) || $action == 'add' || $action == 'request')
dol_htmloutput_mesg('',$errors,'error');
}
- $html = new Form($db);
$cp = new Holiday($db);
$delayForRequest = $cp->getConfCP('delayForRequest');
@@ -678,10 +680,10 @@ if (empty($id) || $action == 'add' || $action == 'request')
print '
';
// Si la demande ne vient pas de l'agenda
if(!isset($_GET['datep'])) {
- $html->select_date(-1,'date_debut_');
+ $form->select_date(-1,'date_debut_');
} else {
$tmpdate = dol_mktime(0, 0, 0, GETPOST('datepmonth'), GETPOST('datepday'), GETPOST('datepyear'));
- $html->select_date($tmpdate,'date_debut_');
+ $form->select_date($tmpdate,'date_debut_');
}
print '