From 4fb4bc6f6cf51332a5776acfe9ce87e689ad51b6 Mon Sep 17 00:00:00 2001
From: De Coninck Laurent <laurent@adlogix.eu>
Date: Fri, 10 Feb 2017 10:20:32 +0100
Subject: [PATCH] [FIX] Dictionnaries without rowid

It's possible to create a dictionnary without the key rowid.
But in that case it's impossible to enable/disable the value because the dictionnary fonctionality uses always rowid even another primary key is defined.

By this fix, the id property uses is the primary key defined on the dictionnary creation.
---
 htdocs/admin/dict.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 09ee313e487..2bb0bbe15dc 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -1537,7 +1537,8 @@ if ($id)
                     $canbemodified=$iserasable;
                     if ($obj->code == 'RECEP') $canbemodified=1;
 
-                    $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
+                    $rowidcol=$tabrowid[$id];
+                    $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->{$rowidcol})?$obj->{$rowidcol}:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
                     if ($param) $url .= '&'.$param;
                     $url.='&';
 
-- 
GitLab