Another try at checking if $id > $max, I like this better

This commit is contained in:
Miles Lott 2001-03-29 06:15:57 +00:00
parent f67f7719c2
commit 2c5d6daae2

View File

@ -1297,9 +1297,8 @@
/*!
@function next_id
@abstract return the next higher value for an integer, and increment it in the db.
The selection of max is a hack, since PHP thinks 0 > 0
*/
function next_id($appname,$min=0,$max=999999999)
function next_id($appname,$min=0,$max=0)
{
global $phpgw;
@ -1318,7 +1317,7 @@
} elseif($id<$min) {
$id = $min;
$phpgw->db->query("UPDATE phpgw_nextid SET id=".$id." WHERE appname='".$appname."'",__LINE__,__FILE__);
} elseif ($id>$max) {
} elseif ($max && ($id > $max)) {
return False;
} else {
$id = $id + 1;
@ -1333,9 +1332,8 @@
/*!
@function last_id
@abstract return the current id in the next_id table for a particular app/class.
The selection of max is a hack, since PHP thinks 0 > 0
*/
function last_id($appname,$min=0,$max=999999999)
function last_id($appname,$min=0,$max=0)
{
global $phpgw;
@ -1355,7 +1353,7 @@
} elseif($id<$min) {
$id = $min;
$phpgw->db->query("UPDATE phpgw_nextid SET id=".$id." WHERE appname='".$appname."'",__LINE__,__FILE__);
} elseif ($id>$max) {
} elseif ($max && ($id > $max)) {
return False;
} else {
return intval($id);