From 29ca4b7a0a0b9efa1b328c66d8b12a56d1375055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 21 Aug 2014 11:32:39 +0200 Subject: [PATCH 01/33] Enhanced modules parent class properties documentation --- htdocs/core/modules/DolibarrModules.class.php | 201 ++++++++++++++---- 1 file changed, 164 insertions(+), 37 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 1215f8e85e2..b730b150c3e 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1,10 +1,11 @@ - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2013 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin +/* Copyright (C) 2003-2007 Rodolphe Quiedeville + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2013 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2014 Raphaël Doursenaud * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,29 +32,161 @@ */ abstract class DolibarrModules { - //! Database handler - var $db; - //! Relative path to module style sheet - var $style_sheet = ''; // deprecated - //! Path to create when module activated - var $dirs = array(); - //! Tableau des boites - var $boxes; - //! Tableau des constantes - var $const; - //! Tableau des droits - var $rights; - //! Tableau des menus - var $menu=array(); - //! Module parts array - var $module_parts=array(); - //! Tableau des documents ??? - var $docs; - - var $dbversion = "-"; - - /** + * @var DoliDb Database handler + */ + public $db; + + /** + * @var string Relative path to module style sheet + * @deprecated + */ + public $style_sheet = ''; + + /** + * @var array Paths to create when module is activated + */ + public $dirs = array(); + + /** + * @var array Module boxes + */ + public $boxes = array(); + + /** + * @var array Module constants + */ + public $const = array(); + + /** + * @var array Module access rights + */ + public $rights; + + /** + * @var string Module access rights family + */ + public $rights_class; + + /** + * @var array Module menu entries + */ + public $menu = array(); + + /** + * @var array Module parts + * array( + * // Set this to 1 if module has its own trigger directory (/mymodule/core/triggers) + * 'triggers' => 0, + * // Set this to 1 if module has its own login method directory (/mymodule/core/login) + * 'login' => 0, + * // Set this to 1 if module has its own substitution function file (/mymodule/core/substitutions) + * 'substitutions' => 0, + * // Set this to 1 if module has its own menus handler directory (/mymodule/core/menus) + * 'menus' => 0, + * // Set this to 1 if module has its own theme directory (/mymodule/theme) + * 'theme' => 0, + * // Set this to 1 if module overwrite template dir (/mymodule/core/tpl) + * 'tpl' => 0, + * // Set this to 1 if module has its own barcode directory (/mymodule/core/modules/barcode) + * 'barcode' => 0, + * // Set this to 1 if module has its own models directory (/mymodule/core/modules/xxx) + * 'models' => 0, + * // Set this to relative path of css file if module has its own css file + * 'css' => '/mymodule/css/mymodule.css.php', + * // Set this to relative path of js file if module must load a js on all pages + * 'js' => '/mymodule/js/mymodule.js', + * // Set here all hooks context managed by module + * 'hooks' => array('hookcontext1','hookcontext2'), + * // Set here all workflow context managed by module + * 'workflow' => array( + * 'WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2' = >array( + * 'enabled' => '! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', + * 'picto'=>'yourpicto@mymodule' + * ) + * ) + * ) + */ + public $module_parts = array(); + + /** + * @var string Module documents ? + * @deprecated Seems unused anywhere + */ + public $docs; + + /** + * @var string ? + * @deprecated Seems unused anywhere + */ + public $dbversion = "-"; + + /** + * @var string Error message + */ + public $error; + + /** + * @var int Module unique ID + */ + public $numero; + + /** + * @var string Module name + */ + public $name; + + /** + * @var string Module version + */ + public $version; + + /** + * @var string Module description + */ + public $description; + + /** + * @var string[] Module language files + */ + public $langfiles; + + /** + * @var string Module export code + */ + public $export_code; + + /** + * @var string Module export label + */ + public $export_label; + + /** + * @var string Module import code + */ + public $import_code; + + /** + * @var string Module import label + */ + public $import_label; + + /** + * @var string Module constant name + */ + public $const_name; + + /** + * @var bool Module can't be disabled + */ + public $always_enabled; + + /** + * @var bool Module is enabled globally (Multicompany support) + */ + public $core_enabled; + + /** * Method to enable a module. Insert into database all constants, boxes of module * * @param array $array_sql Array of SQL requests to execute when enabling module @@ -62,7 +195,7 @@ abstract class DolibarrModules */ function _init($array_sql, $options='') { - global $conf, $langs; + global $conf; $err=0; $this->db->begin(); @@ -98,18 +231,13 @@ abstract class DolibarrModules if (! $err) { $val=$array_sql[$i]; - $sql=''; + $sql=$val; $ignoreerror=0; if (is_array($val)) { $sql=$val['sql']; $ignoreerror=$val['ignoreerror']; } - else - { - $sql=$val; - } - // Add current entity id $sql=str_replace('__ENTITY__', $conf->entity, $sql); @@ -152,7 +280,6 @@ abstract class DolibarrModules */ function _remove($array_sql, $options='') { - global $langs; $err=0; $this->db->begin(); @@ -424,7 +551,7 @@ abstract class DolibarrModules */ function _load_tables($reldir) { - global $db,$conf; + global $conf; $error=0; $dirfound=0; From c3b30893fc74a0193cda9f3b256822207223cbe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 21 Aug 2014 12:16:13 +0200 Subject: [PATCH 02/33] Enhanced modules parent class methods documentation --- htdocs/core/modules/DolibarrModules.class.php | 208 ++++++++---------- 1 file changed, 97 insertions(+), 111 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index b730b150c3e..e4d1f834b4a 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -22,13 +22,15 @@ */ /** - * \file htdocs/core/modules/DolibarrModules.class.php - * \brief File of parent class of module descriptor class files + * \file htdocs/core/modules/DolibarrModules.class.php + * \brief File of parent class of module descriptor class files */ /** - * Parent class of module descriptor class files + * Class DolibarrModules + * + * Parent class for module descriptor class files */ abstract class DolibarrModules { @@ -187,12 +189,14 @@ abstract class DolibarrModules public $core_enabled; /** - * Method to enable a module. Insert into database all constants, boxes of module - * - * @param array $array_sql Array of SQL requests to execute when enabling module - * @param string $options String with options when disabling module ('newboxdefonly|noboxes') - * @return int 1 if OK, 0 if KO - */ + * Enables a module. + * Inserts all informations into database + * + * @param string[] $array_sql SQL requests to be executed when enabling module + * @param string $options String with options when disabling module ('newboxdefonly|noboxes') + * + * @return int 1 if OK, 0 if KO + */ function _init($array_sql, $options='') { global $conf; @@ -272,11 +276,12 @@ abstract class DolibarrModules } /** - * Fonction de desactivation. Supprime de la base les constantes et boites du module + * Disable function. Deletes the module constant and boxes from the database. * - * @param array $array_sql Array of SQL requests to execute when disable module - * @param string $options String with options when disabling module ('newboxdefonly|noboxes') - * @return int 1 if OK, 0 if KO + * @param string[] $array_sql SQL requests to be executed when module is disabled + * @param string $options Options when disabling module ('newboxdefonly|noboxes') + * + * @return int 1 if OK, 0 if KO */ function _remove($array_sql, $options='') { @@ -339,10 +344,9 @@ abstract class DolibarrModules /** - * Retourne le nom traduit du module si la traduction existe dans admin.lang, - * sinon le nom defini par defaut dans le module. + * Gives the translated module name if translation exists in admin.lang or the default module name. * - * @return string Nom du module traduit + * @return string Translated module name */ function getName() { @@ -351,22 +355,21 @@ abstract class DolibarrModules if ($langs->trans("Module".$this->numero."Name") != ("Module".$this->numero."Name")) { - // Si traduction du nom du module existe + // If module name translation exists return $langs->trans("Module".$this->numero."Name"); } else { - // If translation of module with its numero does not exists, we take its name + // If module name translation using it's unique id does not exists, we take its name return $this->name; } } /** - * Retourne la description traduite du module si la traduction existe dans admin.lang, - * sinon la description definie par defaut dans le module + * Gives the translated module description if translation exists in admin.lang or the default module description * - * @return string Nom du module traduit + * @return string Translated module description */ function getDesc() { @@ -375,24 +378,23 @@ abstract class DolibarrModules if ($langs->trans("Module".$this->numero."Desc") != ("Module".$this->numero."Desc")) { - // Si traduction de la description du module existe + // If module description translation exists return $langs->trans("Module".$this->numero."Desc"); } else { - // Si traduction de la description du module n'existe pas, on prend definition en dur dans module + // If module description translation using it's unique id does not exists, we take its description return $this->description; } } /** - * Return module version. - * Pour les modules a l'etat 'experimental', retourne la traduction de 'experimental' - * Pour les modules 'dolibarr', retourne la version de Dolibarr - * Pour les autres modules, retourne la version du module + * Gives module version + * For 'experimental' modules, gives 'experimental' translation + * For 'dolibarr' modules, gives Dolibarr version * - * @return string Version du module + * @return string Module version */ function getVersion() { @@ -408,9 +410,9 @@ abstract class DolibarrModules /** - * Return if a module is a core or external module + * Tells if module is core or external * - * @return string 'core', 'external' or 'unknown' + * @return string 'core', 'external' or 'unknown' */ function isCoreOrExternalModule() { @@ -422,9 +424,9 @@ abstract class DolibarrModules /** - * Return list of lang files related to module + * Gives module related language files list * - * @return array Array of lang files + * @return string[] Language files list */ function getLangFilesArray() { @@ -432,10 +434,11 @@ abstract class DolibarrModules } /** - * Return translated label of a export dataset + * Gives translated label of an export dataset * - * @param int $r Index of dataset - * @return string Label of databaset + * @param int $r Dataset index + * + * @return string Translated databaset label */ function getExportDatasetLabel($r) { @@ -456,10 +459,11 @@ abstract class DolibarrModules /** - * Return translated label of an import dataset + * Gives translated label of an import dataset * - * @param int $r Index of dataset - * @return string Label of databaset + * @param int $r Dataset index + * + * @return string Translated dataset label */ function getImportDatasetLabel($r) { @@ -481,9 +485,9 @@ abstract class DolibarrModules /** - * Insert constant to activate module + * Insert constants for module activation * - * @return int Nb of errors (0 if OK) + * @return int Error count (0 if OK) */ function _active() { @@ -516,10 +520,10 @@ abstract class DolibarrModules /** - * Remove activation line + * Module deactivation * - * @return int Nb of errors (0 if OK) - **/ + * @return int Error count (0 if OK) + */ function _unactive() { global $conf; @@ -541,13 +545,13 @@ abstract class DolibarrModules /** - * Create tables and keys required by module. - * Files module.sql and module.key.sql with create table and create keys - * commands must be stored in directory reldir='/module/sql/' - * This function is called by this->init + * Create tables and keys required by module. + * Files module.sql and module.key.sql with create table and create keys + * commands must be stored in directory reldir='/module/sql/' + * This function is called by this->init * - * @param string $reldir Relative directory where to scan files - * @return int <=0 if KO, >0 if OK + * @param string $reldir Relative directory where to scan files + * @return int <=0 if KO, >0 if OK */ function _load_tables($reldir) { @@ -558,7 +562,7 @@ abstract class DolibarrModules if (empty($reldir)) return 1; - include_once DOL_DOCUMENT_ROOT .'/core/lib/admin.lib.php'; + include_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; $ok = 1; foreach($conf->file->dol_document_root as $dirroot) @@ -635,14 +639,15 @@ abstract class DolibarrModules /** - * Insert boxes into llx_boxes_def + * Adds boxes * - * @param string $option String with options when disabling module ('newboxdefonly'=insert only boxes definition) - * @return int Nb of errors (0 if OK) + * @param string $option Options when disabling module ('newboxdefonly'=insert only boxes definition) + * + * @return int Error count (0 if OK) */ function insert_boxes($option='') { - require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php'; global $conf; @@ -732,9 +737,9 @@ abstract class DolibarrModules /** - * Delete boxes + * Removes boxes * - * @return int Nb of errors (0 if OK) + * @return int Error count (0 if OK) */ function delete_boxes() { @@ -784,9 +789,9 @@ abstract class DolibarrModules } /** - * Remove links to new module page present in llx_const + * Removes tabs * - * @return int Nb of errors (0 if OK) + * @return int Error count (0 if OK) */ function delete_tabs() { @@ -809,9 +814,9 @@ abstract class DolibarrModules } /** - * Add links of new pages from modules in llx_const + * Adds tabs * - * @return int Number of errors (0 if ok) + * @return int Error count (0 if ok) */ function insert_tabs() { @@ -844,13 +849,7 @@ abstract class DolibarrModules $sql.= ")"; dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG); - $resql=$this->db->query($sql); - /* Allow duplicate key - if (! $resql) - { - $err++; - } - */ + $this->db->query($sql); } $i++; } @@ -859,9 +858,9 @@ abstract class DolibarrModules } /** - * Insert constants defined into $this->const array into table llx_const + * Adds constants * - * @return int Number of errors (0 if OK) + * @return int Error count (0 if OK) */ function insert_const() { @@ -926,9 +925,9 @@ abstract class DolibarrModules } /** - * Remove constants with tags deleteonunactive + * Removes constants tagged 'deleteonunactive' * - * @return int <0 if KO, 0 if OK + * @return int <0 if KO, 0 if OK */ function delete_const() { @@ -959,11 +958,12 @@ abstract class DolibarrModules } /** - * Insert permissions definitions related to the module into llx_rights_def + * Adds access rights * - * @param int $reinitadminperms If 1, we also grant them to all admin users - * @param int $force_entity Force current entity - * @return int Number of error (0 if OK) + * @param int $reinitadminperms If 1, we also grant them to all admin users + * @param int $force_entity Force current entity + * + * @return int Error count (0 if OK) */ function insert_permissions($reinitadminperms=0, $force_entity=null) { @@ -1055,7 +1055,7 @@ abstract class DolibarrModules if ($reinitadminperms) { if (! class_exists('User')) { - require DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; + require DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; } $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."user WHERE admin = 1"; dol_syslog(get_class($this)."::insert_permissions Search all admin users", LOG_DEBUG); @@ -1099,9 +1099,9 @@ abstract class DolibarrModules /** - * Delete permissions + * Removes access rights * - * @return int Nb of errors (0 if OK) + * @return int Error count (0 if OK) */ function delete_permissions() { @@ -1124,15 +1124,15 @@ abstract class DolibarrModules /** - * Insert menus entries found into $this->menu into llx_menu* + * Adds menu entries * - * @return int Nb of errors (0 if OK) + * @return int Error count (0 if OK) */ function insert_menus() { global $user; - require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/menubase.class.php'; $err=0; @@ -1228,9 +1228,9 @@ abstract class DolibarrModules /** - * Remove menus entries + * Removes menu entries * - * @return int Nb of errors (0 if OK) + * @return int Error count (0 if OK) */ function delete_menus() { @@ -1254,9 +1254,9 @@ abstract class DolibarrModules } /** - * Create directories required by module + * Creates directories * - * @return int Nb of errors (0 if OK) + * @return int Error count (0 if OK) */ function create_dirs() { @@ -1312,11 +1312,12 @@ abstract class DolibarrModules /** - * Insert directories in llx_const + * Adds directories definitions * - * @param string $name Name - * @param string $dir Directory - * @return int Nb of errors (0 if OK) + * @param string $name Name + * @param string $dir Directory + * + * @return int Error count (0 if OK) */ function insert_dirs($name,$dir) { @@ -1341,7 +1342,7 @@ abstract class DolibarrModules $sql.= " VALUES (".$this->db->encrypt($name,1).",'chaine',".$this->db->encrypt($dir,1).",'Directory for module ".$this->name."','0',".$conf->entity.")"; dol_syslog(get_class($this)."::insert_dirs", LOG_DEBUG); - $resql=$this->db->query($sql); + $this->db->query($sql); } } else @@ -1355,9 +1356,9 @@ abstract class DolibarrModules /** - * Remove directory entries + * Removes directories * - * @return int Nb of errors (0 if OK) + * @return int Error count (0 if OK) */ function delete_dirs() { @@ -1380,23 +1381,9 @@ abstract class DolibarrModules } /** - * Insert activation of generic parts from modules in llx_const - * Input entry use $this->module_parts = array( - * 'triggers' => 0, // Set this to 1 if module has its own trigger directory (/mymodule/core/triggers) - * 'login' => 0, // Set this to 1 if module has its own login method directory (/mymodule/core/login) - * 'substitutions' => 0, // Set this to 1 if module has its own substitution function file (/mymodule/core/substitutions) - * 'menus' => 0, // Set this to 1 if module has its own menus handler directory (/mymodule/core/menus) - * 'theme' => 0, // Set this to 1 if module has its own theme directory (/mymodule/theme) - * 'tpl' => 0, // Set this to 1 if module overwrite template dir (/mymodule/core/tpl) - * 'barcode' => 0, // Set this to 1 if module has its own barcode directory (/mymodule/core/modules/barcode) - * 'models' => 0, // Set this to 1 if module has its own models directory (/mymodule/core/modules/xxx) - * 'css' => '/mymodule/css/mymodule.css.php', // Set this to relative path of css file if module has its own css file - * 'js' => '/mymodule/js/mymodule.js', // Set this to relative path of js file if module must load a js on all pages - * 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module - * 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@mymodule') // Set here all workflow context managed by module - * ) + * Adds generic parts * - * @return int Nb of errors (0 if OK) + * @return int Error count (0 if OK) */ function insert_module_parts() { @@ -1465,9 +1452,9 @@ abstract class DolibarrModules } /** - * Remove activation of generic parts of modules from llx_const + * Removes generic parts * - * @return int Nb of errors (0 if OK) + * @return int Error count (0 if OK) */ function delete_module_parts() { @@ -1495,7 +1482,6 @@ abstract class DolibarrModules } } } - return $err; } From 2c1e892efe7f414f0e5c8ad3f3746cce1e907bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 21 Aug 2014 12:39:17 +0200 Subject: [PATCH 03/33] Enhanced boxes model documentation --- htdocs/core/boxes/modules_boxes.php | 120 +++++++++++++++++++++------- 1 file changed, 90 insertions(+), 30 deletions(-) diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index ece19fe222c..275154cd80e 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -1,6 +1,7 @@ - * Copyright (C) 2005-2012 Regis Houssin +/* Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2014 Raphaël Doursenaud * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,31 +26,88 @@ /** - * Parent class of boxes + * Class ModeleBoxes + * + * Boxes parent class */ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" boxes { - var $db; - var $error=''; - var $max=5; - var $enabled=1; - - var $rowid; - var $id; - var $position; - var $box_order; - var $fk_user; - var $sourcefile; - var $class; - var $box_id; - var $note; - + /** + * @var DoliDB Database handler + */ + public $db; /** - * Constructor + * @var string Error message + */ + public $error = ''; + + /** + * @var int Maximum lines + */ + public $max = 5; + + /** + * @var int Status + */ + public $enabled=1; + + /** + * @var int Box definition database ID + */ + public $rowid; + + /** + * @var int ID + * @deprecated Same as box_id? + */ + public $id; + + /** + * @var int Position? + */ + public $position; + + /** + * @var string Display order + */ + public $box_order; + + /** + * @var int User ID + */ + public $fk_user; + + /** + * @var string Source file + */ + public $sourcefile; + + /** + * @var string Class name + */ + public $class; + + /** + * @var string ID + */ + public $box_id; + + /** + * @var string Alphanumeric ID + */ + public $boxcode; + + /** + * @var string Note + */ + public $note; + + /** + * Constructor * - * @param DoliDB $db Database handler - * @param string $param More parameters + * @param DoliDB $db Database handler + * @param string $param More parameters */ function __construct($db,$param='') { @@ -57,9 +115,9 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" } /** - * Return last error message + * Return last error message * - * @return string Error message + * @return string Error message */ function error() { @@ -68,10 +126,11 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" /** - * Load a box line from its rowid + * Load a box line from its rowid * - * @param int $rowid Row id to load - * @return int <0 if KO, >0 if OK + * @param int $rowid Row id to load + * + * @return int <0 if KO, >0 if OK */ function fetch($rowid) { @@ -110,11 +169,12 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" /** - * Standard method to show a box (usage by boxes not mandatory, a box can still use its own showBox function) + *Standard method to show a box (usage by boxes not mandatory, a box can still use its own showBox function) * - * @param array $head Array with properties of box title - * @param array $contents Array with properties of box lines - * @return void + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * + * @return void */ function showBox($head, $contents) { From 8e6a40d4756186830ad41714ff5086dadbb0209d Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Fri, 22 Aug 2014 16:17:45 +0200 Subject: [PATCH 04/33] FIX error sql on update ficheinter --- htdocs/fichinter/class/fichinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 22466a3143f..cb4f178b840 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -224,7 +224,7 @@ class Fichinter extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET "; - $sql.= ", description = '".$this->db->escape($this->description)."'"; + $sql.= "description = '".$this->db->escape($this->description)."'"; $sql.= ", duree = ".$this->duree; $sql.= ", fk_projet = ".$this->fk_project; $sql.= ", note_private = ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null"); From 7cb283d0ea9800904c5da1d66a37a19305331b53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Aug 2014 19:16:37 +0200 Subject: [PATCH 05/33] Prepare code to be able to choose what to show into footer --- htdocs/core/lib/pdf.lib.php | 17 +++++++++++------ .../modules/cheque/pdf/pdf_blochet.class.php | 3 ++- .../commande/doc/pdf_einstein.modules.php | 3 ++- .../commande/doc/pdf_proforma.modules.php | 3 ++- .../modules/contract/doc/pdf_strato.modules.php | 3 ++- .../expedition/doc/pdf_rouget.modules.php | 3 ++- .../modules/facture/doc/pdf_crabe.modules.php | 3 ++- .../fichinter/doc/pdf_soleil.modules.php | 3 ++- .../livraison/pdf/pdf_typhon.modules.php | 7 ++++--- .../modules/project/pdf/pdf_baleine.modules.php | 7 ++++--- .../modules/propale/doc/pdf_azur.modules.php | 3 ++- .../pdf/pdf_canelle.modules.php | 3 ++- .../supplier_order/pdf/pdf_muscadet.modules.php | 7 ++++--- htdocs/langs/en_US/admin.lang | 1 + 14 files changed, 42 insertions(+), 24 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index ade08400762..e0c6c9ee0e0 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -651,7 +651,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default * @param int $marge_gauche Margin left (no more used) * @param int $page_hauteur Page height (no more used) * @param Object $object Object shown in PDF - * @param int $showdetails Show company details into footer. This param seems to not be used by standard version. + * @param int $showdetails Show company details into footer. This param seems to not be used by standard version. (1=Show address, 2=Show managers, 3=Both) * @param int $hidefreetext 1=Hide free text, 0=Show free text * @return int Return height of bottom margin including footer text */ @@ -681,10 +681,10 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass } // First line of company infos + $line1=""; $line2=""; $line3=""; $line4=""; - if ($showdetails) + if ($showdetails && 1) { - $line1=""; // Company name if ($fromcompany->name) { @@ -716,7 +716,6 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass $line1.=($line1?" - ":"").$outputlangs->transnoentities("Fax").": ".$fromcompany->fax; } - $line2=""; // URL if ($fromcompany->url) { @@ -728,9 +727,16 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass $line2.=($line2?" - ":"").$fromcompany->email; } } + if (($showdetails && 2) || ($fromcompany->country_code == 'DE')) + { + // Managers + if ($fromcompany->managers) + { + $line2.=($line2?" - ":"").$fromcompany->managers; + } + } // Line 3 of company infos - $line3=""; // Juridical status if ($fromcompany->forme_juridique_code) { @@ -757,7 +763,6 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass } // Line 4 of company infos - $line4=""; // Prof Id 3 if ($fromcompany->idprof3) { diff --git a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php index 96214f08d66..ecb4abd561c 100644 --- a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php @@ -352,7 +352,8 @@ class BordereauChequeBlochet extends ModeleChequeReceipts global $conf; $default_font_size = pdf_getPDFFontSize($outputlangs); - //return pdf_pagefoot($pdf,$outputlangs,'BANK_CHEQUERECEIPT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object); + //$showdetails=0; + //return pdf_pagefoot($pdf,$outputlangs,'BANK_CHEQUERECEIPT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); $paramfreetext='BANK_CHEQUERECEIPT_FREE_TEXT'; $marge_basse=$this->marge_basse; $marge_gauche=$this->marge_gauche; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 712dd0b765c..236a4d52454 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1271,7 +1271,8 @@ class pdf_einstein extends ModelePDFCommandes */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index 408fd543c93..38ca0a8748e 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -1228,7 +1228,8 @@ class pdf_proforma extends ModelePDFCommandes */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 5fc0eb6dd2a..cee022805af 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -610,7 +610,8 @@ class pdf_strato extends ModelePDFContract */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'CONTRACT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'CONTRACT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 6d0e44817a7..177a2bb4fa7 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -657,7 +657,8 @@ class pdf_rouget extends ModelePdfExpedition */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'SHIPPING_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'SHIPPING_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index d07bd93825c..3c3cca12440 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1455,7 +1455,8 @@ class pdf_crabe extends ModelePDFFactures */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index f2055e8d643..284dc62a0b7 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -595,7 +595,8 @@ class pdf_soleil extends ModelePDFFicheinter */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'FICHINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'FICHINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index 095e325cb81..75bdc06aaed 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -358,7 +358,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder //$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxqty, $curY); $pdf->MultiCell($this->posxremainingqty - $this->posxqty, 3, $object->lines[$i]->qty_shipped, 0, 'R'); - + // Remaining to ship $pdf->SetXY($this->posxremainingqty, $curY); $qtyRemaining = $object->lines[$i]->qty_asked - $object->commande->expeditions[$object->lines[$i]->fk_origin_line]; @@ -613,7 +613,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetXY($this->posxdesc-1, $tab_top+1); $pdf->MultiCell($this->posxcomm - $this->posxdesc,2, $outputlangs->transnoentities("Designation"),'','L'); } - + // Modif SEB pour avoir une col en plus pour les commentaires clients $pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height); if (empty($hidetop)) { @@ -863,7 +863,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php index e6505c05283..e727f9ba90b 100644 --- a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php @@ -295,7 +295,7 @@ class pdf_baleine extends ModelePDFProjects $pdf->Close(); $pdf->Output($file,'F'); - + // Add pdfgeneration hook if (! is_object($hookmanager)) { @@ -306,7 +306,7 @@ class pdf_baleine extends ModelePDFProjects $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); global $action; $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - + if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); @@ -454,7 +454,8 @@ class pdf_baleine extends ModelePDFProjects */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'PROJECT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'PROJECT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 4ac15330b42..4678b5a48af 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1362,7 +1362,8 @@ class pdf_azur extends ModelePDFPropales */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'PROPALE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'PROPALE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 848778275eb..49a46c79e2e 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -1052,7 +1052,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices */ function _pagefoot(&$pdf, $object, $outputlangs,$hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_INVOICE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_INVOICE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index d601167c26d..1c9315a61bd 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -701,7 +701,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; - + foreach( $localtax_rate as $tvakey => $tvaval ) { if ($tvakey != 0) // On affiche pas taux 0 @@ -733,7 +733,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; - + foreach( $localtax_rate as $tvakey => $tvaval ) { if ($tvakey != 0) // On affiche pas taux 0 @@ -1105,7 +1105,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders */ function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0) { - return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_ORDER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); + $showdetails=0; + return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_ORDER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e4cf7ab08ce..da61d43c1ad 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1082,6 +1082,7 @@ NotificationsDesc=EMails notifications feature allows you to silently send autom ModelModules=Documents templates DocumentModelOdt=Generate documents from OpenDocuments templates (.ODT or .ODS files for OpenOffice, KOffice, TextEdit,...) WatermarkOnDraft=Watermark on draft document +JSOnPaimentBill=Activate feature to autofill payment lines on payment form CompanyIdProfChecker=Rules on Professional Ids MustBeUnique=Must be unique ? MustBeMandatory=Mandatory to create third parties ? From a5deeebfdca8aca6c2d97f4d0d0ed60251fb6acb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Aug 2014 19:32:36 +0200 Subject: [PATCH 06/33] Add try catch --- htdocs/comm/mailing/cibles.php | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index df51f91e1a2..e10ea970b43 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -98,11 +98,10 @@ if ($action == 'add') $result=$obj->add_to_target($id,$filtersarray); } } - if ($result > 0) { setEventMessage($langs->trans("XTargetsAdded",$result),'mesgs'); - + header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } @@ -167,7 +166,6 @@ if ($_POST["button_removefilter"]) /* * View */ - llxHeader('',$langs->trans("Mailing"),'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing'); $form = new Form($db); @@ -306,12 +304,14 @@ if ($object->fetch($id) >= 0) print img_object($langs->trans("Module").': '.get_class($obj),$obj->picto).' '.$obj->getDesc(); print ''; - /* - print ''; - print $modulename; - print ""; - */ - $nbofrecipient=$obj->getNbOfRecipients(''); + try { + $nbofrecipient=$obj->getNbOfRecipients(''); + } + catch(Exception $e) + { + dol_syslog($e->getMessage(), LOG_ERR); + } + print ''; if ($nbofrecipient >= 0) { @@ -324,7 +324,13 @@ if ($object->fetch($id) >= 0) print ''; print ''; - $filter=$obj->formFilter(); + try { + $filter=$obj->formFilter(); + } + catch(Exception $e) + { + dol_syslog($e->getMessage(), LOG_ERR); + } if ($filter) print $filter; else print $langs->trans("None"); print ''; @@ -421,7 +427,7 @@ if ($object->fetch($id) >= 0) print ''; print ' '; print ''; - + print ''; // Ligne des champs de filtres @@ -446,7 +452,7 @@ if ($object->fetch($id) >= 0) print ''; print ' '; print ''; - + // Date sending print ''; print ' '; @@ -530,7 +536,7 @@ if ($object->fetch($id) >= 0) print $object::libStatutDest($obj->statut,2); print ''; } - + //Sreach Icon print ''; print ''; From 9dafdf41bb69a421c367565b8b560ff1cba819f8 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 26 Aug 2014 09:49:15 +0200 Subject: [PATCH 07/33] Fix: error in strict mode --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index fba04593b5b..b1e9ccffd52 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1247,7 +1247,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu else dol_print_error($db); $db->free($resql); } - if ($conf->ftp->enabled && $mainmenu == 'ftp') // Entry for FTP + if (!empty($conf->ftp->enabled) && $mainmenu == 'ftp') // Entry for FTP { $MAXFTP=20; $i=1; From a3469f1f01e0c400d959d84259a37101d3b5b322 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Tue, 26 Aug 2014 11:27:57 +0200 Subject: [PATCH 08/33] FIX bug on migration 3.6 -> 3.7 --- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 868496f3316..40dd7b62f44 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -982,7 +982,6 @@ ALTER TABLE llx_c_civility ADD UNIQUE INDEX uk_c_civility(code); ALTER TABLE llx_adherent CHANGE civilite civility VARCHAR(6); ALTER TABLE llx_socpeople CHANGE civilite civility VARCHAR(6); ALTER TABLE llx_user CHANGE civilite civility VARCHAR(6); -) ENGINE=innodb; ALTER TABLE llx_c_type_fees CHANGE libelle label VARCHAR(30); ALTER TABLE llx_c_type_fees ADD COLUMN accountancy_code varchar(32) DEFAULT NULL AFTER label; From 85228fd8e78209a70a6f0147b139a6f698a119c6 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Tue, 26 Aug 2014 11:50:02 +0200 Subject: [PATCH 09/33] add support in admin --- htdocs/core/lib/fichinter.lib.php | 5 +++++ htdocs/fichinter/class/fichinter.class.php | 5 ++++- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 12 ++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index 01d79cdcabe..cb30a202513 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -126,6 +126,11 @@ function fichinter_admin_prepare_head() $head[$h][2] = 'attributes'; $h++; + $head[$h][0] = DOL_URL_ROOT.'/fichinter/admin/fichinterdet_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFields"); + $head[$h][2] = 'attributesdet'; + $h++; + complete_head_from_modules($conf,$langs,null,$head,$h,'fichinter_admin','remove'); diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index cb4f178b840..a62cefe32bf 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -987,7 +987,10 @@ class FichinterLigne extends CommonObjectLine var $duration; // Duree de l'intervention var $rang = 0; - + public $element='fichinterdet'; + public $table_element='fichinterdet'; + public $fk_element='fk_fichinter'; + /** * Constructor * diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 40dd7b62f44..dea3955ce52 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -991,3 +991,15 @@ ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_element (fk_element); ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_task (fk_task); ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_date (task_date); ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_datehour (task_datehour); + + +-- add extrafield on ficheinter lines +CREATE TABLE IF NOT EXISTS `llx_fichinterdet_extrafields` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_object` int(11) NOT NULL, + `import_key` varchar(14) DEFAULT NULL, + PRIMARY KEY (`rowid`), + KEY `idx_ficheinter_extrafields` (`fk_object`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + From 40aadc8125b41b9ae955d5e272c83fc44676e970 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Tue, 26 Aug 2014 12:11:34 +0200 Subject: [PATCH 10/33] add extrafield in add form --- htdocs/core/class/commonobjectline.class.php | 2 +- .../admin/fichinterdet_extrafields.php | 159 ++++++++++++++++++ htdocs/fichinter/fiche.php | 11 +- 3 files changed, 170 insertions(+), 2 deletions(-) create mode 100644 htdocs/fichinter/admin/fichinterdet_extrafields.php diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 675e1cf0794..3ba7cbf52ca 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -26,7 +26,7 @@ * Parent class for class inheritance lines of business objects * This class is useless for the moment so no inherit are done on it */ -abstract class CommonObjectLine +abstract class CommonObjectLine extends CommonObject { /** * Call trigger based on this instance diff --git a/htdocs/fichinter/admin/fichinterdet_extrafields.php b/htdocs/fichinter/admin/fichinterdet_extrafields.php new file mode 100644 index 00000000000..7f8b5193631 --- /dev/null +++ b/htdocs/fichinter/admin/fichinterdet_extrafields.php @@ -0,0 +1,159 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013 Florian Henry + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/fichinter/admin/fichinter_extrafields.php + * \ingroup fichinter + * \brief Page to setup extra fields of ficheinter + */ + + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + +$langs->load("companies"); +$langs->load("admin"); +$langs->load("members"); +$langs->load('interventions'); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label=ExtraFields::$type2label; +$type2label=array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); + +$action=GETPOST('action', 'alpha'); +$attrname=GETPOST('attrname', 'alpha'); +$elementtype='fichinterdet'; //Must be the $element of the class that manage extrafield + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + + +llxHeader(); + +$textobject=$langs->transnoentitiesnoconv("Interventions"); + +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans("InterventionsSetup"),$linkback,'setup'); + + +$head=fichinter_admin_prepare_head(); + +dol_fiche_head($head, 'attributesdet', $langs->trans("Interventions"), 0, 'intervention'); + + +print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; +print '
'; + +// Load attribute_label +$extrafields->fetch_name_optionals_label($elementtype); + +print ""; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; + +$var=True; +foreach($extrafields->attribute_type as $key => $value) +{ + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print '\n"; + print '\n"; + print '\n"; + print '\n"; + print ""; + // $i++; +} + +print "
'.$langs->trans("Position").''.$langs->trans("Label").''.$langs->trans("AttributeCode").''.$langs->trans("Type").''.$langs->trans("Size").''.$langs->trans("Unique").''.$langs->trans("Required").' 
".$extrafields->attribute_pos[$key]."".$extrafields->attribute_label[$key]."".$key."".$type2label[$extrafields->attribute_type[$key]]."'.$extrafields->attribute_size[$key]."'.yn($extrafields->attribute_unique[$key])."'.yn($extrafields->attribute_required[$key])."'.img_edit().''; + print "  ".img_delete()."
"; + +dol_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') +{ + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; +} + + +/* ************************************************************************** */ +/* */ +/* Creation d'un champ optionnel + /* */ +/* ************************************************************************** */ + +if ($action == 'create') +{ + print "
"; + print_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* ************************************************************************** */ +/* */ +/* Edition d'un champ optionnel */ +/* */ +/* ************************************************************************** */ +if ($action == 'edit' && ! empty($attrname)) +{ + print "
"; + print_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +llxFooter(); + +$db->close(); diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 437002aa23c..4943e5bc245 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -1511,7 +1511,16 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; - + + //Line extrafield + + $lineadd = new FichinterLigne($db); + + $extrafieldsline = new ExtraFields($db); + $extralabelslines=$extrafieldsline->fetch_name_optionals_label($lineadd->table_element); + + print $lineadd->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>4)); + if (! $num) print ''; } From 35fca84f19e66d062f02cbbde570cb68c7b8285c Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Tue, 26 Aug 2014 17:08:03 +0200 Subject: [PATCH 11/33] ok on insert --- htdocs/fichinter/class/fichinter.class.php | 37 ++++++++++++++++++++-- htdocs/fichinter/fiche.php | 26 +++++++++++++-- 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index a62cefe32bf..642dfe29bcb 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -855,7 +855,7 @@ class Fichinter extends CommonObject * @param int $duration Intervention duration * @return int >0 if ok, <0 if ko */ - function addline($user,$fichinterid, $desc, $date_intervention, $duration) + function addline($user,$fichinterid, $desc, $date_intervention, $duration, $array_option=0) { dol_syslog("Fichinter::Addline $fichinterid, $desc, $date_intervention, $duration"); @@ -871,14 +871,20 @@ class Fichinter extends CommonObject $line->datei = $date_intervention; $line->duration = $duration; + if (is_array($array_option) && count($array_option)>0) { + $line->array_options=$array_option; + } + $result=$line->insert($user); - if ($result > 0) + + if ($result >= 0) { + $this->db->commit(); return 1; } else - { + { $this->error=$this->db->error(); $this->db->rollback(); return -1; @@ -1085,7 +1091,21 @@ class FichinterLigne extends CommonObjectLine $resql=$this->db->query($sql); if ($resql) { + $this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'fichinterdet'); + + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $this->id=$this->rowid; + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + + $result=$this->update_total(); + if ($result > 0) { $this->rang=$rangToUse; @@ -1143,6 +1163,17 @@ class FichinterLigne extends CommonObjectLine $resql=$this->db->query($sql); if ($resql) { + + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $this->id=$this->rowid; + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + $result=$this->update_total(); if ($result > 0) { diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 4943e5bc245..7b94d03c503 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -266,12 +266,20 @@ else if ($action == 'add' && $user->rights->ficheinter->creer) $duration = 0; } + $predef = ''; + // Extrafields + $extrafieldsline = new ExtraFields($db); + $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); + $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + + $result = $object->addline( $user, $id, $desc, $date_intervention, - $duration + $duration, + $array_option ); if ($result < 0) @@ -433,12 +441,19 @@ else if ($action == "addline" && $user->rights->ficheinter->creer) $date_intervention = dol_mktime(GETPOST('dihour','int'), GETPOST('dimin','int'), 0, GETPOST('dimonth','int'), GETPOST('diday','int'), GETPOST('diyear','int')); $duration = convertTime2Seconds(GETPOST('durationhour','int'), GETPOST('durationmin','int')); + + // Extrafields + $extrafieldsline = new ExtraFields($db); + $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); + $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $result=$object->addline( $user, $id, $desc, $date_intervention, - $duration + $duration, + $array_option ); // Define output language @@ -524,6 +539,13 @@ else if ($action == 'updateline' && $user->rights->ficheinter->creer && GETPOST( $objectline->datei = $date_inter; $objectline->desc = $desc; $objectline->duration = $duration; + + // Extrafields + $extrafieldsline = new ExtraFields($db); + $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); + $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $objectline->array_options = $array_option; + $result = $objectline->update($user); if ($result < 0) { From 7af788729b280bb98f0b1682973c170d457ca331 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Tue, 26 Aug 2014 17:25:13 +0200 Subject: [PATCH 12/33] debug extrafield on create card --- htdocs/fichinter/class/fichinter.class.php | 12 +++++++ htdocs/fichinter/fiche.php | 39 +++++++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 642dfe29bcb..80375648e26 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -167,6 +167,17 @@ class Fichinter extends CommonObject $resql=$this->db->query($sql); if (! $resql) $error++; } + + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + // Add linked object if (! $error && $this->origin && $this->origin_id) { @@ -1026,6 +1037,7 @@ class FichinterLigne extends CommonObjectLine { $objp = $this->db->fetch_object($result); $this->rowid = $objp->rowid; + $this->id = $objp->rowid; $this->fk_fichinter = $objp->fk_fichinter; $this->datei = $this->db->jdate($objp->datei); $this->desc = $objp->description; diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 7b94d03c503..36bf1690b3c 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -196,6 +196,13 @@ else if ($action == 'add' && $user->rights->ficheinter->creer) $object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']); } + // Extrafields + $extrafields = new ExtraFields($db); + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + $array_option = $extrafields->getOptionalsFromPost($extralabels); + + $object->array_options = $array_option; + $id = $object->create($user); if ($id > 0) @@ -306,6 +313,13 @@ else if ($action == 'add' && $user->rights->ficheinter->creer) } else { + // Extrafields + $extrafields = new ExtraFields($db); + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + $array_option = $extrafields->getOptionalsFromPost($extralabels); + + $object->array_options = $array_option; + $result = $object->create($user); if ($result > 0) { @@ -1455,6 +1469,18 @@ else if ($id > 0 || ! empty($ref)) } print ''; + + $line = new FichinterLigne($db); + $line->fetch($objp->rowid); + + $extrafieldsline = new ExtraFields($db); + $extralabelslines=$extrafieldsline->fetch_name_optionals_label($line->table_element); + + $line->fetch_optionals($line->rowid, $extralabelslines); + + print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>5)); + + } // Line in update mode @@ -1483,6 +1509,17 @@ else if ($id > 0 || ! empty($ref)) print ''; print '
'; print '' . "\n"; + + $line = new FichinterLigne($db); + $line->fetch($objp->rowid); + + $extrafieldsline = new ExtraFields($db); + $extralabelslines=$extrafieldsline->fetch_name_optionals_label($line->table_element); + $line->fetch_optionals($line->rowid, $extralabelslines); + + print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>5)); + + } $i++; @@ -1541,7 +1578,7 @@ else if ($id > 0 || ! empty($ref)) $extrafieldsline = new ExtraFields($db); $extralabelslines=$extrafieldsline->fetch_name_optionals_label($lineadd->table_element); - print $lineadd->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>4)); + print $lineadd->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>5)); if (! $num) print ''; } From a31fec1b0b50ee08d89b3659aaf2f78b5f992249 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 26 Aug 2014 19:55:35 +0200 Subject: [PATCH 13/33] Fix tab active to real tab active --- htdocs/comm/action/listactions.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 055086bbdbb..ae145d4be21 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -197,12 +197,7 @@ if ($resql) $newtitle=$langs->trans($title); - $tabactive=''; - if ($action == 'show_month') $tabactive='cardmonth'; - if ($action == 'show_week') $tabactive='cardweek'; - if ($action == 'show_day') $tabactive='cardday'; - if ($action == 'show_list') $tabactive='cardlist'; - if ($action == 'show_peruser') $tabactive='cardperuser'; + $tabactive='cardlist'; $head = calendars_prepare_head($param); From 4b4360af32ac43e4f2bc7ad8fa829515e9d5e1ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Aug 2014 23:02:21 +0200 Subject: [PATCH 14/33] Fix: sql syntax errors --- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 868496f3316..ac16eefefa9 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -975,14 +975,13 @@ CREATE TABLE llx_holiday_types ( ); -- Change on table c_civilite -DROP INDEX uk_c_civilite ON llx_c_civilite; +ALTER TABLE llx_c_civilite DROP INDEX uk_c_civilite; ALTER TABLE llx_c_civilite RENAME TO llx_c_civility; ALTER TABLE llx_c_civility CHANGE civilite label VARCHAR(50); ALTER TABLE llx_c_civility ADD UNIQUE INDEX uk_c_civility(code); ALTER TABLE llx_adherent CHANGE civilite civility VARCHAR(6); ALTER TABLE llx_socpeople CHANGE civilite civility VARCHAR(6); ALTER TABLE llx_user CHANGE civilite civility VARCHAR(6); -) ENGINE=innodb; ALTER TABLE llx_c_type_fees CHANGE libelle label VARCHAR(30); ALTER TABLE llx_c_type_fees ADD COLUMN accountancy_code varchar(32) DEFAULT NULL AFTER label; From c3fe0c1ae9c4c69204503df976a2cf403c5137bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Aug 2014 23:08:06 +0200 Subject: [PATCH 15/33] Fix: sql errors into migration scripts --- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index ac16eefefa9..cbe07b2fbdf 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -101,6 +101,7 @@ ALTER TABLE llx_product MODIFY COLUMN fk_barcode_type INTEGER NULL DEFAULT NULL; -- VPGSQL8.2 ALTER TABLE llx_product ALTER COLUMN fk_barcode_type SET DEFAULT NULL; UPDATE llx_product SET fk_barcode_type = NULL WHERE fk_barcode_type = 0; ALTER TABLE llx_product ADD INDEX idx_product_fk_barcode_type (fk_barcode_type); +UPDATE llx_product SET fk_barcode_type = NULL WHERE fk_barcode_type NOT IN (SELECT rowid from llx_c_barcode_type); ALTER TABLE llx_product ADD CONSTRAINT fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type (rowid); From 071c405bad5b7630bcbd463beba78631bfdb743f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 27 Aug 2014 10:44:40 +0200 Subject: [PATCH 16/33] Fix: error with php strict mode --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index b1e9ccffd52..5585f2ccc55 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1217,7 +1217,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,(empty($user->societe_id)?0:1),'eldy',$tabMenu); // We update newmenu for special dynamic menus - if ($user->rights->banque->lire && $mainmenu == 'bank') // Entry for each bank account + if (!empty($user->rights->banque->lire) && $mainmenu == 'bank') // Entry for each bank account { $sql = "SELECT rowid, label, courant, rappro, courant"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; From 76cb6f760a93018d8192e038f68f7de04139a676 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 27 Aug 2014 19:02:13 +0200 Subject: [PATCH 17/33] Fix: strict mode anarchy ;-) check your variable please --- htdocs/core/tpl/document_actions_pre_headers.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/document_actions_pre_headers.tpl.php b/htdocs/core/tpl/document_actions_pre_headers.tpl.php index b74c4bedf4d..a4d97e7defb 100644 --- a/htdocs/core/tpl/document_actions_pre_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_pre_headers.tpl.php @@ -79,7 +79,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') setEventMessage($langs->trans("ErrorFailedToDeleteLink", $link->label), 'errors'); } } - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id.($withproject?'&withproject=1':'')); + header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id.(!empty($withproject)?'&withproject=1':'')); exit; } } From a486b4e4157bf03525f6a8fcfc44e075b915a950 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Aug 2014 11:20:13 +0200 Subject: [PATCH 18/33] Fix error management: When an error is returned by hooks into dol_move_uploaded_file, message must be returned by function as if it were an error for any other reason. --- htdocs/core/lib/files.lib.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 0dc5a2c4456..8590f63803f 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -597,7 +597,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable global $conf, $db, $user, $langs; global $object, $hookmanager; - $error=0; + $reshook=0; $file_name = $dest_file; if (empty($nohook)) @@ -663,8 +663,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable } // Security: - // On interdit fichiers caches, remontees de repertoire ainsi que les pipe dans - // les noms de fichiers. + // On interdit fichiers caches, remontees de repertoire ainsi que les pipe dans les noms de fichiers. if (preg_match('/^\./',$dest_file) || preg_match('/\.\./',$dest_file) || preg_match('/[<>|]/',$dest_file)) { dol_syslog("Refused to deliver file ".$dest_file, LOG_WARNING); @@ -677,7 +676,13 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable $reshook=$hookmanager->executeHooks('moveUploadedFile', $parameters, $object); } - if (empty($reshook)) + if ($reshook < 0) // At least one blocking error returned by one hook + { + $errmsg = join(',', $hookmanager->errors); + if (empty($errmsg)) $errmsg = 'ErrorReturnedBySomeHooks'; // Should not occurs. Added if hook is bugged and does not set ->errors when there is error. + return $errmsg; + } + elseif (empty($reshook)) { // The file functions must be in OS filesystem encoding. $src_file_osencoded=dol_osencode($src_file); @@ -710,8 +715,8 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable return -3; // Unknown error } } - else - return $reshook; + + return 1; // Success } /** @@ -802,12 +807,12 @@ function dol_delete_dir($dir,$nophperrors=0) } /** - * Remove a directory $dir and its subdirectories (or only files and subdirectories) + * Remove a directory $dir and its subdirectories (or only files and subdirectories) * * @param string $dir Dir to delete * @param int $count Counter to count nb of deleted elements * @param int $nophperrors Disable all PHP output errors - * @param int $onlysub Delete only files and subdir, not main directory + * @param int $onlysub Delete only files and subdir, not main directory * @return int Number of files and directory removed */ function dol_delete_dir_recursive($dir,$count=0,$nophperrors=0,$onlysub=0) @@ -837,7 +842,7 @@ function dol_delete_dir_recursive($dir,$count=0,$nophperrors=0,$onlysub=0) } } closedir($handle); - + if (empty($onlysub)) { dol_delete_dir($dir,$nophperrors); From dcce6731fec61b9dc554cd259e6cc8cedb128f98 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Aug 2014 12:19:24 +0200 Subject: [PATCH 19/33] Fix: Sql errors --- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index cbe07b2fbdf..b3a35bbfa6e 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -76,7 +76,7 @@ ALTER TABLE llx_societe ADD COLUMN localtax2_value double(6,3) after localtax2_a -- Change on table c_pays ALTER TABLE llx_c_pays RENAME TO llx_c_country; -ALTER TABLE llx_c_country CHANGE libelle label VARCHAR(50); +ALTER TABLE llx_c_country CHANGE COLUMN libelle label VARCHAR(50); ALTER TABLE llx_c_ziptown ADD CONSTRAINT fk_c_ziptown_fk_pays FOREIGN KEY (fk_pays) REFERENCES llx_c_country (rowid); ALTER TABLE llx_c_regions ADD CONSTRAINT fk_c_regions_fk_pays FOREIGN KEY (fk_pays) REFERENCES llx_c_country (rowid); @@ -978,13 +978,13 @@ CREATE TABLE llx_holiday_types ( -- Change on table c_civilite ALTER TABLE llx_c_civilite DROP INDEX uk_c_civilite; ALTER TABLE llx_c_civilite RENAME TO llx_c_civility; -ALTER TABLE llx_c_civility CHANGE civilite label VARCHAR(50); +ALTER TABLE llx_c_civility CHANGE COLUMN civilite label VARCHAR(50); ALTER TABLE llx_c_civility ADD UNIQUE INDEX uk_c_civility(code); -ALTER TABLE llx_adherent CHANGE civilite civility VARCHAR(6); -ALTER TABLE llx_socpeople CHANGE civilite civility VARCHAR(6); -ALTER TABLE llx_user CHANGE civilite civility VARCHAR(6); +ALTER TABLE llx_adherent CHANGE COLUMN civilite civility VARCHAR(6); +ALTER TABLE llx_socpeople CHANGE COLUMN civilite civility VARCHAR(6); +ALTER TABLE llx_user CHANGE COLUMN civilite civility VARCHAR(6); -ALTER TABLE llx_c_type_fees CHANGE libelle label VARCHAR(30); +ALTER TABLE llx_c_type_fees CHANGE COLUMN libelle label VARCHAR(30); ALTER TABLE llx_c_type_fees ADD COLUMN accountancy_code varchar(32) DEFAULT NULL AFTER label; ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_element (fk_element); From 4a91476be3f898b4a1df69cf555d60452bd482dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Aug 2014 12:26:43 +0200 Subject: [PATCH 20/33] Try cut and paste to solve pb on class project. --- htdocs/projet/class/project.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 7f8fd52c500..750c4531cb0 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -53,6 +53,7 @@ class Project extends CommonObject var $statuts; var $oldcopy; + /** * Constructor * @@ -252,7 +253,7 @@ class Project extends CommonObject $result = 1; } else - { + { $this->db->rollback(); $result = -1; } From 911cccba80d0eaf047757cda68b5d08c189f0848 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Aug 2014 12:31:57 +0200 Subject: [PATCH 21/33] Disable rule FunctionDoubleUnderscore that seems to be bugged. --- dev/codesniffer/ruleset.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dev/codesniffer/ruleset.xml b/dev/codesniffer/ruleset.xml index 6b498e7d167..72590c15741 100755 --- a/dev/codesniffer/ruleset.xml +++ b/dev/codesniffer/ruleset.xml @@ -243,6 +243,10 @@ + + + 0 + 0 @@ -253,13 +257,13 @@ 0 + 0 0 - From 8bdf02b340999d7b33b165cd185ce79ee3fb6f32 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Aug 2014 14:48:16 +0200 Subject: [PATCH 22/33] Doxygen --- htdocs/fichinter/class/fichinter.class.php | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 80375648e26..49db958fa32 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -167,17 +167,17 @@ class Fichinter extends CommonObject $resql=$this->db->query($sql); if (! $resql) $error++; } - + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - + $result=$this->insertExtraFields(); if ($result < 0) { $error++; } - } - + } + // Add linked object if (! $error && $this->origin && $this->origin_id) { @@ -864,11 +864,12 @@ class Fichinter extends CommonObject * @param string $desc Line description * @param date $date_intervention Intervention date * @param int $duration Intervention duration + * @param array $array_option Array option * @return int >0 if ok, <0 if ko */ - function addline($user,$fichinterid, $desc, $date_intervention, $duration, $array_option=0) + function addline($user,$fichinterid, $desc, $date_intervention, $duration, $array_option='') { - dol_syslog("Fichinter::Addline $fichinterid, $desc, $date_intervention, $duration"); + dol_syslog(get_class($this)."::addline $fichinterid, $desc, $date_intervention, $duration"); if ($this->statut == 0) { @@ -887,15 +888,14 @@ class Fichinter extends CommonObject } $result=$line->insert($user); - + if ($result >= 0) { - $this->db->commit(); return 1; } else - { + { $this->error=$this->db->error(); $this->db->rollback(); return -1; @@ -1007,7 +1007,7 @@ class FichinterLigne extends CommonObjectLine public $element='fichinterdet'; public $table_element='fichinterdet'; public $fk_element='fk_fichinter'; - + /** * Constructor * @@ -1103,8 +1103,8 @@ class FichinterLigne extends CommonObjectLine $resql=$this->db->query($sql); if ($resql) { - $this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'fichinterdet'); - + $this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'fichinterdet'); + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { $this->id=$this->rowid; @@ -1113,11 +1113,11 @@ class FichinterLigne extends CommonObjectLine { $error++; } - } - - + } + + $result=$this->update_total(); - + if ($result > 0) { $this->rang=$rangToUse; @@ -1175,7 +1175,7 @@ class FichinterLigne extends CommonObjectLine $resql=$this->db->query($sql); if ($resql) { - + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { $this->id=$this->rowid; @@ -1185,7 +1185,7 @@ class FichinterLigne extends CommonObjectLine $error++; } } - + $result=$this->update_total(); if ($result > 0) { From 22fb37f856796f7d14408f7902ae5483f29cc7c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Aug 2014 15:00:09 +0200 Subject: [PATCH 23/33] Fix: Sql syntax for extrafield table of interventions --- .../install/mysql/migration/3.6.0-3.7.0.sql | 18 +++++++------ .../llx_fichinterdet_extrafields.key.sql | 20 +++++++++++++++ .../tables/llx_fichinterdet_extrafields.sql | 25 +++++++++++++++++++ htdocs/install/pgsql/functions/functions.sql | 1 + 4 files changed, 56 insertions(+), 8 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_fichinterdet_extrafields.key.sql create mode 100644 htdocs/install/mysql/tables/llx_fichinterdet_extrafields.sql diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index e018cabfe47..a2d168ed0fd 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -995,12 +995,14 @@ ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_datehour (task_d -- add extrafield on ficheinter lines -CREATE TABLE IF NOT EXISTS `llx_fichinterdet_extrafields` ( - `rowid` int(11) NOT NULL AUTO_INCREMENT, - `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `fk_object` int(11) NOT NULL, - `import_key` varchar(14) DEFAULT NULL, - PRIMARY KEY (`rowid`), - KEY `idx_ficheinter_extrafields` (`fk_object`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; +CREATE TABLE llx_fichinterdet_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb + +ALTER TABLE llx_fichinterdet_extrafields ADD INDEX idx_ficheinterdet_extrafields (fk_object); + diff --git a/htdocs/install/mysql/tables/llx_fichinterdet_extrafields.key.sql b/htdocs/install/mysql/tables/llx_fichinterdet_extrafields.key.sql new file mode 100644 index 00000000000..e80db336c75 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_fichinterdet_extrafields.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2013 Florian Henry +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + + +ALTER TABLE llx_fichinterdet_extrafields ADD INDEX idx_ficheinterdet_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_fichinterdet_extrafields.sql b/htdocs/install/mysql/tables/llx_fichinterdet_extrafields.sql new file mode 100644 index 00000000000..4c44e62e1db --- /dev/null +++ b/htdocs/install/mysql/tables/llx_fichinterdet_extrafields.sql @@ -0,0 +1,25 @@ +-- =================================================================== +-- Copyright (C) 2013 florian Henry +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + +CREATE TABLE llx_fichinterdet_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 89395436c43..04d7b445499 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -83,6 +83,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_extrafields FOR EACH CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_facture FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_facture_fourn FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_fichinter FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_fichinterdet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_livraison FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_localtax FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_menu FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); From 3e2ed270e12f7bf0d879d109100de8b1821f4378 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Aug 2014 15:07:33 +0200 Subject: [PATCH 24/33] Fix: sql request with pgsql --- htdocs/compta/salaries/index.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 0a4a2d99943..b2fc3e1b4a3 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -71,8 +71,8 @@ $form = new Form($db); $salstatic = new PaymentSalary($db); $userstatic = new User($db); -$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm, s.fk_typepayment as type,"; -$sql.= " s.num_payment, pst.code as payment_code"; +$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm, s.fk_typepayment as type, s.num_payment,"; +$sql.= " pst.code as payment_code"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id,"; $sql.= " ".MAIN_DB_PREFIX."user as u"; @@ -87,7 +87,7 @@ if ($filtre) { if ($typeid) { $sql .= " AND s.fk_typepayment=".$typeid; } -$sql.= " GROUP BY s.rowid, s.fk_typepayment, s.amount, s.datev, s.label"; +//$sql.= " GROUP BY u.rowid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev, s.fk_typepayment, s.num_payment, pst.code"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1,$offset); @@ -174,6 +174,7 @@ else } -$db->close(); llxFooter(); + +$db->close(); From 328b8b9643d7b2c0fed0c182ff69acf3f8221373 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Thu, 28 Aug 2014 15:29:31 +0200 Subject: [PATCH 25/33] Fix: Salary payments are not reflected on the reporting sheets Conflicts: ChangeLog --- ChangeLog | 8 ++++ htdocs/compta/resultat/clientfourn.php | 64 ++++++++++++++++++++++++++ htdocs/compta/resultat/index.php | 39 ++++++++++++++++ 3 files changed, 111 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1946c2df9dd..e7c05ea3295 100644 --- a/ChangeLog +++ b/ChangeLog @@ -93,7 +93,15 @@ Dolibarr better: - Table llx_c_pays were renamed into llx_c_country. - Triggers *_BUILDDOC are removed. Building a doc is not a business event. For action after creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead. + +***** ChangeLog for 3.6.1 compared to 3.6.* ***** +For users: +- Fix: Can upload files on services. +- Fix: sql errors on updat fichinter +- Fix: debian script syntax error +- Fix: error "menu param is not inside list" into pos module. +- Fix: Salary payments are not reflected on the reporting sheets ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 5dcd09814ad..14a0e8528b4 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -538,6 +539,69 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujeti print ''; } +/* + * Salaries + */ + +print ''.$langs->trans("Salaries").''; +$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount, u.firstname, u.lastname, p.fk_user"; +$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; +$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user"; +$sql.= " WHERE p.entity = ".$conf->entity; +if (! empty($date_start) && ! empty($date_end)) + $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; + +$sql.= " GROUP BY u.rowid"; +$sql.= " ORDER BY u.firstname"; + +dol_syslog("get payment salaries sql=".$sql); +$result=$db->query($sql); +$subtotal_ht = 0; +$subtotal_ttc = 0; +if ($result) +{ + $num = $db->num_rows($result); + $var=true; + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($result); + + $total_ht -= $obj->amount; + $total_ttc -= $obj->amount; + $subtotal_ht += $obj->amount; + $subtotal_ttc += $obj->amount; + + $var = !$var; + print " "; + + print "".$langs->trans("Salaries")." fk_user."\">".$obj->firstname." ".$obj->lastname."\n"; + + if ($modecompta == 'CREANCES-DETTES') print ''.price(-$obj->amount).''; + print ''.price(-$obj->amount).''; + print ''; + $i++; + } + } + else + { + $var = !$var; + print " "; + print ''.$langs->trans("None").''; + print ''; + } +} +else +{ + dol_print_error($db); +} +print ''; +if ($modecompta == 'CREANCES-DETTES') + print ''.price(-$subtotal_ht).''; +print ''.price(-$subtotal_ttc).''; +print ''; /* * VAT diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index c61c8b76e08..74224c024b0 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -469,6 +470,44 @@ $parameters["mode"] = $modecompta; $hookmanager->initHooks(array('externalbalance')); $reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +/* + * Salaries + */ +$subtotal_ht = 0; +$subtotal_ttc = 0; +$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount"; +$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; +$sql.= " WHERE p.entity = ".$conf->entity; +$sql.= " GROUP BY p.label, dm"; + +dol_syslog("get social salaries payments sql=".$sql); +$result=$db->query($sql); +if ($result) +{ + $num = $db->num_rows($result); + $var=false; + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($result); + + if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0; + $decaiss[$obj->dm] += $obj->amount; + + if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0; + $decaiss_ttc[$obj->dm] += $obj->amount; + + $i++; + } + } +} +else +{ + dol_print_error($db); +} + /* * Show result array */ From 615122bf3735d05dd030fa1e1b3c12f36c39b6fb Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 28 Aug 2014 15:34:50 +0200 Subject: [PATCH 26/33] Fix: another strict mode alert --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 21d272a4198..6b3b1774a63 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -270,7 +270,7 @@ class FormFile if (! empty($iconPDF)) { return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir); } - $printer = ($user->rights->printipp->read && $conf->printipp->enabled)?true:false; + $printer = (!empty($user->rights->printipp->read) && !empty($conf->printipp->enabled))?true:false; $hookmanager->initHooks(array('formfile')); $forname='builddoc'; $out=''; From 139cf10c7c00b4e523eb54a3a7bb0de9134d5b2d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 28 Aug 2014 15:52:20 +0200 Subject: [PATCH 27/33] Fix: php strict mode saga --- htdocs/core/class/html.formfile.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 6b3b1774a63..7ffe021fe92 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1,10 +1,10 @@ - * Copyright (C) 2010-2012 Regis Houssin - * Copyright (c) 2010 Juanjo Menent - * Copyright (c) 2013 Charles-Fr BENKE - * Copyright (C) 2013 Cédric Salvador - * Copyright (c) 2014 Marcos García +/* Copyright (C) 2008-2013 Laurent Destailleur + * Copyright (C) 2010-2014 Regis Houssin + * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2013 Charles-Fr BENKE + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2014 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -514,11 +514,11 @@ class FormFile $out.= $genbutton; $out.= ''; - if($hookmanager->hooks['formfile']) + if (!empty($hookmanager->hooks['formfile'])) { foreach($hookmanager->hooks['formfile'] as $module) { - if(method_exists($module, 'formBuilddocLineOptions')) $out .= ''; + if (method_exists($module, 'formBuilddocLineOptions')) $out .= ''; } } $out.= ''; From b182bf1eb77ecb51bf18dcc97265da4e58243757 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Aug 2014 15:57:34 +0200 Subject: [PATCH 28/33] Output log to make upgrade tack easier --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 104bb1d00c2..cd22137f625 100644 --- a/.travis.yml +++ b/.travis.yml @@ -93,9 +93,9 @@ script: - php upgrade.php 3.5.0 3.6.0 >> upgrade.log - php upgrade2.php 3.5.0 3.6.0 >> upgrade2.log - php upgrade.php 3.6.0 3.7.0 >> upgrade.log + - cat upgrade.log - php upgrade2.php 3.6.0 3.7.0 >> upgrade2.log -# - cat upgrade.log -# - cat upgrade2.log + - cat upgrade2.log - cd ../.. - date - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php From 4d506d29d98ae918c23792a8ac79b7c5159a6358 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Aug 2014 16:14:35 +0200 Subject: [PATCH 29/33] Removed log output (log too long) --- .travis.yml | 4 ++-- build/debian/README.howto | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index cd22137f625..548a8c53380 100644 --- a/.travis.yml +++ b/.travis.yml @@ -93,9 +93,9 @@ script: - php upgrade.php 3.5.0 3.6.0 >> upgrade.log - php upgrade2.php 3.5.0 3.6.0 >> upgrade2.log - php upgrade.php 3.6.0 3.7.0 >> upgrade.log - - cat upgrade.log +# - cat upgrade.log - php upgrade2.php 3.6.0 3.7.0 >> upgrade2.log - - cat upgrade2.log +# - cat upgrade2.log - cd ../.. - date - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php diff --git a/build/debian/README.howto b/build/debian/README.howto index d0bdd4574f4..928a1b181f9 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -153,7 +153,13 @@ from origin/upstream and origin/pristine. * Into root dir, launch: > debian/get-orig-source.sh -If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VERIFY_HOSTNAME=0 " to solve this. +If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VERIFY_HOSTNAME=0" to solve this. + +* Edit tgz file to remove +- includes/sRGB.icc +And rename file into +dolibarr-x.y.z+dsfgw.tgz +(x.y.z = version, w start from 1 and is increased for each new import) * Staying into git root directory, run > git-import-orig -vv ../tcpdf_x.y.z+dfsg.orig.tar.xz @@ -229,7 +235,7 @@ from origin/upstream and origin/pristine. * If new upstream is available onto sourceforge, launch: > debian/get-orig-source.sh -If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VERIFY_HOSTNAME=0 " to solve this. +If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VERIFY_HOSTNAME=0" to solve this. * Edit tgz file to remove - ckeditor From 5e95daad91cabd64eb0ceb7b78d5f83332b84e93 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Aug 2014 16:18:17 +0200 Subject: [PATCH 30/33] Fix: Sql syntax error --- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index a2d168ed0fd..09d84de0bfe 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -973,7 +973,7 @@ CREATE TABLE llx_holiday_types ( deleteAt DATETIME, nbCongesDeducted varchar(255) NOT NULL, nbCongesEveryMonth varchar(255) NOT NULL -); +) ENGINE=innodb; -- Change on table c_civilite ALTER TABLE llx_c_civilite DROP INDEX uk_c_civilite; @@ -1001,7 +1001,7 @@ CREATE TABLE llx_fichinterdet_extrafields tms timestamp, fk_object integer NOT NULL, import_key varchar(14) -- import key -) ENGINE=innodb +) ENGINE=innodb; ALTER TABLE llx_fichinterdet_extrafields ADD INDEX idx_ficheinterdet_extrafields (fk_object); From 711e7e6fc6e72311cbf7af4b7d2a054aa3977eaa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Aug 2014 16:59:10 +0200 Subject: [PATCH 31/33] Fix: phpunit test Fix: debian readme to upgrade tcpdf lib. --- build/debian/README.howto | 12 ++++++------ htdocs/core/modules/modSociete.class.php | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build/debian/README.howto b/build/debian/README.howto index 928a1b181f9..fea942a573f 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -158,17 +158,17 @@ If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VER * Edit tgz file to remove - includes/sRGB.icc And rename file into -dolibarr-x.y.z+dsfgw.tgz +tcpdf_x.y.z+dfsg.tar.xz (x.y.z = version, w start from 1 and is increased for each new import) * Staying into git root directory, run -> git-import-orig -vv ../tcpdf_x.y.z+dfsg.orig.tar.xz +> git-import-orig -vv ../tcpdf_x.y.z+dfsg.tar.xz Note: If there was errors solved manually, you may need to make a git commit * Add an entry into debian/changelog -> dch -v x.y.z-dsfg-1 "My comment" will add entry. -For example: dch -v x.y.z-dsfg-1 "New upstream release." for a new version +> dch -v x.y.z+dsfg-1 "My comment" will add entry. +For example: dch -v x.y.z+dsfg-1 "New upstream release." for a new version Then modify changelog to replace "version" or "unstable" with "UNRELEASED". Warning: Date must have format reported by "date -R" @@ -254,8 +254,8 @@ x.y.z+dsfgw Note: If there was errors solved manually after get-orig-sources.sh, you may need to make a git commit * Add an entry into debian/changelog -> dch -v x.y.z-w "My comment" will add entry. -For example: dch -v x.y.z-w "New upstream release." for a new version (x.y.z = version, w start from 1 and increaed for each new import) +> dch -v x.y.z+dfsg-w "My comment" will add entry. +For example: dch -v x.y.z+dfsg-w "New upstream release." for a new version (x.y.z = version, w start from 1 and increaed for each new import) Then modify changelog to replace "version" or "unstable" with "UNRELEASED". Then check/modify also the user/date signature: - Date must have format reported by "date -R" diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 28a5fcaebe3..63cb9c610b4 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -124,7 +124,7 @@ class modSociete extends DolibarrModules $this->const[$r][4] = 1; $r++; */ - + $this->const[$r][0] = "SOCIETE_ADD_REF_IN_LIST"; $this->const[$r][1] = "yesno"; $this->const[$r][2] = "0"; @@ -320,7 +320,7 @@ class modSociete extends DolibarrModules $this->export_label[$r]='ExportDataset_company_2'; $this->export_icon[$r]='contact'; $this->export_permission[$r]=array(array("societe","contact","export")); - $this->export_fields_array[$r]=array('c.rowid'=>"IdContact",'c.civility'=>"CivilityCode",'c.lastname'=>'Lastname','c.firstname'=>'Firstname','c.poste'=>'PostOrFunction','c.datec'=>"DateCreation",'c.tms'=>"DateLastModification",'c.priv'=>"ContactPrivate",'c.address'=>"Address",'c.zip'=>"Zip",'c.town'=>"Town",'d.nom'=>'State','p.libelle'=>"Country",'p.code'=>"CountryCode",'c.phone'=>"Phone",'c.fax'=>"Fax",'c.phone_mobile'=>"Mobile",'c.email'=>"EMail",'s.rowid'=>"IdCompany",'s.nom'=>"CompanyName",'s.status'=>"Status",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode", 's.client'=>'Customer 0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'Supplier 0 or 1'); + $this->export_fields_array[$r]=array('c.rowid'=>"IdContact",'c.civility'=>"CivilityCode",'c.lastname'=>'Lastname','c.firstname'=>'Firstname','c.poste'=>'PostOrFunction','c.datec'=>"DateCreation",'c.tms'=>"DateLastModification",'c.priv'=>"ContactPrivate",'c.address'=>"Address",'c.zip'=>"Zip",'c.town'=>"Town",'d.nom'=>'State','co.label'=>"Country",'co.code'=>"CountryCode",'c.phone'=>"Phone",'c.fax'=>"Fax",'c.phone_mobile'=>"Mobile",'c.email'=>"EMail",'s.rowid'=>"IdCompany",'s.nom'=>"CompanyName",'s.status'=>"Status",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode", 's.client'=>'Customer 0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'Supplier 0 or 1'); $this->export_TypeFields_array[$r]=array('c.civility'=>"List:c_civility:label:code",'c.lastname'=>'Text','c.firstname'=>'Text','c.poste'=>'Text','c.datec'=>"Date",'c.priv'=>"Boolean",'c.address'=>"Text",'c.cp'=>"Text",'c.ville'=>"Text",'d.nom'=>'Text','co.label'=>"List:c_country:label:rowid",'co.code'=>"Text",'c.phone'=>"Text",'c.fax'=>"Text",'c.email'=>"Text",'s.rowid'=>"List:societe:nom",'s.nom'=>"Text",'s.status'=>"Status",'s.client'=>"Text",'s.fournisseur'=>"Text"); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>"company",'s.code_client'=>"company",'s.code_fournisseur'=>"company", 's.client'=>"company", 's.fournisseur'=>"company"); // We define here only fields that use another picto if (empty($conf->fournisseur->enabled)) From e4dbf6a9e4d60bb1047999b1c8a329f1aa5fd516 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Aug 2014 11:02:21 +0200 Subject: [PATCH 32/33] Removed useless file --- build/makepack-dolibarrlang.pl | 300 --------------------------------- 1 file changed, 300 deletions(-) delete mode 100755 build/makepack-dolibarrlang.pl diff --git a/build/makepack-dolibarrlang.pl b/build/makepack-dolibarrlang.pl deleted file mode 100755 index 6066a678d7c..00000000000 --- a/build/makepack-dolibarrlang.pl +++ /dev/null @@ -1,300 +0,0 @@ -#!/usr/bin/perl -#---------------------------------------------------------------------------- -# \file build/makepack-dolibarrlang.pl -# \brief Package builder (tgz, zip, rpm, deb, exe) -# \author (c)2005 Laurent Destailleur -#---------------------------------------------------------------------------- - -use Cwd; - -$PROJECT = "dolibarr"; - -@LISTETARGET = ("TGZ"); # Possible packages -%REQUIREMENTTARGET = ( # Tool requirement for each package - "TGZ" => "tar", - "ZIP" => "7z", - "EXE" => "makensis.exe" -); -%ALTERNATEPATH = ( - "7z" => "7-ZIP", - "makensis.exe" => "NSIS" -); - -use vars qw/ $REVISION $VERSION /; -$REVISION = '1.10'; -$VERSION = "1.0 (build $REVISION)"; - -#------------------------------------------------------------------------------ -# MAIN -#------------------------------------------------------------------------------ -( $DIR = $0 ) =~ s/([^\/\\]+)$//; -( $PROG = $1 ) =~ s/\.([^\.]*)$//; -$Extension = $1; -$DIR ||= '.'; -$DIR =~ s/([^\/\\])[\\\/]+$/$1/; - -# Detect OS type -# -------------- -if ( "$^O" =~ /linux/i || ( -d "/etc" && -d "/var" && "$^O" !~ /cygwin/i ) ) { - $OS = 'linux'; - $CR = ''; -} -elsif ( -d "/etc" && -d "/Users" ) { $OS = 'macosx'; $CR = ''; } -elsif ( "$^O" =~ /cygwin/i || "$^O" =~ /win32/i ) { - $OS = 'windows'; - $CR = "\r"; -} -if ( !$OS ) { - print "$PROG.$Extension was not able to detect your OS.\n"; - print "Can't continue.\n"; - print "$PROG.$Extension aborted.\n"; - sleep 2; - exit 1; -} - -# Define buildroot -# ---------------- -if ( $OS =~ /linux/ ) { - $TEMP = $ENV{"TEMP"} || $ENV{"TMP"} || "/tmp"; -} -if ( $OS =~ /macos/ ) { - $TEMP = $ENV{"TEMP"} || $ENV{"TMP"} || "/tmp"; -} -if ( $OS =~ /windows/ ) { - $TEMP = $ENV{"TEMP"} || $ENV{"TMP"} || "c:/temp"; - $PROGPATH = $ENV{"ProgramFiles"}; -} -if ( !$TEMP || !-d $TEMP ) { - print "Error: A temporary directory can not be find.\n"; - print "Check that TEMP or TMP environment variable is set correctly.\n"; - print "makepack-dolibarrlang.pl aborted.\n"; - sleep 2; - exit 2; -} -$BUILDROOT = "$TEMP/dolibarr-buildroot"; - -my $copyalreadydone = 0; -my $batch = 0; - -print "Makepack langs version $VERSION\n"; -print "Enter language code to package (en_US, fr_FR, ...) : "; -$PROJECT = ; -chomp($PROJECT); - -# Ask and set version $MAJOR and $MINOR -print "Enter value for version: "; -$PROJVERSION = ; -chomp($PROJVERSION); -( $MAJOR, $MINOR ) = split( /\./, $PROJVERSION, 2 ); -if ( $MINOR eq '' ) { - print "Enter value for minor version: "; - $MINOR = ; - chomp($MINOR); -} - -$FILENAME = "$PROJECT"; -$FILENAMETGZ = "lang_$PROJECT-$MAJOR.$MINOR"; -if ( -d "/usr/src/redhat" ) { - - # redhat - $RPMDIR = "/usr/src/redhat"; -} -if ( -d "/usr/src/RPM" ) { - - # mandrake - $RPMDIR = "/usr/src/RPM"; -} - -$SOURCE = "$DIR/../../dolibarr"; -$DESTI = "$SOURCE/build"; - -# Choose package targets -#----------------------- -$target = "ZIP"; # Les langs sont au format zip -if ($target) { - $CHOOSEDTARGET{ uc($target) } = 1; -} -else { - my $found = 0; - my $NUM_SCRIPT; - while ( !$found ) { - my $cpt = 0; - printf( " %d - %3s (%s)\n", - $cpt, "All", "Need " . join( ",", values %REQUIREMENTTARGET ) ); - foreach my $target (@LISTETARGET) { - $cpt++; - printf( " %d - %3s (%s)\n", - $cpt, $target, "Need " . $REQUIREMENTTARGET{$target} ); - } - - # Are asked to select the file to move - print "Choose one package number or several separated with space: "; - $NUM_SCRIPT = ; - chomp($NUM_SCRIPT); - if ( $NUM_SCRIPT =~ s/-//g ) { - - # Do not do copy - $copyalreadydone = 1; - } - if ( $NUM_SCRIPT !~ /^[0-$cpt\s]+$/ ) { - print "This is not a valid package number list.\n"; - $found = 0; - } - else { - $found = 1; - } - } - print "\n"; - if ($NUM_SCRIPT) { - foreach my $num ( split( /\s+/, $NUM_SCRIPT ) ) { - $CHOOSEDTARGET{ $LISTETARGET[ $num - 1 ] } = 1; - } - } - else { - foreach my $key (@LISTETARGET) { - $CHOOSEDTARGET{$key} = 1; - } - } -} - -# Test if requirement is ok -#-------------------------- -foreach my $target ( keys %CHOOSEDTARGET ) { - foreach my $req ( split( /[,\s]/, $REQUIREMENTTARGET{$target} ) ) { - - # Test - print "Test requirement for target $target: Search '$req'... "; - $ret = `"$req" 2>&1`; - $coderetour = $?; - $coderetour2 = $coderetour >> 8; - if ( - $coderetour != 0 - && ( ( $coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i ) - || ( $coderetour2 == 127 && $OS !~ /windows/ ) ) - && $PROGPATH - ) - { - - # Not found error, we try in PROGPATH - $ret = `"$PROGPATH/$ALTERNATEPATH{$req}/$req\" 2>&1`; - $coderetour = $?; - $coderetour2 = $coderetour >> 8; - $REQUIREMENTTARGET{$target} = "$PROGPATH/$ALTERNATEPATH{$req}/$req"; - } - - if ( - $coderetour != 0 - && ( ( $coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i ) - || ( $coderetour2 == 127 && $OS !~ /windows/ ) ) - ) - { - - # Not found error - print -"Not found\nCan't build target $target. Requirement '$req' not found in PATH\n"; - $CHOOSEDTARGET{$target} = -1; - last; - } - else { - - # Pas erreur ou erreur autre que programme absent - print " Found " . $REQUIREMENTTARGET{$target} . "\n"; - } - } -} - -print "\n"; - -# Check if there is at least on target to build -#---------------------------------------------- -$nboftargetok = 0; -foreach my $target ( keys %CHOOSEDTARGET ) { - if ( $CHOOSEDTARGET{$target} < 0 ) { next; } - $nboftargetok++; -} - -if ($nboftargetok) { - - # Update buildroot - #----------------- - if ( !$copyalreadydone ) { - print "Delete directory $BUILDROOT\n"; - $ret = `rm -fr "$BUILDROOT"`; - mkdir "$BUILDROOT"; - mkdir "$BUILDROOT/htdocs"; - mkdir "$BUILDROOT/htdocs/langs"; - mkdir "$BUILDROOT/htdocs/langs/$PROJECT"; - - print "Copy $SOURCE into $BUILDROOT\n"; - mkdir "$BUILDROOT"; - $ret = - `cp -pr "$SOURCE/htdocs/langs/$PROJECT" "$BUILDROOT/htdocs/langs"`; - } - print "Clean $BUILDROOT\n"; - $ret = -`rm -fr $BUILDROOT/htdocs/langs/$PROJECT/Thumbs.db $BUILDROOT/htdocs/langs/$PROJECT/*/Thumbs.db $BUILDROOT/htdocs/langs/$PROJECT/*/*/Thumbs.db $BUILDROOT/htdocs/langs/$PROJECT/*/*/*/Thumbs.db`; - $ret = -`rm -fr $BUILDROOT/htdocs/langs/$PROJECT/CVS* $BUILDROOT/htdocs/langs/$PROJECT/*/CVS* $BUILDROOT/htdocs/langs/$PROJECT/*/*/CVS* $BUILDROOT/htdocs/langs/$PROJECT/*/*/*/CVS* $BUILDROOT/htdocs/langs/$PROJECT/*/*/*/*/CVS* $BUILDROOT/htdocs/langs/$PROJECT/*/*/*/*/*/CVS*`; - - # Build package for each target - #------------------------------ - foreach my $target ( keys %CHOOSEDTARGET ) - { - if ( $CHOOSEDTARGET{$target} < 0 ) { next; } - - print "\nBuild package for target $target\n"; - - if ( $target eq 'TGZ' ) - { - unlink $FILENAMETGZ . tgz; - - # unlink $BUILDROOT/$FILENAMETGZ.tgz; - print "Compress $BUILDROOT/htdocs into $FILENAMETGZ.tgz...\n"; - $cmd = -"tar --exclude-vcs --exclude-from \"$DESTI/tgz/tar.exclude\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$FILENAMETGZ.tgz\" htdocs"; - $ret = `$cmd`; - -# $cmd="tar --exclude-vcs --exclude-from \"$DESTI/tgz/tar.exclude\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMETGZ.tgz\" htdocs\n"; -# $ret=`$cmd`; - if ( $OS =~ /windows/i ) { - print "Move $FILENAMETGZ.tgz to $DESTI/$FILENAMETGZ.tgz\n"; - $ret = `mv "$FILENAMETGZ.tgz" "$DESTI/$FILENAMETGZ.tgz"`; - - # $ret=`mv "$BUILDROOT/$FILENAMETGZ.tgz" "$DESTI/$FILENAMETGZ.tgz"`; - } - next; - } - - if ( $target eq 'ZIP' ) - { - unlink $FILENAMEZIP . zip; - print "Compress $FILENAMETGZ into $FILENAMEZIP.zip...\n"; - chdir("$BUILDROOT"); - -#print "cd $BUILDROOTNT & 7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMETGZ\\*.*\n"; -#$ret=`cd $BUILDROOTNT & 7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMETGZ\\*.*`; - $ret = - `7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMETGZ\\*.*`; - print "Move $FILENAMEZIP.zip to $DESTI\n"; - rename( "$BUILDROOT/$FILENAMEZIP.zip", "$DESTI/$FILENAMEZIP.zip" ); - next; - } - } -} - -print "\n----- Summary -----\n"; -foreach my $target ( keys %CHOOSEDTARGET ) { - if ( $CHOOSEDTARGET{$target} < 0 ) { - print "Package $target not built (bad requirement).\n"; - } - else { - print "Package $target built succeessfully in $DESTI\n"; - } -} - -if ( !$btach ) { - print "\nPress key to finish..."; - my $WAITKEY = ; -} - -0; From 5dc35ec13769392e795623a8084c2b316e2d3bed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Aug 2014 20:25:54 +0200 Subject: [PATCH 33/33] Fix: Missing field tobuy into service export. Fix: Filter on date into export. Fix: Tooltip help. --- htdocs/core/modules/modProduct.class.php | 1 + htdocs/core/modules/modService.class.php | 9 +++++---- htdocs/exports/export.php | 6 ++++-- htdocs/langs/en_US/exports.lang | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 05c934a8ea6..87dbc3e6dde 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -219,6 +219,7 @@ class modProduct extends DolibarrModules 'pr.price_min'=>"MinPriceHT",'pr.price_min_ttc'=>"MinPriceTTC", 'pr.tva_tx'=>'VATRate', 'pr.date_price'=>'DateCreation'); + //$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Number",'p.surface'=>"Number",'p.volume'=>"Number",'p.weight'=>"Number",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Number",'p.price_ttc'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date'); $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product", 'pr.price_base_type'=>"product",'pr.price_level'=>"product",'pr.price'=>"product", 'pr.price_ttc'=>"product", diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index cd4823d7eab..363fcaf6467 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -137,13 +137,13 @@ class modService extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]="Services"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("service","export")); - $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification'); + $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification'); if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock')); //$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Number",'p.price_ttc'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date'); - $this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Number",'p.price_ttc'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date'); - if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Number')); + $this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Number",'p.price_ttc'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date'); + if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Number')); if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text')); - $this->export_entities_array[$r]=array('p.rowid'=>"service",'p.ref'=>"service",'p.label'=>"service",'p.description'=>"service",'p.accountancy_code_sell'=>'service','p.note'=>"service",'p.price_base_type'=>"service",'p.price'=>"service",'p.price_ttc'=>"service",'p.tva_tx'=>"service",'p.tosell'=>"service",'p.duration'=>"service",'p.datec'=>"service",'p.tms'=>"service"); + $this->export_entities_array[$r]=array('p.rowid'=>"service",'p.ref'=>"service",'p.label'=>"service",'p.description'=>"service",'p.accountancy_code_sell'=>'service','p.note'=>"service",'p.price_base_type'=>"service",'p.price'=>"service",'p.price_ttc'=>"service",'p.tva_tx'=>"service",'p.tosell'=>"service",'p.tobuy'=>"service",'p.duration'=>"service",'p.datec'=>"service",'p.tms'=>"service"); if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'service')); if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'service')); // Add extra fields @@ -182,6 +182,7 @@ class modService extends DolibarrModules 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", 'pr.tva_tx'=>'PriceLevelVATRate', 'pr.date_price'=>'DateCreation'); + //$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Number",'p.surface'=>"Number",'p.volume'=>"Number",'p.weight'=>"Number",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Number",'p.price_ttc'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date'); $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product", 'pr.price_base_type'=>"product",'pr.price_level'=>"product",'pr.price'=>"product", 'pr.price_ttc'=>"product", diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 8ac1f6e6d48..45e78b2ecd3 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -839,7 +839,8 @@ if ($step == 4 && $datatoexport) if (isset($objexport->array_export_fields[0][$code])) { $list.=($list?', ':''); - $list.=$langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code])?$array_filtervalue[$code]:'')."'"; + if (isset($array_filtervalue[$code]) && preg_match('/^\s*[<>]/',$array_filtervalue[$code])) $list.=$langs->trans($objexport->array_export_fields[0][$code]).(isset($array_filtervalue[$code])?$array_filtervalue[$code]:''); + else $list.=$langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code])?$array_filtervalue[$code]:'')."'"; } } } @@ -1070,7 +1071,8 @@ if ($step == 5 && $datatoexport) if (isset($objexport->array_export_fields[0][$code])) { $list.=($list?', ':''); - $list.=$langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code])?$array_filtervalue[$code]:'')."'"; + if (isset($array_filtervalue[$code]) && preg_match('/^\s*[<>]/',$array_filtervalue[$code])) $list.=$langs->trans($objexport->array_export_fields[0][$code]).(isset($array_filtervalue[$code])?$array_filtervalue[$code]:''); + else $list.=$langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code])?$array_filtervalue[$code]:'')."'"; } } } diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang index 79d5bec834f..d396746ccad 100644 --- a/htdocs/langs/en_US/exports.lang +++ b/htdocs/langs/en_US/exports.lang @@ -125,7 +125,7 @@ BankAccountNumber=Account number BankAccountNumberKey=Key SpecialCode=Special code ExportStringFilter=%% allows replacing one or more characters in the text -ExportDateFilter='YYYY' 'YYYYMM' 'YYYYMMDD': filters by one year/month/day
'YYYY+YYYY' 'YYYYMM+YYYYMM' 'YYYYMMDD+YYYYMMDD': filters over a range of years/months/days
'>YYYY' '>YYYYMM' '>YYYYMMDD': filters on the following years/months/days
'<YYYY' '<YYYYMM' '<YYYYMMDD': filters on the previous years/months/days +ExportDateFilter=YYYY, YYYYMM, YYYYMMDD : filters by one year/month/day
YYYY+YYYY, YYYYMM+YYYYMM, YYYYMMDD+YYYYMMDD : filters over a range of years/months/days
> YYYY, > YYYYMM, > YYYYMMDD : filters on all following years/months/days
< YYYY, < YYYYMM, < YYYYMMDD : filters on all previous years/months/days ExportNumericFilter='NNNNN' filters by one value
'NNNNN+NNNNN' filters over a range of values
'>NNNNN' filters by lower values
'>NNNNN' filters by higher values ## filters SelectFilterFields=If you want to filter on some values, just input values here.