mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 17:14:44 +01:00
Another try at checking if $id > $max, I like this better
This commit is contained in:
parent
f67f7719c2
commit
2c5d6daae2
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user