From a33727f4c50c6dbbf4595a120a5c438b52b1fabe Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Thu, 15 Jan 2015 13:00:11 +0100 Subject: [PATCH 01/67] Update task.php Allow to change the ref of a task (like the ref of project) --- htdocs/projet/tasks/task.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index a64d5354768..fd821fe216b 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -81,6 +81,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) $task_parent=$tmparray[1]; if (empty($task_parent)) $task_parent = 0; // If task_parent is '' + $object->ref = $_POST["ref"]; $object->label = $_POST["label"]; $object->description = $_POST['description']; $object->fk_task_parent = $task_parent; @@ -308,7 +309,7 @@ if ($id > 0 || ! empty($ref)) // Ref print ''.$langs->trans("Ref").''; - print ''.$object->ref.''; + print ''; // Label print ''.$langs->trans("Label").''; From c923d06d84c8392d641f217c14fa9ff07fd46d09 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Thu, 15 Jan 2015 17:10:47 +0100 Subject: [PATCH 02/67] Update task.php --- htdocs/projet/tasks/task.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index fd821fe216b..e2bccd26a5d 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -37,7 +37,7 @@ $langs->load("projects"); $langs->load("companies"); $id=GETPOST('id','int'); -$ref=GETPOST('ref','alpha'); +$ref=$_GET["ref"]; $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); $withproject=GETPOST('withproject','int'); From d98d4d219f67aba9124f731744d762f6b7fec28c Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Mon, 19 Jan 2015 22:46:28 +0100 Subject: [PATCH 03/67] Update task.php use GETPOST instead of $_GET and $_POST --- htdocs/projet/tasks/task.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index e2bccd26a5d..b9106c4e2e3 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -37,7 +37,7 @@ $langs->load("projects"); $langs->load("companies"); $id=GETPOST('id','int'); -$ref=$_GET["ref"]; +$ref=GETPOST("ref",'alpha',1); $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); $withproject=GETPOST('withproject','int'); @@ -81,7 +81,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) $task_parent=$tmparray[1]; if (empty($task_parent)) $task_parent = 0; // If task_parent is '' - $object->ref = $_POST["ref"]; + $object->ref = GETPOST("ref",'alpha',2); $object->label = $_POST["label"]; $object->description = $_POST['description']; $object->fk_task_parent = $task_parent; From 659570a6ab69a663f2a638b08777e4e7b1207031 Mon Sep 17 00:00:00 2001 From: jean Date: Mon, 4 May 2015 11:56:02 +0200 Subject: [PATCH 04/67] add a script for migrating pictures of products --- scripts/product/migrate_picture_path.php | 136 +++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100755 scripts/product/migrate_picture_path.php diff --git a/scripts/product/migrate_picture_path.php b/scripts/product/migrate_picture_path.php new file mode 100755 index 00000000000..272e56e3a42 --- /dev/null +++ b/scripts/product/migrate_picture_path.php @@ -0,0 +1,136 @@ +#!/usr/bin/php + + * Copyright (C) 2015 Jean Heimburger + * + * 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 scripts/product/migrate_picture_path.php + * \ingroup scripts + * \brief migrate pictures from old system to 3.7 and more system + * + */ + +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); +$path=dirname(__FILE__).'/'; + +// Test if batch mode +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; + exit(-1); +} + +// Global variables +$version='1.0'; +$error=0; + + +// -------------------- START OF YOUR CODE HERE -------------------- +@set_time_limit(0); // No timeout for this script +define('EVEN_IF_ONLY_LOGIN_ALLOWED',1); // Set this define to 0 if you want to lock your script when dolibarr setup is "locked to admin user only". + +// Include and load Dolibarr environment variables +require_once($path."../../htdocs/master.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); +// After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). +// $user is created but empty. + +//$langs->setDefaultLang('en_US'); // To change default language of $langs +$langs->load("main"); // To load language file for default language + + +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; + +print '--- start'."\n"; + +function migrate_product_photospath($product) +{ + global $conf; + + $dir = $conf->product->multidir_output[$product->entity]; + $origin = $dir .'/'. get_exdir($product->id,2) . $product->id ."/photos"; + $destin = $dir.'/'.dol_sanitizeFileName($product->ref); + + $error = 0; + + $origin_osencoded=dol_osencode($origin); + $destin_osencoded=dol_osencode($destin); + dol_mkdir($destin); + + if (dol_is_dir($origin)) + { + $handle=opendir($origin_osencoded); + if (is_resource($handle)) + { + while (($file = readdir($handle)) != false) + { + if ($file != '.' && $file != '..' && is_dir($origin_osencoded.'/'.$file)) + { + $thumbs = opendir($origin_osencoded.'/'.$file); + if (is_resource($thumbs)) + { + dol_mkdir($destin.'/'.$file); + while (($thumb = readdir($thumbs)) != false) + { + dol_move($origin.'/'.$file.'/'.$thumb, $destin.'/'.$file.'/'.$thumb); + } +// dol_delete_dir($origin.'/'.$file); + } + } + else + { + if (dol_is_file($origin.'/'.$file) ) + { + dol_move($origin.'/'.$file, $destin.'/'.$file); + } + + } + } + } + } +} + +$product = new Product($db); + +$sql = "SELECT rowid as pid from ".MAIN_DB_PREFIX."product "; + +$resql = $db->query($sql); + +if (!resql ) +{ + print "\n sql error ".$sql; + exit; +} + +while ($obj = $db->fetch_object($resql)) +{ + print "\n migrating ".$product->ref; + $product->fetch($obj->pid); + migrate_product_photospath($product); +} + + + + + +// -------------------- END OF YOUR CODE -------------------- + + +$db->close(); // Close $db database opened handler + +exit($error); From 91885c9d6fee6c785f3de70a059d07b185669043 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Fri, 22 May 2015 17:22:57 +0200 Subject: [PATCH 05/67] FIX when multicompany was enabled, this function didn't check just on the good entity (problem when both company use same mask) --- htdocs/core/class/commonobject.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e0bab998982..10e83d80595 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -65,13 +65,17 @@ abstract class CommonObject */ static function isExistingObject($element, $id, $ref='', $ref_ext='') { - global $db; + global $db,$conf; $sql = "SELECT rowid, ref, ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX.$element; - if ($id > 0) $sql.= " WHERE rowid = ".$db->escape($id); - else if ($ref) $sql.= " WHERE ref = '".$db->escape($ref)."'"; - else if ($ref_ext) $sql.= " WHERE ref_ext = '".$db->escape($ref_ext)."'"; + + if($conf->multicompany->enabled)$sql.= " WHERE entity=".$conf->entity; + else $sql.=" WHERE 1 "; + + if ($id > 0) $sql.= " AND rowid = ".$db->escape($id); + else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'"; + else if ($ref_ext) $sql.= " AND ref_ext = '".$db->escape($ref_ext)."'"; else { $error='ErrorWrongParameters'; dol_print_error(get_class()."::isExistingObject ".$error, LOG_ERR); From 44c46d68ed4a443962dbdbb8d8ad130f9ee31f82 Mon Sep 17 00:00:00 2001 From: Alexis ALGOUD Date: Sat, 23 May 2015 23:51:49 +0200 Subject: [PATCH 06/67] Remove the useless if --- htdocs/core/class/commonobject.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 10e83d80595..73019b52eef 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -70,8 +70,7 @@ abstract class CommonObject $sql = "SELECT rowid, ref, ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX.$element; - if($conf->multicompany->enabled)$sql.= " WHERE entity=".$conf->entity; - else $sql.=" WHERE 1 "; + $sql.= " WHERE entity=".$conf->entity; if ($id > 0) $sql.= " AND rowid = ".$db->escape($id); else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'"; From dd7febe2b984f0ab2c60d435279e3a0a6374a5c0 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Fri, 29 May 2015 15:10:59 +0200 Subject: [PATCH 07/67] replace test by getEntity() --- htdocs/core/class/commonobject.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 10e83d80595..03d044a2ee6 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -69,9 +69,7 @@ abstract class CommonObject $sql = "SELECT rowid, ref, ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX.$element; - - if($conf->multicompany->enabled)$sql.= " WHERE entity=".$conf->entity; - else $sql.=" WHERE 1 "; + $sql.= " WHERE entity IN (".getEntity($element).")" ; if ($id > 0) $sql.= " AND rowid = ".$db->escape($id); else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'"; From 074fcd976997c6645329e547524e56d4381ed613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Fri, 29 May 2015 17:51:34 +0200 Subject: [PATCH 08/67] Standardize categories types/ids management Fix #2922 Fix #2843 --- htdocs/categories/categorie.php | 2 +- htdocs/categories/class/categorie.class.php | 311 +++++++++++--------- 2 files changed, 179 insertions(+), 134 deletions(-) diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 155593b5efd..5edede7417e 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -208,7 +208,7 @@ if (empty($reshook)) } else { - setEventMessages($cat->error,$this->errors,'errors'); + setEventMessages( $cat->error, $cat->errors, 'errors' ); } } } diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 167a256a990..222ec7ca713 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -48,6 +48,67 @@ class Categorie extends CommonObject const TYPE_MEMBER = 3; const TYPE_CONTACT = 4; + /** + * @var array ID mapping from type string + * + * @note Move to const array when PHP 5.6 will be our minimum target + */ + private $MAP_ID = array( + 'product' => 0, + 'supplier' => 1, + 'customer' => 2, + 'member' => 3, + 'contact' => 4, + ); + /** + * @var array Foreign keys mapping from type string + * + * @note Move to const array when PHP 5.6 will be our minimum target + */ + private $MAP_CAT_FK = array( + 'product' => 'product', + 'customer' => 'soc', + 'supplier' => 'soc', + 'member' => 'member', + 'contact' => 'socpeople', + ); + /** + * @var array Category tables mapping from type string + * + * @note Move to const array when PHP 5.6 will be our minimum target + */ + private $MAP_CAT_TABLE = array( + 'product' => 'product', + 'customer' => 'societe', + 'supplier' => 'fournisseur', + 'member' => 'member', + 'contact' => 'contact', + ); + /** + * @var array Object class mapping from type string + * + * @note Move to const array when PHP 5.6 will be our minimum target + */ + private $MAP_OBJ_CLASS = array( + 'product' => 'Product', + 'customer' => 'Societe', + 'supplier' => 'Fournisseur', + 'member' => 'Adherent', + 'contact' => 'Contact', + ); + /** + * @var array Object table mapping from type string + * + * @note Move to const array when PHP 5.6 will be our minimum target + */ + private $MAP_OBJ_TABLE = array( + 'product' => 'product', + 'customer' => 'societe', + 'supplier' => 'societe', + 'member' => 'adherent', + 'contact' => 'socpeople', + ); + public $element='category'; public $table_element='categories'; @@ -56,13 +117,21 @@ class Categorie extends CommonObject var $label; var $description; var $socid; - var $type; // 0=Product, 1=Supplier, 2=Customer/Prospect, 3=Member, 4=Contact + /** + * @var int Category type + * + * @see Categorie::TYPE_PRODUCT + * @see Categorie::TYPE_SUPPLIER + * @see Categorie::TYPE_CUSTOMER + * @see Categorie::TYPE_MEMBER + * @see Categorie::TYPE_CONTACT + */ + var $type; var $import_key; var $cats=array(); // Tableau en memoire des categories var $motherof=array(); - /** * Constructor * @@ -477,11 +546,12 @@ class Categorie extends CommonObject } /** - * Link an object to the category + * Link an object to the category * - * @param Object $obj Object to link to category - * @param string $type Type of category ('societe', 'member', 'product', 'contact', 'fournisseur) - * @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked + * @param CommonObject $obj Object to link to category + * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') + * + * @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked */ function add_type($obj,$type) { @@ -492,28 +562,21 @@ class Categorie extends CommonObject if ($this->id == -1) return -2; // For backward compatibility - if ($type == 'company') $type='societe'; - elseif ($type == 'customer') $type='societe'; - elseif ($type == 'supplier') $type='fournisseur'; - - /** - * llx_categorie_contact => fk_socpeople - * llx_categorie_fournisseur, llx_categorie_societe => fk_soc - * llx_categorie_member => fk_member - * llx_categorie_product => fk_product - */ - if ($type == 'contact') { - $column_name = 'socpeople'; - } elseif ($type == 'fournisseur' || ($type == 'societe')) { - $column_name = 'soc'; - } else { - $column_name = $type; + if ($type == 'societe') { + $type = 'customer'; + dol_syslog( get_class( $this ) . "::add_type(): type 'societe' is deprecated, please use 'customer' instead", + LOG_WARNING ); + } elseif ($type == 'fournisseur') { + $type = 'supplier'; + dol_syslog( get_class( $this ) . "::add_type(): type 'fournisseur' is deprecated, please use 'supplier' instead", + LOG_WARNING ); } $this->db->begin(); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".$type." (fk_categorie, fk_".$column_name.")"; - $sql .= " VALUES (".$this->id.", ".$obj->id.")"; + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type]; + $sql .= " (fk_categorie, fk_" . $this->MAP_CAT_FK[$type] . ")"; + $sql .= " VALUES (" . $this->id . ", " . $obj->id . ")"; dol_syslog(get_class($this).'::add_type', LOG_DEBUG); if ($this->db->query($sql)) @@ -596,9 +659,10 @@ class Categorie extends CommonObject /** * Delete object from category * - * @param Object $obj Object - * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact') - * @return int 1 if OK, -1 if KO + * @param CommonObject $obj Object + * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') + * + * @return int 1 if OK, -1 if KO */ function del_type($obj,$type) { @@ -607,19 +671,21 @@ class Categorie extends CommonObject $error=0; // For backward compatibility - if ($type == 'company') $type='societe'; - if ($type == 'customer') $type='societe'; - if ($type == 'supplier') $type='fournisseur'; - - $column_name=$type; - if ($type=='contact') $column_name='socpeople'; - if ($type=='fournisseur') $column_name='societe'; + if ($type == 'societe') { + $type = 'customer'; + dol_syslog( get_class( $this ) . "::del_type(): type 'societe' is deprecated, please use 'customer' instead", + LOG_WARNING ); + } elseif ($type == 'fournisseur') { + $type = 'supplier'; + dol_syslog( get_class( $this ) . "::del_type(): type 'fournisseur' is deprecated, please use 'supplier' instead", + LOG_WARNING ); + } $this->db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_".$type; - $sql .= " WHERE fk_categorie = ".$this->id; - $sql .= " AND fk_".$column_name." = ".$obj->id; + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type]; + $sql .= " WHERE fk_categorie = " . $this->id; + $sql .= " AND fk_" . $this->MAP_CAT_FK[$type] . " = " . $obj->id; dol_syslog(get_class($this).'::del_type', LOG_DEBUG); if ($this->db->query($sql)) @@ -652,41 +718,32 @@ class Categorie extends CommonObject } /** - * Return list of fetched instance of elements having this category + * Return list of fetched instance of elements having this category * - * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact') - * @return mixed -1 if KO, array of instance of object if OK + * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') + * + * @return mixed -1 if KO, array of instance of object if OK */ function getObjectsInCateg($type) { - $field=''; $classname=''; $category_table=''; $object_table=''; - if ($type=='product') { $field='product'; $classname='Product'; } - if ($type=='customer') { $field='soc'; $classname='Societe'; $category_table='societe'; $object_table='societe'; } - if ($type=='supplier') { $field='soc'; $classname='Fournisseur'; $category_table='fournisseur'; $object_table='societe'; } - if ($type=='member') { $field='member'; $classname='Adherent'; $category_table=''; $object_table='adherent'; } - if ($type=='contact') { $field='socpeople'; $classname='Contact'; $category_table='contact'; $object_table='socpeople'; } - $objs = array(); - // Clean parameters - if (empty($category_table)) $category_table=$field; - if (empty($object_table)) $object_table=$field; + $obj = new $this->MAP_OBJ_CLASS[$type]( $this->db ); - $sql = "SELECT c.fk_".$field; - $sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$category_table." as c"; - $sql.= ", ".MAIN_DB_PREFIX.$object_table." as o"; - $sql.= " WHERE o.entity IN (".getEntity($field, 1).")"; + $sql = "SELECT c.fk_" . $this->MAP_CAT_FK[$type]; + $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as c"; + $sql .= ", " . MAIN_DB_PREFIX . $this->MAP_OBJ_TABLE[$type] . " as o"; + $sql .= " WHERE o.entity IN (" . getEntity( $obj->element, 1).")"; $sql.= " AND c.fk_categorie = ".$this->id; - $sql.= " AND c.fk_".$field." = o.rowid"; + $sql .= " AND c.fk_" . $this->MAP_CAT_FK[$type] . " = o.rowid"; dol_syslog(get_class($this)."::getObjectsInCateg", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - while ($rec = $this->db->fetch_array($resql)) - { - $obj = new $classname($this->db); - $obj->fetch($rec['fk_'.$field]); + while ($rec = $this->db->fetch_array($resql)) { + $obj = new $this->MAP_OBJ_CLASS[$type]( $this->db ); + $obj->fetch( $rec['fk_' . $this->MAP_CAT_FK[$type]]); $objs[] = $obj; } return $objs; @@ -699,40 +756,17 @@ class Categorie extends CommonObject } /** - * check for the presence of an object in a category + * Check for the presence of an object in a category * - * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact') - * @param int $object_id id of the object to search - * @return int number of occurrences + * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') + * @param int $object_id id of the object to search + * + * @return int number of occurrences */ - function containsObject($type, $object_id) + function containsObject($type, $object_id ) { - $field = ''; - $category_table = ''; - - if ($type == 'product') { - $field = 'product'; - } - if ($type == 'customer') { - $field = 'societe'; - } - if ($type == 'supplier') { - $field = 'societe'; - $category_table = 'fournisseur'; - } - if ($type == 'member') { - $field = 'member'; - $category_table = ''; - } - if ($type == 'contact') { - $field = 'socpeople'; - $category_table = 'contact'; - } - if (empty($category_table)) { - $category_table = $field; - } - $sql = "SELECT COUNT(*) as nb FROM " . MAIN_DB_PREFIX . "categorie_" . $category_table; - $sql .= " WHERE fk_categorie = " . $this->id . " AND fk_" . $field . " = " . $object_id; + $sql = "SELECT COUNT(*) as nb FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type]; + $sql .= " WHERE fk_categorie = " . $this->id . " AND fk_" . $this->MAP_CAT_FK[$type] . " = " . $object_id; dol_syslog(get_class($this)."::containsObject", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -772,7 +806,6 @@ class Categorie extends CommonObject } } - /** * Load this->motherof that is array(id_son=>id_parent, ...) * @@ -808,23 +841,34 @@ class Categorie extends CommonObject } /** - * Reconstruit l'arborescence des categories sous la forme d'un tableau - * Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec: - * id = id de la categorie - * id_mere = id de la categorie mere - * id_children = tableau des id enfant - * label = nom de la categorie - * fulllabel = nom avec chemin complet de la categorie - * fullpath = chemin complet compose des id + * Reconstruit l'arborescence des categories sous la forme d'un tableau + * Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec: + * id = id de la categorie + * id_mere = id de la categorie mere + * id_children = tableau des id enfant + * label = nom de la categorie + * fulllabel = nom avec chemin complet de la categorie + * fullpath = chemin complet compose des id * - * @param string $type Type of categories (0=product, 1=suppliers, 2=customers, 3=members) - * @param int $markafterid Removed all categories including the leaf $markafterid in category tree. - * @return array Array of categories. this->cats and this->motherof are set. + * @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member'). Old + * mode (0, 1, 2, ...) is deprecated. + * @param int $markafterid Removed all categories including the leaf $markafterid in category tree. + * + * @return array Array of categories. this->cats and this->motherof are set. */ function get_full_arbo($type,$markafterid=0) { global $conf, $langs; + // For backward compatibility + if (is_numeric( $type )) { + // We want to reverse lookup + $map_type = array_flip( $this->MAP_ID ); + $type = $map_type[$type]; + dol_syslog( get_class( $this ) . "::get_full_arbo(): numeric types are deprecated, please use string instead", + LOG_WARNING ); + } + $this->cats = array(); // Init this->motherof that is array(id_son=>id_parent, ...) @@ -836,8 +880,8 @@ class Categorie extends CommonObject if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ", t.label as label_trans, t.description as description_trans"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as c"; if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'"; - $sql.= " WHERE c.entity IN (".getEntity('category',1).")"; - $sql.= " AND c.type = ".$type; + $sql .= " WHERE c.entity IN (" . getEntity( 'category', 1 ) . ")"; + $sql .= " AND c.type = " . $this->MAP_ID[$type]; dol_syslog(get_class($this)."::get_full_arbo get category list", LOG_DEBUG); $resql = $this->db->query($sql); @@ -1171,35 +1215,34 @@ class Categorie extends CommonObject } /** - * Return list of categories (id or instances) linked to element of id $id and type $type - * Should be named getListOfCategForObject + * Return list of categories (id or instances) linked to element of id $id and type $type + * Should be named getListOfCategForObject * - * @param int $id Id of element - * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated. - * @param string $mode 'object'=Get array of fetched category instances, 'label'=Get array of category labels - * @return mixed Array of category objects or < 0 if KO + * @param int $id Id of element + * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode + * (0, 1, 2, ...) is deprecated. + * @param string $mode 'object'=Get array of fetched category instances, 'label'=Get array of category + * labels + * + * @return mixed Array of category objects or < 0 if KO */ function containing($id,$type,$mode='object') { $cats = array(); - $typeid=-1; $table=''; - if ($type == '0' || $type == 'product') { - $typeid=self::TYPE_PRODUCT; $table='product'; $type='product'; - } else if ($type == '1' || $type == 'supplier') { - $typeid=self::TYPE_SUPPLIER; $table='soc'; $type='fournisseur'; - } else if ($type == '2' || $type == 'customer') { - $typeid=self::TYPE_CUSTOMER; $table='soc'; $type='societe'; - } else if ($type == '3' || $type == 'member') { - $typeid=self::TYPE_MEMBER; $table='member'; $type='member'; - } else if ($type == '4' || $type == 'contact') { - $typeid=self::TYPE_CONTACT; $table='socpeople'; $type='contact'; + // For backward compatibility + if (is_numeric( $type )) { + // We want to reverse lookup + $map_type = array_flip( $this->MAP_ID ); + $type = $map_type[$type]; + dol_syslog( get_class( $this ) . "::containing(): numeric types are deprecated, please use string instead", + LOG_WARNING ); } $sql = "SELECT ct.fk_categorie, c.label"; - $sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct, ".MAIN_DB_PREFIX."categorie as c"; - $sql.= " WHERE ct.fk_categorie = c.rowid AND ct.fk_".$table." = ".$id." AND c.type = ".$typeid; - $sql.= " AND c.entity IN (".getEntity('category',1).")"; + $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as ct, " . MAIN_DB_PREFIX . "categorie as c"; + $sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . $id . " AND c.type = " . $this->MAP_ID[$type]; + $sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")"; dol_syslog(get_class($this).'::containing', LOG_DEBUG); $res = $this->db->query($sql); @@ -1243,17 +1286,19 @@ class Categorie extends CommonObject { $cats = array(); - $typeid=-1; - if ($type == 0 || $type == 'product') { $typeid=self::TYPE_PRODUCT; } - else if ($type == 1 || $type == 'supplier') { $typeid=self::TYPE_SUPPLIER; } - else if ($type == 2 || $type == 'customer') { $typeid=self::TYPE_CUSTOMER; } - else if ($type == 3 || $type == 'member') { $typeid=self::TYPE_MEMBER; } - else if ($type == 4 || $type == 'contact') { $typeid=self::TYPE_CONTACT; } + // For backward compatibility + if (is_numeric( $type )) { + // We want to reverse lookup + $map_type = array_flip( $this->MAP_ID ); + $type = $map_type; + dol_syslog( get_class( $this ) . "::rechercher(): numeric types are deprecated, please use string instead", + LOG_WARNING ); + } // Generation requete recherche - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; - $sql.= " WHERE type = ".$typeid; - $sql.= " AND entity IN (".getEntity('category',1).")"; + $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "categorie"; + $sql .= " WHERE type = " . $this->MAP_ID[$type]; + $sql .= " AND entity IN (" . getEntity( 'category', 1 ) . ")"; if ($nom) { if (! $exact) From bbd0b890874ad146a5da3fbfde0819884c89294e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Fri, 29 May 2015 18:49:10 +0200 Subject: [PATCH 09/67] Added tags/categories management to customers Customers part of #2571 --- htdocs/comm/card.php | 6 ++++ htdocs/core/lib/functions.lib.php | 2 +- htdocs/societe/soc.php | 51 +++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index af9b7205d16..ed94d70c85b 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -468,6 +468,12 @@ if ($id > 0) print ''; } + // Categories + print '' . $langs->trans( "Categories" ) . ''; + print ''; + print $form->showCategories( $object->id, 'customer', 1 ); + print ""; + // Other attributes $parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8b6dfa38657..7fae79d44a7 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -227,7 +227,7 @@ function dol_shutdown() * @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get, 4 = post then get then cookie) * @param int $filter Filter to apply when $check is set to custom. (See http://php.net/manual/en/filter.filters.php for détails) * @param mixed $options Options to pass to filter_var when $check is set to custom - * @return string||string[] Value found (string or array), or '' if check fails + * @return string|string[] Value found (string or array), or '' if check fails */ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL) { diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index b26e6766a4e..57ade3645b1 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $langs->load("companies"); @@ -396,6 +397,16 @@ if (empty($reshook)) } } + // Categories association + $custcats = GETPOST( 'custcats', 'array' ); + if (!empty( $custcats )) { + $cat = new Categorie( $db ); + foreach ($custcats as $id_category) { + $cat->fetch( $id_category ); + $cat->add_type( $object, 'customer' ); + } + } + // Logo/Photo save $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); @@ -500,6 +511,22 @@ if (empty($reshook)) $error = $object->error; $errors = $object->errors; } + // Categories association + // First we delete all categories association + $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_societe'; + $sql .= ' WHERE fk_soc = ' . $object->id; + $db->query( $sql ); + + // Then we add the associated categories + $categories = GETPOST( 'custcats', 'array' ); + if (!empty( $categories )) { + $cat = new Categorie( $db ); + foreach ($categories as $id_category) { + $cat->fetch( $id_category ); + $cat->add_type( $object, 'customer' ); + } + } + // Logo/Photo save $dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); @@ -1197,6 +1224,12 @@ else print ''; } + // Categories + print ''.$langs->trans("Categories").''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1); + print $form->multiselectarray('custcats', $cate_arbo, GETPOST( 'custcats', 'array' ), null, null, null, null, 250); + print ""; + // Other attributes $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -1698,6 +1731,18 @@ else print ''; } + // Categories + print ''; + print ''; + $cate_arbo = $form->select_all_categories( Categorie::TYPE_CUSTOMER, null, null, null, null, 1 ); + $c = new Categorie( $db ); + $cats = $c->containing( $object->id, Categorie::TYPE_CUSTOMER ); + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + print $form->multiselectarray( 'custcats', $cate_arbo, $arrayselected, '', 0, '', 0, '100%' ); + print ""; + // Other attributes $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -2124,6 +2169,12 @@ else print ''; } + // Categories + print '' . $langs->trans( "Categories" ) . ''; + print ''; + print $form->showCategories( $object->id, 'customer', 1 ); + print ""; + // Incoterms if (!empty($conf->incoterm->enabled)) { From 19694710b2fef16a94c34175421b25e6721fabfd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 May 2015 12:24:23 +0200 Subject: [PATCH 10/67] Keep this constant visible --- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 2 +- 1 file changed, 1 insertion(+), 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 5072b59ffdf..080fbdc699d 100755 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -1177,4 +1177,4 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_typ ALTER TABLE llx_livraison MODIFY COLUMN date_delivery DATETIME NULL DEFAULT NULL; -INSERT INTO llx_const (name, value, type, note, visible, entity) SELECT 'PRODUCT_USE_OLD_PATH_FOR_PHOTO','1','chaine','Use old path for products images',0,1 FROM llx_const WHERE name='MAIN_VERSION_LAST_INSTALL' AND value < '3.7.0'; \ No newline at end of file +INSERT INTO llx_const (name, value, type, note, visible, entity) SELECT 'PRODUCT_USE_OLD_PATH_FOR_PHOTO','1','chaine','Use old path for products images',1,1 FROM llx_const WHERE name='MAIN_VERSION_LAST_INSTALL' AND value < '3.7.0'; From 227f2842c2f5bef4446e0a9daac9b749a667517e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 May 2015 18:03:24 +0200 Subject: [PATCH 11/67] Prepare version 3.7.1 --- ChangeLog | 4 ++-- build/makepack-dolibarr.pl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e8e4028619b..91d602ab417 100644 --- a/ChangeLog +++ b/ChangeLog @@ -202,8 +202,8 @@ 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. -- A lot of pages called fiche.php were renamed into card.php -- A lot of pages called liste.php were renamed into list.php +- A lot of pages named fiche.php were renamed into card.php +- A lot of pages named liste.php were renamed into list.php - If you used warehouse/stock module, recheck setup of stock increase/decrease rules of the warehouse module and your Point Of Sale module setup if you use one. - Replaced USER_UPDATE_SESSION trigger with an updateSession hook may break modules using it. diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index c667754d4ab..f5d556eb2c5 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -981,10 +981,10 @@ if ($nboftargetok) { mkdir($DESTI.'/package_windows'); if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; } - print "Remove target $FILENAMEEXEDOLIWAMP.exe...\n"; + print "Remove target $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe...\n"; unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"; - print "Check that in your Wine setup, you create a Z: drive that point to your /tmp directory.\n"; + print "Check that in your Wine setup, you create a Z: drive that point to your / directory.\n"; $SOURCEBACK=$SOURCE; $SOURCEBACK =~ s/\//\\/g; From 9753097731f56a558b14abde3c9141726e6ab963 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 May 2015 18:45:01 +0200 Subject: [PATCH 12/67] Prepare 3.7.1 --- ChangeLog | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91d602ab417..31a6c7266a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,14 +10,31 @@ make a Dolibarr upgrade. ***** ChangeLog for 3.7.1 compared to 3.7.* ***** -- Fix: Bug in the new photo system -- Fix: Error management -- Fix: [ Bug #2714 ] Members -> Memberxy-> Agenda -> technical Error -- Fix: [ Bug #2713 ] 3.7.0 mailing-unsubscribe.php not unsubscribe +FIX Bug in the new photo system +FIX Error management +FIX [ Bug #2714 ] Members -> Memberxy-> Agenda -> technical Error +FIX [ Bug #2713 ] 3.7.0 mailing-unsubscribe.php not unsubscribe +FIX #2901 +FIX when we create an agenda event with "Not applicable" status, it is automatically saved with "To do" status +FIX check the user status during authentication +FIX top links menu have target attribute with wrong value +FIX extrafields required on thirdparty +FIX create contact with extrafield is null when it is require +FIX width multiselect +FIX "script" tag with wrong syntax +Fix bug debian 786479 +FIX update usergroup name +Fix facturestats was not filtering on invoice type +FIX #2856 : Wrong table design +FIX button create payment hide if tax amount is less than 1 +FIX event for restricted user was restricted if company null +FIX send mail, copy sendto don't read the list of contact +FIX Properly escape untrusted data to prevent HTML injection. +FIX send mail, copy sendto don't read the list of contact -- Path to save photos of products was moved in 3.7.0 to match path of other attached files. If you had loose - your photo on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to - restore old path. +Path to save photos of products was moved in 3.7.0 to match path of other attached files. If you had loose +your photo on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to +restore old path. WARNING: From a24e4fec6cf1339bbac2e58d57afecbff71c9e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Tue, 12 May 2015 21:10:32 +0200 Subject: [PATCH 13/67] NEW A link to the bugtracker can be enabled in the GUI --- htdocs/admin/ihm.php | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 7f1d17183d2..097b84748bd 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -78,10 +78,10 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"],'chaine',0,'',0); // Param for all entities + dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", $_POST["MAIN_BUGTRACK_ENABLELINK"],'chaine',0,'',$conf->entity); // This one is not always defined if (isset($_POST["MAIN_USE_PREVIEW_TABS"])) dolibarr_set_const($db, "MAIN_USE_PREVIEW_TABS", $_POST["MAIN_USE_PREVIEW_TABS"],'chaine',0,'',$conf->entity); - if (isset($_POST["MAIN_BUGTRACK_ENABLELINK"])) dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", $_POST["MAIN_BUGTRACK_ENABLELINK"],'chaine',0,'',$conf->entity); $_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer @@ -279,16 +279,13 @@ if ($action == 'edit') // Edit print ' '; print ''; - if ($conf->global->MAIN_FEATURES_LEVEL >= 1 || ! empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) - { - // Show bugtrack link - $var=!$var; - print ''.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; - print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK',$conf->global->MAIN_BUGTRACK_ENABLELINK,1); - print ''; - print ' '; - print ''; - } + // Show bugtrack link + $var=!$var; + print ''.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; + print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK',$conf->global->MAIN_BUGTRACK_ENABLELINK,1); + print ''; + print ' '; + print ''; // Message on login page $var=!$var; @@ -465,15 +462,12 @@ else // Show print yn((isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0),1); print ''; - if ($conf->global->MAIN_FEATURES_LEVEL >= 1 || ! empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) - { - // Show bugtrack link - $var=!$var; - print ''.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; - print yn($conf->global->MAIN_BUGTRACK_ENABLELINK).""; - print ' '; - print ""; - } + // Show bugtrack link + $var=!$var; + print ''.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; + print yn($conf->global->MAIN_BUGTRACK_ENABLELINK).""; + print ' '; + print ""; // Message login $var=!$var; From 3f9270ea784d9d40d0a2d4377593d42c3faf0c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 23 Apr 2015 23:21:06 +0200 Subject: [PATCH 14/67] Qual: added deprecation hinting Added deprecation hinting for class properties Added syslog warning events for deprecated functions, methods and/or their parameters Added hinting for some constants --- .../actions_adherentcard_common.class.php | 2 + .../adherents/class/adherent_type.class.php | 3 +- htdocs/categories/class/categorie.class.php | 10 ++ htdocs/comm/action/class/actioncomm.class.php | 11 +- .../class/askpricesupplier.class.php | 112 +++++++++++++++--- htdocs/comm/propal/class/propal.class.php | 102 +++++++++++----- htdocs/commande/apercu.php | 2 +- htdocs/commande/class/commande.class.php | 31 +++-- htdocs/compta/bank/class/account.class.php | 6 + .../deplacement/class/deplacement.class.php | 6 +- htdocs/compta/facture/class/facture.class.php | 37 ++++-- .../compta/paiement/class/paiement.class.php | 11 +- .../class/paymentsocialcontribution.class.php | 5 + .../actions_contactcard_common.class.php | 2 + htdocs/contact/class/contact.class.php | 24 +++- htdocs/contrat/class/contrat.class.php | 5 + htdocs/core/class/commonobject.class.php | 29 ++++- htdocs/core/class/commonobjectline.class.php | 1 + htdocs/core/class/commonorder.class.php | 4 + htdocs/core/class/html.form.class.php | 3 + htdocs/core/class/html.formcompany.class.php | 1 + htdocs/core/class/html.formfile.class.php | 7 +- htdocs/core/class/html.formmail.class.php | 11 +- htdocs/core/class/html.formother.class.php | 6 + htdocs/core/class/translate.class.php | 1 + htdocs/core/lib/date.lib.php | 6 +- htdocs/core/lib/functions.lib.php | 25 +++- htdocs/core/modules/DolibarrModules.class.php | 1 + .../modules_askpricesupplier.php | 5 +- .../modules/commande/modules_commande.php | 3 + .../modules/contract/modules_contract.php | 3 + .../modules/expedition/modules_expedition.php | 3 + .../core/modules/facture/modules_facture.php | 3 + .../modules/livraison/modules_livraison.php | 3 + .../core/modules/mailings/fraise.modules.php | 5 + .../core/modules/project/modules_project.php | 3 + .../modules/project/task/modules_task.php | 3 + .../core/modules/propale/modules_propale.php | 3 + .../modules_commandefournisseur.php | 3 + .../core/triggers/dolibarrtriggers.class.php | 3 +- htdocs/don/class/don.class.php | 5 + htdocs/don/class/paymentdonation.class.php | 8 +- htdocs/expedition/class/expedition.class.php | 45 ++++++- .../class/fournisseur.commande.class.php | 9 +- .../fourn/class/fournisseur.facture.class.php | 32 +++-- .../fourn/class/fournisseur.product.class.php | 9 +- htdocs/holiday/class/holiday.class.php | 4 + htdocs/livraison/class/livraison.class.php | 21 +++- htdocs/loan/class/paymentloan.class.php | 6 + .../class/opensurveysondage.class.php | 5 + htdocs/product/class/product.class.php | 34 +++++- htdocs/projet/class/project.class.php | 27 +++++ htdocs/resource/class/resource.class.php | 4 +- .../canvas/actions_card_common.class.php | 2 + htdocs/societe/class/societe.class.php | 7 +- htdocs/user/class/user.class.php | 12 +- htdocs/user/class/usergroup.class.php | 6 +- 57 files changed, 626 insertions(+), 114 deletions(-) diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index 9987f9bc530..6a8660c7f46 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -55,6 +55,8 @@ abstract class ActionsAdherentCardCommon */ private function getInstanceDao() { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + if (! is_object($this->object)) { $modelclassfile = dol_buildpath('/'.$this->dirmodule.'/canvas/'.$this->canvas.'/dao_'.$this->targetmodule.'_'.$this->canvas.'.class.php'); diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index ee15a261820..f7f6b71150e 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -39,7 +39,8 @@ class AdherentType extends CommonObject /** * @var int - * @deprecated Use rowid + * @deprecated Use id + * @see id */ public $ref; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 167a256a990..ae39b59e471 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1181,6 +1181,11 @@ class Categorie extends CommonObject */ function containing($id,$type,$mode='object') { + // Deprecation warning + if (is_numeric($type)) { + dol_syslog(__METHOD__ . ': using numeric types is deprecated.', LOG_WARNING); + } + $cats = array(); $typeid=-1; $table=''; @@ -1241,6 +1246,11 @@ class Categorie extends CommonObject */ function rechercher($id, $nom, $type, $exact = false, $case = false) { + // Deprecation warning + if (is_numeric($type)) { + dol_syslog(__METHOD__ . ': using numeric types is deprecated.', LOG_WARNING); + } + $cats = array(); $typeid=-1; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index fb4c6f45d84..530083fb30a 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -61,6 +61,7 @@ class ActionComm extends CommonObject /** * @var string * @deprecated Use $label + * @see label */ public $libelle; @@ -71,6 +72,7 @@ class ActionComm extends CommonObject * Object user that create action * @var User * @deprecated + * @see authorid */ var $author; @@ -78,6 +80,7 @@ class ActionComm extends CommonObject * Object user that modified action * @var User * @deprecated + * @see usermodid */ var $usermod; var $authorid; // Id user that create action @@ -114,6 +117,7 @@ class ActionComm extends CommonObject * Object user of owner * @var User * @deprecated + * @see userownerid */ var $usertodo; @@ -121,6 +125,7 @@ class ActionComm extends CommonObject * Object user that did action * @var User * @deprecated + * @see userdoneid */ var $userdone; @@ -130,12 +135,16 @@ class ActionComm extends CommonObject /** * Company linked to action (optional) * @var Societe|null + * @deprecated + * @see socid */ var $societe; /** * Contact linked to action (optional) * @var Contact|null + * @deprecated + * @see contactid */ var $contact; @@ -468,7 +477,7 @@ class ActionComm extends CommonObject $this->fulldayevent = $obj->fulldayevent; $this->location = $obj->location; $this->transparency = $obj->transparency; - $this->punctual = $obj->punctual; + $this->punctual = $obj->punctual; // deprecated $this->socid = $obj->fk_soc; // To have fetch_thirdparty method working $this->contactid = $obj->fk_contact; // To have fetch_contact method working diff --git a/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php b/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php index 2e39d8592cf..2854a0a0d4b 100644 --- a/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php +++ b/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php @@ -59,14 +59,42 @@ class AskPriceSupplier extends CommonObject var $client; // Objet societe client (a charger par fetch_client) var $fk_project; + /** + * @deprecated + * @see user_author_id + */ var $author; var $ref; var $ref_fourn; //Reference saisie lors de l'ajout d'une ligne à la demande var $statut; // 0 (draft), 1 (validated), 2 (signed), 3 (not signed), 4 (billed) - var $datec; // Date of creation var $date; // Date of proposal var $date_livraison; + /** + * @deprecated + * @see date_creation + */ + var $datec; + + /** + * Creation date + * @var int + */ + public $date_creation; + + /** + * @deprecated + * @see date_validation + */ + var $datev; + + /** + * Validation date + * @var int + */ + public $date_validation; + + var $user_author_id; var $user_valid_id; var $user_close_id; @@ -76,9 +104,22 @@ class AskPriceSupplier extends CommonObject var $total_localtax1; // Total Local Taxes 1 var $total_localtax2; // Total Local Taxes 2 var $total_ttc; // Total with tax - var $price; // deprecated (for compatibility) - var $tva; // deprecated (for compatibility) - var $total; // deprecated (for compatibility) + + /** + * @deprecated + * @see price_ht + */ + var $price; + /** + * @deprecated + * @see total_tva + */ + var $tva; + /** + * @deprecated + * @see total_ttc + */ + var $total; var $cond_reglement_id; var $cond_reglement_code; @@ -88,7 +129,11 @@ class AskPriceSupplier extends CommonObject var $remise; var $remise_percent; var $remise_absolue; - var $note; // deprecated (for compatibility) + /** + * @deprecated + * @see note_public, note_private + */ + var $note; var $note_private; var $note_public; var $shipping_method_id; @@ -1031,7 +1076,7 @@ class AskPriceSupplier extends CommonObject $this->remise = $obj->remise; $this->remise_percent = $obj->remise_percent; $this->remise_absolue = $obj->remise_absolue; - $this->total = $obj->total; // TODO obsolete + $this->total = $obj->total; // TODO deprecated $this->total_ht = $obj->total_ht; $this->total_tva = $obj->tva; $this->total_localtax1 = $obj->localtax1; @@ -1040,14 +1085,14 @@ class AskPriceSupplier extends CommonObject $this->socid = $obj->fk_soc; $this->fk_project = $obj->fk_projet; $this->modelpdf = $obj->model_pdf; - $this->note = $obj->note_private; // TODO obsolete + $this->note = $obj->note_private; // TODO deprecated $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->statut = $obj->fk_statut; $this->statut_libelle = $obj->statut_label; - $this->datec = $this->db->jdate($obj->datec); // TODO obsolete - $this->datev = $this->db->jdate($obj->datev); // TODO obsolete + $this->datec = $this->db->jdate($obj->datec); // TODO deprecated + $this->datev = $this->db->jdate($obj->datev); // TODO deprecated $this->date_creation = $this->db->jdate($obj->datec); //Creation date $this->date_validation = $this->db->jdate($obj->datev); //Validation date $this->date_livraison = $this->db->jdate($obj->date_livraison); @@ -2431,7 +2476,17 @@ class AskPriceSupplierLine extends CommonObject var $fk_parent_line; var $desc; // Description ligne var $fk_product; // Id produit predefini - var $product_type = 0; // Type 0 = product, 1 = Service + /** + * @deprecated + * @see product_type + */ + var $fk_product_type; + /** + * Product type + * @var int + * @see Product::TYPE_PRODUCT, Product::TYPE_SERVICE + */ + public $product_type = Product::TYPE_PRODUCT; var $qty; var $tva_tx; @@ -2459,14 +2514,43 @@ class AskPriceSupplierLine extends CommonObject var $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne var $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne - // Ne plus utiliser + /** + * @deprecated + * @see remise_percent, fk_remise_except + */ var $remise; + /** + * @deprecated + * @see subprice + */ var $price; // From llx_product - var $ref; // Reference produit - var $libelle; // Label produit - var $product_desc; // Description produit + /** + * @deprecated + * @see product_ref + */ + var $ref; + /** + * Product reference + * @var string + */ + public $product_ref; + /** + * @deprecated + * @see product_label + */ + var $libelle; + /** + * Product label + * @var string + */ + public $product_label; + /** + * Product description + * @var string + */ + public $product_desc; var $localtax1_tx; // Local tax 1 var $localtax2_tx; // Local tax 2 diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index af46db14d9a..9e0d6c49b84 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -75,26 +75,35 @@ class Propal extends CommonObject /** * Status of the quote - * Check the following constants: - * - STATUS_DRAFT - * - STATUS_VALIDATED - * - STATUS_SIGNED - * - STATUS_NOTSIGNED - * - STATUS_BILLED * @var int + * @see Propal::STATUS_DRAFT, Propal::STATUS_VALIDATED, Propal::STATUS_SIGNED, Propal::STATUS_NOTSIGNED, Propal::STATUS_BILLED */ var $statut; /** - * Date of creation - * @var + * @deprecated + * @see date_creation */ var $datec; + /** - * Date of validation - * @var + * Creation date + * @var int + */ + public $date_creation; + + /** + * @deprecated + * @see date_validation */ var $datev; + + /** + * Validation date + * @var int + */ + public $date_validation; + /** * Date of the quote * @var @@ -102,8 +111,8 @@ class Propal extends CommonObject var $date; /** - * Same than date ¿? - * @var + * @deprecated + * @see date */ var $datep; var $date_livraison; @@ -121,14 +130,17 @@ class Propal extends CommonObject /** * @deprecated + * @see total_ht */ var $price; /** * @deprecated + * @see total_tva */ var $tva; /** * @deprecated + * @see total_ttc */ var $total; @@ -142,6 +154,7 @@ class Propal extends CommonObject var $remise_absolue; /** * @deprecated + * @see note_private, note_public */ var $note; var $note_private; @@ -1222,7 +1235,7 @@ class Propal extends CommonObject $this->remise = $obj->remise; $this->remise_percent = $obj->remise_percent; $this->remise_absolue = $obj->remise_absolue; - $this->total = $obj->total; // TODO obsolete + $this->total = $obj->total; // TODO deprecated $this->total_ht = $obj->total_ht; $this->total_tva = $obj->tva; $this->total_localtax1 = $obj->localtax1; @@ -1231,14 +1244,14 @@ class Propal extends CommonObject $this->socid = $obj->fk_soc; $this->fk_project = $obj->fk_projet; $this->modelpdf = $obj->model_pdf; - $this->note = $obj->note_private; // TODO obsolete + $this->note = $obj->note_private; // TODO deprecated $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->statut = $obj->fk_statut; $this->statut_libelle = $obj->statut_label; - $this->datec = $this->db->jdate($obj->datec); // TODO obsolete - $this->datev = $this->db->jdate($obj->datev); // TODO obsolete + $this->datec = $this->db->jdate($obj->datec); // TODO deprecated + $this->datev = $this->db->jdate($obj->datev); // TODO deprecated $this->date_creation = $this->db->jdate($obj->datec); //Creation date $this->date_validation = $this->db->jdate($obj->datev); //Validation date $this->date = $this->db->jdate($obj->dp); // Proposal date @@ -1967,9 +1980,12 @@ class Propal extends CommonObject * * @return int <0 si ko, >0 si ok * @deprecated + * @see classifyBilled() */ function classer_facturee() { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + return $this->classifyBilled(); } @@ -2724,7 +2740,7 @@ class Propal extends CommonObject * Return clicable link of object (with eventually picto) * * @param int $withpicto Add picto into link - * @param string $option Where point the link ('compta', 'expedition', 'document', ...) + * @param string $option Where point the link ('expedition', 'document', ...) * @param string $get_params Parametres added to url * @return string String with URL */ @@ -2912,17 +2928,19 @@ class PropaleLigne extends CommonObjectLine var $oldline; // From llx_propaldet - var $rowid; var $fk_propal; var $fk_parent_line; var $desc; // Description ligne var $fk_product; // Id produit predefini + /** + * @deprecated + * @see product_type + */ + var $fk_product_type; /** * Product type. - * Use the following constants: - * - Product::TYPE_PRODUCT - * - Product::TYPE_SERVICE * @var int + * @see Product::TYPE_PRODUCT, Product::TYPE_SERVICE */ var $product_type = Product::TYPE_PRODUCT; @@ -2952,14 +2970,43 @@ class PropaleLigne extends CommonObjectLine var $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne var $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne - // Ne plus utiliser + /** + * @deprecated + * @see $remise_percent, $fk_remise_except + */ var $remise; + /** + * @deprecated + * @see subprice + */ var $price; // From llx_product - var $ref; // Reference produit - var $libelle; // Label produit - var $product_desc; // Description produit + /** + * @deprecated + * @see product_ref + */ + var $ref; + /** + * Product reference + * @var string + */ + public $product_ref; + /** + * @deprecated + * @see product_label + */ + var $libelle; + /** + * Product label + * @var string + */ + public $product_label; + /** + * Product description + * @var string + */ + public $product_desc; var $localtax1_tx; // Local tax 1 var $localtax2_tx; // Local tax 2 @@ -3007,7 +3054,8 @@ class PropaleLigne extends CommonObjectLine { $objp = $this->db->fetch_object($result); - $this->rowid = $objp->rowid; + $this->id = $objp->rowid; + $this->rowid = $objp->rowid; // deprecated $this->fk_propal = $objp->fk_propal; $this->fk_parent_line = $objp->fk_parent_line; $this->label = $objp->custom_label; @@ -3016,7 +3064,7 @@ class PropaleLigne extends CommonObjectLine $this->price = $objp->price; // deprecated $this->subprice = $objp->subprice; $this->tva_tx = $objp->tva_tx; - $this->remise = $objp->remise; + $this->remise = $objp->remise; // deprecated $this->remise_percent = $objp->remise_percent; $this->fk_remise_except = $objp->fk_remise_except; $this->fk_product = $objp->fk_product; diff --git a/htdocs/commande/apercu.php b/htdocs/commande/apercu.php index e6878eef179..f3d83b837dd 100644 --- a/htdocs/commande/apercu.php +++ b/htdocs/commande/apercu.php @@ -129,7 +129,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Si fichier detail PDF existe - // TODO obsolete ? + // TODO deprecated ? if (file_exists($filedetail)) { print "Commande detaillee"; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 18c8b554637..5fec34ecfd4 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -74,17 +74,15 @@ class Commande extends CommonOrder /** * Status of the order. Check the following constants: - * - STATUS_CANCELED - * - STATUS_DRAFT - * - STATUS_ACCEPTED - * - STATUS_CLOSED * @var int + * @see Commande::STATUS_CANCELED, Commande::STATUS_DRAFT, Commande::STATUS_ACCEPTED, Commande::STATUS_CLOSED */ var $statut; /** * @deprecated + * @see billed */ - var $facturee; // deprecated + var $facturee; var $billed; // billed or not var $brouillon; @@ -100,7 +98,11 @@ class Commande extends CommonOrder var $fk_delivery_address; var $address; var $date; // Date commande - var $date_commande; // Date commande (deprecated) + /** + * @deprecated + * @see date + */ + var $date_commande; var $date_livraison; // Date livraison souhaitee var $shipping_method_id; var $fk_remise_except; @@ -116,7 +118,11 @@ class Commande extends CommonOrder var $rang; var $special_code; var $source; // Origin of order - var $note; // deprecated + /** + * @deprecated + * @see note_private, note_public + */ + var $note; var $note_private; var $note_public; var $extraparams=array(); @@ -1776,7 +1782,7 @@ class Commande extends CommonOrder * @param int $filtre_statut Filter on status * @return int <0 if KO, Nb of lines found if OK * - * TODO deprecated, move to Shipping class + * TODO deprecate, move to Shipping class */ function loadExpeditions($filtre_statut=-1) { @@ -1823,7 +1829,7 @@ class Commande extends CommonOrder * * @return int Nb of shipments * - * TODO deprecated, move to Shipping class + * TODO deprecate, move to Shipping class */ function nb_expedition() { @@ -1849,7 +1855,7 @@ class Commande extends CommonOrder * @param int $filtre_statut Filtre sur statut * @return int 0 si OK, <0 si KO * - * TODO deprecated, move to Shipping class + * TODO deprecate, move to Shipping class */ function livraison_array($filtre_statut=self::STATUS_CANCELED) { @@ -2399,9 +2405,12 @@ class Commande extends CommonOrder * * @return int <0 if ko, >0 if ok * @deprecated + * @see classifyBilled() */ function classer_facturee() { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + return $this->classifyBilled(); } @@ -3346,6 +3355,7 @@ class OrderLine extends CommonOrderLine * Id of parent order * @var int * @deprecated Use fk_commande + * @see fk_commande */ public $commande_id; @@ -3367,6 +3377,7 @@ class OrderLine extends CommonOrderLine /** * @deprecated + * @see remise_percent, fk_remise_except */ var $remise; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index c8badb1a880..f336cefda98 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -41,6 +41,7 @@ class Account extends CommonObject /** * @var int Use id instead of rowid * @deprecated + * @see id */ var $rowid; var $id; @@ -240,6 +241,11 @@ class Account extends CommonObject */ function addline($date, $oper, $label, $amount, $num_chq, $categorie, $user, $emetteur='',$banque='') { + // Deprecatîon warning + if (is_numeric($oper)) { + dol_syslog(__METHOD__ . ": using numeric operations is deprecated", LOG_WARNING); + } + // Clean parameters $emetteur=trim($emetteur); $banque=trim($banque); diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index dc2d281e2a1..f09875456c2 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -44,7 +44,11 @@ class Deplacement extends CommonObject var $fk_user_author; var $fk_user; var $km; - var $note; // TODO obsolete + /** + * @deprecated + * @see note_private, note_public + */ + var $note; // TODO deprecated var $note_private; var $note_public; var $socid; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 075173d31c9..fc3d8936edf 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -92,18 +92,16 @@ class Facture extends CommonInvoice var $revenuestamp; /** * @deprecated + * @see note_private, note_public */ var $note; var $note_private; var $note_public; /** - * Check constants for more info: - * - STATUS_DRAFT - * - STATUS_VALIDATED - * - STATUS_PAID - * - STATUS_ABANDONED + * Invoice status * @var int + * @see Facture::STATUS_DRAFT, Facture::STATUS_VALIDATED, Facture::STATUS_PAID, Facture::STATUS_ABANDONED */ var $statut; //! Fermeture apres paiement partiel: discount_vat, badcustomer, abandon @@ -131,6 +129,9 @@ class Facture extends CommonInvoice * @deprecated */ var $products=array(); + /** + * @var FactureLigne[] + */ var $lines=array(); var $line; var $extraparams=array(); @@ -1119,7 +1120,8 @@ class Facture extends CommonInvoice $objp = $this->db->fetch_object($result); $line = new FactureLigne($this->db); - $line->rowid = $objp->rowid; + $line->id = $objp->rowid; + $line->rowid = $objp->rowid; // deprecated $line->label = $objp->custom_label; // deprecated $line->desc = $objp->description; // Description line $line->product_type = $objp->product_type; // Type of line @@ -2105,6 +2107,11 @@ class Facture extends CommonInvoice */ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=self::TYPE_STANDARD, $rang=-1, $special_code=0, $origin='', $origin_id=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='', $array_options=0, $situation_percent=100, $fk_prev_id='', $fk_unit = null) { + // Deprecation warning + if ($label) { + dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING); + } + global $mysoc, $conf, $langs; dol_syslog(get_class($this)."::addline facid=$this->id,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type, fk_unit=$fk_unit", LOG_DEBUG); @@ -2289,6 +2296,11 @@ class Facture extends CommonInvoice */ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null) { + // Deprecation warning + if ($label) { + dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING); + } + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; global $mysoc; @@ -3685,7 +3697,10 @@ class FactureLigne extends CommonInvoiceLine var $fk_facture; //! Id parent line var $fk_parent_line; - var $label; // deprecated + /** + * @deprecated + */ + var $label; //! Description ligne var $desc; @@ -3717,8 +3732,16 @@ class FactureLigne extends CommonInvoiceLine //var $remise; // Montant calcule de la remise % sur PU HT (exemple 20) // From llx_product + /** + * @deprecated + * @see product_ref + */ var $ref; // Product ref (deprecated) var $product_ref; // Product ref + /** + * @deprecated + * @see product_label + */ var $libelle; // Product label (deprecated) var $product_label; // Product label var $product_desc; // Description produit diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 077bbde2420..60d669fcacf 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -40,7 +40,16 @@ class Paiement extends CommonObject var $ref; var $facid; var $datepaye; - var $total; // deprecated + /** + * @deprecated + * @see amount, amounts + */ + var $total; + /** + * @deprecated + * @see amount, amounts + */ + var $montant; var $amount; // Total amount of payment var $amounts=array(); // Array of amounts var $author; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index d58e0add8ab..45b2c51acfa 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -40,6 +40,11 @@ class PaymentSocialContribution extends CommonObject var $datec=''; var $tms=''; var $datep=''; + /** + * @deprecated + * @see amount + */ + var $total; var $amount; // Total amount of payment var $amounts=array(); // Array of amounts var $fk_typepaiement; diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 9e6624dda72..ad628fd6574 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -51,6 +51,8 @@ abstract class ActionsContactCardCommon */ private function getInstanceDao() { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + if (! is_object($this->object)) { $modelclassfile = dol_buildpath('/'.$this->dirmodule.'/canvas/'.$this->canvas.'/dao_'.$this->targetmodule.'_'.$this->canvas.'.class.php'); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index ca85995a7d3..0e3c4b0a2bc 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -50,9 +50,21 @@ class Contact extends CommonObject var $zip; var $town; - var $fk_departement; // deprecated - var $departement_code; // deprecated - var $departement; // deprecated + /** + * @deprecated + * @see state_id + */ + var $fk_departement; + /** + * @deprecated + * @see state_code + */ + var $departement_code; + /** + * @deprecated + * @see state + */ + var $departement; var $state_id; // Id of department var $state_code; // Code of department var $state; // Label of department @@ -80,7 +92,11 @@ class Contact extends CommonObject var $birthday; var $default_lang; var $note_public; // Public note - var $note; // deprecated + /** + * @deprecated + * @see note_public, note_private + */ + var $note; var $note_private; // Private note var $no_email; // 1=Don't send e-mail to this contact, 0=do diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 08bc8387387..fb0038b509f 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -154,6 +154,7 @@ class Contrat extends CommonObject /** * @deprecated Use fk_project instead + * @see fk_project */ var $fk_projet; @@ -1642,6 +1643,8 @@ class Contrat extends CommonObject */ function update_statut($user) { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + // If draft, we keep it (should not happen) if ($this->statut == 0) return 1; @@ -2165,6 +2168,7 @@ class ContratLigne extends CommonObjectLine /** * @var string * @deprecated Use $label instead + * @see label */ public $libelle; @@ -2189,6 +2193,7 @@ class ContratLigne extends CommonObjectLine /** * @var float * @deprecated Use $price_ht instead + * @see price_ht */ public $price; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 10f91a07631..25977d23486 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2011-2014 Philippe Grand * Copyright (C) 2012-2015 Marcos García - * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2012-2015 Raphaël Doursenaud * Copyright (C) 2012 Cedric Salvador * * This program is free software; you can redistribute it and/or modify @@ -44,6 +44,7 @@ abstract class CommonObject /** * @var string Error string * @deprecated Use instead the array of error strings + * @see errors */ public $error; @@ -82,7 +83,7 @@ abstract class CommonObject public $errors=array(); /** - * @var string Can be used to pass information when only object is provided to method + * @var string[] Can be used to pass information when only object is provided to method */ public $context=array(); @@ -96,7 +97,24 @@ abstract class CommonObject public $lastname; public $firstname; public $civility_id; + /** + * @deprecated + * @see thirdparty + */ + public $client; + /** + * @var Societe + */ public $thirdparty; + /** + * @deprecated + * @see project + */ + public $projet; + /** + * @var Project + */ + public $project; // No constructor as it is an abstract class @@ -1639,9 +1657,10 @@ abstract class CommonObject /** * Update public note (kept for backward compatibility) * - * @param string $note New value for note - * @return int <0 if KO, >0 if OK - * @deprecated + * @param string $note New value for note + * @return int <0 if KO, >0 if OK + * @deprecated + * @see update_note() */ function update_note_public($note) { diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 07019a0fa1d..ef854a2452e 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -39,6 +39,7 @@ abstract class CommonObjectLine extends CommonObject * Id of the line * @var int * @deprecated Try to use id property as possible (even if field into database is still rowid) + * @see id */ public $rowid; diff --git a/htdocs/core/class/commonorder.class.php b/htdocs/core/class/commonorder.class.php index b4882af8a58..5309b5524ee 100644 --- a/htdocs/core/class/commonorder.class.php +++ b/htdocs/core/class/commonorder.class.php @@ -43,6 +43,7 @@ abstract class CommonOrderLine extends CommonObjectLine * Product ref * @var string * @deprecated Use product_ref + * @see product_ref */ public $ref; @@ -56,6 +57,7 @@ abstract class CommonOrderLine extends CommonObjectLine * Product label * @var string * @deprecated Use product_label + * @see product_label */ public $libelle; @@ -78,7 +80,9 @@ abstract class CommonOrderLine extends CommonObjectLine public $qty; /** + * Unit price * @deprecated + * @see subprice */ var $price; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 53f77262db1..3b1e9ce5630 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -858,6 +858,7 @@ class Form * @param int $limit Maximum number of elements * @return string HTML string with * @deprecated Use select_thirdparty instead + * @see select_thirdparty() */ function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0) { @@ -1227,6 +1228,7 @@ class Form * @param int $force_entity 0 or Id of environment to force * @return void * @deprecated + * @see select_dolusers() */ function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=0) { @@ -3029,6 +3031,7 @@ class Form * @param int $width Force width of box * @return void * @deprecated + * @see formconfirm() */ function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=170, $width=500) { diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 05200feee30..31e7a405836 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -423,6 +423,7 @@ class FormCompany * @param string $filter Add a SQL filter on list * @return void * @deprecated Use print xxx->select_juridicalstatus instead + * @see select_juridicalstatus() */ function select_forme_juridique($selected='', $country_codeid=0, $filter='') { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 926ee8a337a..2fea621626e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -249,7 +249,7 @@ class FormFile * @param string $modelselected Model to preselect by default * @param string $allowgenifempty Allow generation even if list of template ($genallowed) is empty (show however a warning) * @param string $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined) - * @param int $iconPDF Obsolete, see getDocumentsLink + * @param int $iconPDF Deprecated, see getDocumentsLink * @param int $maxfilenamelength Max length for filename shown * @param string $noform Do not output html form tags * @param string $param More param on http links @@ -261,6 +261,11 @@ class FormFile */ function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='') { + // Deprecation warning + if (0 !== $iconPDF) { + dol_syslog(__METHOD__ . ": passing iconPDF parameter is deprecated", LOG_WARNING); + } + global $langs, $conf, $user, $hookmanager; global $form, $bc; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index b9d5048db74..fb71bf3bd5e 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -48,7 +48,16 @@ class FormMail extends Form var $withsubstit; // Show substitution array var $withfrom; - var $withto; // Show recipient emails + /** + * @var int + * @deprecated Fill withto with array before calling method. + * @see withto + */ + public $withtosocid; + /** + * @var int|int[] + */ + public $withto; // Show recipient emails var $withtofree; // Show free text for recipient emails var $withtocc; var $withtoccc; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 08c19463d27..5c2a3bc9274 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -592,6 +592,7 @@ class FormOther * @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813') * @return void * @deprecated + * @see selectColor() */ function select_color($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='') { @@ -611,6 +612,11 @@ class FormOther */ function selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='') { + // Deprecation warning + if ($form_name) { + dol_syslog(__METHOD__ . ": form_name parameter is deprecated", LOG_WARNING); + } + global $langs,$conf; $out=''; diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 0e55da2769a..9b4987ddb56 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -707,6 +707,7 @@ class Translate * @param string $amount If not '', show currency + amount according to langs ($10, 10€). * @return string Amount + Currency symbol encoded into UTF8 * @deprecated Use method price to output a price + * @see price() */ function getCurrencyAmount($currency_code, $amount) { diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 44507bbb919..088c36e06df 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -278,8 +278,8 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt * YYYYMMDDHHMMSS * YYYYMMDDTHHMMSSZ * YYYY-MM-DDTHH:MM:SSZ (RFC3339) - * DD/MM/YY or DD/MM/YYYY (this format should not be used anymore) - * DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (this format should not be used anymore) + * DD/MM/YY or DD/MM/YYYY (deprecated) + * DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (deprecated) * @param int $gm 1 =Input date is GM date, * 0 =Input date is local date using PHP server timezone * @return int Date as a timestamp @@ -292,7 +292,7 @@ function dol_stringtotime($string, $gm=1) // Convert date with format DD/MM/YYY HH:MM:SS. This part of code should not be used. if (preg_match('/^([0-9]+)\/([0-9]+)\/([0-9]+)\s?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i',$string,$reg)) { - dol_syslog("dol_stringtotime call to function with deprecated parameter", LOG_WARNING); + dol_syslog("dol_stringtotime call to function with deprecated parameter format", LOG_WARNING); // Date est au format 'DD/MM/YY' ou 'DD/MM/YY HH:MM:SS' // Date est au format 'DD/MM/YYYY' ou 'DD/MM/YYYY HH:MM:SS' $sday = $reg[1]; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6a9376b57f9..6c63f7386d5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -45,10 +45,13 @@ include_once DOL_DOCUMENT_ROOT .'/core/lib/json.lib.php'; * @param string $class Class name * @param string $member Name of property * @return mixed Return value of static property - * @deprecated Dolibarr now requires 5.3.0+ + * @deprecated Dolibarr now requires 5.3.0+, use $class::$property syntax + * @see https://php.net/manual/language.oop5.static.php */ function getStaticMember($class, $member) { + dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); + // This part is deprecated. Uncomment if for php 5.2.*, and comment next isset class::member /*if (version_compare(phpversion(), '5.3.0', '<')) { @@ -387,11 +390,12 @@ function dol_buildpath($path, $type=0) * * @param object $object Object to clone * @return object Object clone - * @deprecated Dolibarr no longer supports PHP4, you can now use native function + * @deprecated Dolibarr no longer supports PHP4, use PHP5 native clone construct + * @see https://php.net/manual/language.oop5.cloning.php */ function dol_clone($object) { - dol_syslog("Functions.lib::dol_clone Clone object"); + dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); $myclone=clone($object); return $myclone; @@ -1702,11 +1706,15 @@ function dol_substr($string,$start,$length,$stringencoding='') * @param string $url Param to add an url to click values * @return void * @deprecated + * @see DolGraph */ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',$showpercent=0,$url='') { + dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); + global $conf,$langs; global $theme_datacolor; // To have var kept when function is called several times + if (empty($conf->use_javascript_ajax)) return; $jsgraphlib='flot'; $datacolor=array(); @@ -2380,9 +2388,12 @@ function img_mime($file, $titlealt = '') * @param int $option Option * @return string Return img tag * @deprecated + * @see img_picto */ function img_phone($titlealt = 'default', $option = 0) { + dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); + global $conf,$langs; if ($titlealt == 'default') $titlealt = $langs->trans('Call'); @@ -2702,9 +2713,12 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m * @param string $title Title to show * @return string Title to show * @deprecated Use print_fiche_titre instead + * @see print_fiche_titre */ function print_titre($title) { + dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); + print '
'.$title.'
'; } @@ -4059,9 +4073,12 @@ function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8') * * @return float Time (millisecondes) with microsecondes in decimal part * @deprecated Dolibarr does not support PHP4, you should use native function + * @see microtime() */ function dol_microtime_float() { + dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); + return microtime(true); } @@ -4281,6 +4298,8 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1) */ function setEventMessage($mesgs, $style='mesgs') { + dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); + if (! is_array($mesgs)) // If mesgs is a string { if ($mesgs) $_SESSION['dol_events'][$style][] = $mesgs; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 017d1eb8662..fe02fd9b42c 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -42,6 +42,7 @@ abstract class DolibarrModules /** * @var string Relative path to module style sheet * @deprecated + * @see module_parts */ public $style_sheet = ''; diff --git a/htdocs/core/modules/askpricesupplier/modules_askpricesupplier.php b/htdocs/core/modules/askpricesupplier/modules_askpricesupplier.php index 4014452d8c2..4bff78bff54 100644 --- a/htdocs/core/modules/askpricesupplier/modules_askpricesupplier.php +++ b/htdocs/core/modules/askpricesupplier/modules_askpricesupplier.php @@ -156,10 +156,13 @@ abstract class ModeleNumRefAskPriceSupplier * @param int $hidedesc Hide description * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK - * @deprecated Use the new function generateDocument of Propal class + * @deprecated Use the new function generateDocument of AskPriceSupplier class + * @see AskPriceSupplier::generateDocument() */ function askpricesupplier_pdf_create(DoliDB $db, AskPriceSupplier $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/core/modules/commande/modules_commande.php b/htdocs/core/modules/commande/modules_commande.php index 9253f4dc650..10ab1a2300f 100644 --- a/htdocs/core/modules/commande/modules_commande.php +++ b/htdocs/core/modules/commande/modules_commande.php @@ -161,8 +161,11 @@ abstract class ModeleNumRefCommandes * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK * @deprecated Use the new function generateDocument of Commande class + * @see Commande::generateDocument() */ function commande_pdf_create(DoliDB $db, Commande $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/core/modules/contract/modules_contract.php b/htdocs/core/modules/contract/modules_contract.php index d4311bf3028..1efeaef3466 100644 --- a/htdocs/core/modules/contract/modules_contract.php +++ b/htdocs/core/modules/contract/modules_contract.php @@ -156,8 +156,11 @@ class ModelNumRefContracts * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK * @deprecated Use the new function generateDocument of Contrat class + * @see Contrat::generateDocument() */ function contract_pdf_create(DoliDB $db, Contrat $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/core/modules/expedition/modules_expedition.php b/htdocs/core/modules/expedition/modules_expedition.php index 0300d380fe8..0cc89498dae 100644 --- a/htdocs/core/modules/expedition/modules_expedition.php +++ b/htdocs/core/modules/expedition/modules_expedition.php @@ -154,8 +154,11 @@ abstract class ModelNumRefExpedition * @param int $hideref Hide ref * @return int 1 if OK -1 if KO * @deprecated Use the new function generateDocument of Expedition class + * @see Expedition::generateDocument() */ function expedition_pdf_create(DoliDB $db, Expedition $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index 2bf03edf557..afae663b02b 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -156,9 +156,12 @@ abstract class ModeleNumRefFactures * @param int $hideref Hide ref * @return int <0 if KO, >0 if OK * @deprecated Use the new function generateDocument of Facture class + * @see Facture::generateDocument() */ function facture_pdf_create(DoliDB $db, Facture $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/core/modules/livraison/modules_livraison.php b/htdocs/core/modules/livraison/modules_livraison.php index 0a439ed8fe7..c3c762cbed1 100644 --- a/htdocs/core/modules/livraison/modules_livraison.php +++ b/htdocs/core/modules/livraison/modules_livraison.php @@ -156,9 +156,12 @@ abstract class ModeleNumRefDeliveryOrder * @param Translate $outputlangs objet lang a utiliser pour traduction * @return int 0 if KO, 1 if OK * @deprecated Use the new function generateDocument of Livraison class + * @see Livraison::generateDocument() */ function delivery_order_pdf_create(DoliDB $db, Livraison $object, $modele, $outputlangs='') { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + return $object->generateDocument($modele, $outputlangs); } diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 963e8ef0c28..2716bdc1e4c 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -153,6 +153,11 @@ class mailing_fraise extends MailingTargets */ function add_to_target($mailing_id,$filtersarray=array()) { + // Deprecation warning + if ($filtersarray) { + dol_syslog(__METHOD__ . ": filtersarray parameter is deprecated", LOG_WARNING); + } + global $langs,$_POST; $langs->load("members"); $langs->load("companies"); diff --git a/htdocs/core/modules/project/modules_project.php b/htdocs/core/modules/project/modules_project.php index f79de708164..acc1c2738f4 100644 --- a/htdocs/core/modules/project/modules_project.php +++ b/htdocs/core/modules/project/modules_project.php @@ -153,9 +153,12 @@ abstract class ModeleNumRefProjects * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK * @deprecated Use the new function generateDocument of Project class + * @see Project::generateDocument() */ function project_pdf_create(DoliDB $db, Project $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/core/modules/project/task/modules_task.php b/htdocs/core/modules/project/task/modules_task.php index 9f9cb5041c8..bea4d342e29 100644 --- a/htdocs/core/modules/project/task/modules_task.php +++ b/htdocs/core/modules/project/task/modules_task.php @@ -154,9 +154,12 @@ abstract class ModeleNumRefTask * @param HookManager $hookmanager Hook manager instance * @return int 0 if KO, 1 if OK * @deprecated Use the new function generateDocument of Task class + * @see Task::generateDocument() */ function task_pdf_create(DoliDB $db, Task $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false) { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); } diff --git a/htdocs/core/modules/propale/modules_propale.php b/htdocs/core/modules/propale/modules_propale.php index 9ad90e9e3b5..6c0be15f0df 100644 --- a/htdocs/core/modules/propale/modules_propale.php +++ b/htdocs/core/modules/propale/modules_propale.php @@ -157,9 +157,12 @@ abstract class ModeleNumRefPropales * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK * @deprecated Use the new function generateDocument of Propal class + * @see Propal::generateDocument() */ function propale_pdf_create(DoliDB $db, Propal $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php index a968955ea73..c14c2607795 100644 --- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php +++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php @@ -151,9 +151,12 @@ abstract class ModeleNumRefSuppliersOrders * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK * @deprecated Use the new function generateDocument of CommandeFournisseur class + * @see CommandeFournisseur::generateDocument() */ function supplier_order_pdf_create(DoliDB $db, CommandeFournisseur $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/core/triggers/dolibarrtriggers.class.php b/htdocs/core/triggers/dolibarrtriggers.class.php index 0682bb76a71..d4cffc24a01 100644 --- a/htdocs/core/triggers/dolibarrtriggers.class.php +++ b/htdocs/core/triggers/dolibarrtriggers.class.php @@ -61,6 +61,7 @@ abstract class DolibarrTriggers * Error reported by the trigger * @var string * @deprecated Use $this->errors + * @see errors */ public $error = ''; @@ -145,4 +146,4 @@ abstract class DolibarrTriggers */ abstract function runTrigger($action, $object, User $user, Translate $langs, Conf $conf); -} \ No newline at end of file +} diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 77722af6006..fa7bc6dffd8 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -63,6 +63,11 @@ class Don extends CommonObject var $modelpdf; var $projet; + /** + * @deprecated + * @see note_private, note_public + */ + var $commentaire; /** * Constructor diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index a6c56f9f235..2d75cd392fc 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -49,6 +49,12 @@ class PaymentDonation extends CommonObject var $fk_user_creat; var $fk_user_modif; + /** + * @deprecated + * @see amount, amounts + */ + var $total; + /** * Constructor * @@ -590,4 +596,4 @@ class PaymentDonation extends CommonObject return $result; } -} \ No newline at end of file +} diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index e0b5b791ada..17dc2bc963a 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -77,7 +77,21 @@ class Expedition extends CommonObject var $trueSize; var $date_delivery; // Date delivery planed - var $date_expedition; // Date delivery real + /** + * @deprecated + * @see date_shipping + */ + var $date; + /** + * @deprecated + * @see date_shipping + */ + var $date_expedition; + /** + * Effective delivery date + * @var int + */ + public $date_shipping; var $date_creation; var $date_valid; @@ -459,8 +473,8 @@ class Expedition extends CommonObject $this->statut = $obj->fk_statut; $this->user_author_id = $obj->fk_user_author; $this->date_creation = $this->db->jdate($obj->date_creation); - $this->date = $this->db->jdate($obj->date_expedition); // TODO obsolete - $this->date_expedition = $this->db->jdate($obj->date_expedition); // TODO obsolete + $this->date = $this->db->jdate($obj->date_expedition); // TODO deprecated + $this->date_expedition = $this->db->jdate($obj->date_expedition); // TODO deprecated $this->date_shipping = $this->db->jdate($obj->date_expedition); // Date real $this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed $this->fk_delivery_address = $obj->fk_address; @@ -1708,9 +1722,10 @@ class ExpeditionLigne // From llx_commandedet or llx_propaldet var $qty_asked; - var $libelle; // Label produit - var $product_desc; // Description produit - var $ref; + public $product_ref; + public $product_label; + public $product_desc; + // Invoicing var $remise_percent; @@ -1720,6 +1735,24 @@ class ExpeditionLigne var $total_localtax1; // Total Local tax 1 var $total_localtax2; // Total Local tax 2 + public $fk_origin_line; + + // Deprecated + /** + * @deprecated + * @see fk_origin_line + */ + var $origin_line_id; + /** + * @deprecated + * @see product_ref + */ + var $ref; + /** + * @deprecated + * @see product_label + */ + var $libelle; /** * Constructor diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ccd17a2f97b..6628aeb19d7 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -55,6 +55,7 @@ class CommandeFournisseur extends CommonOrder /** * TODO: Remove * @deprecated + * @see product_ref */ var $ref; var $product_ref; @@ -78,8 +79,13 @@ class CommandeFournisseur extends CommonOrder var $total_localtax2; // Total Local tax 2 var $total_ttc; var $source; + /** + * @deprecated + * @see note_private, note_public + */ var $note; - var $note_public; + public $note_private; + public $note_public; var $model_pdf; var $fk_project; var $cond_reglement_id; @@ -2465,6 +2471,7 @@ class CommandeFournisseurLigne extends CommonOrderLine * Supplier ref * @var string * @deprecated Use ref_supplier + * @see ref_supplier */ public $ref_fourn; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 1cfbe941d9a..03ff0ff1eb2 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -58,12 +58,9 @@ class FactureFournisseur extends CommonInvoice var $type = self::TYPE_STANDARD; /** - * Check constants for more info: - * - STATUS_DRAFT - * - STATUS_VALIDATED - * - STATUS_PAID - * - STATUS_ABANDONED + * Supplier invoice status * @var int + * @see FactureFournisseur::STATUS_DRAFT, FactureFournisseur::STATUS_VALIDATED, FactureFournisseur::STATUS_PAID, FactureFournisseur::STATUS_ABANDONED */ var $statut; //! 1 si facture payee COMPLETEMENT, 0 sinon (ce champ ne devrait plus servir car insuffisant) @@ -85,7 +82,11 @@ class FactureFournisseur extends CommonInvoice var $total_localtax1; var $total_localtax2; var $total_ttc; - var $note; // deprecated + /** + * @deprecated + * @see note_private, note_public + */ + var $note; var $note_private; var $note_public; var $propalid; @@ -100,7 +101,10 @@ class FactureFournisseur extends CommonInvoice * @var SupplierInvoiceLine[] */ public $lines = array(); - var $fournisseur; // deprecated + /** + * @deprecated + */ + var $fournisseur; //Incorterms var $fk_incoterms; @@ -1896,9 +1900,17 @@ class SupplierInvoiceLine extends CommonObjectLine var $oldline; + /** + * @deprecated + * @see product_ref + */ public $ref; public $product_ref; public $ref_supplier; + /** + * @deprecated + * @see label + */ public $libelle; public $product_desc; @@ -1906,8 +1918,10 @@ class SupplierInvoiceLine extends CommonObjectLine * Unit price before taxes * @var float * @deprecated Use $subprice + * @see subprice */ public $pu_ht; + public $subprice; /** * Unit price included taxes @@ -1919,8 +1933,10 @@ class SupplierInvoiceLine extends CommonObjectLine * Total VAT amount * @var float * @deprecated Use $total_tva instead + * @see total_tva */ public $tva; + public $total_tva; /** * Id of the corresponding supplier invoice @@ -1932,7 +1948,7 @@ class SupplierInvoiceLine extends CommonObjectLine * Product label * @var string */ - var $label; // deprecated + var $label; /** * Description of the line diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 48c238d60be..b7246d8ac7a 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -42,7 +42,11 @@ class ProductFournisseur extends Product var $product_fourn_price_id; // id of ligne product-supplier var $id; // product id - var $fourn_ref; // deprecated + /** + * @deprecated + * @see ref_supplier + */ + var $fourn_ref; var $delivery_time_days; var $ref_supplier; // ref supplier (can be set by get_buyprice) var $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice) @@ -348,7 +352,8 @@ class ProductFournisseur extends Product if ($obj) { $this->product_fourn_price_id = $rowid; - $this->fourn_ref = $obj->ref_fourn; + $this->fourn_ref = $obj->ref_fourn; // deprecated + $this->ref_supplier = $obj->ref_fourn; $this->fourn_price = $obj->price; $this->fourn_charges = $obj->charges; $this->fourn_qty = $obj->quantity; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 90492fa16f1..f76d9843e02 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -38,6 +38,10 @@ class Holiday extends CommonObject var $error; var $errors=array(); + /** + * @deprecated + * @see id + */ var $rowid; var $ref; diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 52db876fbf0..3a1704f8d8d 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -52,6 +52,11 @@ class Livraison extends CommonObject var $ref_customer; var $statut; + /** + * @deprecated + * @see note_public, note_private + */ + var $note; var $note_public; var $note_private; @@ -1014,10 +1019,8 @@ class Livraison extends CommonObject /** * Classe de gestion des lignes de bons de livraison */ -class LivraisonLigne +class LivraisonLigne extends CommonObjectLine { - var $db; - // From llx_expeditiondet var $qty; var $qty_asked; @@ -1027,7 +1030,19 @@ class LivraisonLigne var $origin_id; var $label; // Label produit var $description; // Description produit + /** + * @deprecated + * @see product_ref + */ var $ref; + /** + * @deprecated + * @see product_label; + */ + var $libelle; + + public $product_ref; + public $product_label; /** * Constructor diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 51961e37e6e..35ce4cbaaa0 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -52,6 +52,12 @@ class PaymentLoan extends CommonObject var $fk_user_creat; var $fk_user_modif; + /** + * @deprecated + * @see amount, amounts + */ + var $total; + /** * Constructor * diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index b4c8570dec8..1ab2352395d 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -43,7 +43,12 @@ class Opensurveysondage extends CommonObject var $id; var $id_sondage; + /** + * @deprecated + * @see description + */ var $commentaires; + public $description; var $mail_admin; var $nom_admin; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d2c3deeb2e4..ca58dc7878d 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -59,10 +59,15 @@ class Product extends CommonObject var $id ; //! Ref var $ref; - /** - * Product label - * @var string - */ + /* + * @deprecated + * @see label + */ + var $libelle; + /** + * Product label + * @var string + */ var $label; /** * Product descripion @@ -183,6 +188,20 @@ class Product extends CommonObject var $fk_price_expression; + /** + * @deprecated + * @see fourn_pu + */ + var $buyprice; + public $fourn_pu; + + /** + * @deprecated + * @see ref_supplier + */ + var $ref_fourn; + public $ref_supplier; + /** * Unit code ('km', 'm', 'l', 'p', ...) * @var string @@ -817,6 +836,11 @@ class Product extends CommonObject */ function delete($id=0) { + // Deprecation warning + if (0 == $id) { + dol_syslog(__METHOD__ . " with parameter is deprecated", LOG_WARNING); + } + global $conf,$user,$langs; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; @@ -1252,7 +1276,7 @@ class Product extends CommonObject $obj->price = $price_result; } } - $this->buyprice = $obj->price; // \deprecated + $this->buyprice = $obj->price; // deprecated $this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id $this->ref_fourn = $obj->ref_fourn; // Ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 8d3e9f39a08..2da276428b0 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -46,6 +46,12 @@ class Project extends CommonObject var $id; var $ref; var $description; + /** + * @var string + * @deprecated + * @see title + */ + public $titre; var $title; var $date_start; var $date_end; @@ -66,6 +72,27 @@ class Project extends CommonObject var $weekWorkLoad; // Used to store workload details of a projet var $weekWorkLoadPerTask; // Used to store workload details of tasks of a projet + /** + * @var int Creation date + * @deprecated + * @see date_c + */ + public $datec; + /** + * @var int Creation date + */ + public $date_c; + /** + * @var int Modification date + * @deprecated + * @see date_m + */ + public $datem; + /** + * @var int Modification date + */ + public $date_m; + /** * Constructor diff --git a/htdocs/resource/class/resource.class.php b/htdocs/resource/class/resource.class.php index 33df80fc095..cac917fa85b 100644 --- a/htdocs/resource/class/resource.class.php +++ b/htdocs/resource/class/resource.class.php @@ -606,9 +606,9 @@ class Resource extends CommonObject * Fetch all resources available, declared by modules * Load available resource in array $this->available_resources * - * note : deprecated, remplaced by hook getElementResources - * * @return int number of available resources declared by modules + * @deprecated, remplaced by hook getElementResources + * @see getElementResources() */ function fetch_all_available() { global $conf; diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index f1472dcb2d7..383ed9e8ff8 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -52,6 +52,8 @@ abstract class ActionsCardCommon */ private function getInstanceDao() { + dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); + if (! is_object($this->object)) { $modelclassfile = dol_buildpath('/'.$this->dirmodule.'/canvas/'.$this->canvas.'/dao_'.$this->targetmodule.'_'.$this->canvas.'.class.php'); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 18bfea5fb0c..6961f54e5d8 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -59,6 +59,7 @@ class Societe extends CommonObject * Thirdparty name * @var string * @deprecated Use $name instead + * @see name */ public $nom; @@ -88,18 +89,21 @@ class Societe extends CommonObject * State code * @var string * @deprecated Use state_code instead + * @see state_code */ var $departement_code; /** * @var string * @deprecated Use state instead + * @see state */ var $departement; /** * @var string * @deprecated Use country instead + * @see country */ var $pays; var $country_id; @@ -298,6 +302,7 @@ class Societe extends CommonObject /** * @var string * @deprecated Note is split in public and private notes + * @see note_public, note_private */ var $note; @@ -2803,7 +2808,7 @@ class Societe extends CommonObject if (empty($name)) $name=$member->getFullName($langs); // Positionne parametres - $this->nom=$name; // TODO obsolete + $this->nom=$name; // TODO deprecated $this->name=$name; $this->address=$member->address; $this->zip=$member->zip; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 0da1b5f8d90..782d4c19c82 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -74,8 +74,16 @@ class User extends CommonObject var $datem; //! If this is defined, it is an external user - var $societe_id; // deprecated - var $contact_id; // deprecated + /** + * @deprecated + * @see socid + */ + var $societe_id; + /** + * @deprecated + * @see contactid + */ + var $contact_id; var $socid; var $contactid; diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 35663f05978..687c2077760 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -40,8 +40,12 @@ class UserGroup extends CommonObject var $id; // Group id var $entity; // Entity of group + /** + * @deprecated + * @see name + */ var $nom; // Name of group - var $name; // Name of group // deprecated + var $name; // Name of group var $globalgroup; // Global group var $note; // Note on group var $datec; // Creation date of group From ea798c23152bd11e69310067e55be7d3836a0c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 23 Apr 2015 23:29:31 +0200 Subject: [PATCH 15/67] Qual: deprecate dol_json_encode() and dol_json_decode() PHP > 5.3 supports json_encode() and json_decode() natively --- htdocs/comm/action/card.php | 24 ++++++++++++------------ htdocs/comm/action/document.php | 4 ++-- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/json.lib.php | 2 ++ htdocs/filefunc.inc.php | 27 +++++++++++---------------- 5 files changed, 28 insertions(+), 31 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index fcb3444be10..0b75ea73e98 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -96,7 +96,7 @@ if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0') { $idtoremove=GETPOST('removedassigned'); - if (! empty($_SESSION['assignedtouser'])) $tmpassigneduserids=dol_json_decode($_SESSION['assignedtouser'],1); + if (! empty($_SESSION['assignedtouser'])) $tmpassigneduserids=json_decode($_SESSION['assignedtouser'],1); else $tmpassigneduserids=array(); foreach ($tmpassigneduserids as $key => $val) @@ -104,7 +104,7 @@ if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0') if ($val['id'] == $idtoremove || $val['id'] == -1) unset($tmpassigneduserids[$key]); } //var_dump($_POST['removedassigned']);exit; - $_SESSION['assignedtouser']=dol_json_encode($tmpassigneduserids); + $_SESSION['assignedtouser']=json_encode($tmpassigneduserids); $donotclearsession=1; if ($action == 'add') $action = 'create'; if ($action == 'update') $action = 'edit'; @@ -119,10 +119,10 @@ if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser')) $assignedtouser=array(); if (! empty($_SESSION['assignedtouser'])) { - $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); + $assignedtouser=json_decode($_SESSION['assignedtouser'], true); } $assignedtouser[GETPOST('assignedtouser')]=array('id'=>GETPOST('assignedtouser'), 'transparency'=>GETPOST('transparency'),'mandatory'=>1); - $_SESSION['assignedtouser']=dol_json_encode($assignedtouser); + $_SESSION['assignedtouser']=json_encode($assignedtouser); } $donotclearsession=1; if ($action == 'add') $action = 'create'; @@ -215,7 +215,7 @@ if ($action == 'add') $object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60; $listofuserid=array(); - if (! empty($_SESSION['assignedtouser'])) $listofuserid=dol_json_decode($_SESSION['assignedtouser']); + if (! empty($_SESSION['assignedtouser'])) $listofuserid=json_decode($_SESSION['assignedtouser']); $i=0; foreach($listofuserid as $key => $value) { @@ -387,7 +387,7 @@ if ($action == 'update') if (! empty($_SESSION['assignedtouser'])) // Now concat assigned users { // Restore array with key with same value than param 'id' - $tmplist1=dol_json_decode($_SESSION['assignedtouser'], true); $tmplist2=array(); + $tmplist1=json_decode($_SESSION['assignedtouser'], true); $tmplist2=array(); foreach($tmplist1 as $key => $val) { if ($val['id'] > 0 && $val['id'] != $assignedtouser) $listofuserid[$val['id']]=$val; @@ -677,13 +677,13 @@ if ($action == 'create') { $assignedtouser=GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : $user->id); if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser,'mandatory'=>0,'transparency'=>$object->transparency); // Owner first - $_SESSION['assignedtouser']=dol_json_encode($listofuserid); + $_SESSION['assignedtouser']=json_encode($listofuserid); } else { if (!empty($_SESSION['assignedtouser'])) { - $listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); + $listofuserid=json_decode($_SESSION['assignedtouser'], true); } } print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0'); @@ -929,13 +929,13 @@ if ($id > 0) if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val; } } - $_SESSION['assignedtouser']=dol_json_encode($listofuserid); + $_SESSION['assignedtouser']=json_encode($listofuserid); } else { if (!empty($_SESSION['assignedtouser'])) { - $listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); + $listofuserid=json_decode($_SESSION['assignedtouser'], true); } } print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0'); @@ -1101,13 +1101,13 @@ if ($id > 0) if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val; } } - $_SESSION['assignedtouser']=dol_json_encode($listofuserid); + $_SESSION['assignedtouser']=json_encode($listofuserid); } else { if (!empty($_SESSION['assignedtouser'])) { - $listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); + $listofuserid=json_decode($_SESSION['assignedtouser'], true); } } print $form->select_dolusers_forevent('view','assignedtouser',1); diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 598b02ef0b8..d45a18e3e8c 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -186,13 +186,13 @@ if ($object->id > 0) if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val; } } - $_SESSION['assignedtouser']=dol_json_encode($listofuserid); + $_SESSION['assignedtouser']=json_encode($listofuserid); } else { if (!empty($_SESSION['assignedtouser'])) { - $listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); + $listofuserid=json_decode($_SESSION['assignedtouser'], true); } } print $form->select_dolusers_forevent('view','assignedtouser',1); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3b1e9ce5630..66d2a5a3463 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1462,7 +1462,7 @@ class Form $assignedtouser=array(); if (!empty($_SESSION['assignedtouser'])) { - $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); + $assignedtouser=json_decode($_SESSION['assignedtouser'], true); } $nbassignetouser=count($assignedtouser); diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index 121e719bb6f..e3f00a064e5 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -42,6 +42,7 @@ if (! function_exists('json_encode')) * * @param mixed $elements PHP Object to json encode * @return string Json encoded string + * @deprecated PHP >= 5.3 supports native json_encode */ function dol_json_encode($elements) { @@ -219,6 +220,7 @@ if (! function_exists('json_decode')) * @param string $json Json encoded to PHP Object or Array * @param bool $assoc False return an object, true return an array. Try to always use it with true ! * @return mixed Object or Array or false on error + * @deprecated PHP >= 5.3 supports native json_decode */ function dol_json_decode($json, $assoc=false) { diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 7c0e9f14a0b..45ba2b24f8c 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -37,22 +37,17 @@ if (! defined('EURO')) define('EURO',chr(128)); // Define syslog constants if (! defined('LOG_DEBUG')) { - if (function_exists("define_syslog_variables")) - { - define_syslog_variables(); // Deprecated since php 5.3.0, syslog variables no longer need to be initialized - } - else - { - // Pour PHP sans syslog (comme sous Windows) - define('LOG_EMERG',0); - define('LOG_ALERT',1); - define('LOG_CRIT',2); - define('LOG_ERR',3); - define('LOG_WARNING',4); - define('LOG_NOTICE',5); - define('LOG_INFO',6); - define('LOG_DEBUG',7); - } + if (! function_exists("syslog")) { + // For PHP versions without syslog (like running on Windows OS) + define('LOG_EMERG',0); + define('LOG_ALERT',1); + define('LOG_CRIT',2); + define('LOG_ERR',3); + define('LOG_WARNING',4); + define('LOG_NOTICE',5); + define('LOG_INFO',6); + define('LOG_DEBUG',7); + } } // End of common declaration part From ecd5ebcb445b1cd984f4fb0cb3376ad02a1d6446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Mon, 1 Jun 2015 11:10:52 +0200 Subject: [PATCH 16/67] Member type ref is not deprecated --- htdocs/adherents/class/adherent_type.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index f7f6b71150e..23ecfd6ea03 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -39,8 +39,6 @@ class AdherentType extends CommonObject /** * @var int - * @deprecated Use id - * @see id */ public $ref; From cf4308aa3b7d354de7886c60721c29e782975f13 Mon Sep 17 00:00:00 2001 From: Gauthier Date: Mon, 1 Jun 2015 11:24:30 +0200 Subject: [PATCH 17/67] FIX : When we automatically creta an order from a proposal with workflow module, if some extrafields of propal don't exist in order object, insertExtraFields() function tries to insert extrafields in unexistant column of commande_extrafields table. --- htdocs/commande/class/commande.class.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index e58ad890f58..0564c60ef4b 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -976,7 +976,9 @@ class Commande extends CommonOrder */ function createFromProposal($object) { - global $conf,$user,$langs,$hookmanager; + global $db, $conf,$user,$langs,$hookmanager; + + dol_include_once('/core/class/extrafields.class.php'); $error=0; @@ -1046,9 +1048,15 @@ class Commande extends CommonOrder // get extrafields from original line $object->fetch_optionals($object->id); - foreach($object->array_options as $options_key => $value) - $this->array_options[$options_key] = $value; - + + $e = new ExtraFields($db); + $element_extrafields = $e->fetch_name_optionals_label($this->element); + + foreach($object->array_options as $options_key => $value) { + if(array_key_exists(str_replace('options_', '', $options_key), $element_extrafields)){ + $this->array_options[$options_key] = $value; + } + } // Possibility to add external linked objects with hooks $this->linked_objects[$this->origin] = $this->origin_id; if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects)) @@ -1657,6 +1665,7 @@ class Commande extends CommonOrder $i++; } + $this->db->free($result); return 1; From 0523f226cfba8f0527a9e483920837fa8d6b71c4 Mon Sep 17 00:00:00 2001 From: phf Date: Mon, 1 Jun 2015 12:29:10 +0200 Subject: [PATCH 18/67] FIX : when mailing is deleted, the targets list was kept in database --- htdocs/comm/mailing/class/mailing.class.php | 25 ++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 69a3520d1e8..1df5a7ad18f 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -421,7 +421,7 @@ class Mailing extends CommonObject $resql=$this->db->query($sql); if ($resql) { - return 1; + return $this->delete_targets(); } else { @@ -429,6 +429,29 @@ class Mailing extends CommonObject return -1; } } + + /** + * Delete targets emailing + * + * @return int 1 if OK, 0 if error + */ + function delete_targets() + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles"; + $sql.= " WHERE fk_mailing = ".$this->id; + + dol_syslog("Mailing::delete_targets", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + return 1; + } + else + { + $this->error=$this->db->lasterror(); + return 0; + } + } /** From f0257d02b5d12dc754f0e912e22b42796806e8b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Jun 2015 16:31:25 +0200 Subject: [PATCH 19/67] Minor fix --- scripts/product/migrate_picture_path.php | 112 +++++++++++++---------- 1 file changed, 62 insertions(+), 50 deletions(-) diff --git a/scripts/product/migrate_picture_path.php b/scripts/product/migrate_picture_path.php index 272e56e3a42..a03e2549006 100755 --- a/scripts/product/migrate_picture_path.php +++ b/scripts/product/migrate_picture_path.php @@ -20,8 +20,8 @@ /** * \file scripts/product/migrate_picture_path.php * \ingroup scripts - * \brief migrate pictures from old system to 3.7 and more system - * + * \brief Migrate pictures from old system prior to 3.7 to new path for 3.7+ + * */ $sapi_type = php_sapi_name(); @@ -34,12 +34,6 @@ if (substr($sapi_type, 0, 3) == 'cgi') { exit(-1); } -// Global variables -$version='1.0'; -$error=0; - - -// -------------------- START OF YOUR CODE HERE -------------------- @set_time_limit(0); // No timeout for this script define('EVEN_IF_ONLY_LOGIN_ALLOWED',1); // Set this define to 0 if you want to lock your script when dolibarr setup is "locked to admin user only". @@ -54,24 +48,72 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); $langs->load("main"); // To load language file for default language +// Global variables +$version=DOL_VERSION; +$error=0; +$forcecommit=0; + + print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; +dol_syslog($script_file." launched with arg ".join(',',$argv)); + +if (! isset($argv[1]) || $argv[1] != 'product') { + print "Usage: $script_file product\n"; + exit(-1); +} print '--- start'."\n"; +// Case to migrate products path +if ($argv[1] == 'product') +{ + $product = new Product($db); + + $sql = "SELECT rowid as pid from ".MAIN_DB_PREFIX."product"; // Get list of all products + $resql = $db->query($sql); + if ($resql) + { + while ($obj = $db->fetch_object($resql)) + { + $product->fetch($obj->pid); + print " migrating product id=".$product->id." ref=".$product->ref."\n"; + migrate_product_photospath($product); + } + } + else + { + print "\n sql error ".$sql; + exit; + } +} + + +$db->close(); // Close $db database opened handler + +exit($error); + + + +/** + * Migrate file from old path to new one for product $product + * + * @param Product $product Object product + * @return void + */ function migrate_product_photospath($product) { global $conf; - + $dir = $conf->product->multidir_output[$product->entity]; $origin = $dir .'/'. get_exdir($product->id,2) . $product->id ."/photos"; $destin = $dir.'/'.dol_sanitizeFileName($product->ref); - + $error = 0; - + $origin_osencoded=dol_osencode($origin); $destin_osencoded=dol_osencode($destin); dol_mkdir($destin); - + if (dol_is_dir($origin)) { $handle=opendir($origin_osencoded); @@ -84,53 +126,23 @@ function migrate_product_photospath($product) $thumbs = opendir($origin_osencoded.'/'.$file); if (is_resource($thumbs)) { - dol_mkdir($destin.'/'.$file); + dol_mkdir($destin.'/'.$file); while (($thumb = readdir($thumbs)) != false) { - dol_move($origin.'/'.$file.'/'.$thumb, $destin.'/'.$file.'/'.$thumb); + dol_move($origin.'/'.$file.'/'.$thumb, $destin.'/'.$file.'/'.$thumb); } -// dol_delete_dir($origin.'/'.$file); - } +// dol_delete_dir($origin.'/'.$file); + } } - else + else { - if (dol_is_file($origin.'/'.$file) ) + if (dol_is_file($origin.'/'.$file) ) { dol_move($origin.'/'.$file, $destin.'/'.$file); } - - } + + } } } } } - -$product = new Product($db); - -$sql = "SELECT rowid as pid from ".MAIN_DB_PREFIX."product "; - -$resql = $db->query($sql); - -if (!resql ) -{ - print "\n sql error ".$sql; - exit; -} - -while ($obj = $db->fetch_object($resql)) -{ - print "\n migrating ".$product->ref; - $product->fetch($obj->pid); - migrate_product_photospath($product); -} - - - - - -// -------------------- END OF YOUR CODE -------------------- - - -$db->close(); // Close $db database opened handler - -exit($error); From 4f75ab79dbce0faae28a81abcc81aa6daf9c8a51 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Jun 2015 16:32:33 +0200 Subject: [PATCH 20/67] Prepare 3.7.2 --- build/debian/changelog | 2 +- htdocs/filefunc.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/debian/changelog b/build/debian/changelog index 134fc188abe..98caa12a1d3 100644 --- a/build/debian/changelog +++ b/build/debian/changelog @@ -1,4 +1,4 @@ -dolibarr (3.7.1-3) UNRELEASED; urgency=low +dolibarr (3.7.2-3) UNRELEASED; urgency=low [ Laurent Destailleur (eldy) ] * New upstream release. diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index a742464606d..716a647240a 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -29,7 +29,7 @@ * \brief File that include conf.php file and commons lib like functions.lib.php */ -if (! defined('DOL_VERSION')) define('DOL_VERSION','3.7.1'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','3.7.2'); if (! defined('EURO')) define('EURO',chr(128)); // Define syslog constants From 6e72d3c8cc13972a845a8e868ac32ddaa71901e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Jun 2015 21:34:21 +0200 Subject: [PATCH 21/67] FIX Export of tags for contact and member --- htdocs/core/modules/modCategorie.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 327608c8814..a1bc1aa215e 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -162,7 +162,7 @@ class modCategorie extends DolibarrModules $this->export_enabled[$r]='$conf->adherent->enabled'; $this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire")); $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.lastname'=>'LastName','p.firstname'=>'Firstname'); - $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.rowid'=>'List:adherent:nom','p.lastname'=>'Text','p.firstname'=>'Text'); + $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.lastname'=>'Text','p.firstname'=>'Text'); $this->export_entities_array[$r]=array('p.rowid'=>'member','p.lastname'=>'member','p.firstname'=>'member'); // We define here only fields that use another picto $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p'; @@ -202,7 +202,6 @@ class modCategorie extends DolibarrModules $this->export_TypeFields_array[$r] = array ( 'u.label' => "Text", 'u.description' => "Text", - 'p.rowid' => 'List:contact:lastname', 'p.lastname' => 'Text', 'p.firstname' => 'Text' ); From acd693b513a6c79b8f96eeb98c0e2eedb2c01ff2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Jun 2015 21:37:09 +0200 Subject: [PATCH 22/67] Fix phpcs --- htdocs/core/class/html.form.class.php | 4 ++-- htdocs/product/stock/product.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 53f77262db1..a53c3b3e925 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4794,10 +4794,10 @@ class Form * @param int $width Width of photo * @param int $height Height of photo (auto if 0) * @param int $caneditfield Add edit fields - * @param string $photologo CSS name to use on img for photo + * @param string $cssclass CSS name to use on img for photo * @return string HTML code to output photo */ - static function showphoto($modulepart,$object,$width=100,$height=0,$caneditfield=0,$cssclass='photowithmargin') + static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin') { global $conf,$langs; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 12e05c3a45d..f80050287e9 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -502,7 +502,7 @@ if ($id > 0 || $ref) $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)?$langs->trans("ReStockOnValidateOrder").'
':''); $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)?$langs->trans("ReStockOnDispatchOrder").'
':''); print ''; - print $form->textwithtooltip($langs->trans("PhysicalStock") ,$text_stock_options, 2, 1, img_picto('', 'info'), '', 2); + print $form->textwithtooltip($langs->trans("PhysicalStock"), $text_stock_options, 2, 1, img_picto('', 'info'), '', 2); print ''; print ''.$product->stock_reel; if ($product->seuil_stock_alerte && ($product->stock_reel < $product->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockLowerThanLimit")); From 3f1613197e006e29163b4cdaa1e4c2519827e217 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 2 Jun 2015 08:41:42 +0200 Subject: [PATCH 23/67] FIX : If supplier invoice block linked element is display after other block total HT amount is not reset to 0 and sum other block (like customer orders values) --- htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index c10fea8bb8a..2f66049143e 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -40,6 +40,7 @@ else print_titre($langs->trans("RelatedBill")); trans("Status"); ?> Date: Tue, 2 Jun 2015 11:20:08 +0200 Subject: [PATCH 24/67] FIX : total amount in tpl linked object are not reset --- htdocs/expedition/tpl/linkedobjectblock.tpl.php | 1 + htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index 364afb92177..a235944bff8 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -41,6 +41,7 @@ print_titre($langs->trans('RelatedShippings')); trans("Status"); ?> trans('RelatedOrders')); trans("Status"); ?> Date: Tue, 2 Jun 2015 13:01:51 +0200 Subject: [PATCH 25/67] Add contrl invoice supplier already exists (as it is done on customer invoice) --- htdocs/fourn/facture/card.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index bf310d92f8d..b4b853b58bc 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1508,7 +1508,16 @@ if ($action == 'create') $langs->load('orders'); $txt=$langs->trans("SupplierOrder"); } - print ''.$txt.''.$objectsrc->getNomUrl(1).''; + print ''.$txt.''.$objectsrc->getNomUrl(1); + //We check if Origin document has already an invoice attached to it + $objectsrc->fetchObjectLinked($originid,'','','invoice_supplier'); + $cntinvoice=count($objectsrc->linkedObjects['invoice_supplier']); + if ($cntinvoice>=1) + { + setEventMessage('WarningBillExist','warnings'); + echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['facture'])->getNomUrl(1).')'; + } + echo ''; print ''.$langs->trans('TotalHT').''.price($objectsrc->total_ht).''; print ''.$langs->trans('TotalVAT').''.price($objectsrc->total_tva).""; if ($mysoc->country_code=='ES') From 9b747a12aa7b57978d441414447fe11a3b07e192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Tue, 2 Jun 2015 15:12:19 +0200 Subject: [PATCH 26/67] Fixed some coding style issues --- htdocs/api/class/api_access.class.php | 42 +++++++++++++-------------- htdocs/public/api/index.php | 6 ++-- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 1e3d43ed9db..d453d141546 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -18,7 +18,7 @@ use \Luracast\Restler\iAuthenticate; use \Luracast\Restler\Resources; use \Luracast\Restler\Defaults; -use Luracast\Restler\RestException; +use \Luracast\Restler\RestException; /** @@ -44,24 +44,14 @@ class DolibarrApiAccess implements iAuthenticate */ public static $user = ''; - // @codingStandardsIgnoreStart - - /** - * @return string string to be used with WWW-Authenticate header - * @example Basic - * @example Digest - * @example OAuth - */ - public function __getWWWAuthenticateString(); - /** * Check access * - * @return boolean + * @return bool + * @throws RestException */ - public function _isAllowed() - { - // @codingStandardsIgnoreEnd + public function __isAllowed() + { global $db; $stored_key = ''; @@ -74,7 +64,8 @@ class DolibarrApiAccess implements iAuthenticate $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE u.api_key = '".$db->escape($_GET['api_key'])."'"; - if ($db->query($sql)) + $result = $db->query($sql); + if ($result) { if ($db->num_rows($result)) { @@ -116,6 +107,12 @@ class DolibarrApiAccess implements iAuthenticate } // @codingStandardsIgnoreStart + /** + * @return string string to be used with WWW-Authenticate header + * @example Basic + * @example Digest + * @example OAuth + */ public function __getWWWAuthenticateString() { return ''; @@ -123,12 +120,13 @@ class DolibarrApiAccess implements iAuthenticate // @codingStandardsIgnoreEnd /** - * Verify access - * - * @param array $m Properties of method - * - * @access private - */ + * Verify access + * + * @param array $m Properties of method + * + * @access private + * @return bool + */ public static function verifyAccess(array $m) { $requires = isset($m['class']['DolibarrApiAccess']['properties']['requires']) diff --git a/htdocs/public/api/index.php b/htdocs/public/api/index.php index d5065e45a32..352849af15c 100644 --- a/htdocs/public/api/index.php +++ b/htdocs/public/api/index.php @@ -47,8 +47,8 @@ if (empty($conf->global->MAIN_MODULE_API)) exit; } -use Luracast\Restler\Defaults; -Defaults::setProperty('authenticationMethod','_isAllowed'); +use \Luracast\Restler\Defaults; +Defaults::setProperty('authenticationMethod','__isAllowed'); $api = new DolibarrApi($db); @@ -125,4 +125,4 @@ foreach ($modulesdir as $dir) } } -$api->r->handle(); //serve the response \ No newline at end of file +$api->r->handle(); //serve the response From 3f4ded4780df440d2aae99ef8a9c224a464e3a5d Mon Sep 17 00:00:00 2001 From: Gauthier Date: Tue, 2 Jun 2015 16:06:03 +0200 Subject: [PATCH 27/67] FIX : When we clone a propal, if it has a project which is not assigned to a third, it was not on new propal because fk_project was always set to empty string if new propal is for another third. --- htdocs/comm/propal/class/propal.class.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 3a8c9c6c0ae..775e1ad2782 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -959,8 +959,10 @@ class Propal extends CommonObject */ function createFromClone($socid=0) { - global $user,$langs,$conf,$hookmanager; - + global $db, $user,$langs,$conf,$hookmanager; + + dol_include_once('/projet/class.project.class.php'); + $this->context['createfromclone']='createfromclone'; $error=0; @@ -985,7 +987,16 @@ class Propal extends CommonObject $this->socid = $objsoc->id; $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); - $this->fk_project = ''; + + $project = new Project($db); + + if($objFrom->fk_project > 0 && $project->fetch($objFrom->fk_project)) { + if($project->socid <= 0) $this->fk_project = $objFrom->fk_project; + else $this->fk_project = ''; + } else { + $this->fk_project = ''; + } + $this->fk_delivery_address = ''; } From ef88a04f93bb6c5f71c93309aac018fe237b9c28 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 2 Jun 2015 20:41:02 +0200 Subject: [PATCH 28/67] Fix: Donation error on admin tab --- htdocs/core/lib/donation.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/donation.lib.php b/htdocs/core/lib/donation.lib.php index 1fdd2399610..f7d5421d2ac 100644 --- a/htdocs/core/lib/donation.lib.php +++ b/htdocs/core/lib/donation.lib.php @@ -27,7 +27,7 @@ * @param Donation $object Donation * @return array Array of tabs to show */ -function donation_admin_prepare_head($object) +function donation_admin_prepare_head() { global $langs, $conf; @@ -43,14 +43,14 @@ function donation_admin_prepare_head($object) // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname); to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation_admin'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'donation_admin'); $head[$h][0] = DOL_URL_ROOT . '/don/admin/donation_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); $head[$h][2] = 'attributes'; $h++; - complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation_admin', 'remove'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'donation_admin', 'remove'); return $head; } From d28a56c8ac7386d72c625cbdd59dacedc0e070c0 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 3 Jun 2015 05:49:43 +0200 Subject: [PATCH 29/67] Correct travis --- htdocs/core/lib/donation.lib.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/donation.lib.php b/htdocs/core/lib/donation.lib.php index f7d5421d2ac..c9362425459 100644 --- a/htdocs/core/lib/donation.lib.php +++ b/htdocs/core/lib/donation.lib.php @@ -24,7 +24,6 @@ /** * Prepare array with list of admin tabs * - * @param Donation $object Donation * @return array Array of tabs to show */ function donation_admin_prepare_head() @@ -32,7 +31,7 @@ function donation_admin_prepare_head() global $langs, $conf; $h = 0; - $head = array (); + $head = array(); $head[$h][0] = DOL_URL_ROOT . '/don/admin/donation.php'; $head[$h][1] = $langs->trans("Miscellaneous"); @@ -66,7 +65,7 @@ function donation_prepare_head($object) global $langs, $conf; $h = 0; - $head = array (); + $head = array(); $head[$h][0] = DOL_URL_ROOT . '/don/card.php?id=' . $object->id; $head[$h][1] = $langs->trans("Card"); From bde91633da7a91d595fc7d4d30d770ecc6a747b9 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 3 Jun 2015 06:01:05 +0200 Subject: [PATCH 30/67] Fix: input of french article is disabled by default --- htdocs/core/modules/dons/html_cerfafr.modules.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 69c862d916d..67131a28645 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2006 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 Marcos García - * Copyright (C) 2014 Alexandre Spangaro + * Copyright (C) 2014-2015 Alexandre Spangaro * * 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 @@ -181,11 +181,11 @@ class html_cerfafr extends ModeleDon if (preg_match('/fr/i',$outputlangs->defaultlang)) { if ($conf->global->DONATION_ART200 >= 1) { - $art200='200 du CGI'; + $art200='200 du CGI'; } else { - $art200='200 du CGI'; + $art200='200 du CGI'; } } $form = str_replace('__ARTICLE200__',$art200,$form); @@ -194,11 +194,11 @@ class html_cerfafr extends ModeleDon if (preg_match('/fr/i',$outputlangs->defaultlang)) { if ($conf->global->DONATION_ART238 >= 1) { - $art238='238 bis du CGI'; + $art238='238 bis du CGI'; } else { - $art238='238 bis du CGI'; + $art238='238 bis du CGI'; } } $form = str_replace('__ARTICLE238__',$art238,$form); @@ -207,11 +207,11 @@ class html_cerfafr extends ModeleDon if (preg_match('/fr/i',$outputlangs->defaultlang)) { if ($conf->global->DONATION_ART885 >= 1) { - $art885='885-0 V bis du CGI'; + $art885='885-0 V bis du CGI'; } else { - $art885='885-0 V bis du CGI'; + $art885='885-0 V bis du CGI'; } } $form = str_replace('__ARTICLE885__',$art885,$form); From aa9951948b1ab7e6c7c33c07bd363b1b4b8a478c Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 3 Jun 2015 06:02:52 +0200 Subject: [PATCH 31/67] New: Add logo cerfa in common themes files --- htdocs/theme/common/logo_cerfa.png | Bin 0 -> 5718 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 htdocs/theme/common/logo_cerfa.png diff --git a/htdocs/theme/common/logo_cerfa.png b/htdocs/theme/common/logo_cerfa.png new file mode 100644 index 0000000000000000000000000000000000000000..0db57c205ab11248aafeebd6fba99ec991b02cf4 GIT binary patch literal 5718 zcmZ9QbyO7Z+s0>ESfr(-Te_R2k)@@PuaqnyE!`mqBA|ePfJ%2rH!Mh}G%Fw=9nxKr z@A%()erL~~nX|hy`^+8J^|_xY9W50CTxwhZ00`7n5qjXU7JMTg!2X?CKF0$OFiQ;; z1aSZFmG!;w6Zi?Xr<$e`_6!ywt~f>x!sG`4kYB1H6byXR_RRcz$)45Ud-;el#>s55 zGscCeKE=;^Oxnq;&GbGjYpGJnh)ff3L*%k#x@0s0?`@c%_#COwE)phLl5pg6O<4sT zCdy+ZNk20irX_}v)cn@TUD3YSKrjFWFfk5Sv*iE=pd64s6Ow^6?#Kl|bTGysjb&{Gu(7=R-+(+c z>rp!|ASzu7(B6v%fSCgL5CO7wc_0jeKM_p-Agcl4eUwcvU!3tD#1tLeim@aI z)RN3hT8z!p&Qi!zhD6NW51Iieb6@MrNf=sELeq+Qzm&ig$fstH1DPLPf zB0w8@$sV$Um*hgi5f+wT)@LYtiI3#8rh8 z?hzt6Lz0kFPx>1NDMjoaGBYzT9UOctC}1;fbcOi&`7tsFRA1Az_W@H-JMzgfLPFM% zCZtVep0gQ>&dk)*t~Z*>bEO-Hnc2a~Dew5$eZo!zf$&`J#PVN@SD_u(#YNV)W;9FF zW5q=f>Qv3g6B85v`<9tm(tDROhE6KkfQuZG70;rQ03jeCAfu<>FKU$*$Tct{*#`{6 zjMzB+dc0M7`}*`99l42#%gmaS$#AiDuK#2N#Llt^3+v;5rxv(%?9!X%dovE;jzhTW znvW}jZ%f8?KYjY-hqiwCvWoUPsF~X9z5!-!d%n40&D+R= zg;FkoHmtonIu0dojghBUTvS;Zw?4MDwUsdUlBI;{h;1X|(kd)}h_GGh!=rf47lB7g z1A8Rx9?0`3_0TghN{$o0@xH!@*SBZ?B?~vy*C$j|RIJtGSTjFvM+jt><+b{K1vtrY zueM7nB+5?4b5&Ryh6%Tq+Fdg~&Kbn)ziaB*Ru7=fWq)Yo@C1#8GW4*!41c-u&_8hJd}U& zf?kB0fIX(6L7aq?RM2HXdc+5O7Vo)fdi8vgj*gDTi-iDP6O#`sE0!XnqF*%+_V!}l zK(U$S3=~!KJXqc9eQA6Yf!9 zG}GU&%EiGUust|D%t}E)flEYGn3za5+u|o2bbou{d42xs#dTz4>&>x-ag9w({HWZ0 zOO`vOY@o!end)$T*zoXhVqzk~+1a`Gc((c_Ub?hjg7fc21q4DRme#Fy#GH5|`MiU` z$Iqg*txb-Vot-9KzGPC*-(QmVMavgv78Xtki7z=hIh*r7i}@)j)L>P6ZpKwrhL3?M z1Zz+Qj6I?o-|u$E{66RM(l!>55FjkF7!16Z`Ycoc#PB zQ&LifBuz9l@DBWOlGK$-49kT08eKjft@fe8BD53Jc6?rK9i_Rxw6mij<-MC#UoXbY z{O#Mf9PqJ?E0K_%o*rFgWf(E>-eOxOFb1{@9A#MgeA#aPb4M%vTgD-eG1b&!9gfYq z=@+@Pv&L3Tdkf!FVT81HhBnKc;k~s7-!C#4&5n+al+CDP-X$a?^v}(ueyUgbNN-?Z z(EY9D+%Y2Hd{-?hD(duVr$XP!i6=iVFV47Z!$86uZ)0Oa+1}pXhE9l$?cK(3YM+DG zbg7YI1R>o@-tfS{a^B8jTiax{?@APV(YJ5!BfoH-cykwTxYZ6;LEkOWvVc(gG^a=HYTzZ)b5yNp7)zp>a|GnBo{Aa&mI9EnIy3 zyrH3|xu!2)vfgfK2Ul~P^wPLga#fU-#Z3Ptc>46|n!%-G#rNL7*_6hz9+X1X4_xkc zrpi|H(gm&FEx8BZo=wMS!|IGR(S_O#U+#W4c_bz$D|>l)@yxTbvReM_v>4pqq`bng zBOTDG!6zaTuYU;Zt6iU#_1ZR=aHuN{-J7W?RQj5g#fb7h`z9DL2nm44_zT zhxam1@fTxGJng%8@2cs|jLVYggKykYtrz`wc(tmzsN{Q zaqwv3H>rohhr?7haYi^Y4yv$XlhqH!d# z?_U@$pIIx$hy+ogy!TQj?_2^~~)RuM{6=t31UGrA@eDxsu=J6$Fqna>RMxIgOY-$DMi%HxK*``x|0VS9w7r6uOp z>+8J+IN__SYHp0-QE7Oj6f=!FaF3Tfh69*T(bGHs{=skX9}>w}SmFjkL5W<8RbOnC z_4(eM3V?PgtEgz$qU)eNX!=91HA7BD_Um!;>s$Y1Q*ZBj79lBJ zj@0vt7vH0WHDIPq?mf$2Wj#dZXG{$ZmHGJi4A<%XH<`FNIV}cktgWAW*?lQ_*!%>vv)^B4b1&1(Tndnc?|bTFTRb`m6lkP|uBPoR(v@(w<^-bMr|# zvFp_S``^D!wbrq*u~WU)K%4O}UWZ~6jzNi}ku@V`&E8dO+L^MNI5;?-CmWielz3id zfUacpx1p{sJ~J~@>1$CDhZbD=WJoyFt06NA#L$TADJq6_nGuBeDTpe) ze%<;Ej;1&)`LAMjvPT#*K%^a~%L_)oipr6=jQH|yACz%@rjc#uQjoxMcQ(g!PZt6X z#uvT^6oX()$Z?q1_qVK zQx0`&tE*PJ8-}3NSUc|G|lU zUcHaJA;e%3`EjL{jeEJYGbn?uDlgZHE`=XnT>Sa|dS{Baa1$EBsbAn){%WqC0JQO( zH95Bx#7Lb>+wD}&P?2tKmR=Q6Im-7ahw(cYlwQ!9;M2mw!dUApfYe*u2VR>pz>jb) zL8Z|Q8M@(48&J_AE>Nkdsc6p>NfBbu-UxEm?|)f+bStNWyLaadg%Qd2H?dh0ZFEPG zRt5fbudS}6YODh()(+nc0^6o9#8!W*5ZAy7BC|Hb}rGmeO$pswo+_51{}SF;Go^w^D&^ug3# z5de?4#^rE1g5gn~M!w!SxDK`4@v-Hu2)}7}r^VLvT$N}e1*qmUKdI4zjPnvULtuM+ z&AFa0h(8k`B|Zh6pNyJXy~bvEWz7P0DkdlxzrDRpOLb-k6_|Q|562qtrgXHvmI;H^ z*492qi9b0x$&HT22T|aWkI~KTLGYhVX3OMa<5|hcjQIHYUay}f^-jz4&&mzB;2+9( zc<&k_K#nfGsWUF?xs8VLfjH@L4=x`Z>$*~3ul2_p=;|uO#Ke%%(P;wrvpa69y;LtZ zhQ2CFrjL~0M(144_udB!n&96V8ynlrRKK)2Lm&{Y#}po&3i*0&VtKQu-A^u8 znUO}BGOuPuRxL}wavcZVL=A-BpdcB?6O2WFO2se%t6qG)l1Xowmvcw#s)3eMx2}v= z9E;9&%r-E7Ufvj+ku)_B{#eb;&8ek*1$w%>$F9zHVjLfKUHp~!O6+#dAOv2dVPyJx(4OG#EcC6{T*U$%->f3n3soy3_*#k=Ab*rYiMZX{`_eGj>5Gri?TH|ey@N_{>+g`7^MntSq0L+whmj2fw=;zvSJsooOWxn~*s#2WRI; z2C(Jjfw=*52Vk2>NnosT@yci2$UIqNELShCo_gZt@LWi@_>f% zLT!ehKYzCOtbg2m4&JfS5x>!8vDJ4g|MNp)VhDH(a73}TwPj&pftHnRjHVw`>!pnxdHxl~7NQ%`jVVw_6E!O|V2!a=8&MX3EhXTB z5&5pa($=zvL@Q(q@0QuUb)Nnco2KRM{Z?V7x^)x>2jF3FOr%F+$?YEo7c|&5%o;od zCxYIorpn5(_;JkQzoL>eYSl1~_Ov~o%(Fd4aHjaN?JRxq+XI~Bu|Bqj3cJGfK89c?&yBP++Eni}AAv^zWfUK#IKc44xeN;pa!BK&{QUgzcSH<)O_~@* zkVB=K-o79hTl+8=mAIojWDe1~n}nF)c&I|14+r?~j% z7eQyw7DV><_j@^t!N6qRixtX{+b}tuUHd+er!dxMTWFbL- zF=G(-B;BtZ{)0lG66)Xokh~RXyjKDFsd)ANK)rPO^G;w8e6Vrw5U3#xfPMia^rR5B z)>L2mt3NRvy_OXm8^0cVLQII14skc-(*DDgjC_DE%s$FXk7`Pn zQL5JKG9-#(oZ{)>-ubD^h0zB3jf45ct|3)i{<&J^x8uQ@Bof!pg3j=COT8Q!|$k6`-KimDH literal 0 HcmV?d00001 From 3461a8712aac4c09fa2656352a61c537d5720ae0 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 3 Jun 2015 06:48:15 +0200 Subject: [PATCH 32/67] New: Add object of the company - Needed for donation --- htdocs/admin/company.php | 11 +++++++++++ htdocs/core/class/commondocgenerator.class.php | 1 + htdocs/langs/en_US/admin.lang | 1 + 3 files changed, 13 insertions(+) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index dccf26e75c0..1a75a199dc6 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2011 Philippe Grand + * Copyright (C) 2015 Alexandre Spangaro * * 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 @@ -151,6 +152,7 @@ if ( ($action == 'update' && empty($_POST["cancel"])) dolibarr_set_const($db, "MAIN_INFO_PROFID6",$_POST["MAIN_INFO_PROFID6"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT",$_POST["object"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START",$_POST["fiscalmonthstart"],'chaine',0,'',$conf->entity); @@ -528,6 +530,12 @@ if ($action == 'edit' || $action == 'updateedit') $var=!$var; print ''; print ''; + print ''; + + // Object of the company + $var=!$var; + print ''; + print ''; print ''; print ''; @@ -929,6 +937,9 @@ else } print ''; print ''; + + $var=!$var; + print ''.$langs->trans("CompanyObject").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? nl2br($conf->global->MAIN_INFO_SOCIETE_OBJECT) : '') . ''; print ''; print ''; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 22a33f4d2a8..d0730149b36 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -118,6 +118,7 @@ abstract class CommonDocGenerator 'mycompany_idprof5'=>$mysoc->idprof5, 'mycompany_idprof6'=>$mysoc->idprof6, 'mycompany_vatnumber'=>$mysoc->tva_intra, + 'mycompany_object'=>$mysoc->object, // Only private not exists for "mysoc" 'mycompany_note_private'=>$mysoc->note_private, diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 2c6db68dac7..0420e808e41 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -940,6 +940,7 @@ CompanyZip=Zip CompanyTown=Town CompanyCountry=Country CompanyCurrency=Main currency +CompanyObject=Object of the company Logo=Logo DoNotShow=Do not show DoNotSuggestPaymentMode=Do not suggest From f7eaf35d30accf34855a5fe693ca301c802296a9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Jun 2015 11:55:39 +0200 Subject: [PATCH 33/67] NEW When creating order, proposal or invoice from thirdparty card, the project is asked during creation. A link to create project if it does not exists is also available. NEW Uniformize form creation of proposal to add public and private notes during creation like done for order and invoice. --- htdocs/comm/propal.php | 77 ++++++--- htdocs/commande/card.php | 35 ++-- htdocs/compta/facture.php | 228 +++++++++++++------------- htdocs/projet/card.php | 23 ++- htdocs/projet/class/project.class.php | 4 +- htdocs/theme/eldy/style.css.php | 4 + 6 files changed, 216 insertions(+), 155 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 47accf6b9a0..ce22d192f81 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -41,6 +41,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/modules/propale/modules_propale.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; @@ -305,7 +306,8 @@ if (empty($reshook)) $object->fk_project = GETPOST('projectid'); $object->modelpdf = GETPOST('model'); $object->author = $user->id; // deprecated - $object->note = GETPOST('note'); + $object->note_private = GETPOST('note_private'); + $object->note_public = GETPOST('note_public'); $object->statut = Propal::STATUS_DRAFT; $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); @@ -331,7 +333,8 @@ if (empty($reshook)) $object->fk_project = GETPOST('projectid'); $object->modelpdf = GETPOST('model'); $object->author = $user->id; // deprecated - $object->note = GETPOST('note'); + $object->note_private = GETPOST('note_private'); + $object->note_public = GETPOST('note_public'); $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); @@ -1256,6 +1259,7 @@ $formother = new FormOther($db); $formfile = new FormFile($db); $formpropal = new FormPropal($db); $companystatic = new Societe($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } $now = dol_now(); @@ -1340,7 +1344,7 @@ if ($action == 'create') print ''; // Reference - print ''; + print ''; // Ref customer print ''; - // Model - print ''; - print ''; - print '"; + // Project + if (! empty($conf->projet->enabled) && $socid > 0) + { + $projectid = GETPOST('projectid')?GETPOST('projectid'):0; + if ($origin == 'project') $projectid = ($originid ? $originid : 0); + + $langs->load("projects"); + print ''; + print ''; + print ''; + } // Incoterms if (!empty($conf->incoterm->enabled)) @@ -1462,25 +1473,41 @@ if ($action == 'create') print ''; } - // Project - if (! empty($conf->projet->enabled) && $socid > 0) + // Template to use by default + print ''; + print ''; + print '"; + + // Public note + print ''; + print ''; + print ''; - print ''; + print ''; - print ''; + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); + print $doleditor->Create(1); + // print ' + print ''; } // Other attributes diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 5a4b434286c..fcd96f8c898 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1214,6 +1214,7 @@ llxHeader('', $langs->trans('Order'), 'EN:Customers_Orders|FR:Commandes_Clients| $form = new Form($db); $formfile = new FormFile($db); $formorder = new FormOrder($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } /** * ******************************************************************* @@ -1320,7 +1321,7 @@ if ($action == 'create' && $user->rights->commande->creer) print '
' . $langs->trans('Ref') . '' . $langs->trans("Draft") . '
' . $langs->trans('Ref') . '' . $langs->trans("Draft") . '
' . $langs->trans('RefCustomer') . ''; @@ -1444,13 +1448,20 @@ if ($action == 'create') } print '
' . $langs->trans("DefaultModel") . ''; - $liste = ModelePDFPropales::liste_modeles($db); - print $form->selectarray('model', $liste, ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF)); - print "
' . $langs->trans("Project") . ''; + $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); + print '   id).'">' . $langs->trans("AddProject") . ''; + print '
' . $langs->trans("DefaultModel") . ''; + $liste = ModelePDFPropales::liste_modeles($db); + print $form->selectarray('model', $liste, ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF)); + print "
' . $langs->trans('NotePublic') . ''; + $note_public = ''; + if (is_object($objectsrc)) // Take value from source object { - $formproject = new FormProjets($db); - - $projectid = 0; - if ($origin == 'project') - $projectid = ($originid ? $originid : 0); + $note_public = $objectsrc->note_public; + } + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); + print $doleditor->Create(1); + // Private note + if (empty($user->societe_id)) + { print '
' . $langs->trans("Project") . ''; - - $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); - if ($numprojet == 0) { - $langs->load("projects"); - print '   ' . $langs->trans("AddProject") . ''; + print '' . $langs->trans('NotePrivate') . ''; + $note_private = ''; + if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) // Take value from source object + { + $note_private = $objectsrc->note_private; } - print '
'; // Reference - print ''; + print ''; // Reference client print ''; + print ''; + print '   id).'">' . $langs->trans("AddProject") . ''; + print ''; + print ''; } // Incoterms @@ -1458,29 +1461,30 @@ if ($action == 'create' && $user->rights->commande->creer) print $form->selectarray('model', $liste, $conf->global->COMMANDE_ADDON_PDF); print ""; - // Note publique + // Note public print ''; print ''; print ''; - // Note privee + // Note private if (empty($user->societe_id)) { print ''; print ''; print ''; } - if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) { + if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) + { // TODO for compatibility if ($origin == 'contrat') { // Calcul contrat->price (HT), contrat->total (TTC), contrat->tva @@ -1514,8 +1518,11 @@ if ($action == 'create' && $user->rights->commande->creer) } print '"; - } else { - if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) { + } + else + { + if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) + { /* * Services/produits predefinis */ diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 410377c5683..379d2d2ee5d 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1854,6 +1854,8 @@ $form = new Form($db); $formother = new FormOther($db); $formfile = new FormFile($db); $bankaccountstatic = new Account($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } + $now = dol_now(); llxHeader('', $langs->trans('Bill'), 'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); @@ -2080,22 +2082,21 @@ if ($action == 'create') } print ''; if ($socid > 0) @@ -2293,12 +2292,15 @@ if ($action == 'create') print ''; // Project - if (! empty($conf->projet->enabled) && $socid > 0) { - $formproject = new FormProjets($db); + if (! empty($conf->projet->enabled) && $socid > 0) + { + $projectid = GETPOST('projectid')?GETPOST('projectid'):0; + if ($origin == 'project') $projectid = ($originid ? $originid : 0); $langs->load('projects'); print ''; } @@ -2320,7 +2322,7 @@ if ($action == 'create') print $object->showOptionals($extrafields, 'edit'); } - // Modele PDF + // Template to use by default print ''; print ''; @@ -2418,7 +2420,9 @@ if ($action == 'create') print '"; } print '"; - } else { + } + else + { // Show deprecated optional form to add product line here if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) { print ''; - print ''; - print ''; - print ''; - print ''; + if ($object->situation_cycle_ref && $object->statut == 0) { + print ''; + print ''; + print ''; + print ''; + print ''; - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ''; - } - print ''; - print ''; - print ''; - if ($inputalsopricewithtax) print ''; - print ''; - print ''; - print ''; - if (! empty($conf->margin->enabled) && empty($user->societe_id)) - { - print ''; - if ((! empty($conf->global->DISPLAY_MARGIN_RATES) || ! empty($conf->global->DISPLAY_MARK_RATES)) && $user->rights->margins->liretous) { - print ''; + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ''; } - } - print ''; - print ''; - print ''; - print ''; - print "\n"; + print ''; + print ''; + print ''; + if ($inputalsopricewithtax) print ''; + print ''; + print ''; + print ''; + if (! empty($conf->margin->enabled) && empty($user->societe_id)) + { + print ''; + if ((! empty($conf->global->DISPLAY_MARGIN_RATES) || ! empty($conf->global->DISPLAY_MARK_RATES)) && $user->rights->margins->liretous) { + print ''; + } + } + print ''; + print ''; + print ''; + print ''; + print "\n"; - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ''; + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ''; + } + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; } - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } } // Show object lines diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index b7ea6bd798b..791f01d5932 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -39,6 +39,7 @@ $ref=GETPOST('ref','alpha'); $action=GETPOST('action','alpha'); $backtopage=GETPOST('backtopage','alpha'); $cancel=GETPOST('cancel','alpha'); +$status=GETPOST('status','int'); if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $action != "update" && ! $_POST["cancel"])) accessforbidden(); @@ -139,6 +140,7 @@ if (empty($reshook)) $object->datec=dol_now(); $object->date_start=$date_start; $object->date_end=$date_end; + $object->statuts = $status; // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -167,8 +169,16 @@ if (empty($reshook)) { $db->commit(); - header("Location:card.php?id=".$object->id); - exit; + if ($backtopage) + { + header("Location: ".$backtopage.'&projectid='.$object->id); + exit; + } + else + { + header("Location:card.php?id=".$object->id); + exit; + } } else { @@ -444,6 +454,15 @@ if ($action == 'create' && $user->rights->projet->creer) else print $text; print ''; + // Status + if ($status != '') + { + print ''; + } + // Public print '"; // Ref @@ -711,9 +711,9 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ print '"; // Ref diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index ff005dd088f..a819577085f 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -818,9 +818,10 @@ class Project extends CommonObject * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param string $option Variant ('', 'nolink') * @param int $addlabel 0=Default, 1=Add label into string, >1=Add first chars into string + * @param string $moreinpopup Text to add into popu * @return string Chaine avec URL */ - function getNomUrl($withpicto=0, $option='', $addlabel=0) + function getNomUrl($withpicto=0, $option='', $addlabel=0, $moreinpopup='') { global $langs; @@ -831,7 +832,8 @@ class Project extends CommonObject if (! empty($this->ref)) $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; if (! empty($this->title)) - $label .= '
' . $langs->trans('Name') . ': ' . $this->title; + $label .= '
' . $langs->trans('Label') . ': ' . $this->title; + if ($moreinpopup) $label.='
'.$moreinpopup; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option != 'nolink') { From 1411772c8145352e4af3b8d1b4b3ed60cd4469b4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Jun 2015 17:07:46 +0200 Subject: [PATCH 37/67] Fix sql error --- htdocs/core/class/html.formprojet.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 9469b680631..9e4ad9d1f59 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -231,7 +231,7 @@ class FormProjets $sql.= " FROM ".MAIN_DB_PREFIX.$table_element; $sql.= " WHERE ".$projectkey." is null"; - if (!empty($socid)) $sql.= " AND fk_soc=".$socid; + if (! empty($socid) && ! in_array($table_element, array('don'))) $sql.= " AND fk_soc=".$socid; if (! in_array($table_element, array('expensereport_det'))) $sql.= ' AND entity='.getEntity('project'); $sql.= " ORDER BY ref DESC"; From aa9f0965c0d8b9cf8814faf095dd4c50c97ec480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Wed, 3 Jun 2015 17:31:42 +0200 Subject: [PATCH 38/67] Qual: PHP5 OOP, commented and typehinted class template --- dev/skeletons/skeleton_class.class.php | 647 ++++++++++++++----------- 1 file changed, 352 insertions(+), 295 deletions(-) diff --git a/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php index 1f5b56e661b..21c1beda9a1 100644 --- a/dev/skeletons/skeleton_class.class.php +++ b/dev/skeletons/skeleton_class.class.php @@ -1,7 +1,8 @@ - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2015 Florian Henry +/* Copyright (C) 2007-2012 Laurent Destailleur + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2015 Florian Henry + * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software; you can redistribute it and/or modify @@ -19,407 +20,463 @@ */ /** - * \file dev/skeletons/skeleton_class.class.php - * \ingroup mymodule othermodule1 othermodule2 - * \brief This file is an example for a CRUD class file (Create/Read/Update/Delete) - * Put here some comments + * \file dev/skeletons/skeleton_class.class.php + * \ingroup mymodule othermodule1 othermodule2 + * \brief This file is an example for a CRUD class file (Create/Read/Update/Delete) + * Put some comments here */ // Put here all includes required by your class file -require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); -//require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); -//require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); - +require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; /** - * Put here description of your class + * Class Skeleton_Class + * + * Put here description of your class */ class Skeleton_Class extends CommonObject { - var $db; //!< To store db handler - var $error; //!< To return error code (or message) - var $errors=array(); //!< To return several error codes (or messages) - var $element='skeleton'; //!< Id that identify managed objects - var $table_element='skeleton'; //!< Name of table without prefix where object is stored + /** + * @var DoliDb Database handler + */ + protected $db; - var $lines=array(); + /** + * @var string Error code (or message) + * @deprecated + * @see Skeleton_Class::errors + */ + public $error; + /** + * @var string[] Error codes (or messages) + */ + public $errors = array(); + /** + * @var string Id to identify managed objects + */ + public $element = 'skeleton'; + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'skeleton'; - var $id; - var $prop1; - var $prop2; + /** + * @var Skeleton_ClassLine[] Lines + */ + public $lines = array(); + + /** + * @var int ID + */ + public $id; + /** + * @var mixed Sample property 1 + */ + public $prop1; + /** + * @var mixed Sample property 2 + */ + public $prop2; //... + /** + * Constructor + * + * @param DoliDb $db Database handler + */ + public function __construct( DoliDB $db ) + { + $this->db = $db; - /** - * Constructor - * - * @param DoliDb $db Database handler - */ - function __construct($db) - { - $this->db = $db; - return 1; - } + return 1; + } + /** + * Create object into database + * + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * + * @return int <0 if KO, Id of created object if OK + */ + public function create( User $user, $notrigger = false ) + { + dol_syslog( __METHOD__, LOG_DEBUG ); - /** - * Create object into database - * - * @param User $user User that creates - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 if KO, Id of created object if OK - */ - function create($user, $notrigger=0) - { - global $conf, $langs; - $error=0; + $error = 0; // Clean parameters - if (isset($this->prop1)) $this->prop1=trim($this->prop1); - if (isset($this->prop2)) $this->prop2=trim($this->prop2); + if (isset( $this->prop1 )) { + $this->prop1 = trim( $this->prop1 ); + } + if (isset( $this->prop2 )) { + $this->prop2 = trim( $this->prop2 ); + } //... // Check parameters // Put here code to add control on parameters values - // Insert request - $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."("; - $sql.= " field1,"; - $sql.= " field2"; + // Insert request + $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; + $sql .= ' field1,'; + $sql .= ' field2'; //... - $sql.= ") VALUES ("; - $sql.= " '".$this->prop1."',"; - $sql.= " '".$this->prop2."'"; + $sql .= ') VALUES ('; + $sql .= ' \'' . $this->prop1 . '\','; + $sql .= ' \'' . $this->prop2 . '\''; //... - $sql.= ")"; + $sql .= ')'; $this->db->begin(); - dol_syslog(__METHOD__, LOG_DEBUG); - $resql=$this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + $resql = $this->db->query( $sql ); + if (!$resql) { + $error ++; + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR ); + } - if (! $error) - { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); + if (!$error) { + $this->id = $this->db->last_insert_id( MAIN_DB_PREFIX . $this->table_element ); - if (! $notrigger) - { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action to call a trigger. + if (!$notrigger) { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action to call a trigger. - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_CREATE',$user); - //if ($result < 0) $error++; - //// End call triggers + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_CREATE',$user); + //if ($result < 0) $error++; + //// End call triggers } - } + } - // Commit or rollback - if ($error) - { + // Commit or rollback + if ($error) { $this->db->rollback(); - return -1*$error; - } - else - { + + return - 1 * $error; + } else { $this->db->commit(); - return $this->id; + + return $this->id; } - } + } + /** + * Load object in memory from the database + * + * @param int $id Id object + * @param string $ref Ref + * + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetch( $id, $ref = null ) + { + dol_syslog( __METHOD__, LOG_DEBUG ); - /** - * Load object in memory from the database - * - * @param int $id Id object - * @param string $ref Ref - * @return int <0 if KO, 0 if not found, >0 if OK - */ - function fetch($id,$ref='') - { - global $langs; - $sql = "SELECT"; - $sql.= " t.rowid,"; - $sql.= " t.field1,"; - $sql.= " t.field2"; + $sql = 'SELECT'; + $sql .= ' t.rowid,'; + $sql .= ' t.field1,'; + $sql .= ' t.field2'; //... - $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; - if ($ref) $sql.= " WHERE t.ref = '".$ref."'"; - else $sql.= " WHERE t.rowid = ".$id; + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; + if (null !== $ref) { + $sql .= ' WHERE t.ref = ' . '\'' . $ref . '\''; + } else { + $sql .= ' WHERE t.rowid = ' . $id; + } - dol_syslog(get_class($this)."::fetch"); - $resql=$this->db->query($sql); - if ($resql) - { - $numrows = $this->db->num_rows($resql); - if ($numrows) - { - $obj = $this->db->fetch_object($resql); + $resql = $this->db->query( $sql ); + if ($resql) { + $numrows = $this->db->num_rows( $resql ); + if ($numrows) { + $obj = $this->db->fetch_object( $resql ); - $this->id = $obj->rowid; - $this->prop1 = $obj->field1; - $this->prop2 = $obj->field2; + $this->id = $obj->rowid; + $this->prop1 = $obj->field1; + $this->prop2 = $obj->field2; //... - } - $this->db->free($resql); + } + $this->db->free( $resql ); - return ($numrows?1:0); - } - else - { - $this->error="Error ".$this->db->lasterror(); - return -1; - } - } + if ($numrows) { + return 1; + } else { + return 0; + } + } else { + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR ); - /** - * Load object in memory from the database - * - * @param string $sortorder Sort Order + return - 1; + } + } + + /** + * Load object in memory from the database + * + * @param string $sortorder Sort Order * @param string $sortfield Sort field - * @param int $limit offset limit - * @param int $offset offset limit - * @param array $filter filter array + * @param int $limit offset limit + * @param int $offset offset limit + * @param array $filter filter array + * * @return int <0 if KO, >0 if OK - */ - function fetchAll($sortorder, $sortfield, $limit, $offset, $filter = array()) - { - global $langs; - $sql = "SELECT"; - $sql.= " t.rowid,"; - $sql.= " t.field1,"; - $sql.= " t.field2"; - //... - $sql.= " FROM ".MAIN_DB_PREFIX."mytable as t"; + */ + public function fetchAll( $sortorder, $sortfield, $limit, $offset, array $filter = array() ) + { + dol_syslog( __METHOD__, LOG_DEBUG ); - // Manage filter - $sqlwhere=array(); - if (count($filter)>0) { - foreach ( $filter as $key => $value ) { - //$sqlwhere []= ' AND '. $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; - } - } - if (count($sqlwhere)>0) { - $sql.= ' WHERE '.implode(' AND ', $sqlwhere); - } - $sql .= " ORDER BY " . $sortfield . " " . $sortorder . " " . $this->db->plimit($limit + 1, $offset); + $sql = 'SELECT'; + $sql .= ' t.rowid,'; + $sql .= ' t.field1,'; + $sql .= ' t.field2'; + //... + $sql .= ' FROM ' . MAIN_DB_PREFIX . 'mytable as t'; - $this->lines = array (); + // Manage filter + $sqlwhere = array(); + if (count( $filter ) > 0) { + foreach ($filter as $key => $value) { + $sqlwhere [] = ' AND ' . $key . ' LIKE \'%' . $this->db->escape( $value ) . '%\''; + } + } + if (count( $sqlwhere ) > 0) { + $sql .= ' WHERE ' . implode( ' AND ', $sqlwhere ); + } + $sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ' ' . $this->db->plimit( $limit + 1, $offset ); - dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); + $this->lines = array(); - while ($obj = $this->db->fetch_object($resql)) - { - $line=new Skeleton_ClassLine(); + $resql = $this->db->query( $sql ); + if ($resql) { + $num = $this->db->num_rows( $resql ); - $line->id = $obj->rowid; - $line->prop1 = $obj->field1; - $line->prop2 = $obj->field2; + while ($obj = $this->db->fetch_object( $resql )) { + $line = new Skeleton_ClassLine(); - $this->lines[]=$line; - //... - } - $this->db->free($resql); + $line->id = $obj->rowid; + $line->prop1 = $obj->field1; + $line->prop2 = $obj->field2; - return $num; - } - else - { - $this->error="Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetchAll ".$this->error, LOG_ERR); - return -1; - } - } + $this->lines[] = $line; + //... + } + $this->db->free( $resql ); + return $num; + } else { + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR ); - /** - * Update object into database - * - * @param User $user User that modifies - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 if KO, >0 if OK - */ - function update($user, $notrigger=0) - { - global $conf, $langs; - $error=0; + return - 1; + } + } + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * + * @return int <0 if KO, >0 if OK + */ + public function update( User $user, $notrigger = false ) + { + $error = 0; + + dol_syslog( __METHOD__, LOG_DEBUG ); // Clean parameters - if (isset($this->prop1)) $this->prop1=trim($this->prop1); - if (isset($this->prop2)) $this->prop2=trim($this->prop2); + if (isset( $this->prop1 )) { + $this->prop1 = trim( $this->prop1 ); + } + if (isset( $this->prop2 )) { + $this->prop2 = trim( $this->prop2 ); + } //... // Check parameters // Put here code to add a control on parameters values - // Update request - $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; - $sql.= " field1=".(isset($this->field1)?"'".$this->db->escape($this->field1)."'":"null").","; - $sql.= " field2=".(isset($this->field2)?"'".$this->db->escape($this->field2)."'":"null").""; + // Update request + $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; + if (isset( $this->field1 )) { + $sql .= ' field1=\'' . $this->db->escape( $this->field1 ) . '\','; + } else { + $sql .= ' field1=null' . ','; + } + if (isset( $this->field2 )) { + $sql .= ' field2=\'' . $this->db->escape( $this->field2 ) . '\''; + } else { + $sql .= ' field2=null'; + } //... - $sql.= " WHERE rowid=".$this->id; + $sql .= ' WHERE rowid=' . $this->id; $this->db->begin(); - dol_syslog(__METHOD__); - $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - - if (! $error && ! $notrigger) - { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. - - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); - //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - //// End call triggers + $resql = $this->db->query( $sql ); + if (!$resql) { + $error ++; + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR ); } - // Commit or rollback - if ($error) - { + if (!$error && !$notrigger) { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + //// End call triggers + } + + // Commit or rollback + if ($error) { $this->db->rollback(); - return -1*$error; - } - else - { + + return - 1 * $error; + } else { $this->db->commit(); - return 1; - } - } - - /** - * Delete object in database - * - * @param User $user User that deletes - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 if KO, >0 if OK - */ - function delete($user, $notrigger=0) - { - global $conf, $langs; - $error=0; - - $this->db->begin(); - - if (! $error) - { - if (! $notrigger) - { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. - - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_DELETE',$user); - //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - //// End call triggers - } - } - - if (! $error) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; - $sql.= " WHERE rowid=".$this->id; - - dol_syslog(__METHOD__); - $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - } - - // Commit or rollback - if ($error) - { - $this->db->rollback(); - return -1*$error; - } - else - { - $this->db->commit(); return 1; } } + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * + * @return int <0 if KO, >0 if OK + */ + public function delete( User $user, $notrigger = false ) + { + dol_syslog( __METHOD__, LOG_DEBUG ); + $error = 0; + + $this->db->begin(); + + if (!$error) { + if (!$notrigger) { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_DELETE',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + //// End call triggers + } + } + + if (!$error) { + $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; + $sql .= ' WHERE rowid=' . $this->id; + + $resql = $this->db->query( $sql ); + if (!$resql) { + $error ++; + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR ); + } + } + + // Commit or rollback + if ($error) { + $this->db->rollback(); + + return - 1 * $error; + } else { + $this->db->commit(); + + return 1; + } + } /** - * Load an object from its id and create a new one in database + * Load an object from its id and create a new one in database * - * @param int $fromid Id of object to clone - * @return int New id of clone + * @param int $fromid Id of object to clone + * + * @return int New id of clone */ - function createFromClone($fromid) + public function createFromClone( $fromid ) { - global $user,$langs; + dol_syslog( __METHOD__, LOG_DEBUG ); - $error=0; - - $object=new Skeleton_Class($this->db); + global $user; + $error = 0; + $object = new Skeleton_Class( $this->db ); $this->db->begin(); // Load source object - $object->fetch($fromid); - $object->id=0; - $object->statut=0; + $object->fetch( $fromid ); + // Reset object + $object->id = 0; // Clear fields // ... // Create clone - $result=$object->create($user); + $result = $object->create( $user ); // Other options - if ($result < 0) - { - $this->error=$object->error; - $error++; - } - - if (! $error) - { - - + if ($result < 0) { + $error ++; + $this->errors = $object->errors; + dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR ); } // End - if (! $error) - { + if (!$error) { $this->db->commit(); + return $object->id; - } - else - { + } else { $this->db->rollback(); - return -1; + + return - 1; } } - /** - * Initialise object with example values - * Id must be 0 if object instance is a specimen + * Initialise object with example values + * Id must be 0 if object instance is a specimen * - * @return void + * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { - $this->id=0; - $this->prop1='prop1'; - $this->prop2='prop2'; + $this->id = 0; + $this->prop1 = 'prop1'; + $this->prop2 = 'prop2'; } } +/** + * Class Skeleton_ClassLine + */ class Skeleton_ClassLine { - var $id; - var $prop1; - var $prop2; + /** + * @var int ID + */ + public $id; + /** + * @var mixed Sample line property 1 + */ + public $prop1; + /** + * @var mixed Sample line property 2 + */ + public $prop2; } From c57693a245c748378193d08465e20af737039680 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Jun 2015 18:08:30 +0200 Subject: [PATCH 39/67] Fix bad param on select box for project --- htdocs/don/card.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index cca760f54d6..2056ebad4bd 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -388,16 +388,18 @@ if (! empty($id) && $action == 'edit') $hselected='card'; $head = donation_prepare_head($object); - dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic'); print '
'; print ''; - print '
' . $langs->trans('Ref') . '' . $langs->trans("Draft") . '
' . $langs->trans('Ref') . '' . $langs->trans("Draft") . '
' . $langs->trans('RefCustomer') . ''; @@ -1422,14 +1423,16 @@ if ($action == 'create' && $user->rights->commande->creer) // Project if (! empty($conf->projet->enabled) && $socid > 0) { - $formproject = new FormProjets($db); + $projectid = GETPOST('projectid')?GETPOST('projectid'):0; + if ($origin == 'project') $projectid = ($originid ? $originid : 0); - print '
' . $langs->trans('Project') . ''; + $langs->load("projects"); + print '
' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); - if ($numprojet == 0) { - print '   ' . $langs->trans("AddProject") . ''; - } - print '
' . $langs->trans('NotePublic') . ''; - $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); // print ''; print '
' . $langs->trans('NotePrivate') . ''; - $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); // print ''; print '
' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc) . "
' . $langs->trans('Type') . ''; - print '' . "\n"; + + print '
' . "\n"; // Standard invoice - print '
' . "\n"; + print ''; if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid)))) { // Deposit - print '' . "\n"; + + print ''; } if ($socid > 0) { if (! empty($conf->global->INVOICE_USE_SITUATION)) { - // First situation invoice - print '' . "\n"; + // First situation invoice + print '
'; + $tmp=' '; + $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceFirstSituationAsk"), $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3); + print $desc; + print '
'; - // Next situation invoice - $opt = $form->load_situation_invoices(GETPOST('originid'), $socid); - print '' . "\n"; + // Next situation invoice + $opt = $form->load_situation_invoices(GETPOST('originid'), $socid); + print '
'; + $tmp='' . $langs->trans('NoSituations') . '') || (GETPOST('origin') && GETPOST('origin') != 'facture')) $tmp.=' disabled'; + $tmp.= '> '; + $text = $tmp.$langs->trans("InvoiceSituationAsk") . ' '; + $text .= ''; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceSituationDesc"), 1, 'help', '', 0, 3); + print $desc; + print '
'; } // Replacement - print '' . "\n"; + print ''; } else { - print '' . "\n"; + print ''; } if (empty($origin)) @@ -2191,12 +2192,10 @@ if ($action == 'create') if ($socid > 0) { // Credit note - print '' . "\n"; + print ''; } else { - print '' . "\n"; + print '' . "\n"; } } - print '
'; - print ''; - print ''; - $desc = $form->textwithpicto($langs->trans("InvoiceStandardAsk"), $langs->transnoentities("InvoiceStandardDesc"), 1); + print '
'; + $tmp=' '; + $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceStandardAsk"), $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3); print $desc; - print '
'; - print ''; - print ''; + print '
'; + $tmp=' '; print ''; - $desc = $form->textwithpicto($langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1); - print ''; - if (($origin == 'propal') || ($origin == 'commande')) { + + $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3); + print '
' . $desc . '
'; + if (($origin == 'propal') || ($origin == 'commande')) + { print '
'; + print $desc; + print ''; $arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount'); print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1); @@ -2113,44 +2118,41 @@ if ($action == 'create') print '' . $langs->trans('Value') . ':'; } print '
'; - print '
'; - print ''; - print ''; - $desc = $form->textwithpicto($langs->trans("InvoiceFirstSituationAsk"), $langs->transnoentities("InvoiceFirstSituationDesc"), 1); - print $desc; - print '
'; - print '' . $langs->trans('NoSituations') . '' || (GETPOST('origin') && GETPOST('origin') != 'facture')) print 'disabled'; - print '>'; - print ''; - $text = $langs->trans("InvoiceSituationAsk") . ' '; - $text .= ''; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceSituationDesc"), 1); - print $desc; - print '
'; - print ''; - print ''; + print '
'; + $tmp=' jQuery(document).ready(function() { jQuery("#fac_replacement").change(function() { @@ -2158,7 +2160,7 @@ if ($action == 'create') }); }); '; - $text = $langs->trans("InvoiceReplacementAsk") . ' '; + $text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' '; $text .= ''; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1); + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); print $desc; - print '
'; - print ''; - print ''; - $text = $langs->trans("InvoiceReplacement") . ' '; + print '
'; + $tmp=' '; + $text = $tmp.$langs->trans("InvoiceReplacement") . ' '; $text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1); + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); print $desc; - print '
'; - print ''; - print ''; + print '
'; + $tmp=' jQuery(document).ready(function() { @@ -2212,7 +2211,7 @@ if ($action == 'create') }); }); '; - $text = $langs->transnoentities("InvoiceAvoirAsk") . ' '; + $text = $tmp.$langs->transnoentities("InvoiceAvoirAsk") . ' '; // $text.=''; $text .= ''; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1); + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); print $desc; print '
'; @@ -2233,22 +2232,22 @@ if ($action == 'create') print '
    0 ? 'checked':'').' /> "; print '
'; - print '
'; - print ''; - print ''; - $text = $langs->trans("InvoiceAvoir") . ' '; + print '
'; + $tmp=' '; + $text = $tmp.$langs->trans("InvoiceAvoir") . ' '; $text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1); + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); print $desc; - print '
'; + print ''; + print '
' . $langs->trans('Project') . ''; - $formproject->select_projects($soc->id, $projectid, 'projectid', 0); + $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); + print '   id).'">' . $langs->trans("AddProject") . ''; print '
' . $langs->trans('Model') . ''; include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php'; @@ -2337,7 +2339,7 @@ if ($action == 'create') { $note_public = $objectsrc->note_public; } - $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); // Private note @@ -2351,7 +2353,7 @@ if ($action == 'create') { $note_private = $objectsrc->note_private; } - $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); // print ' print '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($objectsrc->total_localtax2) . "
' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc) . "
'; @@ -3486,50 +3490,50 @@ if ($action == 'create') // Show global modifiers if (! empty($conf->global->INVOICE_US_SITUATION)) { - if ($object->situation_cycle_ref && $object->statut == 0) { - print '
 ' . $langs->trans('ModifyAllLines') . '     ' . $langs->trans('Progress') . '       
' . $langs->trans('ModifyAllLines') . '     ' . $langs->trans('Progress') . '      
  
     %
     %
'.$langs->trans("Status").''; + print ''; + print $object->LibStatut($status, 4); + print '
'.$langs->trans("Visibility").''; $array=array(0 => $langs->trans("PrivateProject"),1 => $langs->trans("SharedProject")); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 8d3e9f39a08..ff005dd088f 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -125,12 +125,12 @@ class Project extends CommonObject $sql.= ", '" . $this->db->escape($this->description) . "'"; $sql.= ", " . ($this->socid > 0 ? $this->socid : "null"); $sql.= ", " . $user->id; - $sql.= ", 0"; + $sql.= ", ".(is_numeric($this->statuts) ? $this->statuts : '0'); $sql.= ", " . ($this->public ? 1 : 0); $sql.= ", '".$this->db->idate($now)."'"; $sql.= ", " . ($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null'); $sql.= ", " . ($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); - $sql.= ", " . ($this->budget_amount != ''?price2num($this->budget_amount):'null'); + $sql.= ", " . ($this->budget_amount != '' ? price2num($this->budget_amount) : 'null'); $sql.= ", ".$conf->entity; $sql.= ")"; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 2a63e558801..93bd5a09d9a 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -448,6 +448,10 @@ textarea.centpercent { #formuserfile_link { margin-left: 1px; } +.listofinvoicetype { + height: 28px; + vertical-align: middle; +} /* Style to move picto into left of button */ /* From 4adeb8980d865b9d854ea7b4aa9b3b3f074cad0e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Jun 2015 16:40:02 +0200 Subject: [PATCH 34/67] NEW Add ref and label of project into export --- htdocs/core/modules/modFournisseur.class.php | 30 ++++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index ef8b3f7888c..d43535dd4e1 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -279,10 +279,13 @@ class modFournisseur extends DolibarrModules $this->export_label[$r]='Factures fournisseurs et lignes de facture'; $this->export_icon[$r]='bill'; $this->export_permission[$r]=array(array("fournisseur","facture","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_buy'=>'ProductAccountancyBuyCode'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId', + 'p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_buy'=>'ProductAccountancyBuyCode','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel'); //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Number','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text'); - $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Number','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text'); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_buy'=>'product'); + $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Number','fd.fk_product'=>'List:product:label', + 'p.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text'); + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product', + 'p.ref'=>'product','p.label'=>'product','p.accountancy_code_buy'=>'product','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project'); $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them // Add extra fields object $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'"; @@ -362,6 +365,7 @@ class modFournisseur extends DolibarrModules $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture_fourn as f'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as project on (f.fk_projet = project.rowid)'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_extrafields as extra ON f.rowid = extra.fk_object'; $this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'facture_fourn_det as fd'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_det_extrafields as extraline ON fd.rowid = extraline.fk_object'; @@ -374,10 +378,13 @@ class modFournisseur extends DolibarrModules $this->export_label[$r]='Factures fournisseurs et reglements'; $this->export_icon[$r]='bill'; $this->export_permission[$r]=array(array("fournisseur","facture","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment', + 'p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel'); //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number'); - $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number'); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment'); + $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'pf.amount'=>'Number', + 'p.datep'=>'Date','p.num_paiement'=>'Number','project.ref'=>'Text','project.title'=>'Text'); + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment', + 'p.datep'=>'payment','p.num_paiement'=>'payment','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project'); $this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them // Add extra fields object $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'"; @@ -420,6 +427,7 @@ class modFournisseur extends DolibarrModules $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture_fourn as f'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as project on (f.fk_projet = project.rowid)'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_extrafields as extra ON f.rowid = extra.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn as p ON pf.fk_paiementfourn = p.rowid'; @@ -432,14 +440,17 @@ class modFournisseur extends DolibarrModules $this->export_label[$r]='Commandes fournisseurs et lignes de commandes'; $this->export_icon[$r]='order'; $this->export_permission[$r]=array(array("fournisseur","commande","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.date_approve'=>'DateApprove','f.date_approve2'=>'DateApprove2','f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'ua1.login'=>'ApprovedBy','ua2.login'=>'ApprovedBy2','fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.date_approve'=>'DateApprove','f.date_approve2'=>'DateApprove2','f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'ua1.login'=>'ApprovedBy','ua2.login'=>'ApprovedBy2','fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId', + 'p.ref'=>'ProductRef','p.label'=>'ProductLabel','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel'); if (empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL)) { unset($this->export_fields_array['f.date_approve2']); unset($this->export_fields_array['ua2.login']); } - $this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.fk_statut'=>'Status','f.date_approve'=>'Date','f.date_approve2'=>'Date','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Number",'fd.qty'=>"Number",'fd.remise_percent'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.total_tva'=>"Number",'fd.product_type'=>'Number','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text'); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','ua1.login'=>'user','ua2.login'=>'user','fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product'); + $this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.fk_statut'=>'Status','f.date_approve'=>'Date','f.date_approve2'=>'Date','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Number",'fd.qty'=>"Number",'fd.remise_percent'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.total_tva'=>"Number",'fd.product_type'=>'Number','fd.fk_product'=>'List:product:label', + 'p.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text'); + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','ua1.login'=>'user','ua2.login'=>'user','fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product', + 'p.ref'=>'product','p.label'=>'product','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project'); $this->export_dependencies_array[$r]=array('order_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them // Add extra fields object $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseur'"; @@ -520,6 +531,7 @@ class modFournisseur extends DolibarrModules $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande_fournisseur as f'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as project on (f.fk_projet = project.rowid)'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as ua1 ON ua1.rowid = f.fk_user_approve'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as ua2 ON ua2.rowid = f.fk_user_approve2'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur_extrafields as extra ON f.rowid = extra.fk_object,'; From 76865c00b52be36d747964b6005dbd51af8dcb34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Jun 2015 16:49:22 +0200 Subject: [PATCH 35/67] NEW The line where mouse is over can be highlight with option THEME_ELDY_USE_HOVER (on by default) --- htdocs/theme/eldy/style.css.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 93bd5a09d9a..a546ba1544a 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -155,8 +155,8 @@ $colortext =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty( $fontsize =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE1) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE1) :(empty($user->conf->THEME_ELDY_FONT_SIZE1)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE1); $fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE2) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE2) :(empty($user->conf->THEME_ELDY_FONT_SIZE2)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE2); // No hover by default, we keep only if we set var THEME_ELDY_USE_HOVER -if ((! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) && empty($user->conf->THEME_ELDY_USE_HOVER)) - || (empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) && empty($conf->global->THEME_ELDY_USE_HOVER))) +if ((! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) && (isset($user->conf->THEME_ELDY_USE_HOVER) && $user->conf->THEME_ELDY_USE_HOVER == '0')) + || (empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) && (isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0'))) { $colorbacklineimpairhover=''; $colorbacklinepairhover=''; From d109c78c6bc1eb76c9c391e353d4e7494dfefbcc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Jun 2015 16:59:48 +0200 Subject: [PATCH 36/67] Fix label of project was not visible --- htdocs/core/lib/project.lib.php | 8 ++++---- htdocs/projet/class/project.class.php | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index ee024c60c2a..1bf4c9531df 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -541,8 +541,8 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t { $projectstatic->id=$lines[$i]->fk_project; $projectstatic->ref=$lines[$i]->projectref; + $projectstatic->title=$lines[$i]->projectlabel; $projectstatic->public=$lines[$i]->public; - $projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]; $taskstatic->id=$lines[$i]->id; @@ -550,7 +550,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t // Project print ""; - print $projectstatic->getNomUrl(1); + print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); print "'; $projectstatic->id=$lines[$i]->fk_project; $projectstatic->ref=$lines[$i]->projectref; + $projectstatic->title=$lines[$i]->projectlabel; $projectstatic->public=$lines[$i]->public; - $projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]; - print $projectstatic->getNomUrl(1); + print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); print "
'; - print ''; print ''; print ''; + + dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic'); + + print '
'; + // Ref print "".''; } @@ -482,11 +484,11 @@ if (! empty($id) && $action == 'edit') print "
'.$langs->trans("Ref").''; print $object->getNomUrl(); @@ -468,7 +470,7 @@ if (! empty($id) && $action == 'edit') $langs->load('projects'); print '
'.$langs->trans('Project').''; - $formproject->select_projects(-1, $object->fk_projet,'fk_projet', 0, 1, 0, 1); + $formproject->select_projects(-1, $object->fk_projet,'fk_projet', 0, 0, 1, 1); print '
\n"; - print '
   
'; + dol_fiche_end(); + + print '
   
'; print "\n"; - - print "\n"; } From 995645800ed3eba33d2e5b7bac13d0578bb9b6b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Jun 2015 18:24:09 +0200 Subject: [PATCH 40/67] Fix loading of project --- htdocs/core/class/commonobject.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 10f91a07631..bb481807e16 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -759,10 +759,14 @@ abstract class CommonObject */ function fetch_projet() { + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + + if (empty($this->fk_project) && ! empty($this->fk_projet)) $this->fk_project = $this->fk_projet; // For backward compatibility if (empty($this->fk_project)) return 0; $project = new Project($this->db); $result = $project->fetch($this->fk_project); + $this->projet = $project; // deprecated $this->project = $project; return $result; From dd8a0b849a22a2796350e8892e00ba9c750a13d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Jun 2015 21:01:50 +0200 Subject: [PATCH 41/67] NEW If module salaries is on, you can set a hourly value for tome consumed by users. Each time a user enter its time consumed on a project, a calculation is done to provide the cost for human services. This value appears into the "Transversal view" of project. --- htdocs/core/class/html.form.class.php | 13 +- htdocs/core/class/html.formprojet.class.php | 12 +- htdocs/core/lib/functions.lib.php | 1 + htdocs/don/card.php | 5 +- htdocs/langs/en_US/projects.lang | 5 +- htdocs/projet/card.php | 2 +- htdocs/projet/class/project.class.php | 31 ++-- htdocs/projet/class/task.class.php | 55 ++++++- htdocs/projet/element.php | 150 +++++++++++++++++--- htdocs/projet/tasks/contact.php | 8 +- htdocs/projet/tasks/time.php | 10 +- 11 files changed, 240 insertions(+), 52 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a53c3b3e925..1ecc6dc9aea 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1248,10 +1248,11 @@ class Form * @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status * @param string $morefilter Add more filters into sql request * @param string $show_every 0=default list, 1=add also a value "Everybody" at beginning of list + * @param string $enableonlytext If option $enableonly is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty. * @return string HTML select string * @see select_dolgroups */ - function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='', $show_every=0) + function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='') { global $conf,$user,$langs; @@ -1347,8 +1348,8 @@ class Form $userstatic->lastname=$obj->lastname; $userstatic->firstname=$obj->firstname; - $disableline=0; - if (is_array($enableonly) && count($enableonly) && ! in_array($obj->rowid,$enableonly)) $disableline=1; + $disableline=''; + if (is_array($enableonly) && count($enableonly) && ! in_array($obj->rowid,$enableonly)) $disableline=($enableonlytext?$enableonlytext:'1'); if ((is_object($selected) && $selected->id == $obj->rowid) || (! is_object($selected) && $selected == $obj->rowid)) { @@ -1398,6 +1399,10 @@ class Form } } $out.=($moreinfo?')':''); + if ($disableline && $disableline != '1') + { + $out.=' - '.$disableline; // This is text from $enableonlytext parameter + } $out.= ''; $i++; @@ -4248,6 +4253,7 @@ class Form $hourSelected=0; $minSelected=0; + // Hours if ($iSecond != '') { require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -4278,6 +4284,7 @@ class Form $retstring.=' '.$langs->trans('HourShort'); + // Minutes if ($minunderhours) $retstring.='
'; else $retstring.=" "; diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 9e4ad9d1f59..681c667854f 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -147,13 +147,15 @@ class FormProjets $labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany"); } - if (!empty($selected) && $selected == $obj->rowid && $obj->fk_statut > 0) + if (!empty($selected) && $selected == $obj->rowid) { - $out.= ''; + $out.= '