FIX #7072
This commit is contained in:
parent
d511fed504
commit
6fcb54b2d6
@ -43,23 +43,23 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
|||||||
class Categorie extends CommonObject
|
class Categorie extends CommonObject
|
||||||
{
|
{
|
||||||
// Categories types
|
// Categories types
|
||||||
const TYPE_PRODUCT = 0; // TODO Replace with value 'product'
|
const TYPE_PRODUCT = 'product';
|
||||||
const TYPE_SUPPLIER = 1; // TODO Replace this value with 'supplier'
|
const TYPE_SUPPLIER = 'supplier';
|
||||||
const TYPE_CUSTOMER = 2; // TODO Replace this value with 'customer'
|
const TYPE_CUSTOMER = 'customer';
|
||||||
const TYPE_MEMBER = 3; // TODO Replace this value with 'member'
|
const TYPE_MEMBER = 'member';
|
||||||
const TYPE_CONTACT = 4; // TODO Replace this value with 'contact'
|
const TYPE_CONTACT = 'contact';
|
||||||
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
|
const TYPE_USER = 'user';
|
||||||
|
const TYPE_PROJECT = 'project';
|
||||||
const TYPE_ACCOUNT = 5; // TODO Replace this value with 'bank_account'
|
const TYPE_ACCOUNT = 'bank_account';
|
||||||
const TYPE_PROJECT = 6; // TODO Replace this value with 'project'
|
|
||||||
const TYPE_BANK_LINE = 'bank_line';
|
const TYPE_BANK_LINE = 'bank_line';
|
||||||
|
|
||||||
public $picto = 'category';
|
public $picto = 'category';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array ID mapping from type string
|
* @var array ID mapping from type string
|
||||||
*
|
*
|
||||||
* @note This array should be remove in future, once previous constants are moved to the string value.
|
* @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,
|
||||||
@ -67,10 +67,21 @@ class Categorie extends CommonObject
|
|||||||
'customer' => 2,
|
'customer' => 2,
|
||||||
'member' => 3,
|
'member' => 3,
|
||||||
'contact' => 4,
|
'contact' => 4,
|
||||||
'user' => 4,
|
|
||||||
'account' => 5,
|
'account' => 5,
|
||||||
'project' => 6,
|
'project' => 6,
|
||||||
|
'user' => 7,
|
||||||
);
|
);
|
||||||
|
public static $MAP_ID_TO_CODE = array(
|
||||||
|
0 => 'product',
|
||||||
|
1 => 'supplier',
|
||||||
|
2 => 'customer',
|
||||||
|
3 => 'member',
|
||||||
|
4 => 'contact',
|
||||||
|
5 => 'account',
|
||||||
|
6 => 'project',
|
||||||
|
7 => 'user',
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array Foreign keys mapping from type string
|
* @var array Foreign keys mapping from type string
|
||||||
*
|
*
|
||||||
@ -82,9 +93,9 @@ class Categorie extends CommonObject
|
|||||||
'supplier' => 'soc',
|
'supplier' => 'soc',
|
||||||
'member' => 'member',
|
'member' => 'member',
|
||||||
'contact' => 'socpeople',
|
'contact' => 'socpeople',
|
||||||
'user' => 'user',
|
'user' => 'user',
|
||||||
'account' => 'account',
|
'account' => 'account',
|
||||||
'project' => 'project',
|
'project' => 'project',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* @var array Category tables mapping from type string
|
* @var array Category tables mapping from type string
|
||||||
@ -97,9 +108,9 @@ class Categorie extends CommonObject
|
|||||||
'supplier' => 'fournisseur',
|
'supplier' => 'fournisseur',
|
||||||
'member' => 'member',
|
'member' => 'member',
|
||||||
'contact' => 'contact',
|
'contact' => 'contact',
|
||||||
'user' => 'user',
|
'user' => 'user',
|
||||||
'account' => 'account',
|
'account' => 'account',
|
||||||
'project' => 'project',
|
'project' => 'project',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* @var array Object class mapping from type string
|
* @var array Object class mapping from type string
|
||||||
@ -113,8 +124,8 @@ class Categorie extends CommonObject
|
|||||||
'member' => 'Adherent',
|
'member' => 'Adherent',
|
||||||
'contact' => 'Contact',
|
'contact' => 'Contact',
|
||||||
'user' => 'User',
|
'user' => 'User',
|
||||||
'account' => 'Account',
|
'account' => 'Account',
|
||||||
'project' => 'Project',
|
'project' => 'Project',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* @var array Object table mapping from type string
|
* @var array Object table mapping from type string
|
||||||
@ -128,8 +139,8 @@ class Categorie extends CommonObject
|
|||||||
'member' => 'adherent',
|
'member' => 'adherent',
|
||||||
'contact' => 'socpeople',
|
'contact' => 'socpeople',
|
||||||
'user' => 'user',
|
'user' => 'user',
|
||||||
'account' => 'bank_account',
|
'account' => 'bank_account',
|
||||||
'project' => 'projet',
|
'project' => 'projet',
|
||||||
);
|
);
|
||||||
|
|
||||||
public $element='category';
|
public $element='category';
|
||||||
|
|||||||
@ -39,6 +39,8 @@ $id=GETPOST('id','int');
|
|||||||
$type=(GETPOST('type','aZ09') ? GETPOST('type','aZ09') : Categorie::TYPE_PRODUCT);
|
$type=(GETPOST('type','aZ09') ? GETPOST('type','aZ09') : Categorie::TYPE_PRODUCT);
|
||||||
$catname=GETPOST('catname','alpha');
|
$catname=GETPOST('catname','alpha');
|
||||||
|
|
||||||
|
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -53,8 +55,8 @@ elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCat
|
|||||||
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='account'; }
|
||||||
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
|
|
||||||
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'; }
|
||||||
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }
|
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }
|
||||||
|
|
||||||
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
||||||
|
|||||||
@ -42,6 +42,8 @@ $type=GETPOST('type');
|
|||||||
$action=GETPOST('action','aZ09');
|
$action=GETPOST('action','aZ09');
|
||||||
$confirm=GETPOST('confirm');
|
$confirm=GETPOST('confirm');
|
||||||
|
|
||||||
|
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||||
|
|
||||||
if ($id == "")
|
if ($id == "")
|
||||||
{
|
{
|
||||||
dol_print_error('','Missing parameter id');
|
dol_print_error('','Missing parameter id');
|
||||||
@ -100,7 +102,8 @@ if ($object->id)
|
|||||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
||||||
else $title=$langs->trans("Category");
|
elseif ($type == Categorie::TYPE_USER) $title=$langs->trans("UsersCategoriesShort");
|
||||||
|
else $title=$langs->trans("Category");
|
||||||
|
|
||||||
$head = categories_prepare_head($object,$type);
|
$head = categories_prepare_head($object,$type);
|
||||||
|
|
||||||
|
|||||||
@ -35,11 +35,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
$langs->load("languages");
|
$langs->load("languages");
|
||||||
|
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
$action=GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$cancel=GETPOST('cancel','alpha');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
$type=GETPOST('type');
|
$type = GETPOST('type','aZ09');
|
||||||
|
|
||||||
|
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
|
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
|
||||||
@ -153,6 +155,7 @@ elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategor
|
|||||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
||||||
|
elseif ($type == Categorie::TYPE_USER) $title=$langs->trans("UsersCategoriesShort");
|
||||||
else $title=$langs->trans("Category");
|
else $title=$langs->trans("Category");
|
||||||
|
|
||||||
$head = categories_prepare_head($object,$type);
|
$head = categories_prepare_head($object,$type);
|
||||||
|
|||||||
@ -34,13 +34,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|||||||
|
|
||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
|
|
||||||
$id=GETPOST('id','int');
|
$id = GETPOST('id','int');
|
||||||
$label=GETPOST('label');
|
$label= GETPOST('label','alpha');
|
||||||
$type=GETPOST('type');
|
$type = GETPOST('type','az09');
|
||||||
$action=GETPOST('action','aZ09');
|
$action=GETPOST('action','aZ09');
|
||||||
$confirm=GETPOST('confirm');
|
$confirm = GETPOST('confirm','alpha');
|
||||||
$removeelem = GETPOST('removeelem','int');
|
$removeelem = GETPOST('removeelem','int');
|
||||||
$elemid=GETPOST('elemid');
|
$elemid = GETPOST('elemid','alpha');
|
||||||
|
|
||||||
if ($id == "" && $label == "")
|
if ($id == "" && $label == "")
|
||||||
{
|
{
|
||||||
@ -61,6 +61,7 @@ if ($result <= 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$type=$object->type;
|
$type=$object->type;
|
||||||
|
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||||
|
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
@ -187,6 +188,7 @@ elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategor
|
|||||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
||||||
|
elseif ($type == Categorie::TYPE_USER) $title=$langs->trans("ProjectsCategoriesShort");
|
||||||
else $title=$langs->trans("Category");
|
else $title=$langs->trans("Category");
|
||||||
|
|
||||||
$head = categories_prepare_head($object,$type);
|
$head = categories_prepare_head($object,$type);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user