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.