diff --git a/application/Invoice/InvoiceModel.php b/application/Invoice/InvoiceModel.php index 2afe875c1..04af23caa 100644 --- a/application/Invoice/InvoiceModel.php +++ b/application/Invoice/InvoiceModel.php @@ -153,7 +153,7 @@ class InvoiceModel { WHERE $where ORDER BY invoice_number DESC LIMIT 1"; - //mfLoghandler::singleton()->debug($sql); + mfLoghandler::singleton()->debug($sql); $res = $db->query($sql); if($db->num_rows($res)) { @@ -429,17 +429,21 @@ class InvoiceModel { } } + if(array_key_exists("sepa_id", $filter)) { + $sepa_id = $filter['sepa_id']; + if($sepa_id) { + $where .= " AND Invoice.sepa_id = '$sepa_id'"; + } + } + + if(array_key_exists("add-where", $filter)) { $where .= " ".$filter['add-where']; } - if(array_key_exists("Invoice_period", $filter)) { - $Invoice_period = $filter['Invoice_period']; - if(is_numeric($Invoice_period)) { - $where .= " AND Invoice.Invoice_period = $Invoice_period"; - } - } + + //var_dump($filter, $where);exit; return $where; }