invoice::max() causing havoc

13 views
Skip to first unread message

Ap.Muthu

unread,
Oct 21, 2013, 12:13:11 PM10/21/13
to Justin James Kelly, SI Group
Lines 1289 to 1294 of sql_patches.php are:
 
    $max_invoice = invoice::max();
    $patch['213']['name'] = "Update the index table with max invoice id - if required";
    if($max_invoice > "0")
    {
        $patch['213']['patch'] = "insert into `".TB_PREFIX."index` (id, node, sub_node, domain_id)  VALUES (".$max_invoice.", 'invoice', '".$defaults['preference']."','1');";
    } else {
....
During initial login, the session provides the domain_id but since the above directly calls the public static function with invoice::max(), we cannot use the $this variable in the function. Furthermore, if the si_index does not exist, then we get tripped by this patch.
 
 

Justin Kelly

unread,
Oct 23, 2013, 11:22:52 PM10/23/13
to Ap.Muthu, SI Group
index table gets created in sql 204 - which runs before this one (213)

what havoc is it causing?

Ap.Muthu

unread,
Oct 25, 2013, 9:04:54 AM10/25/13
to Justin Kelly, SI Group
At the moment, it is restricted to a new install where the patch manager table was not initialised - not a general occurence. Looks like the file is executed when partial updates to an existing install was done.
 
It's okay as it is, but will be a gotcha in certain non-standard instances.
Reply all
Reply to author
Forward
0 new messages