added unique key case to build urls used in browse mode for deleting/editing a record

This commit is contained in:
Loïc Chapeaux
2001-10-12 19:48:48 +00:00
parent d90288719c
commit b45537335d
2 changed files with 9 additions and 2 deletions

View File

@@ -22,6 +22,8 @@ $Source$
setting. setting.
* tbl_qbe.php3: fixed lots of warnings reported by Steve. * tbl_qbe.php3: fixed lots of warnings reported by Steve.
* left.php3, line 66: removed a too restrictive test. * 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<4C>c Chapeaux <lolo@phpheaven.net> 2001-10-09 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* user_details.php3, lines 1232-1245 & 1254: fixed some bugs with modifying * user_details.php3, lines 1232-1245 & 1254: fixed some bugs with modifying

View File

@@ -611,6 +611,7 @@ if (!defined('__LIB_DISPLAY_TBL__')){
// 1. Prepares the row (gets primary keys to use) // 1. Prepares the row (gets primary keys to use)
if ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn') { if ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn') {
$primary_key = ''; $primary_key = '';
$unique_key = '';
$uva_nonprimary_condition = ''; $uva_nonprimary_condition = '';
// 1.1 Results from a "SELECT" statement -> builds the // 1.1 Results from a "SELECT" statement -> builds the
@@ -626,15 +627,19 @@ if (!defined('__LIB_DISPLAY_TBL__')){
} }
if ($primary->primary_key > 0) { if ($primary->primary_key > 0) {
$primary_key .= $condition; $primary_key .= $condition;
} else if ($primary->unique_key > 0) {
$unique_key .= $condition;
} }
$uva_nonprimary_condition .= $condition; $uva_nonprimary_condition .= $condition;
} // end for } // end for
// Correction uva 19991216: prefer primary keys for // Correction uva 19991216: prefer primary or unique keys
// condition, but use conjunction of all values if no // for condition, but use conjunction of all values if no
// primary key // primary key
if ($primary_key) { if ($primary_key) {
$uva_condition = $primary_key; $uva_condition = $primary_key;
} else if ($unique_key) {
$uva_condition = $unique_key;
} else { } else {
$uva_condition = $uva_nonprimary_condition; $uva_condition = $uva_nonprimary_condition;
} }