Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#15 Quickfix for 999 records limitation

1.3RC3
open
tobozo
5
2005-11-03
2005-11-03
tobozo
No

There is a bug that prevents myphpmoney to handle more
than 999 operations, here's a quickfix.

WARNING : apply this patch BEFORE using the software,
it won't do nice stuffs on an existing one, and it'll
make the application less efficient if you have more
than one user registered.

yeah I know it sucks, we'll try to find a better
solution when we have more time.

this patch roughly changes this line :
[-] return $ids;

into this line :

[+] return $ids == '' || !strstr($ids,$sess_pid) ?
$sess_pid.'000'.$ids : $ids;

Edit the file 'sql.inc' located in the inc folder, look
for the function SQL_RecupId, and replace it by this :

function SQL_RecupId($data) {
Global $sess,$sess_pid,$_MPM,$db; $_MPM['Serial'][] =
"SQL_RecupId($data)";

$sess_pid = isset($sess_pid) && is_object($sess)
&& $sess->is_registered('sess_pid') ? $sess_pid : '';
if ($sess_pid != '' && isset($data) &&
is_int($data)) {
switch($data) {
case 0 : $sqlmax = 'CATID'; break;
case 1 : $sqlmax = 'OPID'; break;
case 2 : $sqlmax = 'ACCOUNTID'; break;
case 4 : $sqlmax = 'THIRDID'; break;
}
$db->query (
"SELECT (MAX($sqlmax) +1) as ID_C
FROM ".$_MPM['table'][$data]."
WHERE USERID='$sess_pid'"
);
$db->next_record();

$ids = $db->f('ID_C');
return $ids;
} ## end if ($sess_pid != '')
} ## end of SQL_RecupId

Discussion