add: quick link categories to contacts

This commit is contained in:
Theo 2021-10-22 16:46:55 +02:00
parent a36c966f15
commit d5fc28f9b5
2 changed files with 28 additions and 3 deletions

View File

@ -173,9 +173,10 @@ if ($elemid && $action == 'addintocategory' &&
(($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) ||
($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) ||
($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) ||
($type == Categorie::TYPE_TICKET && $user->rights->ticket->write) ||
($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer)||
($type == Categorie::TYPE_MEMBER && $user->rights->projet->creer)
($type == Categorie::TYPE_TICKET && $user->rights->ticket->write) ||
($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer) ||
($type == Categorie::TYPE_MEMBER && $user->rights->projet->creer) ||
($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer)
)) {
if ($type == Categorie::TYPE_PRODUCT) {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@ -201,6 +202,10 @@ if ($elemid && $action == 'addintocategory' &&
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$newobject = new Adherent($db);
$elementtype = 'member';
} elseif ($type == Categorie::TYPE_CONTACT) {
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$newobject = new Contact($db);
$elementtype = 'contact';
}
$result = $newobject->fetch($elemid);
@ -782,6 +787,25 @@ if ($type == Categorie::TYPE_CONTACT) {
if ($contacts < 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("AddContactIntoCategory").' &nbsp;';
print $form->selectContacts('', '','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

@ -90,6 +90,7 @@ CategorieRecursivHelp=Si l'option est activé, quand un produit est ajouté dans
AddProductServiceIntoCategory=Ajouter le produit/service suivant
AddCustomerIntoCategory=Assigner cette catégorie au client
AddMemberIntoCategory=Assigner cette catégorie au membre
AddContactIntoCategory=Assigner cette catégorie au contact
AddProjectIntoCategory=Assigner cette catégorie au projet
AddTicketIntoCategory=Assigner cette catégorie au ticket
AddSupplierIntoCategory=Assigner cette catégorie au fournisseur