diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index 2e04a29b69f..44a12293e67 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -621,6 +621,11 @@ if (empty($reshook)) {
}
}
$action = ($result < 0 || !$error) ? '' : 'create';
+
+ if (!$error && $backtopage) {
+ header("Location: ".$backtopage);
+ exit;
+ }
}
if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') {
diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php
index 7e8a1252095..5450127bff3 100644
--- a/htdocs/categories/viewcat.php
+++ b/htdocs/categories/viewcat.php
@@ -103,7 +103,7 @@ if ($confirm == 'no') {
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
// Remove element from category
-if ($id > 0 && $removeelem > 0) {
+if ($id > 0 && $removeelem > 0 && $action == 'unlink') {
if ($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$tmpobject = new Product($db);
@@ -521,7 +521,8 @@ if ($type == Categorie::TYPE_PRODUCT) {
print '';
print '
';
- $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; $newcardbutton = '';
+ $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = '';
+ $newcardbutton = dolGetButtonTitle($langs->trans("AddProduct"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&categories[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer);
print_barre_liste($langs->trans("ProductsAndServices"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit);
@@ -544,7 +545,7 @@ if ($type == Categorie::TYPE_PRODUCT) {
// Link to delete from category
print '
';
if ($permission) {
- print "id."&type=".$typeid."&removeelem=".$prod->id."'>";
+ print "id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$prod->id."'>";
print $langs->trans("DeleteFromCat");
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
@@ -597,7 +598,8 @@ if ($type == Categorie::TYPE_CUSTOMER) {
print '';
print ' ';
- $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; $newcardbutton = '';
+ $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = '';
+ $newcardbutton = dolGetButtonTitle($langs->trans("AddThirdParty"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&client=3&custcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer);
print_barre_liste($langs->trans("Customers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit);
print ''."\n";
@@ -618,7 +620,7 @@ if ($type == Categorie::TYPE_CUSTOMER) {
// Link to delete from category
print '';
if ($permission) {
- print "id."&type=".$typeid."&removeelem=".$soc->id."'>";
+ print "id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$soc->id."'>";
print $langs->trans("DeleteFromCat");
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
@@ -671,7 +673,8 @@ if ($type == Categorie::TYPE_SUPPLIER) {
print '';
print ' ';
- $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; $newcardbutton = '';
+ $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = '';
+ $newcardbutton = dolGetButtonTitle($langs->trans("AddSupplier"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&fournisseur=1&suppcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer);
print_barre_liste($langs->trans("Suppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit);
print ''."\n";
@@ -692,7 +695,7 @@ if ($type == Categorie::TYPE_SUPPLIER) {
// Link to delete from category
print '';
if ($permission) {
- print "id."&type=".$typeid."&removeelem=".$soc->id."'>";
+ print "id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$soc->id."'>";
print $langs->trans("DeleteFromCat");
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
@@ -748,7 +751,8 @@ if ($type == Categorie::TYPE_MEMBER) {
print '';
print ' ';
- $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; $newcardbutton = '';
+ $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = '';
+ $newcardbutton = dolGetButtonTitle($langs->trans("AddMember"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create&memcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->adherent->creer);
print_barre_liste($langs->trans("Member"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit);
print "\n";
@@ -772,7 +776,7 @@ if ($type == Categorie::TYPE_MEMBER) {
// Link to delete from category
print '';
if ($permission) {
- print "id."&type=".$typeid."&removeelem=".$member->id."'>";
+ print "id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$member->id."'>";
print $langs->trans("DeleteFromCat");
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
@@ -788,7 +792,7 @@ if ($type == Categorie::TYPE_MEMBER) {
}
}
-// Categorie contact
+// List of contacts
if ($type == Categorie::TYPE_CONTACT) {
$permission = $user->rights->societe->creer;
@@ -808,7 +812,7 @@ if ($type == Categorie::TYPE_CONTACT) {
print '';
print '';
print '| ';
- print $langs->trans("AddContactIntoCategory").' ';
+ print $langs->trans("AssignCategoryTo").' ';
print $form->selectContacts('', '', 'elemid');
print ' | ';
print ' ';
@@ -826,7 +830,7 @@ if ($type == Categorie::TYPE_CONTACT) {
$param = '&limit='.$limit.'&id='.$id.'&type='.$type;
$num = count($contacts);
$nbtotalofrecords = '';
- $newcardbutton = '';
+ $newcardbutton = dolGetButtonTitle($langs->trans("AddContact"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?action=create&contcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer);
$objsoc = new Societe($db);
print_barre_liste($langs->trans("Contact"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contact', 0, $newcardbutton, '', $limit);
@@ -853,7 +857,7 @@ if ($type == Categorie::TYPE_CONTACT) {
// Link to delete from category
print '';
if ($permission) {
- print "id."&type=".$typeid."&removeelem=".$contact->id."'>";
+ print "id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$contact->id."'>";
print $langs->trans("DeleteFromCat");
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
@@ -931,7 +935,7 @@ if ($type == Categorie::TYPE_ACCOUNT) {
// Link to delete from category
print ' | ';
if ($permission) {
- print "id."&type=".$typeid."&removeelem=".$account->id."'>";
+ print "id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$account->id."'>";
print $langs->trans("DeleteFromCat");
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
@@ -1009,7 +1013,7 @@ if ($type == Categorie::TYPE_PROJECT) {
// Link to delete from category
print ' | ';
if ($permission) {
- print "id."&type=".$typeid."&removeelem=".$project->id."'>";
+ print "id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$project->id."'>";
print $langs->trans("DeleteFromCat");
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
@@ -1081,7 +1085,7 @@ if ($type == Categorie::TYPE_USER) {
// Link to delete from category
print ' | ';
if ($user->rights->user->user->creer) {
- print "id."&type=".$type."&removeelem=".$userentry->id."'>";
+ print "id."&type=".$type."&action=unlink&token=".newToken()."&removeelem=".$userentry->id."'>";
print $langs->trans("DeleteFromCat");
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
@@ -1140,7 +1144,7 @@ if ($type == Categorie::TYPE_WAREHOUSE) {
// Link to delete from category
print ' | ';
if ($permission) {
- print "id."&type=".$typeid."&removeelem=".$project->id."'>";
+ print "id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$project->id."'>";
print $langs->trans("DeleteFromCat");
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
@@ -1156,6 +1160,7 @@ if ($type == Categorie::TYPE_WAREHOUSE) {
}
}
+// List of tickets
if ($type == Categorie::TYPE_TICKET) {
$permission = ($user->rights->categorie->creer || $user->rights->categorie->creer);
@@ -1212,7 +1217,7 @@ if ($type == Categorie::TYPE_TICKET) {
// Link to delete from category
print ' | ';
if ($permission) {
- print "id."&type=".$typeid."&removeelem=".$ticket->id."'>";
+ print "id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$ticket->id."'>";
print $langs->trans("DeleteFromCat");
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
print "";
| | | | |