Implement extrafields into category create
This commit is contained in:
parent
f14d2fbfe0
commit
d9baae3456
@ -28,6 +28,7 @@
|
|||||||
* \brief File of class to manage categories
|
* \brief File of class to manage categories
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||||
@ -36,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
|||||||
/**
|
/**
|
||||||
* Class to manage categories
|
* Class to manage categories
|
||||||
*/
|
*/
|
||||||
class Categorie
|
class Categorie extends CommonObject
|
||||||
{
|
{
|
||||||
public $element='category';
|
public $element='category';
|
||||||
public $table_element='categories';
|
public $table_element='categories';
|
||||||
|
|||||||
@ -27,9 +27,12 @@
|
|||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
|
||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
|
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=GETPOST('socid','int');
|
$socid=GETPOST('socid','int');
|
||||||
@ -59,6 +62,7 @@ if ($origin)
|
|||||||
|
|
||||||
if ($catorigin && $type == 0) $idCatOrigin = $catorigin;
|
if ($catorigin && $type == 0) $idCatOrigin = $catorigin;
|
||||||
|
|
||||||
|
$object = new Categorie($db);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -112,7 +116,7 @@ if ($action == 'add' && $user->rights->categorie->creer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$object = new Categorie($db);
|
|
||||||
|
|
||||||
$object->label = $label;
|
$object->label = $label;
|
||||||
$object->description = dol_htmlcleanlastbr($description);
|
$object->description = dol_htmlcleanlastbr($description);
|
||||||
@ -122,6 +126,8 @@ if ($action == 'add' && $user->rights->categorie->creer)
|
|||||||
|
|
||||||
if ($parent != "-1") $object->fk_parent = $parent;
|
if ($parent != "-1") $object->fk_parent = $parent;
|
||||||
|
|
||||||
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
|
||||||
if (! $object->label)
|
if (! $object->label)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
@ -239,6 +245,12 @@ if ($user->rights->categorie->creer)
|
|||||||
print $form->select_all_categories($type, $catorigin);
|
print $form->select_all_categories($type, $catorigin);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
print $object->showOptionals($extrafields,'edit');
|
||||||
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<center><br>';
|
print '<center><br>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user