I'm getting there. I firmly believe it's in the SQL of the invoice forms.
There's a problem with this select. For 1 row in the table it returns 16 in the query result
SELECT t1.amount, t1.creationdate, t1.description, t3.countryname, t2.did, t1.currency FROM cc_charge t1 LEFT JOIN (cc_did t2, cc_country t3 ) ON ( t1.id_cc_did = t2.id AND t2.id_cc_country = t3.id ) WHERE (t1.chargetype = 1 OR t1.chargetype = 2) AND t1.id_cc_card = 1;
DB entry seems fine
Update
I've re-written the query and it now works as expected.
Quote:
$QUERY = "SELECT t1.amount, t1.creationdate, t1.description, t3.countryname, t2.did, t1.currency " .
" FROM cc_charge t1 " .
" LEFT JOIN cc_did t2 " .
" ON t1.id_cc_did = t2.id " .
" LEFT JOIN cc_country t3 " .
" ON t2.id_cc_country = t3.id " .
" WHERE (t1.chargetype = 1 OR t1.chargetype = 2) " .
" AND t1.id_cc_card = ".$customerID.
" AND t1.creationdate >(Select CASE WHEN max(cover_enddate) IS NULL THEN '0001-01-01 01:00:00' ELSE max(cover_enddate) END from cc_invoices)";
I'll update the others and post fix to trac