diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml
index 6098a0e0139..0b39529ff66 100644
--- a/dev/setup/codesniffer/ruleset.xml
+++ b/dev/setup/codesniffer/ruleset.xml
@@ -201,7 +201,7 @@
0
-
+
diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php
index f5b13437ba9..4605b9f200e 100644
--- a/htdocs/categories/class/api_categories.class.php
+++ b/htdocs/categories/class/api_categories.class.php
@@ -53,7 +53,7 @@ class Categories extends DolibarrApi
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
global $db, $conf;
$this->db = $db;
@@ -70,7 +70,7 @@ class Categories extends DolibarrApi
*
* @throws RestException
*/
- function get($id)
+ public function get($id)
{
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401);
@@ -103,7 +103,7 @@ class Categories extends DolibarrApi
*
* @throws RestException
*/
- function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '')
+ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '')
{
global $db, $conf;
@@ -173,7 +173,7 @@ class Categories extends DolibarrApi
* @param array $request_data Request data
* @return int ID of category
*/
- function post($request_data = null)
+ public function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->categorie->creer) {
throw new RestException(401);
@@ -198,7 +198,7 @@ class Categories extends DolibarrApi
* @param array $request_data Datas
* @return int
*/
- function put($id, $request_data = null)
+ public function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->categorie->creer) {
throw new RestException(401);
@@ -234,7 +234,7 @@ class Categories extends DolibarrApi
* @param int $id Category ID
* @return array
*/
- function delete($id)
+ public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->categorie->supprimer) {
throw new RestException(401);
@@ -267,7 +267,7 @@ class Categories extends DolibarrApi
* @param Categorie $object Object to clean
* @return array Array of cleaned object properties
*/
- function _cleanObjectDatas($object)
+ private function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);
@@ -324,7 +324,7 @@ class Categories extends DolibarrApi
*
* @throws RestException
*/
- function _validate($data)
+ private function _validate($data)
{
$category = array();
foreach (Categories::$FIELDS as $field) {
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index 20d9a862f33..f162bc68bba 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -10,7 +10,7 @@
* Copyright (C) 2015 Marcos García
* Copyright (C) 2015 Raphaël Doursenaud
* Copyright (C) 2016 Charlie Benke
- * Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2018-2019 Frédéric France
*
* 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
@@ -107,7 +107,7 @@ class Categorie extends CommonObject
'account' => 'account', // old for bank_account
'bank_account' => 'account',
'project' => 'project',
- );
+ );
/**
* @var array Category tables mapping from type string
@@ -221,7 +221,7 @@ class Categorie extends CommonObject
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -234,7 +234,7 @@ class Categorie extends CommonObject
* @param string $type Type of category ('product', '...') or (0, 1, ...)
* @return int <0 if KO, >0 if OK
*/
- function fetch($id, $label = '', $type = null)
+ public function fetch($id, $label = '', $type = null)
{
global $conf;
@@ -297,15 +297,15 @@ class Categorie extends CommonObject
}
/**
- * Add category into database
+ * Add category into database
*
- * @param User $user Object user
- * @return int -1 : SQL error
+ * @param User $user Object user
+ * @return int -1 : SQL error
* -2 : new ID unknown
* -3 : Invalid category
* -4 : category already exists
*/
- function create($user)
+ public function create($user)
{
global $conf,$langs,$hookmanager;
$langs->load('categories');
@@ -426,7 +426,7 @@ class Categorie extends CommonObject
* -1 : SQL error
* -2 : invalid category
*/
- function update(User $user)
+ public function update(User $user)
{
global $conf, $langs,$hookmanager;
@@ -501,7 +501,7 @@ class Categorie extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 KO >0 OK
*/
- function delete($user, $notrigger = 0)
+ public function delete($user, $notrigger = 0)
{
global $conf,$langs;
@@ -588,7 +588,7 @@ class Categorie extends CommonObject
* @param string $type Type of category ('product', ...)
* @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked
*/
- function add_type($obj, $type)
+ public function add_type($obj, $type)
{
// phpcs:enable
global $user,$langs,$conf;
@@ -682,7 +682,7 @@ class Categorie extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Delete object from category
*
@@ -691,7 +691,7 @@ class Categorie extends CommonObject
*
* @return int 1 if OK, -1 if KO
*/
- function del_type($obj, $type)
+ public function del_type($obj, $type)
{
// phpcs:enable
global $user,$langs,$conf;
@@ -749,7 +749,7 @@ class Categorie extends CommonObject
* @return array|int -1 if KO, array of instance of object if OK
* @see containsObject
*/
- function getObjectsInCateg($type, $onlyids = 0)
+ public function getObjectsInCateg($type, $onlyids = 0)
{
$objs = array();
@@ -796,7 +796,7 @@ class Categorie extends CommonObject
* @return int Number of occurrences
* @see getObjectsInCateg
*/
- function containsObject($type, $object_id)
+ public function containsObject($type, $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;
@@ -821,7 +821,7 @@ class Categorie extends CommonObject
* @param int $page Page number
* @return array|int Array of categories, 0 if no cat, -1 on error
*/
- function getListForItem($id, $type = 'customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
+ public function getListForItem($id, $type = 'customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{
global $conf;
@@ -913,7 +913,7 @@ class Categorie extends CommonObject
*
* @return array|int <0 KO, array ok
*/
- function get_filles()
+ public function get_filles()
{
// phpcs:enable
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie";
@@ -974,7 +974,7 @@ class Categorie extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Rebuilding the category tree as an array
* Return an array of table('id','id_mere',...) trie selon arbre et avec:
@@ -990,7 +990,7 @@ class Categorie extends CommonObject
*
* @return array|int Array of categories. this->cats and this->motherof are set, -1 on error
*/
- function get_full_arbo($type, $markafterid = 0)
+ public function get_full_arbo($type, $markafterid = 0)
{
// phpcs:enable
global $conf, $langs;
@@ -1068,7 +1068,7 @@ class Categorie extends CommonObject
return $this->cats;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* For category id_categ and its childs available in this->cats, define property fullpath and fulllabel
*
@@ -1076,8 +1076,8 @@ class Categorie extends CommonObject
* @param int $protection Deep counter to avoid infinite loop
* @return void
*/
- function build_path_from_id_categ($id_categ, $protection = 1000)
- {
+ public function build_path_from_id_categ($id_categ, $protection = 1000)
+ {
// phpcs:enable
dol_syslog(get_class($this)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG);
@@ -1112,13 +1112,13 @@ class Categorie extends CommonObject
return;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Display content of $this->cats
*
* @return void
*/
- function debug_cats()
+ public function debug_cats()
{
// phpcs:enable
// Display $this->cats
@@ -1135,7 +1135,7 @@ class Categorie extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns all categories
*
@@ -1143,7 +1143,7 @@ class Categorie extends CommonObject
* @param boolean $parent Just parent categories if true
* @return array|int Table of Object Category, -1 on error
*/
- function get_all_categories($type = null, $parent = false)
+ public function get_all_categories($type = null, $parent = false)
{
// phpcs:enable
if (! is_numeric($type)) $type = $this->MAP_ID[$type];
@@ -1174,13 +1174,13 @@ class Categorie extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Check if no category with same label already exists for this cat's parent or root and for this cat's type
*
* @return integer 1 if already exist, 0 otherwise, -1 if error
*/
- function already_exists()
+ public function already_exists()
{
// phpcs:enable
$type=$this->type;
@@ -1225,20 +1225,20 @@ class Categorie extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the top level categories (which are not girls)
*
* @param int $type Type of category (0, 1, ...)
* @return array
*/
- function get_main_categories($type = null)
+ public function get_main_categories($type = null)
{
// phpcs:enable
return $this->get_all_categories($type, true);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the path of the category, with the names of the categories
* separated by $sep (" >> " by default)
@@ -1248,7 +1248,7 @@ class Categorie extends CommonObject
* @param int $nocolor 0
* @return array
*/
- function print_all_ways($sep = " >> ", $url = '', $nocolor = 0)
+ public function print_all_ways($sep = " >> ", $url = '', $nocolor = 0)
{
// phpcs:enable
$ways = array();
@@ -1297,13 +1297,13 @@ class Categorie extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns an array containing the list of parent categories
*
* @return int|array <0 KO, array OK
*/
- function get_meres()
+ public function get_meres()
{
// phpcs:enable
$parents = array();
@@ -1333,14 +1333,14 @@ class Categorie extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns in a table all possible paths to get to the category
* starting with the major categories represented by Tables of categories
*
* @return array
*/
- function get_all_ways()
+ public function get_all_ways()
{
// phpcs:enable
$ways = array();
@@ -1376,7 +1376,7 @@ class Categorie extends CommonObject
* labels, 'id'= Get array of category IDs
* @return array|int Array of category objects or < 0 if KO
*/
- function containing($id, $type, $mode = 'object')
+ public function containing($id, $type, $mode = 'object')
{
$cats = array();
@@ -1458,7 +1458,7 @@ class Categorie extends CommonObject
* @param boolean $case Case sensitive (true/false)
* @return array|int Array of category id, -1 if error
*/
- function rechercher($id, $nom, $type, $exact = false, $case = false)
+ public function rechercher($id, $nom, $type, $exact = false, $case = false)
{
// Deprecation warning
if (is_numeric($type)) {
@@ -1468,13 +1468,12 @@ class Categorie extends CommonObject
$cats = array();
// For backward compatibility
- if (is_numeric($type)) {
+ 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) . "::rechercher(): numeric types are deprecated, please use string instead",
- LOG_WARNING );
- }
+ 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";
@@ -1522,7 +1521,7 @@ dol_syslog( get_class($this) . "::rechercher(): numeric types are deprecated, pl
* @param int $maxlength Max length of text
* @return string Chaine avec URL
*/
- function getNomUrl($withpicto = 0, $option = '', $maxlength = 0)
+ public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0)
{
global $langs;
@@ -1557,7 +1556,7 @@ dol_syslog( get_class($this) . "::rechercher(): numeric types are deprecated, pl
* @param string $file Nom du fichier uploade
* @return void
*/
- function add_photo($sdir, $file)
+ public function add_photo($sdir, $file)
{
// phpcs:enable
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -1608,7 +1607,7 @@ dol_syslog( get_class($this) . "::rechercher(): numeric types are deprecated, pl
* @param int $nbmax Nombre maximum de photos (0=pas de max)
* @return array Tableau de photos
*/
- function liste_photos($dir, $nbmax = 0)
+ public function liste_photos($dir, $nbmax = 0)
{
// phpcs:enable
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
@@ -1657,14 +1656,14 @@ dol_syslog( get_class($this) . "::rechercher(): numeric types are deprecated, pl
return $tabobj;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Efface la photo de la categorie et sa vignette
*
* @param string $file Path to file
* @return void
*/
- function delete_photo($file)
+ public function delete_photo($file)
{
// phpcs:enable
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -1687,14 +1686,14 @@ dol_syslog( get_class($this) . "::rechercher(): numeric types are deprecated, pl
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load size of image file
*
* @param string $file Path to file
* @return void
*/
- function get_image_size($file)
+ public function get_image_size($file)
{
// phpcs:enable
$infoImg = getimagesize($file); // Recuperation des infos de l'image
@@ -1709,7 +1708,7 @@ dol_syslog( get_class($this) . "::rechercher(): numeric types are deprecated, pl
*
* @return int <0 if KO, >0 if OK
*/
- function setMultiLangs($user)
+ public function setMultiLangs($user)
{
global $langs;
@@ -1790,7 +1789,7 @@ dol_syslog( get_class($this) . "::rechercher(): numeric types are deprecated, pl
*
* @return int <0 if KO, >0 if OK
*/
- function getMultiLangs()
+ public function getMultiLangs()
{
global $langs;
@@ -1829,7 +1828,7 @@ dol_syslog( get_class($this) . "::rechercher(): numeric types are deprecated, pl
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of contact status
*/
- function getLibStatut($mode)
+ public function getLibStatut($mode)
{
return '';
}
@@ -1842,7 +1841,7 @@ dol_syslog( get_class($this) . "::rechercher(): numeric types are deprecated, pl
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
dol_syslog(get_class($this)."::initAsSpecimen");
@@ -1856,20 +1855,20 @@ dol_syslog( get_class($this) . "::rechercher(): numeric types are deprecated, pl
$this->type = self::TYPE_PRODUCT;
}
- /**
- * Function used to replace a thirdparty id with another one.
- *
- * @param DoliDB $db Database handler
- * @param int $origin_id Old thirdparty id
- * @param int $dest_id New thirdparty id
- * @return bool
- */
- public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
- {
- $tables = array(
- 'categorie_societe'
- );
+ /**
+ * Function used to replace a thirdparty id with another one.
+ *
+ * @param DoliDB $db Database handler
+ * @param int $origin_id Old thirdparty id
+ * @param int $dest_id New thirdparty id
+ * @return bool
+ */
+ public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
+ {
+ $tables = array(
+ 'categorie_societe'
+ );
- return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables, 1);
- }
+ return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables, 1);
+ }
}
diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php
index 3352927f7c9..4f8d1ac0301 100644
--- a/htdocs/expedition/class/api_shipments.class.php
+++ b/htdocs/expedition/class/api_shipments.class.php
@@ -46,7 +46,7 @@ class Shipments extends DolibarrApi
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
global $db, $conf;
$this->db = $db;
@@ -60,10 +60,10 @@ class Shipments extends DolibarrApi
*
* @param int $id ID of shipment
* @return array|mixed data without useless information
- *
+ *
* @throws RestException
*/
- function get($id)
+ public function get($id)
{
if(! DolibarrApiAccess::$user->rights->expedition->lire) {
throw new RestException(401);
@@ -99,7 +99,7 @@ class Shipments extends DolibarrApi
*
* @throws RestException
*/
- function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
+ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
{
global $db, $conf;
@@ -182,7 +182,7 @@ class Shipments extends DolibarrApi
* @param array $request_data Request data
* @return int ID of shipment
*/
- function post($request_data = null)
+ public function post($request_data = null)
{
if (! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401, "Insuffisant rights");
@@ -218,7 +218,7 @@ class Shipments extends DolibarrApi
* @return int
*/
/*
- function getLines($id)
+ public function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->expedition->lire) {
throw new RestException(401);
@@ -252,7 +252,7 @@ class Shipments extends DolibarrApi
* @return int
*/
/*
- function postLine($id, $request_data = null)
+ public function postLine($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401);
@@ -315,7 +315,7 @@ class Shipments extends DolibarrApi
* @return object
*/
/*
- function putLine($id, $lineid, $request_data = null)
+ public function putLine($id, $lineid, $request_data = null)
{
if (! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401);
@@ -376,7 +376,7 @@ class Shipments extends DolibarrApi
* @throws 401
* @throws 404
*/
- function deleteLine($id, $lineid)
+ public function deleteLine($id, $lineid)
{
if(! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401);
@@ -412,7 +412,7 @@ class Shipments extends DolibarrApi
*
* @return int
*/
- function put($id, $request_data = null)
+ public function put($id, $request_data = null)
{
if (! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401);
@@ -448,7 +448,7 @@ class Shipments extends DolibarrApi
*
* @return array
*/
- function delete($id)
+ public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->shipment->supprimer) {
throw new RestException(401);
@@ -493,7 +493,7 @@ class Shipments extends DolibarrApi
* "notrigger": 0
* }
*/
- function validate($id, $notrigger = 0)
+ public function validate($id, $notrigger = 0)
{
if (! DolibarrApiAccess::$user->rights->expedition->creer) {
throw new RestException(401);
@@ -542,7 +542,8 @@ class Shipments extends DolibarrApi
* @throws 404
* @throws 405
*/
-/* function setinvoiced($id)
+ /*
+ public function setinvoiced($id)
{
if(! DolibarrApiAccess::$user->rights->expedition->creer) {
@@ -562,7 +563,7 @@ class Shipments extends DolibarrApi
}
return $result;
}
-*/
+ */
/**
@@ -579,7 +580,7 @@ class Shipments extends DolibarrApi
* @throws 405
*/
/*
- function createShipmentFromOrder($orderid)
+ public function createShipmentFromOrder($orderid)
{
require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
@@ -615,7 +616,7 @@ class Shipments extends DolibarrApi
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
- function _cleanObjectDatas($object)
+ private function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);
@@ -654,7 +655,7 @@ class Shipments extends DolibarrApi
* @return array
* @throws RestException
*/
- function _validate($data)
+ private function _validate($data)
{
$shipment = array();
foreach (Shipments::$FIELDS as $field) {
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 9c908d32a95..169511fe160 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -171,7 +171,7 @@ class Expedition extends CommonObject
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
@@ -207,7 +207,7 @@ class Expedition extends CommonObject
* @param Societe $soc Thirdparty object
* @return string Free reference for contract
*/
- function getNextNumRef($soc)
+ public function getNextNumRef($soc)
{
global $langs, $conf;
$langs->load("sendings");
@@ -264,7 +264,7 @@ class Expedition extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 si erreur, id expedition creee si ok
*/
- function create($user, $notrigger = 0)
+ public function create($user, $notrigger = 0)
{
global $conf, $hookmanager;
@@ -434,7 +434,7 @@ class Expedition extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a expedition line
*
@@ -444,7 +444,7 @@ class Expedition extends CommonObject
* @param array $array_options extrafields array
* @return int <0 if KO, line_id if OK
*/
- function create_line($entrepot_id, $origin_line_id, $qty, $array_options = 0)
+ public function create_line($entrepot_id, $origin_line_id, $qty, $array_options = 0)
{
//phpcs:enable
$expeditionline = new ExpeditionLigne($this->db);
@@ -462,7 +462,7 @@ class Expedition extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create the detail (eat-by date) of the expedition line
*
@@ -470,7 +470,7 @@ class Expedition extends CommonObject
* @param array $array_options extrafields array
* @return int <0 if KO, >0 if OK
*/
- function create_line_batch($line_ext, $array_options = 0)
+ public function create_line_batch($line_ext, $array_options = 0)
{
// phpcs:enable
$error = 0;
@@ -520,7 +520,7 @@ class Expedition extends CommonObject
* @param string $ref_int Internal reference of other object
* @return int >0 if OK, 0 if not found, <0 if KO
*/
- function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
+ public function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
{
global $conf;
@@ -646,7 +646,7 @@ class Expedition extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if OK, >0 if KO
*/
- function valid($user, $notrigger = 0)
+ public function valid($user, $notrigger = 0)
{
global $conf, $langs;
@@ -862,14 +862,14 @@ class Expedition extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a delivery receipt from a shipment
*
* @param User $user User
* @return int <0 if KO, >=0 if OK
*/
- function create_delivery($user)
+ public function create_delivery($user)
{
// phpcs:enable
global $conf;
@@ -908,7 +908,7 @@ class Expedition extends CommonObject
* @param array $array_options extrafields array
* @return int <0 if KO, >0 if OK
*/
- function addline($entrepot_id, $id, $qty, $array_options = 0)
+ public function addline($entrepot_id, $id, $qty, $array_options = 0)
{
global $conf, $langs;
@@ -971,7 +971,7 @@ class Expedition extends CommonObject
$this->lines[$num] = $line;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Add a shipment line with batch record
*
@@ -979,7 +979,7 @@ class Expedition extends CommonObject
* @param array $array_options extrafields array
* @return int <0 if KO, >0 if OK
*/
- function addline_batch($dbatch, $array_options = 0)
+ public function addline_batch($dbatch, $array_options = 0)
{
// phpcs:enable
global $conf,$langs;
@@ -1048,7 +1048,7 @@ class Expedition extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function update($user = null, $notrigger = 0)
+ public function update($user = null, $notrigger = 0)
{
global $conf;
$error=0;
@@ -1152,7 +1152,7 @@ class Expedition extends CommonObject
*
* @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO
*/
- function delete()
+ public function delete()
{
global $conf, $langs, $user;
@@ -1360,13 +1360,13 @@ class Expedition extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load lines
*
* @return int >0 if OK, Otherwise if KO
*/
- function fetch_lines()
+ public function fetch_lines()
{
// phpcs:enable
global $conf, $mysoc;
@@ -1548,7 +1548,7 @@ class Expedition extends CommonObject
* @param int $lineid Id of line to delete
* @return int >0 if OK, <0 if KO
*/
- function deleteline($user, $lineid)
+ public function deleteline($user, $lineid)
{
global $user;
@@ -1593,7 +1593,7 @@ class Expedition extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
- function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1)
+ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1)
{
global $langs;
@@ -1643,12 +1643,12 @@ class Expedition extends CommonObject
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto
* @return string Libelle
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->statut, $mode);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return label of a status
*
@@ -1656,7 +1656,7 @@ class Expedition extends CommonObject
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto
* @return string Label of status
*/
- function LibStatut($statut, $mode)
+ public function LibStatut($statut, $mode)
{
// phpcs:enable
global $langs;
@@ -1700,7 +1700,7 @@ class Expedition extends CommonObject
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
global $langs;
@@ -1772,7 +1772,7 @@ class Expedition extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set the planned delivery date
*
@@ -1780,7 +1780,7 @@ class Expedition extends CommonObject
* @param timestamp $date_livraison Date de livraison
* @return int <0 if KO, >0 if OK
*/
- function set_date_livraison($user, $date_livraison)
+ public function set_date_livraison($user, $date_livraison)
{
// phpcs:enable
if ($user->rights->expedition->creer)
@@ -1808,13 +1808,13 @@ class Expedition extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fetch deliveries method and return an array. Load array this->meths(rowid=>label).
*
* @return void
*/
- function fetch_delivery_methods()
+ public function fetch_delivery_methods()
{
// phpcs:enable
global $langs;
@@ -1836,14 +1836,14 @@ class Expedition extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fetch all deliveries method and return an array. Load array this->listmeths.
*
* @param id $id only this carrier, all if none
* @return void
*/
- function list_delivery_methods($id = '')
+ public function list_delivery_methods($id = '')
{
// phpcs:enable
global $langs;
@@ -1872,7 +1872,7 @@ class Expedition extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update/create delivery method.
*
@@ -1880,7 +1880,7 @@ class Expedition extends CommonObject
*
* @return void
*/
- function update_delivery_method($id = '')
+ public function update_delivery_method($id = '')
{
// phpcs:enable
if ($id=='')
@@ -1902,7 +1902,7 @@ class Expedition extends CommonObject
if ($resql < 0) dol_print_error($this->db, '');
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Activate delivery method.
*
@@ -1910,7 +1910,7 @@ class Expedition extends CommonObject
*
* @return void
*/
- function activ_delivery_method($id)
+ public function activ_delivery_method($id)
{
// phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1';
@@ -1919,7 +1919,7 @@ class Expedition extends CommonObject
$resql = $this->db->query($sql);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* DesActivate delivery method.
*
@@ -1927,7 +1927,7 @@ class Expedition extends CommonObject
*
* @return void
*/
- function disable_delivery_method($id)
+ public function disable_delivery_method($id)
{
// phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0';
@@ -1943,7 +1943,7 @@ class Expedition extends CommonObject
* @param string $value Value
* @return void
*/
- function getUrlTrackingStatus($value = '')
+ public function getUrlTrackingStatus($value = '')
{
if (! empty($this->shipping_method_id))
{
@@ -1977,7 +1977,7 @@ class Expedition extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
- function setClosed()
+ public function setClosed()
{
global $conf,$langs,$user;
@@ -2123,13 +2123,13 @@ class Expedition extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on)
*
* @return int <0 if ko, >0 if ok
*/
- function set_billed()
+ public function set_billed()
{
// phpcs:enable
global $user;
@@ -2174,7 +2174,7 @@ class Expedition extends CommonObject
*
* @return int <0 if KO, 0 if already open, >0 if OK
*/
- function reOpen()
+ public function reOpen()
{
global $conf,$langs,$user;
@@ -2273,14 +2273,13 @@ class Expedition extends CommonObject
}
}
- if (! $error)
- {
+ if (! $error) {
// Call trigger
$result=$this->call_trigger('SHIPPING_REOPEN', $user);
if ($result < 0) {
$error++;
}
- }
+ }
} else {
$error++;
$this->errors[]=$this->db->lasterror();
@@ -2510,7 +2509,7 @@ class ExpeditionLigne extends CommonObjectLine
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db=$db;
}
@@ -2521,7 +2520,7 @@ class ExpeditionLigne extends CommonObjectLine
* @param int $rowid Id line order
* @return int <0 if KO, >0 if OK
*/
- function fetch($rowid)
+ public function fetch($rowid)
{
$sql = 'SELECT ed.rowid, ed.fk_expedition, ed.fk_entrepot, ed.fk_origin_line, ed.qty, ed.rang';
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as ed';
@@ -2556,7 +2555,7 @@ class ExpeditionLigne extends CommonObjectLine
* @param int $notrigger 1 = disable triggers
* @return int <0 if KO, line id >0 if OK
*/
- function insert($user = null, $notrigger = 0)
+ public function insert($user = null, $notrigger = 0)
{
global $langs, $conf;
@@ -2638,7 +2637,7 @@ class ExpeditionLigne extends CommonObjectLine
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int >0 if OK, <0 if KO
*/
- function delete($user = null, $notrigger = 0)
+ public function delete($user = null, $notrigger = 0)
{
global $conf;
@@ -2715,7 +2714,7 @@ class ExpeditionLigne extends CommonObjectLine
* @param int $notrigger 1 = disable triggers
* @return int < 0 if KO, > 0 if OK
*/
- function update($user = null, $notrigger = 0)
+ public function update($user = null, $notrigger = 0)
{
global $conf;
diff --git a/htdocs/expedition/class/expeditionbatch.class.php b/htdocs/expedition/class/expeditionbatch.class.php
index e15e766c439..1cc0f277af6 100644
--- a/htdocs/expedition/class/expeditionbatch.class.php
+++ b/htdocs/expedition/class/expeditionbatch.class.php
@@ -35,21 +35,21 @@ class ExpeditionLineBatch extends CommonObject
private static $_table_element='expeditiondet_batch'; //!< Name of table without prefix where object is stored
- var $sellby;
- var $eatby;
- var $batch;
- var $qty;
- var $dluo_qty; // deprecated, use qty
- var $entrepot_id;
- var $fk_origin_stock;
- var $fk_expeditiondet;
+ public $sellby;
+ public $eatby;
+ public $batch;
+ public $qty;
+ public $dluo_qty; // deprecated, use qty
+ public $entrepot_id;
+ public $fk_origin_stock;
+ public $fk_expeditiondet;
/**
* Constructor
*
* @param DoliDb $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -60,7 +60,7 @@ class ExpeditionLineBatch extends CommonObject
* @param int $id_stockdluo Rowid in product_batch table
* @return int -1 if KO, 1 if OK
*/
- function fetchFromStock($id_stockdluo)
+ public function fetchFromStock($id_stockdluo)
{
$sql = "SELECT";
$sql.= " pb.batch,";
@@ -104,7 +104,7 @@ class ExpeditionLineBatch extends CommonObject
* @param int $id_line_expdet rowid of expedtiondet record
* @return int <0 if KO, Id of record (>0) if OK
*/
- function create($id_line_expdet)
+ public function create($id_line_expdet)
{
$error = 0;
@@ -155,7 +155,7 @@ class ExpeditionLineBatch extends CommonObject
* @param int $id_expedition rowid of shipment
* @return int -1 if KO, 1 if OK
*/
- static function deletefromexp($db, $id_expedition)
+ public static function deletefromexp($db, $id_expedition)
{
$id_expedition = (int) $id_expedition;
@@ -181,7 +181,7 @@ class ExpeditionLineBatch extends CommonObject
* @param int $fk_product If provided, load also detailed information of lot
* @return int|array -1 if KO, array of ExpeditionLineBatch if OK
*/
- static function fetchAll($db, $id_line_expdet, $fk_product = 0)
+ public static function fetchAll($db, $id_line_expdet, $fk_product = 0)
{
$sql="SELECT";
$sql.= " eb.rowid,";
diff --git a/htdocs/expedition/class/expeditionstats.class.php b/htdocs/expedition/class/expeditionstats.class.php
index e1bb3c0b219..d6ac5e2242a 100644
--- a/htdocs/expedition/class/expeditionstats.class.php
+++ b/htdocs/expedition/class/expeditionstats.class.php
@@ -34,17 +34,17 @@ include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
*/
class ExpeditionStats extends Stats
{
- /**
- * @var string Name of table without prefix where object is stored
- */
- public $table_element;
+ /**
+ * @var string Name of table without prefix where object is stored
+ */
+ public $table_element;
- var $socid;
- var $userid;
+ public $socid;
+ public $userid;
- var $from;
- var $field;
- var $where;
+ public $from;
+ public $field;
+ public $where;
/**
@@ -55,7 +55,7 @@ class ExpeditionStats extends Stats
* @param string $mode Option (not used)
* @param int $userid Id user for filter (creation user)
*/
- function __construct($db, $socid, $mode, $userid = 0)
+ public function __construct($db, $socid, $mode, $userid = 0)
{
global $user, $conf;
@@ -88,7 +88,7 @@ class ExpeditionStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with number by month
*/
- function getNbByMonth($year, $format = 0)
+ public function getNbByMonth($year, $format = 0)
{
global $user;
@@ -110,7 +110,7 @@ class ExpeditionStats extends Stats
* @return array Array with number by year
*
*/
- function getNbByYear()
+ public function getNbByYear()
{
global $user;
@@ -129,7 +129,7 @@ class ExpeditionStats extends Stats
*
* @return array Array of values
*/
- function getAllByYear()
+ public function getAllByYear()
{
global $user;
diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php
index c0e0b485d71..c95bcdcb8f4 100644
--- a/htdocs/product/class/api_products.class.php
+++ b/htdocs/product/class/api_products.class.php
@@ -44,7 +44,7 @@ class Products extends DolibarrApi
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
global $db, $conf;
$this->db = $db;
@@ -68,14 +68,14 @@ class Products extends DolibarrApi
* @throws 403
* @throws 404
*/
- function get($id, $ref = '', $ref_ext = '', $barcode = '', $includestockdata = 0)
+ public function get($id, $ref = '', $ref_ext = '', $barcode = '', $includestockdata = 0)
{
if (empty($id) && empty($ref) && empty($ref_ext) && empty($barcode)) {
throw new RestException(400, 'bad value for parameter id, ref, ref_ext or barcode');
}
$id = (empty($id)?0:$id);
-
+
if(! DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(403);
}
@@ -84,7 +84,7 @@ class Products extends DolibarrApi
if(! $result ) {
throw new RestException(404, 'Product not found');
}
-
+
if(! DolibarrApi::_checkAccessToResource('product', $this->product->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -110,7 +110,7 @@ class Products extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)"
* @return array Array of product objects
*/
- function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '')
+ public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '')
{
global $db, $conf;
@@ -185,7 +185,7 @@ class Products extends DolibarrApi
* @param array $request_data Request data
* @return int ID of product
*/
- function post($request_data = null)
+ public function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->produit->creer) {
throw new RestException(401);
@@ -215,7 +215,7 @@ class Products extends DolibarrApi
* @throws 401
* @throws 404
*/
- function put($id, $request_data = null)
+ public function put($id, $request_data = null)
{
global $conf;
@@ -300,7 +300,7 @@ class Products extends DolibarrApi
* @param int $id Product ID
* @return array
*/
- function delete($id)
+ public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->produit->supprimer) {
throw new RestException(401);
@@ -335,7 +335,7 @@ class Products extends DolibarrApi
*
* @url GET {id}/categories
*/
- function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
+ public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401);
@@ -365,7 +365,7 @@ class Products extends DolibarrApi
*
* @url GET {id}/selling_multiprices/per_segment
*/
- function getCustomerPricesPerSegment($id)
+ public function getCustomerPricesPerSegment($id)
{
global $conf;
@@ -387,13 +387,13 @@ class Products extends DolibarrApi
}
return array(
- 'multiprices'=>$this->product->multiprices,
- 'multiprices_inc_tax'=>$this->product->multiprices_ttc,
- 'multiprices_min'=>$this->product->multiprices_min,
- 'multiprices_min_inc_tax'=>$this->product->multiprices_min_ttc,
- 'multiprices_vat'=>$this->product->multiprices_tva_tx,
- 'multiprices_base_type'=>$this->product->multiprices_base_type,
- //'multiprices_default_vat_code'=>$this->product->multiprices_default_vat_code
+ 'multiprices'=>$this->product->multiprices,
+ 'multiprices_inc_tax'=>$this->product->multiprices_ttc,
+ 'multiprices_min'=>$this->product->multiprices_min,
+ 'multiprices_min_inc_tax'=>$this->product->multiprices_min_ttc,
+ 'multiprices_vat'=>$this->product->multiprices_tva_tx,
+ 'multiprices_base_type'=>$this->product->multiprices_base_type,
+ //'multiprices_default_vat_code'=>$this->product->multiprices_default_vat_code
);
}
@@ -406,7 +406,7 @@ class Products extends DolibarrApi
*
* @url GET {id}/selling_multiprices/per_customer
*/
- function getCustomerPricesPerCustomer($id)
+ public function getCustomerPricesPerCustomer($id)
{
global $conf;
@@ -440,7 +440,7 @@ class Products extends DolibarrApi
*
* @url GET {id}/selling_multiprices/per_quantity
*/
- function getCustomerPricesPerQuantity($id)
+ public function getCustomerPricesPerQuantity($id)
{
global $conf;
@@ -474,7 +474,7 @@ class Products extends DolibarrApi
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
- function _cleanObjectDatas($object)
+ private function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);
@@ -502,7 +502,7 @@ class Products extends DolibarrApi
* @return array
* @throws RestException
*/
- function _validate($data)
+ private function _validate($data)
{
$product = array();
foreach (Products::$FIELDS as $field) {
diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php
index 93d239cc207..b19ec65e43f 100644
--- a/htdocs/product/class/html.formproduct.class.php
+++ b/htdocs/product/class/html.formproduct.class.php
@@ -69,7 +69,7 @@ class FormProduct
* @param array $exclude warehouses ids to exclude
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
*/
- function loadWarehouses($fk_product = 0, $batch = '', $status = '', $sumStock = true, $exclude = '')
+ public function loadWarehouses($fk_product = 0, $batch = '', $status = '', $sumStock = true, $exclude = '')
{
global $conf, $langs;
@@ -210,7 +210,7 @@ class FormProduct
* @param int $showfullpath 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse
* @return string HTML select
*/
- function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = '', $showfullpath = 1)
+ public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = '', $showfullpath = 1)
{
global $conf,$langs,$user;
@@ -255,7 +255,7 @@ class FormProduct
* @param int $addempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
* @return void
*/
- function formSelectWarehouses($page, $selected = '', $htmlname = 'warehouse_id', $addempty = 0)
+ public function formSelectWarehouses($page, $selected = '', $htmlname = 'warehouse_id', $addempty = 0)
{
global $langs;
if ($htmlname != "none") {
@@ -291,7 +291,7 @@ class FormProduct
* @param int $adddefault Add empty unit called "Default"
* @return void
*/
- function select_measuring_units($name = 'measuring_units', $measuring_style = '', $default = '0', $adddefault = 0)
+ public function select_measuring_units($name = 'measuring_units', $measuring_style = '', $default = '0', $adddefault = 0)
{
//phpcs:enable
print $this->load_measuring_units($name, $measuring_style, $default, $adddefault);
@@ -308,7 +308,7 @@ class FormProduct
* @param int $adddefault Add empty unit called "Default"
* @return string
*/
- function load_measuring_units($name = 'measuring_units', $measuring_style = '', $default = '0', $adddefault = 0)
+ public function load_measuring_units($name = 'measuring_units', $measuring_style = '', $default = '0', $adddefault = 0)
{
//phpcs:enable
global $langs, $conf, $mysoc, $db;
@@ -365,7 +365,7 @@ class FormProduct
*
* @return string HTML select
*/
- function selectLotStock($selected = '', $htmlname = 'batch_id', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array(), $empty_label = '', $forcecombo = 0, $events = array(), $morecss = 'minwidth200')
+ public function selectLotStock($selected = '', $htmlname = 'batch_id', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array(), $empty_label = '', $forcecombo = 0, $events = array(), $morecss = 'minwidth200')
{
global $langs;
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 3a10377e8a3..9ef3ba450cf 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2001-2007 Rodolphe Quiedeville
* Copyright (C) 2004-2014 Laurent Destailleur
* Copyright (C) 2005-2015 Regis Houssin
* Copyright (C) 2006 Andre Cianfarani
@@ -344,20 +344,29 @@ class Product extends CommonObject
public $fields = array(
- 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
- 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
- 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
- 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
- 'note' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
- 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
- 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
- //'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
- 'fk_user_author'=>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'llx_user.rowid'),
- 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
- //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
- 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
- //'tosell' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
- //'tobuy' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
+ 'rowid' => array(
+ 'type'=>'integer',
+ 'label'=>'TechnicalID',
+ 'enabled'=>1,
+ 'visible'=>-2,
+ 'notnull'=>1,
+ 'index'=>1,
+ 'position'=>1,
+ 'comment'=>'Id',
+ ),
+ 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
+ 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
+ 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
+ 'note' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
+ 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
+ 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
+ //'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
+ 'fk_user_author'=>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'llx_user.rowid'),
+ 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
+ //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
+ 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
+ //'tosell' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
+ //'tobuy' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
);
/**
@@ -383,7 +392,7 @@ class Product extends CommonObject
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
$this->canvas = '';
@@ -394,7 +403,7 @@ class Product extends CommonObject
*
* @return int >1 if OK, <=0 if KO
*/
- function check()
+ public function check()
{
$this->ref = dol_sanitizeFileName(stripslashes($this->ref));
@@ -423,7 +432,7 @@ class Product extends CommonObject
* @param int $notrigger Disable triggers
* @return int Id of product/service if OK, < 0 if KO
*/
- function create($user, $notrigger = 0)
+ public function create($user, $notrigger = 0)
{
global $conf, $langs;
@@ -436,32 +445,41 @@ class Product extends CommonObject
$this->price=price2num($this->price);
$this->price_min_ttc=price2num($this->price_min_ttc);
$this->price_min=price2num($this->price_min);
- if (empty($this->tva_tx)) { $this->tva_tx = 0;
+ if (empty($this->tva_tx)) {
+ $this->tva_tx = 0;
}
- if (empty($this->tva_npr)) { $this->tva_npr = 0;
+ if (empty($this->tva_npr)) {
+ $this->tva_npr = 0;
}
//Local taxes
- if (empty($this->localtax1_tx)) { $this->localtax1_tx = 0;
+ if (empty($this->localtax1_tx)) {
+ $this->localtax1_tx = 0;
}
- if (empty($this->localtax2_tx)) { $this->localtax2_tx = 0;
+ if (empty($this->localtax2_tx)) {
+ $this->localtax2_tx = 0;
}
- if (empty($this->localtax1_type)) { $this->localtax1_type = '0';
+ if (empty($this->localtax1_type)) {
+ $this->localtax1_type = '0';
}
- if (empty($this->localtax2_type)) { $this->localtax2_type = '0';
+ if (empty($this->localtax2_type)) {
+ $this->localtax2_type = '0';
}
-
- if (empty($this->price)) { $this->price = 0;
+ if (empty($this->price)) {
+ $this->price = 0;
}
- if (empty($this->price_min)) { $this->price_min = 0;
+ if (empty($this->price_min)) {
+ $this->price_min = 0;
}
-
// Price by quantity
- if (empty($this->price_by_qty)) { $this->price_by_qty = 0;
+ if (empty($this->price_by_qty)) {
+ $this->price_by_qty = 0;
}
- if (empty($this->status)) { $this->status = 0;
+ if (empty($this->status)) {
+ $this->status = 0;
}
- if (empty($this->status_buy)) { $this->status_buy = 0;
+ if (empty($this->status_buy)) {
+ $this->status_buy = 0;
}
$price_ht=0;
@@ -608,7 +626,7 @@ class Product extends CommonObject
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."product");
if ($id > 0) {
- $this->id = $id;
+ $this->id = $id;
$this->price = $price_ht;
$this->price_ttc = $price_ttc;
$this->price_min = $price_min_ht;
@@ -622,8 +640,8 @@ class Product extends CommonObject
}
else
{
- $error++;
- $this->error=$this->db->lasterror();
+ $error++;
+ $this->error=$this->db->lasterror();
}
}
else
@@ -685,7 +703,7 @@ class Product extends CommonObject
*
* @return int 0 if OK, <0 if KO
*/
- function verify()
+ public function verify()
{
$this->errors=array();
@@ -716,7 +734,7 @@ class Product extends CommonObject
return $result;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Check barcode
*
@@ -727,7 +745,7 @@ class Product extends CommonObject
* -2 ErrorBarCodeRequired
* -3 ErrorBarCodeAlreadyUsed
*/
- function check_barcode($valuetotest, $typefortest)
+ public function check_barcode($valuetotest, $typefortest)
{
// phpcs:enable
global $conf;
@@ -764,7 +782,7 @@ class Product extends CommonObject
* @param string $action Current action for hookmanager ('add' or 'update')
* @return int 1 if OK, -1 if ref already exists, -2 if other error
*/
- function update($id, $user, $notrigger = false, $action = 'update')
+ public function update($id, $user, $notrigger = false, $action = 'update')
{
global $langs, $conf, $hookmanager;
@@ -806,24 +824,33 @@ class Product extends CommonObject
$this->surface_units = trim($this->surface_units);
$this->volume = price2num($this->volume);
$this->volume_units = trim($this->volume_units);
- if (empty($this->tva_tx)) { $this->tva_tx = 0;
+ if (empty($this->tva_tx)) {
+ $this->tva_tx = 0;
}
- if (empty($this->tva_npr)) { $this->tva_npr = 0;
+ if (empty($this->tva_npr)) {
+ $this->tva_npr = 0;
}
- if (empty($this->localtax1_tx)) { $this->localtax1_tx = 0;
+ if (empty($this->localtax1_tx)) {
+ $this->localtax1_tx = 0;
}
- if (empty($this->localtax2_tx)) { $this->localtax2_tx = 0;
+ if (empty($this->localtax2_tx)) {
+ $this->localtax2_tx = 0;
}
- if (empty($this->localtax1_type)) { $this->localtax1_type = '0';
+ if (empty($this->localtax1_type)) {
+ $this->localtax1_type = '0';
}
- if (empty($this->localtax2_type)) { $this->localtax2_type = '0';
+ if (empty($this->localtax2_type)) {
+ $this->localtax2_type = '0';
}
- if (empty($this->status)) { $this->status = 0;
+ if (empty($this->status)) {
+ $this->status = 0;
}
- if (empty($this->status_buy)) { $this->status_buy = 0;
+ if (empty($this->status_buy)) {
+ $this->status_buy = 0;
}
- if (empty($this->country_id)) { $this->country_id = 0;
+ if (empty($this->country_id)) {
+ $this->country_id = 0;
}
// Barcode value
@@ -1056,7 +1083,7 @@ class Product extends CommonObject
* @param int $notrigger Do not execute trigger
* @return int < 0 if KO, 0 = Not possible, > 0 if OK
*/
- function delete(User $user, $notrigger = 0)
+ public function delete(User $user, $notrigger = 0)
{
// Deprecation warning
if ($id > 0) {
@@ -1224,7 +1251,7 @@ class Product extends CommonObject
* @param User $user Object user making update
* @return int <0 if KO, >0 if OK
*/
- function setMultiLangs($user)
+ public function setMultiLangs($user)
{
global $conf, $langs;
@@ -1333,7 +1360,7 @@ class Product extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
- function delMultiLangs($langtodelete, $user)
+ public function delMultiLangs($langtodelete, $user)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_lang";
$sql.= " WHERE fk_product=".$this->id." AND lang='".$this->db->escape($langtodelete)."'";
@@ -1422,7 +1449,7 @@ class Product extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
- function getMultiLangs()
+ public function getMultiLangs()
{
global $langs;
@@ -1458,7 +1485,7 @@ class Product extends CommonObject
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Insert a track that we changed a customer price
*
@@ -1466,7 +1493,7 @@ class Product extends CommonObject
* @param int $level price level to change
* @return int <0 if KO, >0 if OK
*/
- function _log_price($user, $level = 0)
+ private function _log_price($user, $level = 0)
{
// phpcs:enable
global $conf;
@@ -1498,7 +1525,7 @@ class Product extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Delete a price line
*
@@ -1506,7 +1533,7 @@ class Product extends CommonObject
* @param int $rowid Line id to delete
* @return int <0 if KO, >0 if OK
*/
- function log_price_delete($user, $rowid)
+ public function log_price_delete($user, $rowid)
{
// phpcs:enable
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price_by_qty";
@@ -1536,7 +1563,7 @@ class Product extends CommonObject
* @return array Array of price information
* @see get_buyprice()
*/
- function getSellPrice($thirdparty_seller, $thirdparty_buyer, $pqp = 0)
+ public function getSellPrice($thirdparty_seller, $thirdparty_buyer, $pqp = 0)
{
global $conf, $db;
@@ -1634,7 +1661,7 @@ class Product extends CommonObject
return array('pu_ht'=>$pu_ht, 'pu_ttc'=>$pu_ttc, 'price_min'=>$price_min, 'price_base_type'=>$price_base_type, 'tva_tx'=>$tva_tx, 'tva_npr'=>$tva_npr);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Read price used by a provider.
* We enter as input couple prodfournprice/qty or triplet qty/product_id/fourn_ref.
@@ -1648,7 +1675,7 @@ class Product extends CommonObject
* @return int <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...)
* @see getSellPrice()
*/
- function get_buyprice($prodfournprice, $qty, $product_id = 0, $fourn_ref = '', $fk_soc = 0)
+ public function get_buyprice($prodfournprice, $qty, $product_id = 0, $fourn_ref = '', $fk_soc = 0)
{
// phpcs:enable
global $conf;
@@ -1798,7 +1825,7 @@ class Product extends CommonObject
* @param string $newdefaultvatcode Default vat code
* @return int <0 if KO, >0 if OK
*/
- function updatePrice($newprice, $newpricebase, $user, $newvat = '', $newminprice = 0, $level = 0, $newnpr = 0, $newpbq = 0, $ignore_autogen = 0, $localtaxes_array = array(), $newdefaultvatcode = '')
+ public function updatePrice($newprice, $newpricebase, $user, $newvat = '', $newminprice = 0, $level = 0, $newnpr = 0, $newpbq = 0, $ignore_autogen = 0, $localtaxes_array = array(), $newdefaultvatcode = '')
{
global $conf,$langs;
@@ -1961,7 +1988,7 @@ class Product extends CommonObject
* @return int <0 if KO, >0 if OK
* @deprecated Use Product::update instead
*/
- function setPriceExpression($expression_id)
+ public function setPriceExpression($expression_id)
{
global $user;
@@ -1980,7 +2007,7 @@ class Product extends CommonObject
* @param int $ignore_expression Ignores the math expression for calculating price and uses the db value instead
* @return int <0 if KO, 0 if not found, >0 if OK
*/
- function fetch($id = '', $ref = '', $ref_ext = '', $barcode = '', $ignore_expression = 0)
+ public function fetch($id = '', $ref = '', $ref_ext = '', $barcode = '', $ignore_expression = 0)
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@@ -2004,13 +2031,16 @@ class Product extends CommonObject
$sql.= " datec, tms, import_key, entity, desiredstock, tobatch, fk_unit,";
$sql.= " fk_price_expression, price_autogen";
$sql.= " FROM ".MAIN_DB_PREFIX."product";
- if ($id) { $sql.= " WHERE rowid = ".$this->db->escape($id);
- } else
- {
+ if ($id) {
+ $sql.= " WHERE rowid = ".$this->db->escape($id);
+ } else {
$sql.= " WHERE entity IN (".getEntity($this->element).")";
- if ($ref) { $sql.= " AND ref = '".$this->db->escape($ref)."'";
- } elseif ($ref_ext) { $sql.= " AND ref_ext = '".$this->db->escape($ref_ext)."'";
- } elseif ($barcode) { $sql.= " AND barcode = '".$this->db->escape($barcode)."'";
+ if ($ref) {
+ $sql.= " AND ref = '".$this->db->escape($ref)."'";
+ } elseif ($ref_ext) {
+ $sql.= " AND ref_ext = '".$this->db->escape($ref_ext)."'";
+ } elseif ($barcode) {
+ $sql.= " AND barcode = '".$this->db->escape($barcode)."'";
}
}
@@ -2019,7 +2049,7 @@ class Product extends CommonObject
if ($this->db->num_rows($resql) > 0) {
$obj = $this->db->fetch_object($resql);
- $this->id = $obj->rowid;
+ $this->id = $obj->rowid;
$this->ref = $obj->ref;
$this->ref_ext = $obj->ref_ext;
$this->label = $obj->label;
@@ -2202,7 +2232,7 @@ class Product extends CommonObject
$resultat=array();
$resql = $this->db->query($sql);
if ($resql) {
- $ii=0;
+ $ii=0;
while ($result= $this->db->fetch_array($resql)) {
$resultat[$ii]=array();
$resultat[$ii]["rowid"]=$result["rowid"];
@@ -2214,7 +2244,7 @@ class Product extends CommonObject
$resultat[$ii]["price_base_type"]= $result["price_base_type"];
$ii++;
}
- $this->prices_by_qty_list[0]=$resultat;
+ $this->prices_by_qty_list[0]=$resultat;
}
else
{
@@ -2259,24 +2289,24 @@ class Product extends CommonObject
$this->prices_by_qty_id[$i]=$result["rowid"];
// Récuperation de la liste des prix selon qty si flag positionné
if ($this->prices_by_qty[$i] == 1) {
- $sql = "SELECT rowid, price, unitprice, quantity, remise_percent, remise, price_base_type";
- $sql.= " FROM ".MAIN_DB_PREFIX."product_price_by_qty";
- $sql.= " WHERE fk_product_price = ".$this->prices_by_qty_id[$i];
- $sql.= " ORDER BY quantity ASC";
- $resultat=array();
- $resql = $this->db->query($sql);
+ $sql = "SELECT rowid, price, unitprice, quantity, remise_percent, remise, price_base_type";
+ $sql.= " FROM ".MAIN_DB_PREFIX."product_price_by_qty";
+ $sql.= " WHERE fk_product_price = ".$this->prices_by_qty_id[$i];
+ $sql.= " ORDER BY quantity ASC";
+ $resultat=array();
+ $resql = $this->db->query($sql);
if ($resql) {
$ii=0;
while ($result= $this->db->fetch_array($resql)) {
- $resultat[$ii]=array();
- $resultat[$ii]["rowid"]=$result["rowid"];
- $resultat[$ii]["price"]= $result["price"];
- $resultat[$ii]["unitprice"]= $result["unitprice"];
- $resultat[$ii]["quantity"]= $result["quantity"];
- $resultat[$ii]["remise_percent"]= $result["remise_percent"];
- $resultat[$ii]["remise"]= $result["remise"]; // deprecated
- $resultat[$ii]["price_base_type"]= $result["price_base_type"];
- $ii++;
+ $resultat[$ii]=array();
+ $resultat[$ii]["rowid"]=$result["rowid"];
+ $resultat[$ii]["price"]= $result["price"];
+ $resultat[$ii]["unitprice"]= $result["unitprice"];
+ $resultat[$ii]["quantity"]= $result["quantity"];
+ $resultat[$ii]["remise_percent"]= $result["remise_percent"];
+ $resultat[$ii]["remise"]= $result["remise"]; // deprecated
+ $resultat[$ii]["price_base_type"]= $result["price_base_type"];
+ $ii++;
}
$this->prices_by_qty_list[$i]=$resultat;
}
@@ -2326,14 +2356,14 @@ class Product extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge tableau des stats propale pour le produit/service
*
* @param int $socid Id societe
* @return array Tableau des stats
*/
- function load_stats_propale($socid = 0)
+ public function load_stats_propale($socid = 0)
{
// phpcs:enable
global $conf;
@@ -2373,14 +2403,14 @@ class Product extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge tableau des stats propale pour le produit/service
*
* @param int $socid Id thirdparty
* @return array Tableau des stats
*/
- function load_stats_proposal_supplier($socid = 0)
+ public function load_stats_proposal_supplier($socid = 0)
{
// phpcs:enable
global $conf;
@@ -2420,7 +2450,7 @@ class Product extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge tableau des stats commande client pour le produit/service
*
@@ -2429,7 +2459,7 @@ class Product extends CommonObject
* @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
* @return array Array of stats (nb=nb of order, qty=qty ordered)
*/
- function load_stats_commande($socid = 0, $filtrestatut = '', $forVirtualStock = 0)
+ public function load_stats_commande($socid = 0, $filtrestatut = '', $forVirtualStock = 0)
{
// phpcs:enable
global $conf,$user;
@@ -2515,7 +2545,7 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge tableau des stats commande fournisseur pour le produit/service
*
@@ -2524,7 +2554,7 @@ class Product extends CommonObject
* @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
* @return array Tableau des stats
*/
- function load_stats_commande_fournisseur($socid = 0, $filtrestatut = '', $forVirtualStock = 0)
+ public function load_stats_commande_fournisseur($socid = 0, $filtrestatut = '', $forVirtualStock = 0)
{
// phpcs:enable
global $conf,$user;
@@ -2563,7 +2593,7 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge tableau des stats expedition client pour le produit/service
*
@@ -2572,7 +2602,7 @@ class Product extends CommonObject
* @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
* @return array Tableau des stats
*/
- function load_stats_sending($socid = 0, $filtrestatut = '', $forVirtualStock = 0)
+ public function load_stats_sending($socid = 0, $filtrestatut = '', $forVirtualStock = 0)
{
// phpcs:enable
global $conf,$user;
@@ -2615,7 +2645,7 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge tableau des stats réception fournisseur pour le produit/service
*
@@ -2624,7 +2654,7 @@ class Product extends CommonObject
* @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
* @return array Tableau des stats
*/
- function load_stats_reception($socid = 0, $filtrestatut = '', $forVirtualStock = 0)
+ public function load_stats_reception($socid = 0, $filtrestatut = '', $forVirtualStock = 0)
{
// phpcs:enable
global $conf,$user;
@@ -2663,14 +2693,14 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge tableau des stats contrat pour le produit/service
*
* @param int $socid Id societe
* @return array Tableau des stats
*/
- function load_stats_contrat($socid = 0)
+ public function load_stats_contrat($socid = 0)
{
// phpcs:enable
global $conf;
@@ -2709,14 +2739,14 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge tableau des stats facture pour le produit/service
*
* @param int $socid Id societe
* @return array Tableau des stats
*/
- function load_stats_facture($socid = 0)
+ public function load_stats_facture($socid = 0)
{
// phpcs:enable
global $conf;
@@ -2755,14 +2785,14 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge tableau des stats facture pour le produit/service
*
* @param int $socid Id societe
* @return array Tableau des stats
*/
- function load_stats_facture_fournisseur($socid = 0)
+ public function load_stats_facture_fournisseur($socid = 0)
{
// phpcs:enable
global $conf;
@@ -2801,7 +2831,7 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return an array formated for showing graphs
*
@@ -2810,7 +2840,7 @@ class Product extends CommonObject
* @param int $year Year (0=current year)
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
- function _get_stats($sql, $mode, $year = 0)
+ private function _get_stats($sql, $mode, $year = 0)
{
// phpcs:enable
$resql = $this->db->query($sql);
@@ -2865,7 +2895,7 @@ class Product extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return nb of units or customers invoices in which product is included
*
@@ -2876,7 +2906,7 @@ class Product extends CommonObject
* @param string $morefilter More sql filters
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
- function get_nb_vente($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
+ public function get_nb_vente($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
{
// phpcs:enable
global $conf;
@@ -2910,7 +2940,7 @@ class Product extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return nb of units or supplier invoices in which product is included
*
@@ -2921,7 +2951,7 @@ class Product extends CommonObject
* @param string $morefilter More sql filters
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
- function get_nb_achat($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
+ public function get_nb_achat($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
{
// phpcs:enable
global $conf;
@@ -2954,7 +2984,7 @@ class Product extends CommonObject
return $this->_get_stats($sql, $mode, $year);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return nb of units or proposals in which product is included
*
@@ -2965,7 +2995,7 @@ class Product extends CommonObject
* @param string $morefilter More sql filters
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
- function get_nb_propal($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
+ public function get_nb_propal($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
{
// phpcs:enable
global $conf;
@@ -2998,7 +3028,7 @@ class Product extends CommonObject
return $this->_get_stats($sql, $mode, $year);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return nb of units or proposals in which product is included
*
@@ -3009,7 +3039,7 @@ class Product extends CommonObject
* @param string $morefilter More sql filters
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
- function get_nb_propalsupplier($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
+ public function get_nb_propalsupplier($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
{
// phpcs:enable
global $conf;
@@ -3042,7 +3072,7 @@ class Product extends CommonObject
return $this->_get_stats($sql, $mode, $year);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return nb of units or orders in which product is included
*
@@ -3053,7 +3083,7 @@ class Product extends CommonObject
* @param string $morefilter More sql filters
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
- function get_nb_order($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
+ public function get_nb_order($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
{
// phpcs:enable
global $conf, $user;
@@ -3085,7 +3115,7 @@ class Product extends CommonObject
return $this->_get_stats($sql, $mode, $year);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return nb of units or orders in which product is included
*
@@ -3096,13 +3126,14 @@ class Product extends CommonObject
* @param string $morefilter More sql filters
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
- function get_nb_ordersupplier($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
+ public function get_nb_ordersupplier($socid, $mode, $filteronproducttype = -1, $year = 0, $morefilter = '')
{
// phpcs:enable
global $conf, $user;
$sql = "SELECT sum(d.qty), date_format(c.date_commande, '%Y%m')";
- if ($mode == 'bynumber') { $sql.= ", count(DISTINCT c.rowid)";
+ if ($mode == 'bynumber') {
+ $sql.= ", count(DISTINCT c.rowid)";
}
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as d, ".MAIN_DB_PREFIX."commande_fournisseur as c, ".MAIN_DB_PREFIX."societe as s";
if ($filteronproducttype >= 0) { $sql.=", ".MAIN_DB_PREFIX."product as p";
@@ -3128,7 +3159,7 @@ class Product extends CommonObject
return $this->_get_stats($sql, $mode, $year);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Link a product/service to a parent product/service
*
@@ -3138,7 +3169,7 @@ class Product extends CommonObject
* @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease
* @return int < 0 if KO, > 0 if OK
*/
- function add_sousproduit($id_pere, $id_fils, $qty, $incdec = 1)
+ public function add_sousproduit($id_pere, $id_fils, $qty, $incdec = 1)
{
// phpcs:enable
// Clean parameters
@@ -3186,7 +3217,7 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Modify composed product
*
@@ -3196,7 +3227,7 @@ class Product extends CommonObject
* @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease
* @return int < 0 if KO, > 0 if OK
*/
- function update_sousproduit($id_pere, $id_fils, $qty, $incdec = 1)
+ public function update_sousproduit($id_pere, $id_fils, $qty, $incdec = 1)
{
// phpcs:enable
// Clean parameters
@@ -3224,7 +3255,7 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Retire le lien entre un sousproduit et un produit/service
*
@@ -3232,7 +3263,7 @@ class Product extends CommonObject
* @param int $fk_child Id du produit a ne plus lie
* @return int < 0 if KO, > 0 if OK
*/
- function del_sousproduit($fk_parent, $fk_child)
+ public function del_sousproduit($fk_parent, $fk_child)
{
// phpcs:enable
if (! is_numeric($fk_parent)) { $fk_parent=0;
@@ -3253,7 +3284,7 @@ class Product extends CommonObject
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Verifie si c'est un sous-produit
*
@@ -3261,7 +3292,7 @@ class Product extends CommonObject
* @param int $fk_child Id du produit lie
* @return int < 0 si erreur, > 0 si ok
*/
- function is_sousproduit($fk_parent, $fk_child)
+ public function is_sousproduit($fk_parent, $fk_child)
{
// phpcs:enable
$sql = "SELECT fk_product_pere, qty, incdec";
@@ -3293,7 +3324,7 @@ class Product extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Add a supplier price for the product.
* Note: Duplicate ref is accepted for different quantity only, or for different companies.
@@ -3304,7 +3335,7 @@ class Product extends CommonObject
* @param float $quantity Quantity minimum for price
* @return int < 0 if KO, 0 if link already exists for this product, > 0 if OK
*/
- function add_fournisseur($user, $id_fourn, $ref_fourn, $quantity)
+ public function add_fournisseur($user, $id_fourn, $ref_fourn, $quantity)
{
// phpcs:enable
global $conf;
@@ -3394,13 +3425,13 @@ class Product extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la liste des fournisseurs du produit/service
*
* @return array Tableau des id de fournisseur
*/
- function list_suppliers()
+ public function list_suppliers()
{
// phpcs:enable
global $conf;
@@ -3427,7 +3458,7 @@ class Product extends CommonObject
return $list;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Recopie les prix d'un produit/service sur un autre
*
@@ -3435,7 +3466,7 @@ class Product extends CommonObject
* @param int $toId Id product target
* @return int < 0 if KO, > 0 if OK
*/
- function clone_price($fromId, $toId)
+ public function clone_price($fromId, $toId)
{
// phpcs:enable
$this->db->begin();
@@ -3456,7 +3487,7 @@ class Product extends CommonObject
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Clone links between products
*
@@ -3464,7 +3495,7 @@ class Product extends CommonObject
* @param int $toId Product id
* @return int <0 if KO, >0 if OK
*/
- function clone_associations($fromId, $toId)
+ public function clone_associations($fromId, $toId)
{
// phpcs:enable
$this->db->begin();
@@ -3483,7 +3514,7 @@ class Product extends CommonObject
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Recopie les fournisseurs et prix fournisseurs d'un produit/service sur un autre
*
@@ -3491,7 +3522,7 @@ class Product extends CommonObject
* @param int $toId Id produit cible
* @return int < 0 si erreur, > 0 si ok
*/
- function clone_fournisseurs($fromId, $toId)
+ public function clone_fournisseurs($fromId, $toId)
{
// phpcs:enable
$this->db->begin();
@@ -3531,7 +3562,7 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fonction recursive uniquement utilisee par get_arbo_each_prod, recompose l'arborescence des sousproduits
* Define value of this->res
@@ -3543,7 +3574,7 @@ class Product extends CommonObject
* @param int $id_parent Id parent
* @return void
*/
- function fetch_prod_arbo($prod, $compl_path = "", $multiply = 1, $level = 1, $id_parent = 0)
+ public function fetch_prod_arbo($prod, $compl_path = "", $multiply = 1, $level = 1, $id_parent = 0)
{
// phpcs:enable
global $conf,$langs;
@@ -3592,7 +3623,7 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Build the tree of subproducts into an array
* this->sousprods is loaded by this->get_sousproduits_arbo()
@@ -3600,7 +3631,7 @@ class Product extends CommonObject
* @param int $multiply Because each sublevel must be multiplicated by parent nb
* @return array $this->res
*/
- function get_arbo_each_prod($multiply = 1)
+ public function get_arbo_each_prod($multiply = 1)
{
// phpcs:enable
$this->res = array();
@@ -3791,14 +3822,14 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return tree of all subproducts for product. Tree contains id, name and quantity.
* Set this->sousprods
*
* @return void
*/
- function get_sousproduits_arbo()
+ public function get_sousproduits_arbo()
{
// phpcs:enable
$parent=array();
@@ -4010,7 +4041,7 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return label of a given status
*
@@ -4019,7 +4050,7 @@ class Product extends CommonObject
* @param int $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
* @return string Label of status
*/
- function LibStatut($status, $mode = 0, $type = 0)
+ public function LibStatut($status, $mode = 0, $type = 0)
{
// phpcs:enable
global $conf, $langs;
@@ -4051,38 +4082,52 @@ class Product extends CommonObject
}
}
if ($mode == 0) {
- if ($status == 0) { return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort'));
- } elseif ($status == 1) { return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort'));
+ if ($status == 0) {
+ return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort'));
+ } elseif ($status == 1) {
+ return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort'));
}
}
elseif ($mode == 1) {
- if ($status == 0) { return ($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy'));
- } elseif ($status == 1) { return ($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy'));
+ if ($status == 0) {
+ return ($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy'));
+ } elseif ($status == 1) {
+ return ($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy'));
}
}
elseif ($mode == 2) {
- if ($status == 0) { return img_picto($langs->trans('ProductStatusNotOnSell'), 'statut5', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort'));
- } elseif ($status == 1) { return img_picto($langs->trans('ProductStatusOnSell'), 'statut4', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort'));
+ if ($status == 0) {
+ return img_picto($langs->trans('ProductStatusNotOnSell'), 'statut5', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort'));
+ } elseif ($status == 1) {
+ return img_picto($langs->trans('ProductStatusOnSell'), 'statut4', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort'));
}
}
elseif ($mode == 3) {
- if ($status == 0) { return img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell') : $langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"');
- } elseif ($status == 1) { return img_picto(($type==0 ? $langs->trans('ProductStatusOnSell') : $langs->trans('ProductStatusOnBuy')), 'statut4', 'class="pictostatus"');
+ if ($status == 0) {
+ return img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell') : $langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"');
+ } elseif ($status == 1) {
+ return img_picto(($type==0 ? $langs->trans('ProductStatusOnSell') : $langs->trans('ProductStatusOnBuy')), 'statut4', 'class="pictostatus"');
}
}
elseif ($mode == 4) {
- if ($status == 0) { return img_picto($langs->trans('ProductStatusNotOnSell'), 'statut5', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy'));
- } elseif ($status == 1) { return img_picto($langs->trans('ProductStatusOnSell'), 'statut4', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy'));
+ if ($status == 0) {
+ return img_picto($langs->trans('ProductStatusNotOnSell'), 'statut5', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy'));
+ } elseif ($status == 1) {
+ return img_picto($langs->trans('ProductStatusOnSell'), 'statut4', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy'));
}
}
elseif ($mode == 5) {
- if ($status == 0) { return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"');
- } elseif ($status == 1) { return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')), 'statut4', 'class="pictostatus"');
+ if ($status == 0) {
+ return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"');
+ } elseif ($status == 1) {
+ return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')), 'statut4', 'class="pictostatus"');
}
}
elseif ($mode == 6) {
- if ($status == 0) { return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"');
- } elseif ($status == 1) { return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')), 'statut4', 'class="pictostatus"');
+ if ($status == 0) {
+ return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"');
+ } elseif ($status == 1) {
+ return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')), 'statut4', 'class="pictostatus"');
}
}
return $langs->trans('Unknown');
@@ -4094,7 +4139,7 @@ class Product extends CommonObject
*
* @return string Libelle
*/
- function getLibFinished()
+ public function getLibFinished()
{
global $langs;
$langs->load('products');
@@ -4107,7 +4152,7 @@ class Product extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adjust stock in a warehouse for product
*
@@ -4122,7 +4167,7 @@ class Product extends CommonObject
* @param int $origin_id Origin id of element
* @return int <0 if KO, >0 if OK
*/
- function correct_stock($user, $id_entrepot, $nbpiece, $movement, $label = '', $price = 0, $inventorycode = '', $origin_element = '', $origin_id = null)
+ public function correct_stock($user, $id_entrepot, $nbpiece, $movement, $label = '', $price = 0, $inventorycode = '', $origin_element = '', $origin_id = null)
{
// phpcs:enable
if ($id_entrepot) {
@@ -4152,7 +4197,7 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adjust stock in a warehouse for product with batch number
*
@@ -4170,7 +4215,7 @@ class Product extends CommonObject
* @param int $origin_id Origin id of element
* @return int <0 if KO, >0 if OK
*/
- function correct_stock_batch($user, $id_entrepot, $nbpiece, $movement, $label = '', $price = 0, $dlc = '', $dluo = '', $lot = '', $inventorycode = '', $origin_element = '', $origin_id = null)
+ public function correct_stock_batch($user, $id_entrepot, $nbpiece, $movement, $label = '', $price = 0, $dlc = '', $dluo = '', $lot = '', $inventorycode = '', $origin_element = '', $origin_id = null)
{
// phpcs:enable
if ($id_entrepot) {
@@ -4200,7 +4245,7 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load information about stock of a product into ->stock_reel, ->stock_warehouse[] (including stock_warehouse[idwarehouse]->detail_batch for batch products)
* This function need a lot of load. If you use it on list, use a cache to execute it once for each product id.
@@ -4210,7 +4255,7 @@ class Product extends CommonObject
* @return int < 0 if KO, > 0 if OK
* @see load_virtual_stock(), loadBatchInfo()
*/
- function load_stock($option = '')
+ public function load_stock($option = '')
{
// phpcs:enable
global $conf;
@@ -4274,7 +4319,7 @@ class Product extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load value ->stock_theorique of a product. Property this->id must be defined.
* This function need a lot of load. If you use it on list, use a cache to execute it one for each product id.
@@ -4282,7 +4327,7 @@ class Product extends CommonObject
* @return int < 0 if KO, > 0 if OK
* @see load_stock(), loadBatchInfo()
*/
- function load_virtual_stock()
+ public function load_virtual_stock()
{
// phpcs:enable
global $conf, $hookmanager, $action;
@@ -4360,7 +4405,7 @@ class Product extends CommonObject
* @return array Array with record into product_batch
* @see load_stock(), load_virtual_stock()
*/
- function loadBatchInfo($batch)
+ public function loadBatchInfo($batch)
{
$result=array();
@@ -4388,7 +4433,7 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Move an uploaded file described into $file array into target directory $sdir.
*
@@ -4396,7 +4441,7 @@ class Product extends CommonObject
* @param string $file Array of file info of file to upload: array('name'=>..., 'tmp_name'=>...)
* @return int <0 if KO, >0 if OK
*/
- function add_photo($sdir, $file)
+ public function add_photo($sdir, $file)
{
// phpcs:enable
global $conf;
@@ -4406,8 +4451,10 @@ class Product extends CommonObject
$result = 0;
$dir = $sdir;
- if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { $dir .= '/'. get_exdir($this->id, 2, 0, 0, $this, 'product') . $this->id ."/photos";
- } else { $dir .= '/'.get_exdir(0, 0, 0, 0, $this, 'product').dol_sanitizeFileName($this->ref);
+ if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) {
+ $dir .= '/'. get_exdir($this->id, 2, 0, 0, $this, 'product') . $this->id ."/photos";
+ } else {
+ $dir .= '/'.get_exdir(0, 0, 0, 0, $this, 'product').dol_sanitizeFileName($this->ref);
}
dol_mkdir($dir);
@@ -4426,19 +4473,21 @@ class Product extends CommonObject
}
}
- if (is_numeric($result) && $result > 0) { return 1;
- } else { return -1;
+ if (is_numeric($result) && $result > 0) {
+ return 1;
+ } else {
+ return -1;
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return if at least one photo is available
*
* @param string $sdir Directory to scan
* @return boolean True if at least one photo is available, False if not
*/
- function is_photo_available($sdir)
+ public function is_photo_available($sdir)
{
// phpcs:enable
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
@@ -4469,7 +4518,7 @@ class Product extends CommonObject
return false;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Retourne tableau de toutes les photos du produit
*
@@ -4477,7 +4526,7 @@ class Product extends CommonObject
* @param int $nbmax Nombre maximum de photos (0=pas de max)
* @return array Tableau de photos
*/
- function liste_photos($dir, $nbmax = 0)
+ public function liste_photos($dir, $nbmax = 0)
{
// phpcs:enable
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -4526,14 +4575,14 @@ class Product extends CommonObject
return $tabobj;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Efface la photo du produit et sa vignette
*
* @param string $file Chemin de l'image
* @return void
*/
- function delete_photo($file)
+ public function delete_photo($file)
{
// phpcs:enable
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -4560,14 +4609,14 @@ class Product extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load size of image file
*
* @param string $file Path to file
* @return void
*/
- function get_image_size($file)
+ public function get_image_size($file)
{
// phpcs:enable
$file_osencoded=dol_osencode($file);
@@ -4576,13 +4625,13 @@ class Product extends CommonObject
$this->imgHeight = $infoImg[1]; // Hauteur de l'image
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load indicators this->nb for the dashboard
*
* @return int <0 if KO, >0 if OK
*/
- function load_state_board()
+ public function load_state_board()
{
// phpcs:enable
global $conf, $user, $hookmanager;
@@ -4624,7 +4673,7 @@ class Product extends CommonObject
*
* @return boolean True if it's a product
*/
- function isProduct()
+ public function isProduct()
{
return ($this->type == Product::TYPE_PRODUCT ? true : false);
}
@@ -4634,12 +4683,12 @@ class Product extends CommonObject
*
* @return boolean True if it's a service
*/
- function isService()
+ public function isService()
{
return ($this->type == Product::TYPE_SERVICE ? true : false);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get a barcode from the module to generate barcode values.
* Return value is stored into this->barcode
@@ -4648,7 +4697,7 @@ class Product extends CommonObject
* @param string $type Barcode type (ean, isbn, ...)
* @return void
*/
- function get_barcode($object, $type = '')
+ public function get_barcode($object, $type = '')
{
// phpcs:enable
global $conf;
@@ -4679,7 +4728,7 @@ class Product extends CommonObject
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
global $user,$langs,$conf,$mysoc;
@@ -4724,7 +4773,7 @@ class Product extends CommonObject
* @param string $type Label type (long or short)
* @return string|int <0 if ko, label if ok
*/
- function getLabelOfUnit($type = 'long')
+ public function getLabelOfUnit($type = 'long')
{
global $langs;
@@ -4761,19 +4810,19 @@ class Product extends CommonObject
*
* @return boolean True if it's has
*/
- function hasbatch()
+ public function hasbatch()
{
return ($this->status_batch == 1 ? true : false);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return minimum product recommended price
*
* @return int Minimum recommanded price that is higher price among all suppliers * PRODUCT_MINIMUM_RECOMMENDED_PRICE
*/
- function min_recommended_price()
+ public function min_recommended_price()
{
// phpcs:enable
global $conf;
@@ -4950,7 +4999,7 @@ class Product extends CommonObject
* @param int $id Id of thirdparty to load
* @return void
*/
- function info($id)
+ public function info($id)
{
$sql = "SELECT p.rowid, p.ref, p.datec as date_creation, p.tms as date_modification,";
$sql.= " p.fk_user_author, p.fk_user_modif";
diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php
index 51afbe5edd1..6c115a258e6 100644
--- a/htdocs/product/class/productbatch.class.php
+++ b/htdocs/product/class/productbatch.class.php
@@ -57,7 +57,7 @@ class Productbatch extends CommonObject
*
* @param DoliDb $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -70,7 +70,7 @@ class Productbatch extends CommonObject
* @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)
+ public function create($user, $notrigger = 0)
{
global $conf, $langs;
$error=0;
@@ -142,7 +142,7 @@ class Productbatch extends CommonObject
* @param int $id Id object
* @return int <0 if KO, >0 if OK
*/
- function fetch($id)
+ public function fetch($id)
{
global $langs;
$sql = "SELECT";
@@ -201,7 +201,7 @@ class Productbatch extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function update($user = null, $notrigger = 0)
+ public function update($user = null, $notrigger = 0)
{
global $conf, $langs;
$error=0;
@@ -262,17 +262,17 @@ class Productbatch extends CommonObject
$this->db->commit();
return 1;
}
- }
+ }
- /**
- * Delete object in database
- *
- * @param User $user User that deletes
+ /**
+ * 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)
- {
+ * @return int <0 if KO, >0 if OK
+ */
+ public function delete($user, $notrigger = 0)
+ {
global $conf, $langs;
$error=0;
@@ -330,7 +330,7 @@ class Productbatch extends CommonObject
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
- function createFromClone($fromid)
+ public function createFromClone($fromid)
{
global $user,$langs;
@@ -387,7 +387,7 @@ class Productbatch extends CommonObject
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
$this->id=0;
@@ -421,7 +421,7 @@ class Productbatch extends CommonObject
* @param string $batch_number batch number for object
* @return int <0 if KO, >0 if OK
*/
- function find($fk_product_stock = 0, $eatby = '', $sellby = '', $batch_number = '')
+ public function find($fk_product_stock = 0, $eatby = '', $sellby = '', $batch_number = '')
{
global $langs;
$where = array();
@@ -511,10 +511,9 @@ class Productbatch extends CommonObject
dol_syslog("productbatch::findAll", LOG_DEBUG);
$resql=$db->query($sql);
- if ($resql)
- {
- $num = $db->num_rows($resql);
- $i=0;
+ if ($resql) {
+ $num = $db->num_rows($resql);
+ $i=0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
@@ -539,7 +538,7 @@ class Productbatch extends CommonObject
}
else
{
- $error="Error ".$db->lasterror();
+ $error="Error ".$db->lasterror();
return -1;
}
}
diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php
index 511ce5c3138..f4c7c954156 100644
--- a/htdocs/product/class/productcustomerprice.class.php
+++ b/htdocs/product/class/productcustomerprice.class.php
@@ -54,7 +54,7 @@ class Productcustomerprice extends CommonObject
/**
* @var int Thirdparty ID
*/
- public $fk_soc;
+ public $fk_soc;
public $price;
public $price_ttc;
@@ -81,10 +81,10 @@ class Productcustomerprice extends CommonObject
*
* @param DoliDb $db handler
*/
- function __construct($db)
+ public function __construct($db)
{
- $this->db = $db;
- }
+ $this->db = $db;
+ }
/**
* Create object into database
@@ -94,7 +94,7 @@ class Productcustomerprice extends CommonObject
* @param int $forceupdateaffiliate update price on each soc child
* @return int <0 if KO, Id of created object if OK
*/
- function create($user, $notrigger = 0, $forceupdateaffiliate = 0)
+ public function create($user, $notrigger = 0, $forceupdateaffiliate = 0)
{
global $conf, $langs;
@@ -258,7 +258,7 @@ class Productcustomerprice extends CommonObject
* @param int $id object
* @return int <0 if KO, >0 if OK
*/
- function fetch($id)
+ public function fetch($id)
{
global $langs;
@@ -332,7 +332,7 @@ class Productcustomerprice extends CommonObject
* @param array $filter Filter for select
* @return int <0 if KO, >0 if OK
*/
- function fetch_all($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = array())
+ public function fetch_all($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = array())
{
// phpcs:enable
global $langs;
@@ -447,7 +447,7 @@ class Productcustomerprice extends CommonObject
* @param array $filter Filter for sql request
* @return int <0 if KO, >0 if OK
*/
- function fetch_all_log($sortorder, $sortfield, $limit, $offset, $filter = array())
+ public function fetch_all_log($sortorder, $sortfield, $limit, $offset, $filter = array())
{
// phpcs:enable
global $langs;
@@ -553,7 +553,7 @@ class Productcustomerprice extends CommonObject
* @param int $forceupdateaffiliate update price on each soc child
* @return int <0 if KO, >0 if OK
*/
- function update($user = 0, $notrigger = 0, $forceupdateaffiliate = 0)
+ public function update($user = 0, $notrigger = 0, $forceupdateaffiliate = 0)
{
global $conf, $langs;
@@ -751,7 +751,7 @@ class Productcustomerprice extends CommonObject
* @param int $forceupdateaffiliate update price on each soc child
* @return int <0 if KO, >0 if OK
*/
- function setPriceOnAffiliateThirdparty($user, $forceupdateaffiliate)
+ public function setPriceOnAffiliateThirdparty($user, $forceupdateaffiliate)
{
$error = 0;
@@ -844,7 +844,7 @@ class Productcustomerprice extends CommonObject
* @param int $notrigger triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function delete($user, $notrigger = 0)
+ public function delete($user, $notrigger = 0)
{
global $conf, $langs;
@@ -898,7 +898,7 @@ class Productcustomerprice extends CommonObject
* @param int $fromid of object to clone
* @return int id of clone
*/
- function createFromClone($fromid)
+ public function createFromClone($fromid)
{
global $user, $langs;
@@ -950,7 +950,7 @@ class Productcustomerprice extends CommonObject
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
$this->id = 0;
@@ -1014,12 +1014,12 @@ class PriceByCustomerLine
public $localtax1_tx;
public $localtax2_tx;
- /**
- * @var int User ID
- */
- public $fk_user;
+ /**
+ * @var int User ID
+ */
+ public $fk_user;
- public $import_key;
- public $socname;
- public $prodref;
+ public $import_key;
+ public $socname;
+ public $prodref;
}
diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php
index 9a62b9c1e6f..89512848c1b 100644
--- a/htdocs/product/class/propalmergepdfproduct.class.php
+++ b/htdocs/product/class/propalmergepdfproduct.class.php
@@ -41,15 +41,15 @@ class Propalmergepdfproduct extends CommonObject
*/
public $table_element='propal_merge_pdf_product';
- var $fk_product;
- var $file_name;
- var $fk_user_author;
- var $fk_user_mod;
- var $datec='';
- var $tms='';
- var $lang;
+ public $fk_product;
+ public $file_name;
+ public $fk_user_author;
+ public $fk_user_mod;
+ public $datec='';
+ public $tms='';
+ public $lang;
- var $lines=array();
+ public $lines=array();
@@ -59,7 +59,7 @@ class Propalmergepdfproduct extends CommonObject
*
* @param DoliDb $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -72,7 +72,7 @@ class Propalmergepdfproduct extends CommonObject
* @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)
+ public function create($user, $notrigger = 0)
{
global $conf, $langs;
$error=0;
@@ -167,7 +167,7 @@ class Propalmergepdfproduct extends CommonObject
* @param int $id Id object
* @return int <0 if KO, >0 if OK
*/
- function fetch($id)
+ public function fetch($id)
{
global $langs,$conf;
@@ -228,7 +228,7 @@ class Propalmergepdfproduct extends CommonObject
* @param string $lang Lang string code
* @return int <0 if KO, >0 if OK
*/
- function fetch_by_product($product_id, $lang = '')
+ public function fetch_by_product($product_id, $lang = '')
{
// phpcs:enable
global $langs,$conf;
@@ -303,7 +303,7 @@ class Propalmergepdfproduct extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function update($user = 0, $notrigger = 0)
+ public function update($user = 0, $notrigger = 0)
{
global $conf, $langs;
$error=0;
@@ -379,7 +379,7 @@ class Propalmergepdfproduct extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function delete($user, $notrigger = 0)
+ public function delete($user, $notrigger = 0)
{
global $conf, $langs;
$error=0;
@@ -440,7 +440,7 @@ class Propalmergepdfproduct extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function delete_by_product($user, $product_id, $lang_id = '', $notrigger = 0)
+ public function delete_by_product($user, $product_id, $lang_id = '', $notrigger = 0)
{
// phpcs:enable
global $conf, $langs;
@@ -503,7 +503,7 @@ class Propalmergepdfproduct extends CommonObject
* @param User $user User that deletes
* @return int <0 if KO, >0 if OK
*/
- function delete_by_file($user)
+ public function delete_by_file($user)
{
// phpcs:enable
global $conf, $langs;
@@ -563,7 +563,7 @@ class Propalmergepdfproduct extends CommonObject
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
- function createFromClone($fromid)
+ public function createFromClone($fromid)
{
global $user,$langs;
@@ -620,7 +620,7 @@ class Propalmergepdfproduct extends CommonObject
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
$this->id=0;
@@ -639,15 +639,15 @@ class Propalmergepdfproduct extends CommonObject
*/
class PropalmergepdfproductLine
{
- /**
- * @var int ID
- */
- public $id;
-
- /**
+ /**
* @var int ID
*/
- public $fk_product;
+ public $id;
+
+ /**
+ * @var int ID
+ */
+ public $fk_product;
public $file_name;
public $lang;
@@ -669,7 +669,7 @@ class PropalmergepdfproductLine
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
return 1;
}
diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php
index e8e3c4b0137..4c5971b8cc4 100644
--- a/htdocs/product/stock/class/api_stockmovements.class.php
+++ b/htdocs/product/stock/class/api_stockmovements.class.php
@@ -45,7 +45,7 @@ class StockMovements extends DolibarrApi
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
global $db, $conf;
$this->db = $db;
@@ -63,7 +63,7 @@ class StockMovements extends DolibarrApi
* @throws RestException
*/
/*
- function get($id)
+ public function get($id)
{
if(! DolibarrApiAccess::$user->rights->stock->lire) {
throw new RestException(401);
@@ -93,7 +93,7 @@ class StockMovements extends DolibarrApi
*
* @throws RestException
*/
- function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
+ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
global $db, $conf;
@@ -174,7 +174,7 @@ class StockMovements extends DolibarrApi
* @return int ID of stock movement
*/
//function post($product_id, $warehouse_id, $qty, $lot='', $movementcode='', $movementlabel='', $price=0)
- function post($request_data = null)
+ public function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->stock->creer) {
throw new RestException(401);
@@ -213,7 +213,7 @@ class StockMovements extends DolibarrApi
* @return int
*/
/*
- function put($id, $request_data = null)
+ public function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->stock->creer) {
throw new RestException(401);
@@ -246,7 +246,7 @@ class StockMovements extends DolibarrApi
* @return array
*/
/*
- function delete($id)
+ public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->stock->supprimer) {
throw new RestException(401);
@@ -280,7 +280,7 @@ class StockMovements extends DolibarrApi
* @param MouvementStock $object Object to clean
* @return array Array of cleaned object properties
*/
- function _cleanObjectDatas($object)
+ private function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);
@@ -338,7 +338,7 @@ class StockMovements extends DolibarrApi
*
* @throws RestException
*/
- function _validate($data)
+ private function _validate($data)
{
$stockmovement = array();
foreach (Warehouses::$FIELDS as $field) {
diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php
index 9dd34f18569..b245578da6b 100644
--- a/htdocs/product/stock/class/api_warehouses.class.php
+++ b/htdocs/product/stock/class/api_warehouses.class.php
@@ -43,7 +43,7 @@ class Warehouses extends DolibarrApi
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
global $db, $conf;
$this->db = $db;
@@ -60,7 +60,7 @@ class Warehouses extends DolibarrApi
*
* @throws RestException
*/
- function get($id)
+ public function get($id)
{
if (! DolibarrApiAccess::$user->rights->stock->lire) {
throw new RestException(401);
@@ -92,7 +92,7 @@ class Warehouses extends DolibarrApi
*
* @throws RestException
*/
- function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
+ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
global $db, $conf;
@@ -159,7 +159,7 @@ class Warehouses extends DolibarrApi
* @param array $request_data Request data
* @return int ID of warehouse
*/
- function post($request_data = null)
+ public function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->stock->creer) {
throw new RestException(401);
@@ -184,7 +184,7 @@ class Warehouses extends DolibarrApi
* @param array $request_data Datas
* @return int
*/
- function put($id, $request_data = null)
+ public function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->stock->creer) {
throw new RestException(401);
@@ -216,7 +216,7 @@ class Warehouses extends DolibarrApi
* @param int $id Warehouse ID
* @return array
*/
- function delete($id)
+ public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->stock->supprimer) {
throw new RestException(401);
@@ -249,7 +249,7 @@ class Warehouses extends DolibarrApi
* @param Entrepot $object Object to clean
* @return array Array of cleaned object properties
*/
- function _cleanObjectDatas($object)
+ private function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);
@@ -269,7 +269,7 @@ class Warehouses extends DolibarrApi
*
* @throws RestException
*/
- function _validate($data)
+ private function _validate($data)
{
$warehouse = array();
foreach (Warehouses::$FIELDS as $field) {
diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php
index 81e8680034e..4713da6e901 100644
--- a/htdocs/product/stock/class/entrepot.class.php
+++ b/htdocs/product/stock/class/entrepot.class.php
@@ -100,7 +100,7 @@ class Entrepot extends CommonObject
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf;
$this->db = $db;
@@ -123,7 +123,7 @@ class Entrepot extends CommonObject
* @param User $user Object user that create the warehouse
* @return int >0 if OK, =<0 if KO
*/
- function create($user)
+ public function create($user)
{
global $conf;
@@ -197,7 +197,7 @@ class Entrepot extends CommonObject
* @param User $user User object
* @return int >0 if OK, <0 if KO
*/
- function update($id, $user)
+ public function update($id, $user)
{
if (empty($id)) $id = $this->id;
@@ -260,7 +260,7 @@ class Entrepot extends CommonObject
* @param int $notrigger 1=No trigger
* @return int <0 if KO, >0 if OK
*/
- function delete($user, $notrigger = 0)
+ public function delete($user, $notrigger = 0)
{
$this->db->begin();
@@ -331,7 +331,7 @@ class Entrepot extends CommonObject
* @param string $ref Warehouse label
* @return int >0 if OK, <0 if KO
*/
- function fetch($id, $ref = '')
+ public function fetch($id, $ref = '')
{
global $conf;
@@ -403,7 +403,7 @@ class Entrepot extends CommonObject
* @param int $id warehouse id
* @return void
*/
- function info($id)
+ public function info($id)
{
$sql = "SELECT e.rowid, e.datec, e.tms as datem, e.fk_user_author";
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
@@ -451,7 +451,7 @@ class Entrepot extends CommonObject
* @param int $status Status
* @return array Array list of warehouses
*/
- function list_array($status = 1)
+ public function list_array($status = 1)
{
// phpcs:enable
$liste = array();
@@ -483,7 +483,7 @@ class Entrepot extends CommonObject
*
* @return Array Array('nb'=>Nb, 'value'=>Value)
*/
- function nb_different_products()
+ public function nb_different_products()
{
// phpcs:enable
$ret=array();
@@ -517,7 +517,7 @@ class Entrepot extends CommonObject
*
* @return Array Array('nb'=>Nb, 'value'=>Value)
*/
- function nb_products()
+ public function nb_products()
{
// phpcs:enable
$ret=array();
@@ -552,7 +552,7 @@ class Entrepot extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label of status
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->statut, $mode);
}
@@ -565,7 +565,7 @@ class Entrepot extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label of status
*/
- function LibStatut($statut, $mode = 0)
+ public function LibStatut($statut, $mode = 0)
{
// phpcs:enable
global $langs;
@@ -616,7 +616,7 @@ class Entrepot extends CommonObject
* @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/
- function getNomUrl($withpicto = 0, $option = '', $showfullpath = 0, $notooltip = 0)
+ public function getNomUrl($withpicto = 0, $option = '', $showfullpath = 0, $notooltip = 0)
{
global $conf, $langs;
$langs->load("stocks");
@@ -663,7 +663,7 @@ class Entrepot extends CommonObject
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
global $user,$langs,$conf,$mysoc;
@@ -690,7 +690,7 @@ class Entrepot extends CommonObject
*
* @return string String full path to current warehouse separated by " >> "
*/
- function get_full_arbo()
+ public function get_full_arbo()
{
// phpcs:enable
global $user,$langs,$conf;
@@ -734,7 +734,7 @@ class Entrepot extends CommonObject
* @param integer[] $TChildWarehouses array which will contain all children (param by reference)
* @return integer[] $TChildWarehouses array which will contain all children
*/
- function get_children_warehouses($id, &$TChildWarehouses)
+ public function get_children_warehouses($id, &$TChildWarehouses)
{
// phpcs:enable
diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php
index 8a9baa6499d..19c5a1a0178 100644
--- a/htdocs/product/stock/class/mouvementstock.class.php
+++ b/htdocs/product/stock/class/mouvementstock.class.php
@@ -83,7 +83,7 @@ class MouvementStock extends CommonObject
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -111,7 +111,7 @@ class MouvementStock extends CommonObject
* @param int $id_product_batch Id product_batch (when skip_batch is false and we already know which record of product_batch to use)
* @return int <0 if KO, 0 if fk_product is null, >0 if OK
*/
- function _create($user, $fk_product, $entrepot_id, $qty, $type, $price = 0, $label = '', $inventorycode = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $skip_batch = false, $id_product_batch = 0)
+ public function _create($user, $fk_product, $entrepot_id, $qty, $type, $price = 0, $label = '', $inventorycode = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $skip_batch = false, $id_product_batch = 0)
{
global $conf, $langs;
@@ -188,7 +188,7 @@ class MouvementStock extends CommonObject
$resql = $this->db->query($sql);
if ($resql)
{
- $num = $this->db->num_rows($resql);
+ $num = $this->db->num_rows($resql);
$i=0;
if ($num > 0)
{
@@ -370,7 +370,7 @@ class MouvementStock extends CommonObject
dol_syslog(get_class($this)."::_create insert record into stock_mouvement", LOG_DEBUG);
$resql = $this->db->query($sql);
-
+
if ($resql)
{
$mvid = $this->db->last_insert_id(MAIN_DB_PREFIX."stock_mouvement");
@@ -413,7 +413,7 @@ class MouvementStock extends CommonObject
$error = -2;
}
}
-
+
// Calculate new PMP.
$newpmp=0;
if (! $error)
@@ -640,7 +640,7 @@ class MouvementStock extends CommonObject
* @param string $inventorycode Inventory code
* @return int <0 if KO, 0 if OK
*/
- function _createSubProduct($user, $idProduct, $entrepot_id, $qty, $type, $price = 0, $label = '', $inventorycode = '')
+ private function _createSubProduct($user, $idProduct, $entrepot_id, $qty, $type, $price = 0, $label = '', $inventorycode = '')
{
global $langs;
@@ -712,7 +712,7 @@ class MouvementStock extends CommonObject
* @param int $id_product_batch Id product_batch
* @return int <0 if KO, >0 if OK
*/
- function livraison($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $id_product_batch = 0)
+ public function livraison($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $id_product_batch = 0)
{
global $conf;
@@ -735,7 +735,7 @@ class MouvementStock extends CommonObject
* @param string $batch batch number
* @return int <0 if KO, >0 if OK
*/
- function reception($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $eatby = '', $sellby = '', $batch = '')
+ public function reception($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $eatby = '', $sellby = '', $batch = '')
{
return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price, $label, '', '', $eatby, $sellby, $batch);
}
@@ -749,7 +749,7 @@ class MouvementStock extends CommonObject
* @deprecated A count($product->getChildsArbo($id,1)) is same. No reason to have this in this class.
*/
/*
- function nbOfSubProducts($id)
+ public function nbOfSubProducts($id)
{
$nbSP=0;
@@ -770,7 +770,7 @@ class MouvementStock extends CommonObject
* @param timestamp $datebefore Date limit
* @return int Number
*/
- function calculateBalanceForProductBefore($productidselected, $datebefore)
+ public function calculateBalanceForProductBefore($productidselected, $datebefore)
{
$nb=0;
@@ -885,7 +885,7 @@ class MouvementStock extends CommonObject
* @param int $origintype Type origin
* @return string
*/
- function get_origin($fk_origin, $origintype)
+ public function get_origin($fk_origin, $origintype)
{
// phpcs:enable
$origin='';
@@ -946,7 +946,7 @@ class MouvementStock extends CommonObject
*
* @return void
*/
- function setOrigin($origin_element, $origin_id)
+ public function setOrigin($origin_element, $origin_id)
{
if (!empty($origin_element) && $origin_id > 0)
{
@@ -973,7 +973,7 @@ class MouvementStock extends CommonObject
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
global $user,$langs,$conf,$mysoc;
@@ -994,7 +994,7 @@ class MouvementStock extends CommonObject
* @param string $morecss Add more css on link
* @return string String with URL
*/
- function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '')
+ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '')
{
global $langs, $conf, $db;
@@ -1027,7 +1027,7 @@ class MouvementStock extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return $this->LibStatut($mode);
}
@@ -1039,7 +1039,7 @@ class MouvementStock extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
- function LibStatut($mode = 0)
+ public function LibStatut($mode = 0)
{
// phpcs:enable
global $langs;
diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php
index a47e627036c..8bb3a984634 100644
--- a/htdocs/product/stock/class/productlot.class.php
+++ b/htdocs/product/stock/class/productlot.class.php
@@ -485,7 +485,7 @@ class Productlot extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label of status
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return $this->LibStatut(0, $mode);
}
@@ -498,7 +498,7 @@ class Productlot extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label of status
*/
- function LibStatut($statut, $mode = 0)
+ public function LibStatut($statut, $mode = 0)
{
// phpcs:enable
global $langs;
@@ -521,7 +521,7 @@ class Productlot extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
- function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '', $save_lastsearch_value = -1)
+ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '', $save_lastsearch_value = -1)
{
global $langs, $conf, $db;
global $dolibarr_main_authentication, $dolibarr_main_demo;
diff --git a/htdocs/product/stock/class/productstockentrepot.class.php b/htdocs/product/stock/class/productstockentrepot.class.php
index d3e60d16016..36e302bf661 100644
--- a/htdocs/product/stock/class/productstockentrepot.class.php
+++ b/htdocs/product/stock/class/productstockentrepot.class.php
@@ -478,7 +478,7 @@ class ProductStockEntrepot extends CommonObject
* @param string $morecss Add more css on link
* @return string String with URL
*/
- function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '')
+ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '')
{
global $langs, $conf, $db;
global $dolibarr_main_authentication, $dolibarr_main_demo;
@@ -501,10 +501,10 @@ class ProductStockEntrepot extends CommonObject
{
$result.=($link.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
if ($withpicto != 2) $result.=' ';
- }
- $result.= $link . $this->ref . $linkend;
- return $result;
- }
+ }
+ $result.= $link . $this->ref . $linkend;
+ return $result;
+ }
/**
* Retourne le libelle du status d'un user (actif, inactif)
@@ -512,12 +512,12 @@ class ProductStockEntrepot extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->status, $mode);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un status donne
*
@@ -525,7 +525,7 @@ class ProductStockEntrepot extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
- function LibStatut($status, $mode = 0)
+ public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php
index 882cda1cffd..532f46ccfe4 100644
--- a/htdocs/projet/class/api_projects.class.php
+++ b/htdocs/projet/class/api_projects.class.php
@@ -46,7 +46,7 @@ class Projects extends DolibarrApi
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
global $db, $conf;
$this->db = $db;
@@ -64,7 +64,7 @@ class Projects extends DolibarrApi
*
* @throws RestException
*/
- function get($id)
+ public function get($id)
{
if(! DolibarrApiAccess::$user->rights->projet->lire) {
throw new RestException(401);
@@ -98,7 +98,7 @@ class Projects extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of project objects
*/
- function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
+ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
{
global $db, $conf;
@@ -180,7 +180,7 @@ class Projects extends DolibarrApi
* @param array $request_data Request data
* @return int ID of project
*/
- function post($request_data = null)
+ public function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->projet->creer) {
throw new RestException(401, "Insuffisant rights");
@@ -215,7 +215,7 @@ class Projects extends DolibarrApi
*
* @url GET {id}/tasks
*/
- function getLines($id, $includetimespent = 0)
+ public function getLines($id, $includetimespent = 0)
{
if (! DolibarrApiAccess::$user->rights->projet->lire) {
throw new RestException(401);
@@ -258,7 +258,7 @@ class Projects extends DolibarrApi
*
* @return int
*/
- function getRoles($id, $userid = 0)
+ public function getRoles($id, $userid = 0)
{
global $db;
@@ -303,7 +303,7 @@ class Projects extends DolibarrApi
* @return int
*/
/*
- function postLine($id, $request_data = null)
+ public function postLine($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->projet->creer) {
throw new RestException(401);
@@ -366,7 +366,7 @@ class Projects extends DolibarrApi
* @return object
*/
/*
- function putLine($id, $lineid, $request_data = null)
+ public function putLine($id, $lineid, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->projet->creer) {
throw new RestException(401);
@@ -423,7 +423,7 @@ class Projects extends DolibarrApi
*
* @return int
*/
- function put($id, $request_data = null)
+ public function put($id, $request_data = null)
{
if (! DolibarrApiAccess::$user->rights->projet->creer) {
throw new RestException(401);
@@ -459,7 +459,7 @@ class Projects extends DolibarrApi
*
* @return array
*/
- function delete($id)
+ public function delete($id)
{
if (! DolibarrApiAccess::$user->rights->projet->supprimer) {
throw new RestException(401);
@@ -503,7 +503,7 @@ class Projects extends DolibarrApi
* "notrigger": 0
* }
*/
- function validate($id, $notrigger = 0)
+ public function validate($id, $notrigger = 0)
{
if(! DolibarrApiAccess::$user->rights->projet->creer) {
throw new RestException(401);
@@ -540,7 +540,7 @@ class Projects extends DolibarrApi
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
- function _cleanObjectDatas($object)
+ private function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);
@@ -591,7 +591,7 @@ class Projects extends DolibarrApi
* @return array
* @throws RestException
*/
- function _validate($data)
+ private function _validate($data)
{
$object = array();
foreach (self::$FIELDS as $field) {
diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php
index ad49146cfaa..40c3e78f7e6 100644
--- a/htdocs/projet/class/api_tasks.class.php
+++ b/htdocs/projet/class/api_tasks.class.php
@@ -46,10 +46,10 @@ class Tasks extends DolibarrApi
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
- global $db, $conf;
- $this->db = $db;
+ global $db, $conf;
+ $this->db = $db;
$this->task = new Task($this->db);
}
@@ -64,7 +64,7 @@ class Tasks extends DolibarrApi
*
* @throws RestException
*/
- function get($id, $includetimespent = 0)
+ public function get($id, $includetimespent = 0)
{
if(! DolibarrApiAccess::$user->rights->projet->lire) {
throw new RestException(401);
@@ -106,7 +106,7 @@ class Tasks extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of project objects
*/
- function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
+ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
global $db, $conf;
@@ -188,7 +188,7 @@ class Tasks extends DolibarrApi
* @param array $request_data Request data
* @return int ID of project
*/
- function post($request_data = null)
+ public function post($request_data = null)
{
if (! DolibarrApiAccess::$user->rights->projet->creer) {
throw new RestException(401, "Insuffisant rights");
@@ -222,7 +222,7 @@ class Tasks extends DolibarrApi
* @url GET {id}/tasks
*/
/*
- function getLines($id, $includetimespent=0)
+ public function getLines($id, $includetimespent=0)
{
if(! DolibarrApiAccess::$user->rights->projet->lire) {
throw new RestException(401);
@@ -265,7 +265,7 @@ class Tasks extends DolibarrApi
*
* @return int
*/
- function getRoles($id, $userid = 0)
+ public function getRoles($id, $userid = 0)
{
global $db;
@@ -308,7 +308,7 @@ class Tasks extends DolibarrApi
* @return int
*/
/*
- function postLine($id, $request_data = null)
+ public function postLine($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->projet->creer) {
throw new RestException(401);
@@ -371,7 +371,7 @@ class Tasks extends DolibarrApi
* @return object
*/
/*
- function putLine($id, $lineid, $request_data = null)
+ public function putLine($id, $lineid, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->projet->creer) {
throw new RestException(401);
@@ -427,7 +427,7 @@ class Tasks extends DolibarrApi
*
* @return int
*/
- function put($id, $request_data = null)
+ public function put($id, $request_data = null)
{
if (! DolibarrApiAccess::$user->rights->projet->creer) {
throw new RestException(401);
@@ -463,11 +463,11 @@ class Tasks extends DolibarrApi
*
* @return array
*/
- function delete($id)
+ public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->projet->supprimer) {
- throw new RestException(401);
- }
+ throw new RestException(401);
+ }
$result = $this->task->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Task not found');
@@ -505,7 +505,7 @@ class Tasks extends DolibarrApi
*
* @return array
*/
- function addTimeSpent($id, $date, $duration, $user_id = 0, $note = '')
+ public function addTimeSpent($id, $date, $duration, $user_id = 0, $note = '')
{
if( ! DolibarrApiAccess::$user->rights->projet->creer) {
throw new RestException(401);
@@ -553,7 +553,7 @@ class Tasks extends DolibarrApi
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
- function _cleanObjectDatas($object)
+ private function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);
@@ -601,7 +601,7 @@ class Tasks extends DolibarrApi
* @return array
* @throws RestException
*/
- function _validate($data)
+ private function _validate($data)
{
$object = array();
foreach (self::$FIELDS as $field) {
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 4544f047b6f..34a36e859dc 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -155,7 +155,7 @@ class Project extends CommonObject
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
@@ -170,7 +170,7 @@ class Project extends CommonObject
* @param int $notrigger Disable triggers
* @return int <0 if KO, id of created project if OK
*/
- function create($user, $notrigger = 0)
+ public function create($user, $notrigger = 0)
{
global $conf, $langs;
@@ -299,11 +299,11 @@ class Project extends CommonObject
* @param int $notrigger 1=Disable all triggers
* @return int <=0 if KO, >0 if OK
*/
- function update($user, $notrigger = 0)
+ public function update($user, $notrigger = 0)
{
global $langs, $conf;
- $error=0;
+ $error=0;
// Clean parameters
$this->title = trim($this->title);
@@ -413,7 +413,7 @@ class Project extends CommonObject
$result = -2;
}
dol_syslog(get_class($this)."::update error " . $result . " " . $this->error, LOG_ERR);
- }
+ }
}
else
{
@@ -431,9 +431,9 @@ class Project extends CommonObject
* @param string $ref Ref of project
* @return int >0 if OK, 0 if not found, <0 if KO
*/
- function fetch($id, $ref = '')
+ public function fetch($id, $ref = '')
{
- global $conf;
+ global $conf;
if (empty($id) && empty($ref)) return -1;
@@ -508,14 +508,14 @@ class Project extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of projects
*
* @param int $socid To filter on a particular third party
* @return array List of projects
*/
- function liste_array($socid = '')
+ public function liste_array($socid = '')
{
// phpcs:enable
global $conf;
@@ -551,7 +551,7 @@ class Project extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of elements for type, linked to a project
*
@@ -563,7 +563,7 @@ class Project extends CommonObject
* @param string $projectkey Equivalent key to fk_projet for actual type
* @return mixed Array list of object ids linked to project, < 0 or string if error
*/
- function get_element_list($type, $tablename, $datefieldname = '', $dates = '', $datee = '', $projectkey = 'fk_projet')
+ public function get_element_list($type, $tablename, $datefieldname = '', $dates = '', $datee = '', $projectkey = 'fk_projet')
{
// phpcs:enable
$elements = array();
@@ -595,7 +595,7 @@ class Project extends CommonObject
else
{
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . $tablename." WHERE ".$projectkey." IN (". $ids .") AND entity IN (".getEntity($type).")";
- }
+ }
if ($dates > 0)
{
@@ -647,7 +647,7 @@ class Project extends CommonObject
* @param int $notrigger Disable triggers
* @return int <0 if KO, 0 if not possible, >0 if OK
*/
- function delete($user, $notrigger = 0)
+ public function delete($user, $notrigger = 0)
{
global $langs, $conf;
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
@@ -772,7 +772,7 @@ class Project extends CommonObject
* @param User $user User
* @return int <0 if KO, 1 if OK
*/
- function deleteTasks($user)
+ public function deleteTasks($user)
{
$countTasks = count($this->lines);
$deleted = false;
@@ -807,7 +807,7 @@ class Project extends CommonObject
* @param int $notrigger 1=Disable triggers
* @return int <0 if KO, >0 if OK
*/
- function setValid($user, $notrigger = 0)
+ public function setValid($user, $notrigger = 0)
{
global $langs, $conf;
@@ -870,7 +870,7 @@ class Project extends CommonObject
* @param User $user User that close project
* @return int <0 if KO, 0 if already closed, >0 if OK
*/
- function setClose($user)
+ public function setClose($user)
{
global $langs, $conf;
@@ -933,12 +933,12 @@ class Project extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->statut, $mode);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi status label for a status
*
@@ -946,7 +946,7 @@ class Project extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label
*/
- function LibStatut($statut, $mode = 0)
+ public function LibStatut($statut, $mode = 0)
{
// phpcs:enable
global $langs;
@@ -998,7 +998,7 @@ class Project extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
- function getNomUrl($withpicto = 0, $option = '', $addlabel = 0, $moreinpopup = '', $sep = ' - ', $notooltip = 0, $save_lastsearch_value = -1)
+ public function getNomUrl($withpicto = 0, $option = '', $addlabel = 0, $moreinpopup = '', $sep = ' - ', $notooltip = 0, $save_lastsearch_value = -1)
{
global $conf, $langs, $user, $hookmanager;
@@ -1089,7 +1089,7 @@ class Project extends CommonObject
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
global $user, $langs, $conf;
@@ -1132,7 +1132,7 @@ class Project extends CommonObject
* @param string $mode Type of permission we want to know: 'read', 'write'
* @return int >0 if user has permission, <0 if user has no permission
*/
- function restrictedProjectArea($user, $mode = 'read')
+ public function restrictedProjectArea($user, $mode = 'read')
{
// To verify role of users
$userAccess = 0;
@@ -1185,7 +1185,7 @@ class Project extends CommonObject
* @param string $filter additionnal filter on project (statut, ref, ...)
* @return array or string Array of projects id, or string with projects id separated with "," if list is 1
*/
- function getProjectsAuthorizedForUser($user, $mode = 0, $list = 0, $socid = 0, $filter = '')
+ public function getProjectsAuthorizedForUser($user, $mode = 0, $list = 0, $socid = 0, $filter = '')
{
$projects = array();
$temp = array();
@@ -1272,21 +1272,21 @@ class Project extends CommonObject
}
/**
- * Load an object from its id and create a new one in database
- *
- * @param int $fromid Id of object to clone
- * @param bool $clone_contact Clone contact of project
- * @param bool $clone_task Clone task of project
- * @param bool $clone_project_file Clone file of project
- * @param bool $clone_task_file Clone file of task (if task are copied)
- * @param bool $clone_note Clone note of project
- * @param bool $move_date Move task date on clone
- * @param integer $notrigger No trigger flag
- * @param int $newthirdpartyid New thirdparty id
- * @return int New id of clone
- */
- function createFromClone($fromid, $clone_contact = false, $clone_task = true, $clone_project_file = false, $clone_task_file = false, $clone_note = true, $move_date = true, $notrigger = 0, $newthirdpartyid = 0)
- {
+ * Load an object from its id and create a new one in database
+ *
+ * @param int $fromid Id of object to clone
+ * @param bool $clone_contact Clone contact of project
+ * @param bool $clone_task Clone task of project
+ * @param bool $clone_project_file Clone file of project
+ * @param bool $clone_task_file Clone file of task (if task are copied)
+ * @param bool $clone_note Clone note of project
+ * @param bool $move_date Move task date on clone
+ * @param integer $notrigger No trigger flag
+ * @param int $newthirdpartyid New thirdparty id
+ * @return int New id of clone
+ */
+ public function createFromClone($fromid, $clone_contact = false, $clone_task = true, $clone_project_file = false, $clone_task_file = false, $clone_note = true, $move_date = true, $notrigger = 0, $newthirdpartyid = 0)
+ {
global $user,$langs,$conf;
$error=0;
@@ -1366,11 +1366,11 @@ class Project extends CommonObject
$clone_project_id=$clone_project->id;
//Note Update
- if (!$clone_note)
- {
+ if (!$clone_note)
+ {
$clone_project->note_private='';
$clone_project->note_public='';
- }
+ }
else
{
$this->db->begin();
@@ -1529,17 +1529,17 @@ class Project extends CommonObject
dol_syslog(get_class($this)."::createFromClone nbError: ".$error." error : " . $this->error, LOG_ERR);
return -1;
}
- }
+ }
- /**
- * Shift project task date from current date to delta
- *
- * @param timestamp $old_project_dt_start old project start date
- * @return int 1 if OK or < 0 if KO
- */
- function shiftTaskDate($old_project_dt_start)
- {
+ /**
+ * Shift project task date from current date to delta
+ *
+ * @param timestamp $old_project_dt_start old project start date
+ * @return int 1 if OK or < 0 if KO
+ */
+ public function shiftTaskDate($old_project_dt_start)
+ {
global $user,$langs,$conf;
$error=0;
@@ -1573,13 +1573,13 @@ class Project extends CommonObject
//Calcultate new task start date with difference between old proj start date and origin task start date
if (!empty($tasktoshiftdate->date_start))
{
- $task->date_start = $this->date_start + ($tasktoshiftdate->date_start - $old_project_dt_start);
+ $task->date_start = $this->date_start + ($tasktoshiftdate->date_start - $old_project_dt_start);
}
//Calcultate new task end date with difference between origin proj end date and origin task end date
if (!empty($tasktoshiftdate->date_end))
{
- $task->date_end = $this->date_start + ($tasktoshiftdate->date_end - $old_project_dt_start);
+ $task->date_end = $this->date_start + ($tasktoshiftdate->date_end - $old_project_dt_start);
}
if ($to_update)
@@ -1600,7 +1600,7 @@ class Project extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Associate element to a project
*
@@ -1608,7 +1608,7 @@ class Project extends CommonObject
* @param int $elementSelectId Key-rowid of the line of the element to update
* @return int 1 if OK or < 0 if KO
*/
- function update_element($tableName, $elementSelectId)
+ public function update_element($tableName, $elementSelectId)
{
// phpcs:enable
$sql="UPDATE ".MAIN_DB_PREFIX.$tableName;
@@ -1629,12 +1629,12 @@ class Project extends CommonObject
if (!$resql) {
$this->error=$this->db->lasterror();
return -1;
- }else {
+ } else {
return 1;
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Associate element to a project
*
@@ -1642,7 +1642,7 @@ class Project extends CommonObject
* @param int $elementSelectId Key-rowid of the line of the element to update
* @return int 1 if OK or < 0 if KO
*/
- function remove_element($tableName, $elementSelectId)
+ public function remove_element($tableName, $elementSelectId)
{
// phpcs:enable
$sql="UPDATE ".MAIN_DB_PREFIX.$tableName;
@@ -1710,7 +1710,7 @@ class Project extends CommonObject
* @param int $userid Time spent by a particular user
* @return int <0 if OK, >0 if KO
*/
- public function loadTimeSpent($datestart, $taskid = 0, $userid = 0)
+ public function loadTimeSpent($datestart, $taskid = 0, $userid = 0)
{
$error=0;
@@ -1766,14 +1766,14 @@ class Project extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param User $user Objet user
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
- function load_board($user)
+ public function load_board($user)
{
// phpcs:enable
global $conf, $langs;
@@ -1852,13 +1852,13 @@ class Project extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge indicateurs this->nb pour le tableau de bord
*
* @return int <0 if KO, >0 if OK
*/
- function load_state_board()
+ public function load_state_board()
{
// phpcs:enable
global $user;
@@ -1918,7 +1918,7 @@ class Project extends CommonObject
* @param int $id Id of order
* @return void
*/
- function info($id)
+ public function info($id)
{
$sql = 'SELECT c.rowid, datec as datec, tms as datem,';
$sql.= ' date_close as datecloture,';
@@ -2027,7 +2027,7 @@ class Project extends CommonObject
* @param User $user Object user we want project allowed to
* @return int >0 if OK, <0 if KO
*/
- function getLinesArray($user)
+ public function getLinesArray($user)
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$taskstatic = new Task($this->db);
diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php
index bd324ba8b1d..b3920480729 100644
--- a/htdocs/projet/class/projectstats.class.php
+++ b/htdocs/projet/class/projectstats.class.php
@@ -24,25 +24,25 @@ include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
*/
class ProjectStats extends Stats
{
- private $project;
- public $userid;
- public $socid;
- public $year;
+ private $project;
+ public $userid;
+ public $socid;
+ public $year;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
- {
- global $conf, $user;
+ public function __construct($db)
+ {
+ global $conf, $user;
- $this->db = $db;
+ $this->db = $db;
- require_once 'project.class.php';
- $this->project = new Project($this->db);
- }
+ require_once 'project.class.php';
+ $this->project = new Project($this->db);
+ }
/**
@@ -53,7 +53,7 @@ class ProjectStats extends Stats
* @return array|int Array with value or -1 if error
* @throws Exception
*/
- function getAllProjectByStatus($limit = 5)
+ public function getAllProjectByStatus($limit = 5)
{
global $conf, $user, $langs;
@@ -118,7 +118,7 @@ class ProjectStats extends Stats
*
* @return array of values
*/
- function getAllByYear()
+ public function getAllByYear()
{
global $conf, $user, $langs;
@@ -193,7 +193,7 @@ class ProjectStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of values
*/
- function getNbByMonth($year, $format = 0)
+ public function getNbByMonth($year, $format = 0)
{
global $user;
@@ -222,7 +222,7 @@ class ProjectStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with amount by month
*/
- function getAmountByMonth($year, $format = 0)
+ public function getAmountByMonth($year, $format = 0)
{
global $user;
@@ -253,7 +253,7 @@ class ProjectStats extends Stats
* @param int $wonlostfilter Add a filter on status won/lost
* @return array Array of values
*/
- function getWeightedAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $wonlostfilter = 1)
+ public function getWeightedAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $wonlostfilter = 1)
{
global $conf,$user,$langs;
@@ -346,7 +346,7 @@ class ProjectStats extends Stats
* @param int $wonlostfilter Add a filter on status won/lost
* @return array Array with amount by month
*/
- function getWeightedAmountByMonth($year, $wonlostfilter = 1)
+ public function getWeightedAmountByMonth($year, $wonlostfilter = 1)
{
global $user;
@@ -375,7 +375,7 @@ class ProjectStats extends Stats
* @param int $cachedelay accept for cache file (0=No read, no save of cache, -1=No read but save)
* @return array of values
*/
- function getTransformRateByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0)
+ public function getTransformRateByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0)
{
global $conf, $user, $langs;
@@ -456,7 +456,7 @@ class ProjectStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with amount by month
*/
- function getTransformRateByMonth($year, $format = 0)
+ public function getTransformRateByMonth($year, $format = 0)
{
global $user;
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 82f8c9ba169..f0797f3f5b2 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -119,7 +119,7 @@ class Task extends CommonObject
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -132,7 +132,7 @@ class Task extends CommonObject
* @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)
+ public function create($user, $notrigger = 0)
{
global $conf, $langs;
@@ -231,7 +231,7 @@ class Task extends CommonObject
* @param int $loadparentdata Also load parent data
* @return int <0 if KO, 0 if not found, >0 if OK
*/
- function fetch($id, $ref = '', $loadparentdata = 0)
+ public function fetch($id, $ref = '', $loadparentdata = 0)
{
global $langs, $conf;
@@ -333,7 +333,7 @@ class Task extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <=0 if KO, >0 if OK
*/
- function update($user = null, $notrigger = 0)
+ public function update($user = null, $notrigger = 0)
{
global $conf, $langs;
$error=0;
@@ -444,7 +444,7 @@ class Task extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function delete($user, $notrigger = 0)
+ public function delete($user, $notrigger = 0)
{
global $conf, $langs;
@@ -567,7 +567,7 @@ class Task extends CommonObject
*
* @return int <0 if KO, 0 if no children, >0 if OK
*/
- function hasChildren()
+ public function hasChildren()
{
$error=0;
$ret=0;
@@ -601,7 +601,7 @@ class Task extends CommonObject
*
* @return int <0 if KO, 0 if no children, >0 if OK
*/
- function hasTimeSpent()
+ public function hasTimeSpent()
{
$error=0;
$ret=0;
@@ -643,7 +643,7 @@ class Task extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/
- function getNomUrl($withpicto = 0, $option = '', $mode = 'task', $addlabel = 0, $sep = ' - ', $notooltip = 0, $save_lastsearch_value = -1)
+ public function getNomUrl($withpicto = 0, $option = '', $mode = 'task', $addlabel = 0, $sep = ' - ', $notooltip = 0, $save_lastsearch_value = -1)
{
global $conf, $langs, $user;
@@ -700,7 +700,7 @@ class Task extends CommonObject
*
* @return void
*/
- function initAsSpecimen()
+ public function initAsSpecimen()
{
$this->id=0;
@@ -731,7 +731,7 @@ class Task extends CommonObject
* @param string $filterontaskuser Filter on user assigned to task
* @return array Array of tasks
*/
- function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0)
+ public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0)
{
global $conf;
@@ -890,7 +890,7 @@ class Task extends CommonObject
* @param integer $filteronprojstatus Filter on project status if userp is set. Not used if userp not defined.
* @return array Array (projectid => 'list of roles for project' or taskid => 'list of roles for task')
*/
- function getUserRolesForProjectsOrTasks($userp, $usert, $projectid = '', $taskid = 0, $filteronprojstatus = -1)
+ public function getUserRolesForProjectsOrTasks($userp, $usert, $projectid = '', $taskid = 0, $filteronprojstatus = -1)
{
$arrayroles = array();
@@ -967,7 +967,7 @@ class Task extends CommonObject
* @param string $source Source
* @return array Array of id of contacts
*/
- function getListContactId($source = 'internal')
+ public function getListContactId($source = 'internal')
{
$contactAlreadySelected = array();
$tab = $this->liste_contact(-1, $source);
@@ -991,7 +991,7 @@ class Task extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <=0 if KO, >0 if OK
*/
- function addTimeSpent($user, $notrigger = 0)
+ public function addTimeSpent($user, $notrigger = 0)
{
global $conf,$langs;
@@ -1096,7 +1096,7 @@ class Task extends CommonObject
* @param string $morewherefilter Add more filter into where SQL request (must start with ' AND ...')
* @return array Array of info for task array('min_date', 'max_date', 'total_duration', 'total_amount', 'nblines', 'nblinesnull')
*/
- function getSummaryOfTimeSpent($userobj = null, $morewherefilter = '')
+ public function getSummaryOfTimeSpent($userobj = null, $morewherefilter = '')
{
global $langs;
@@ -1159,7 +1159,7 @@ class Task extends CommonObject
* @param string $datee End date (ex 23:59:59)
* @return array Array of info for task array('amount','nbseconds','nblinesnull')
*/
- function getSumOfAmount($fuser = '', $dates = '', $datee = '')
+ public function getSumOfAmount($fuser = '', $dates = '', $datee = '')
{
global $langs;
@@ -1214,7 +1214,7 @@ class Task extends CommonObject
* @param int $id Id object
* @return int <0 if KO, >0 if OK
*/
- function fetchTimeSpent($id)
+ public function fetchTimeSpent($id)
{
global $langs;
@@ -1268,7 +1268,7 @@ class Task extends CommonObject
* @param string $morewherefilter Add more filter into where SQL request (must start with ' AND ...')
* @return int <0 if KO, array of time spent if OK
*/
- function fetchAllTimeSpent(User $userobj, $morewherefilter = '')
+ public function fetchAllTimeSpent(User $userobj, $morewherefilter = '')
{
global $langs;
@@ -1358,7 +1358,7 @@ class Task extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function updateTimeSpent($user, $notrigger = 0)
+ public function updateTimeSpent($user, $notrigger = 0)
{
global $conf,$langs;
@@ -1443,7 +1443,7 @@ class Task extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function delTimeSpent($user, $notrigger = 0)
+ public function delTimeSpent($user, $notrigger = 0)
{
global $conf, $langs;
@@ -1505,20 +1505,20 @@ class Task extends CommonObject
}
}
- /** Load an object from its id and create a new one in database
- *
- * @param int $fromid Id of object to clone
- * @param int $project_id Id of project to attach clone task
- * @param int $parent_task_id Id of task to attach clone task
- * @param bool $clone_change_dt recalculate date of task regarding new project start date
- * @param bool $clone_affectation clone affectation of project
- * @param bool $clone_time clone time of project
- * @param bool $clone_file clone file of project
- * @param bool $clone_note clone note of project
- * @param bool $clone_prog clone progress of project
- * @return int New id of clone
- */
- function createFromClone($fromid, $project_id, $parent_task_id, $clone_change_dt = false, $clone_affectation = false, $clone_time = false, $clone_file = false, $clone_note = false, $clone_prog = false)
+ /** Load an object from its id and create a new one in database
+ *
+ * @param int $fromid Id of object to clone
+ * @param int $project_id Id of project to attach clone task
+ * @param int $parent_task_id Id of task to attach clone task
+ * @param bool $clone_change_dt recalculate date of task regarding new project start date
+ * @param bool $clone_affectation clone affectation of project
+ * @param bool $clone_time clone time of project
+ * @param bool $clone_file clone file of project
+ * @param bool $clone_note clone note of project
+ * @param bool $clone_prog clone progress of project
+ * @return int New id of clone
+ */
+ public function createFromClone($fromid, $project_id, $parent_task_id, $clone_change_dt = false, $clone_affectation = false, $clone_time = false, $clone_file = false, $clone_note = false, $clone_prog = false)
{
global $user,$langs,$conf;
@@ -1745,20 +1745,20 @@ class Task extends CommonObject
* @param integer $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label
*/
- function getLibStatut($mode = 0)
+ public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->fk_statut, $mode);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Return status label for an object
+ * Return status label for an object
*
- * @param int $statut Id statut
- * @param integer $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
- * @return string Label
+ * @param int $statut Id statut
+ * @param integer $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
+ * @return string Label
*/
- function LibStatut($statut, $mode = 0)
+ public function LibStatut($statut, $mode = 0)
{
// phpcs:enable
// list of Statut of the task
@@ -1869,14 +1869,14 @@ class Task extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param User $user Objet user
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
- function load_board($user)
+ public function load_board($user)
{
// phpcs:enable
global $conf, $langs;
@@ -1944,13 +1944,13 @@ class Task extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge indicateurs this->nb de tableau de bord
*
* @return int <0 if ko, >0 if ok
*/
- function load_state_board()
+ public function load_state_board()
{
// phpcs:enable
global $user;
diff --git a/htdocs/projet/class/taskstats.class.php b/htdocs/projet/class/taskstats.class.php
index c71a2ea0746..ad080068f93 100644
--- a/htdocs/projet/class/taskstats.class.php
+++ b/htdocs/projet/class/taskstats.class.php
@@ -34,7 +34,7 @@ class TaskStats extends Stats
*
* @param DoliDb $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
@@ -50,7 +50,7 @@ class TaskStats extends Stats
* @return array|int Array with value or -1 if error
* @throws Exception
*/
- function getAllTaskByStatus($limit = 5)
+ public function getAllTaskByStatus($limit = 5)
{
global $conf, $user, $langs;
@@ -107,7 +107,7 @@ class TaskStats extends Stats
*
* @return array of values
*/
- function getAllByYear()
+ public function getAllByYear()
{
global $conf, $user, $langs;
@@ -166,7 +166,7 @@ class TaskStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of values
*/
- function getNbByMonth($year, $format = 0)
+ public function getNbByMonth($year, $format = 0)
{
global $user;