This commit is contained in:
Frédéric FRANCE 2019-02-24 23:32:09 +01:00
parent f83f746123
commit 27218b7087
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
25 changed files with 723 additions and 676 deletions

View File

@ -201,7 +201,7 @@
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint">
<severity>0</severity>
</rule>
<rule ref="Squiz.Scope.MethodScope.Missing" />
<!-- Rules from PEAR Standard -->

View File

@ -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) {

View File

@ -10,7 +10,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
*
* 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 = " &gt;&gt; ", $url = '', $nocolor = 0)
public function print_all_ways($sep = " &gt;&gt; ", $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);
}
}

View File

@ -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) {

View File

@ -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;

View File

@ -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,";

View File

@ -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;

View File

@ -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) {

View File

@ -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;

File diff suppressed because it is too large Load Diff

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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) {

View File

@ -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) {

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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) {

View File

@ -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) {

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;