mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
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
|
||||
{
|
||||
// Categories types
|
||||
const TYPE_PRODUCT = 0; // TODO Replace with value 'product'
|
||||
const TYPE_SUPPLIER = 1; // TODO Replace this value with 'supplier'
|
||||
const TYPE_CUSTOMER = 2; // TODO Replace this value with 'customer'
|
||||
const TYPE_MEMBER = 3; // TODO Replace this value with 'member'
|
||||
const TYPE_CONTACT = 4; // TODO Replace this value with 'contact'
|
||||
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
|
||||
|
||||
const TYPE_ACCOUNT = 5; // TODO Replace this value with 'bank_account'
|
||||
const TYPE_PROJECT = 6; // TODO Replace this value with 'project'
|
||||
const TYPE_PRODUCT = 'product';
|
||||
const TYPE_SUPPLIER = 'supplier';
|
||||
const TYPE_CUSTOMER = 'customer';
|
||||
const TYPE_MEMBER = 'member';
|
||||
const TYPE_CONTACT = 'contact';
|
||||
const TYPE_USER = 'user';
|
||||
const TYPE_PROJECT = 'project';
|
||||
const TYPE_ACCOUNT = 'bank_account';
|
||||
const TYPE_BANK_LINE = 'bank_line';
|
||||
|
||||
public $picto = 'category';
|
||||
|
||||
|
||||
/**
|
||||
* @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(
|
||||
'product' => 0,
|
||||
|
|
@ -67,10 +67,21 @@ class Categorie extends CommonObject
|
|||
'customer' => 2,
|
||||
'member' => 3,
|
||||
'contact' => 4,
|
||||
'user' => 4,
|
||||
'account' => 5,
|
||||
'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
|
||||
*
|
||||
|
|
@ -82,9 +93,9 @@ class Categorie extends CommonObject
|
|||
'supplier' => 'soc',
|
||||
'member' => 'member',
|
||||
'contact' => 'socpeople',
|
||||
'user' => 'user',
|
||||
'account' => 'account',
|
||||
'project' => 'project',
|
||||
'user' => 'user',
|
||||
'account' => 'account',
|
||||
'project' => 'project',
|
||||
);
|
||||
/**
|
||||
* @var array Category tables mapping from type string
|
||||
|
|
@ -97,9 +108,9 @@ class Categorie extends CommonObject
|
|||
'supplier' => 'fournisseur',
|
||||
'member' => 'member',
|
||||
'contact' => 'contact',
|
||||
'user' => 'user',
|
||||
'account' => 'account',
|
||||
'project' => 'project',
|
||||
'user' => 'user',
|
||||
'account' => 'account',
|
||||
'project' => 'project',
|
||||
);
|
||||
/**
|
||||
* @var array Object class mapping from type string
|
||||
|
|
@ -113,8 +124,8 @@ class Categorie extends CommonObject
|
|||
'member' => 'Adherent',
|
||||
'contact' => 'Contact',
|
||||
'user' => 'User',
|
||||
'account' => 'Account',
|
||||
'project' => 'Project',
|
||||
'account' => 'Account',
|
||||
'project' => 'Project',
|
||||
);
|
||||
/**
|
||||
* @var array Object table mapping from type string
|
||||
|
|
@ -128,8 +139,8 @@ class Categorie extends CommonObject
|
|||
'member' => 'adherent',
|
||||
'contact' => 'socpeople',
|
||||
'user' => 'user',
|
||||
'account' => 'bank_account',
|
||||
'project' => 'projet',
|
||||
'account' => 'bank_account',
|
||||
'project' => 'projet',
|
||||
);
|
||||
|
||||
public $element='category';
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ $id=GETPOST('id','int');
|
|||
$type=(GETPOST('type','aZ09') ? GETPOST('type','aZ09') : Categorie::TYPE_PRODUCT);
|
||||
$catname=GETPOST('catname','alpha');
|
||||
|
||||
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||
|
||||
|
||||
/*
|
||||
* 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_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; }
|
||||
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_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
|
||||
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }
|
||||
|
||||
$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');
|
||||
$confirm=GETPOST('confirm');
|
||||
|
||||
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||
|
||||
if ($id == "")
|
||||
{
|
||||
dol_print_error('','Missing parameter id');
|
||||
|
|
@ -100,15 +102,16 @@ if ($object->id)
|
|||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||
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);
|
||||
|
||||
|
||||
dol_fiche_head($head, 'photos', $title, -1, 'category');
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$object->ref = $object->label;
|
||||
$morehtmlref='<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
||||
$ways = $object->print_all_ways(" >> ", '', 1);
|
||||
|
|
@ -117,9 +120,9 @@ if ($object->id)
|
|||
$morehtmlref.=$way."<br>\n";
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
||||
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression de photo
|
||||
*/
|
||||
|
|
@ -129,7 +132,7 @@ if ($object->id)
|
|||
}
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
|
@ -148,7 +151,7 @@ if ($object->id)
|
|||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
|
||||
print dol_fiche_end();
|
||||
|
||||
|
||||
|
|
@ -258,7 +261,7 @@ if ($object->id)
|
|||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
if ($nbphoto < 1)
|
||||
{
|
||||
print '<div class="opacitymedium">'.$langs->trans("NoPhotoYet")."</div>";
|
||||
|
|
|
|||
|
|
@ -35,11 +35,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|||
$langs->load("categories");
|
||||
$langs->load("languages");
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action=GETPOST('action','alpha');
|
||||
$cancel=GETPOST('cancel','alpha');
|
||||
$type=GETPOST('type');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action','alpha');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
$type = GETPOST('type','aZ09');
|
||||
|
||||
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||
|
||||
// Security check
|
||||
$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_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_USER) $title=$langs->trans("UsersCategoriesShort");
|
||||
else $title=$langs->trans("Category");
|
||||
|
||||
$head = categories_prepare_head($object,$type);
|
||||
|
|
@ -256,9 +259,9 @@ if ($action == 'edit')
|
|||
print '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
|
|
@ -271,7 +274,7 @@ if ($action == 'edit')
|
|||
else if ($action != 'add')
|
||||
{
|
||||
if ($cnt_trans) print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
if (! empty($object->multilangs))
|
||||
{
|
||||
foreach ($object->multilangs as $key => $value)
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|||
|
||||
$langs->load("categories");
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$label=GETPOST('label');
|
||||
$type=GETPOST('type');
|
||||
$id = GETPOST('id','int');
|
||||
$label= GETPOST('label','alpha');
|
||||
$type = GETPOST('type','az09');
|
||||
$action=GETPOST('action','aZ09');
|
||||
$confirm=GETPOST('confirm');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
$removeelem = GETPOST('removeelem','int');
|
||||
$elemid=GETPOST('elemid');
|
||||
$elemid = GETPOST('elemid','alpha');
|
||||
|
||||
if ($id == "" && $label == "")
|
||||
{
|
||||
|
|
@ -61,6 +61,7 @@ if ($result <= 0)
|
|||
}
|
||||
|
||||
$type=$object->type;
|
||||
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$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_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_USER) $title=$langs->trans("ProjectsCategoriesShort");
|
||||
else $title=$langs->trans("Category");
|
||||
|
||||
$head = categories_prepare_head($object,$type);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user