add categorie user based on contact user
allow to add categorie to user, the same as contact user (because user and contact are persons too)
This commit is contained in:
parent
c910fd151f
commit
5e288db0e5
@ -11,6 +11,7 @@
|
|||||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
|
* Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -43,6 +44,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|||||||
if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
|
if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
|
||||||
if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
if (! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
if (! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
||||||
|
if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
|
||||||
|
|
||||||
$id = GETPOST('id','int');
|
$id = GETPOST('id','int');
|
||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
@ -244,7 +247,11 @@ if (empty($reshook)) {
|
|||||||
if (isset($_POST['password']) && trim($_POST['password'])) {
|
if (isset($_POST['password']) && trim($_POST['password'])) {
|
||||||
$object->setPassword($user, trim($_POST['password']));
|
$object->setPassword($user, trim($_POST['password']));
|
||||||
}
|
}
|
||||||
|
if (! empty($conf->categorie->enabled)) {
|
||||||
|
// Categories association
|
||||||
|
$usercats = GETPOST( 'usercats', 'array' );
|
||||||
|
$object->setCategories($usercats);
|
||||||
|
}
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||||
@ -472,6 +479,12 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (! $error && ! count($object->errors))
|
||||||
|
{
|
||||||
|
// Then we add the associated categories
|
||||||
|
$categories = GETPOST( 'usercats', 'array' );
|
||||||
|
$object->setCategories($categories);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$error && !count($object->errors)) {
|
if (!$error && !count($object->errors)) {
|
||||||
setEventMessages($langs->trans("UserModified"), null, 'mesgs');
|
setEventMessages($langs->trans("UserModified"), null, 'mesgs');
|
||||||
@ -1082,6 +1095,15 @@ if (($action == 'create') || ($action == 'adduserldap'))
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Categories
|
||||||
|
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) {
|
||||||
|
print '<tr><td>' . fieldLabel( 'Categories', 'usercats' ) . '</td><td colspan="3">';
|
||||||
|
$cate_arbo = $form->select_all_categories( Categorie::TYPE_USER, null, 'parent', null, null, 1 );
|
||||||
|
print $form->multiselectarray( 'usercats', $cate_arbo, GETPOST( 'usercats', 'array' ), null, null, null,
|
||||||
|
null, '90%' );
|
||||||
|
print "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
// Note
|
// Note
|
||||||
print '<tr><td class="tdtop">';
|
print '<tr><td class="tdtop">';
|
||||||
print $langs->trans("Note");
|
print $langs->trans("Note");
|
||||||
@ -1426,6 +1448,15 @@ else
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Categories
|
||||||
|
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
|
||||||
|
{
|
||||||
|
print '<tr><td>' . $langs->trans( "Categories" ) . '</td>';
|
||||||
|
print '<td colspan="3">';
|
||||||
|
print $form->showCategories( $object->id, 'user', 1 );
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Company / Contact
|
// Company / Contact
|
||||||
if (! empty($conf->societe->enabled))
|
if (! empty($conf->societe->enabled))
|
||||||
{
|
{
|
||||||
@ -2172,33 +2203,47 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Accountancy code
|
// Accountancy code
|
||||||
if ($conf->salaries->enabled)
|
if ($conf->salaries->enabled)
|
||||||
|
{
|
||||||
|
print "<tr>";
|
||||||
|
print '<td>'.$langs->trans("AccountancyCode").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
if ($caneditfield)
|
||||||
{
|
{
|
||||||
print "<tr>";
|
print '<input size="30" type="text" class="flat" name="accountancy_code" value="'.$object->accountancy_code.'">';
|
||||||
print '<td>'.$langs->trans("AccountancyCode").'</td>';
|
|
||||||
print '<td>';
|
|
||||||
if ($caneditfield)
|
|
||||||
{
|
|
||||||
print '<input size="30" type="text" class="flat" name="accountancy_code" value="'.$object->accountancy_code.'">';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.'">';
|
|
||||||
print $object->accountancy_code;
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
print "</tr>";
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.'">';
|
||||||
|
print $object->accountancy_code;
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print "</tr>";
|
||||||
|
}
|
||||||
|
|
||||||
// User color
|
// User color
|
||||||
if (! empty($conf->agenda->enabled))
|
if (! empty($conf->agenda->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("ColorUser").'</td>';
|
print '<tr><td>'.$langs->trans("ColorUser").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formother->selectColor(GETPOST('color')?GETPOST('color'):$object->color, 'color', null, 1, '', 'hideifnotset');
|
print $formother->selectColor(GETPOST('color')?GETPOST('color'):$object->color, 'color', null, 1, '', 'hideifnotset');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Categories
|
||||||
|
if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) {
|
||||||
|
print '<tr><td>' . fieldLabel( 'Categories', 'usercats' ) . '</td>';
|
||||||
|
print '<td colspan="3">';
|
||||||
|
$cate_arbo = $form->select_all_categories( Categorie::TYPE_CONTACT, null, null, null, null, 1 );
|
||||||
|
$c = new Categorie( $db );
|
||||||
|
$cats = $c->containing( $object->id, Categorie::TYPE_CONTACT );
|
||||||
|
foreach ($cats as $cat) {
|
||||||
|
$arrayselected[] = $cat->id;
|
||||||
}
|
}
|
||||||
|
print $form->multiselectarray( 'usercats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%' );
|
||||||
|
print "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td>';
|
print '<tr><td>'.$langs->trans("Status").'</td>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user