As the database has grown, the statement entry page query has finally ground to a halt. The query was kludged as simple as possible, and it now operates much quicker. A cleaner solution would be nice...
git-svn-id: file:///svn-source/pmgr/branches/v0.2.0_work@936 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -47,7 +47,17 @@ class StatementEntriesController extends AppController {
|
|||||||
|
|
||||||
if (!empty($params['post']['custom']['statement_entry_id'])) {
|
if (!empty($params['post']['custom']['statement_entry_id'])) {
|
||||||
$link['ChargeEntry'] = array();
|
$link['ChargeEntry'] = array();
|
||||||
$link['DisbursementEntry'] = array();
|
// This query actually represents a union...
|
||||||
|
// Unpaid Charge/Surplus: ChargeID - NULL; DisbursementID - NULL
|
||||||
|
// Paid Charge/Refund: ChargeID - NULL; DisbursementID - !NULL
|
||||||
|
// Disbursement/Reversal: ChargeID - !NULL; DisbursementID - NULL
|
||||||
|
// <EMPTY SET>: ChargeID - !NULL; DisbursementID - !NULL
|
||||||
|
//
|
||||||
|
// The query is really slow unless we add the `id` condition to the join.
|
||||||
|
// A cleaner query would be nice, but we must work within the Cake framework.
|
||||||
|
$link['DisbursementEntry'] = array('conditions' =>
|
||||||
|
'`DisbursementEntry`.`id` = '
|
||||||
|
. $params['post']['custom']['statement_entry_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array('link' => $link);
|
return array('link' => $link);
|
||||||
|
|||||||
Reference in New Issue
Block a user