diff --git a/site/controllers/customers_controller.php b/site/controllers/customers_controller.php index a090377..fb60635 100644 --- a/site/controllers/customers_controller.php +++ b/site/controllers/customers_controller.php @@ -2,6 +2,12 @@ class CustomersController extends AppController { + // DEBUG FUNCTION ONLY! + // Call without id to update ALL customers + function force_update($id = null) { + $this->Customer->update($id); + $this->redirect(array('action'=>'index')); + } /************************************************************************** ************************************************************************** diff --git a/site/models/lease.php b/site/models/lease.php index fd43dd3..96aaac9 100644 --- a/site/models/lease.php +++ b/site/models/lease.php @@ -148,9 +148,11 @@ class Lease extends AppModel { array('class' => 'StatementEntry', 'fields' => array(), 'conditions' => array - ('SEx.effective_date = DATE_ADD(StatementEntry.through_date, INTERVAL 1 day)', - 'SEx.lease_id = StatementEntry.lease_id', + ('SEx.lease_id = StatementEntry.lease_id', + 'SEx.type' => 'CHARGE', + 'SEx.account_id' => $rent_account_id, 'SEx.reverse_transaction_id IS NULL', + 'SEx.effective_date = DATE_ADD(StatementEntry.through_date, INTERVAL 1 day)', ), ), ),