From b45537335d4751550756fff21546f2663f761999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Fri, 12 Oct 2001 19:48:48 +0000 Subject: [PATCH] added unique key case to build urls used in browse mode for deleting/editing a record --- ChangeLog | 2 ++ libraries/display_tbl.lib.php3 | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 54393054a..c29d1c37e 100755 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,8 @@ $Source$ setting. * tbl_qbe.php3: fixed lots of warnings reported by Steve. * left.php3, line 66: removed a too restrictive test. + * display_tbl.lib.php3: added unique key case to build urls used in browse + mode for deleting/editing a record. 2001-10-09 Loïc Chapeaux * user_details.php3, lines 1232-1245 & 1254: fixed some bugs with modifying diff --git a/libraries/display_tbl.lib.php3 b/libraries/display_tbl.lib.php3 index da6f6bae9..c6a1e810d 100644 --- a/libraries/display_tbl.lib.php3 +++ b/libraries/display_tbl.lib.php3 @@ -611,6 +611,7 @@ if (!defined('__LIB_DISPLAY_TBL__')){ // 1. Prepares the row (gets primary keys to use) if ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn') { $primary_key = ''; + $unique_key = ''; $uva_nonprimary_condition = ''; // 1.1 Results from a "SELECT" statement -> builds the @@ -626,15 +627,19 @@ if (!defined('__LIB_DISPLAY_TBL__')){ } if ($primary->primary_key > 0) { $primary_key .= $condition; + } else if ($primary->unique_key > 0) { + $unique_key .= $condition; } $uva_nonprimary_condition .= $condition; } // end for - // Correction uva 19991216: prefer primary keys for - // condition, but use conjunction of all values if no + // Correction uva 19991216: prefer primary or unique keys + // for condition, but use conjunction of all values if no // primary key if ($primary_key) { $uva_condition = $primary_key; + } else if ($unique_key) { + $uva_condition = $unique_key; } else { $uva_condition = $uva_nonprimary_condition; }