Add warning on deprecated param
This commit is contained in:
parent
3df464270c
commit
3119d77565
@ -48,14 +48,13 @@ class Categorie extends CommonObject
|
||||
const TYPE_CUSTOMER = 2;
|
||||
const TYPE_MEMBER = 3;
|
||||
const TYPE_CONTACT = 4;
|
||||
const TYPE_USER = 4; // categorie contact and user are same
|
||||
// bank account
|
||||
const TYPE_ACCOUNT = 5;
|
||||
const TYPE_USER = 4; // categorie contact and user are same !
|
||||
const TYPE_ACCOUNT = 5; // bank account
|
||||
|
||||
/**
|
||||
* @var array ID mapping from type string
|
||||
*
|
||||
* @note Move to const array when PHP 5.6 will be our minimum target
|
||||
* @note This array should be remove in future, once previous constants are moved to the string value.
|
||||
*/
|
||||
private $MAP_ID = array(
|
||||
'product' => 0,
|
||||
@ -1274,14 +1273,12 @@ class Categorie extends CommonObject
|
||||
* Should be named getListOfCategForObject
|
||||
*
|
||||
* @param int $id Id of element
|
||||
* @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode
|
||||
* (0, 1, 2, ...) is deprecated.
|
||||
* @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
|
||||
* @param string $mode 'object'=Get array of fetched category instances, 'label'=Get array of category
|
||||
* labels, 'id'= Get array of category IDs
|
||||
*
|
||||
* @return mixed Array of category objects or < 0 if KO
|
||||
*/
|
||||
function containing($id,$type,$mode='object')
|
||||
function containing($id, $type, $mode='object')
|
||||
{
|
||||
$cats = array();
|
||||
|
||||
|
||||
@ -3145,7 +3145,7 @@ class Form
|
||||
/**
|
||||
* Return list of categories having choosed type
|
||||
*
|
||||
* @param int $type Type de categories (0=product, 1=supplier, 2=customer, 3=member)
|
||||
* @param int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
|
||||
* @param string $selected Id of category preselected or 'auto' (autoselect category if there is only one element)
|
||||
* @param string $htmlname HTML field name
|
||||
* @param int $maxlength Maximum length for labels
|
||||
@ -3161,6 +3161,12 @@ class Form
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
// For backward compatibility
|
||||
if (is_numeric($type))
|
||||
{
|
||||
dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
|
||||
}
|
||||
|
||||
$cat = new Categorie($this->db);
|
||||
$cate_arbo = $cat->get_full_arbo($type,$excludeafterid);
|
||||
|
||||
|
||||
@ -302,7 +302,7 @@ class FormOther
|
||||
/**
|
||||
* Return select list for categories (to use in form search selectors)
|
||||
*
|
||||
* @param int $type Type of categories (0=product, 1=supplier, 2=customer, 3=member, 4=contact)
|
||||
* @param int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
|
||||
* @param integer $selected Preselected value
|
||||
* @param string $htmlname Name of combo list
|
||||
* @param int $nocateg Show also an entry "Not categorized"
|
||||
@ -315,6 +315,12 @@ class FormOther
|
||||
global $conf, $langs;
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
// For backward compatibility
|
||||
if (is_numeric($type))
|
||||
{
|
||||
dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
|
||||
}
|
||||
|
||||
// Load list of "categories"
|
||||
$static_categs = new Categorie($this->db);
|
||||
$tab_categs = $static_categs->get_full_arbo($type);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user