add: quick link categories to account

This commit is contained in:
Theo 2021-10-22 17:15:51 +02:00
parent f4a48e46ff
commit 03030685f6
2 changed files with 29 additions and 2 deletions

View File

@ -177,7 +177,8 @@ if ($elemid && $action == 'addintocategory' &&
($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer) ||
($type == Categorie::TYPE_MEMBER && $user->rights->projet->creer) ||
($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) ||
($type == Categorie::TYPE_USER && $user->rights->user->user->creer)
($type == Categorie::TYPE_USER && $user->rights->user->user->creer) ||
($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer)
)) {
if ($type == Categorie::TYPE_PRODUCT) {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@ -211,6 +212,10 @@ if ($elemid && $action == 'addintocategory' &&
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
$newobject = new User($db);
$elementtype = 'user';
} elseif ($type == Categorie::TYPE_ACCOUNT) {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$newobject = new User($db);
$elementtype = 'bank_account';
}
$result = $newobject->fetch($elemid);
@ -558,6 +563,7 @@ if ($type == Categorie::TYPE_PRODUCT) {
}
}
// List of customers
if ($type == Categorie::TYPE_CUSTOMER) {
$permission = $user->rights->societe->creer;
@ -631,7 +637,7 @@ if ($type == Categorie::TYPE_CUSTOMER) {
}
}
// List of suppliers
if ($type == Categorie::TYPE_SUPPLIER) {
$permission = $user->rights->societe->creer;
@ -876,6 +882,26 @@ if ($type == Categorie::TYPE_ACCOUNT) {
if ($accounts < 0) {
dol_print_error($db, $object->error, $object->errors);
} else {
// Form to add record into a category
$showclassifyform = 1;
if ($showclassifyform) {
print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
print '<input type="hidden" name="type" value="'.$typeid.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="action" value="addintocategory">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
print $langs->trans("AddAccountIntoCategory").' &nbsp;';
$form->select_comptes('', 'elemid');
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
}
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';

View File

@ -93,6 +93,7 @@ AddMemberIntoCategory=Assigner cette catégorie au membre
AddContactIntoCategory=Assigner cette catégorie au contact
AddUserIntoCategory=Assigner cette catégorie à l'utilisateur
AddProjectIntoCategory=Assigner cette catégorie au projet
AddAccountIntoCategory=Assigner cette catégorie au compte
AddTicketIntoCategory=Assigner cette catégorie au ticket
AddSupplierIntoCategory=Assigner cette catégorie au fournisseur
ShowCategory=Afficher tag/catégorie