Fix regression on categories
This commit is contained in:
parent
3f7eea2e0a
commit
502ac19a0a
@ -62,14 +62,15 @@ class Categorie extends CommonObject
|
|||||||
* @note This array should be remove in future, once previous constants are moved to the string value. Deprecated
|
* @note This array should be remove in future, once previous constants are moved to the string value. Deprecated
|
||||||
*/
|
*/
|
||||||
private $MAP_ID = array(
|
private $MAP_ID = array(
|
||||||
'product' => 0,
|
'product' => 0,
|
||||||
'supplier' => 1,
|
'supplier' => 1,
|
||||||
'customer' => 2,
|
'customer' => 2,
|
||||||
'member' => 3,
|
'member' => 3,
|
||||||
'contact' => 4,
|
'contact' => 4,
|
||||||
'account' => 5,
|
'bank_account' => 5,
|
||||||
'project' => 6,
|
'project' => 6,
|
||||||
'user' => 7,
|
'user' => 7,
|
||||||
|
'bank_line' => 8,
|
||||||
);
|
);
|
||||||
public static $MAP_ID_TO_CODE = array(
|
public static $MAP_ID_TO_CODE = array(
|
||||||
0 => 'product',
|
0 => 'product',
|
||||||
@ -77,9 +78,10 @@ class Categorie extends CommonObject
|
|||||||
2 => 'customer',
|
2 => 'customer',
|
||||||
3 => 'member',
|
3 => 'member',
|
||||||
4 => 'contact',
|
4 => 'contact',
|
||||||
5 => 'account',
|
5 => 'bank_account',
|
||||||
6 => 'project',
|
6 => 'project',
|
||||||
7 => 'user',
|
7 => 'user',
|
||||||
|
8 => 'bank_line',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,7 +96,8 @@ class Categorie extends CommonObject
|
|||||||
'member' => 'member',
|
'member' => 'member',
|
||||||
'contact' => 'socpeople',
|
'contact' => 'socpeople',
|
||||||
'user' => 'user',
|
'user' => 'user',
|
||||||
'account' => 'account',
|
'account' => 'account', // old for bank_account
|
||||||
|
'bank_account' => 'account',
|
||||||
'project' => 'project',
|
'project' => 'project',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
@ -109,7 +112,8 @@ class Categorie extends CommonObject
|
|||||||
'member' => 'member',
|
'member' => 'member',
|
||||||
'contact' => 'contact',
|
'contact' => 'contact',
|
||||||
'user' => 'user',
|
'user' => 'user',
|
||||||
'account' => 'account',
|
'account' => 'account', // old for bank_account
|
||||||
|
'bank_account'=> 'account',
|
||||||
'project' => 'project',
|
'project' => 'project',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
@ -124,7 +128,8 @@ class Categorie extends CommonObject
|
|||||||
'member' => 'Adherent',
|
'member' => 'Adherent',
|
||||||
'contact' => 'Contact',
|
'contact' => 'Contact',
|
||||||
'user' => 'User',
|
'user' => 'User',
|
||||||
'account' => 'Account',
|
'account' => 'Account', // old for bank account
|
||||||
|
'bank_account' => 'Account',
|
||||||
'project' => 'Project',
|
'project' => 'Project',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
@ -947,8 +952,8 @@ class Categorie extends CommonObject
|
|||||||
* fulllabel = nom avec chemin complet de la categorie
|
* fulllabel = nom avec chemin complet de la categorie
|
||||||
* fullpath = chemin complet compose des id
|
* fullpath = chemin complet compose des id
|
||||||
*
|
*
|
||||||
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...).
|
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...).
|
||||||
* @param int $markafterid Removed all categories including the leaf $markafterid in category tree.
|
* @param int $markafterid Removed all categories including the leaf $markafterid in category tree.
|
||||||
*
|
*
|
||||||
* @return array Array of categories. this->cats and this->motherof are set.
|
* @return array Array of categories. this->cats and this->motherof are set.
|
||||||
*/
|
*/
|
||||||
@ -1340,11 +1345,11 @@ class Categorie extends CommonObject
|
|||||||
* Return list of categories (object instances or labels) linked to element of id $id and type $type
|
* Return list of categories (object instances or labels) linked to element of id $id and type $type
|
||||||
* Should be named getListOfCategForObject
|
* Should be named getListOfCategForObject
|
||||||
*
|
*
|
||||||
* @param int $id Id of element
|
* @param int $id Id of element
|
||||||
* @param int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...)
|
* @param string|int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...)
|
||||||
* @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category
|
* @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category
|
||||||
* labels, 'id'= Get array of category IDs
|
* labels, 'id'= Get array of category IDs
|
||||||
* @return mixed Array of category objects or < 0 if KO
|
* @return mixed Array of category objects or < 0 if KO
|
||||||
*/
|
*/
|
||||||
function containing($id, $type, $mode='object')
|
function containing($id, $type, $mode='object')
|
||||||
{
|
{
|
||||||
@ -1352,7 +1357,7 @@ class Categorie extends CommonObject
|
|||||||
|
|
||||||
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type];
|
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type];
|
||||||
|
|
||||||
if ($type == Categorie::TYPE_BANK_LINE) // TODO Remove this with standard category code
|
if ($type === Categorie::TYPE_BANK_LINE) // TODO Remove this with standard category code
|
||||||
{
|
{
|
||||||
// Load bank groups
|
// Load bank groups
|
||||||
$sql = "SELECT c.label, c.rowid";
|
$sql = "SELECT c.label, c.rowid";
|
||||||
|
|||||||
@ -54,7 +54,7 @@ elseif ($type == Categorie::TYPE_SUPPLIER) { $title=$langs->trans("SuppliersCat
|
|||||||
elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; }
|
elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; }
|
||||||
elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; }
|
elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; }
|
||||||
elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; }
|
elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; }
|
||||||
elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='account'; }
|
elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='bank_account'; }
|
||||||
elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; }
|
elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; }
|
||||||
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
|
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
|
||||||
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }
|
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }
|
||||||
|
|||||||
@ -658,7 +658,7 @@ else
|
|||||||
// Categories
|
// Categories
|
||||||
if ($conf->categorie->enabled) {
|
if ($conf->categorie->enabled) {
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
|
||||||
print $form->showCategories($object->id,'account',1);
|
print $form->showCategories($object->id,'bank_account',1);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3401,12 +3401,12 @@ class Form
|
|||||||
/**
|
/**
|
||||||
* Return list of categories having choosed type
|
* Return list of categories having choosed type
|
||||||
*
|
*
|
||||||
* @param int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
|
* @param string|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 $selected Id of category preselected or 'auto' (autoselect category if there is only one element)
|
||||||
* @param string $htmlname HTML field name
|
* @param string $htmlname HTML field name
|
||||||
* @param int $maxlength Maximum length for labels
|
* @param int $maxlength Maximum length for labels
|
||||||
* @param int $excludeafterid Exclude all categories after this leaf in category tree.
|
* @param int $excludeafterid Exclude all categories after this leaf in category tree.
|
||||||
* @param int $outputmode 0=HTML select string, 1=Array
|
* @param int $outputmode 0=HTML select string, 1=Array
|
||||||
* @return string
|
* @return string
|
||||||
* @see select_categories
|
* @see select_categories
|
||||||
*/
|
*/
|
||||||
@ -3449,7 +3449,7 @@ class Form
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$cat = new Categorie($this->db);
|
$cat = new Categorie($this->db);
|
||||||
$cate_arbo = $cat->get_full_arbo($type,$excludeafterid);
|
$cate_arbo = $cat->get_full_arbo($type, $excludeafterid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
$output = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user