I'm still in the middle of moving onto a ledger based system. However, I'm am now changing how transactions and entries relate back to the customer. I'll be using a ledger for each lease (for rent, late charges, security deposits, etc), and a ledger for each customer (for POS, non-specific deposits such as reservations or covering mulitple units, bad debt writeoff, and possibly customer credits, when not obviously lease specific). This coming change might not be in the right direction, so I want to capture the work as is right now. This change set is not fully functional. Many operations do work, but there are obviously transaction problems with units and customers.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@71 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-06 20:18:56 +00:00
parent ce24abc812
commit 677458e942
52 changed files with 2367 additions and 1469 deletions

View File

@@ -83,27 +83,51 @@ class AppModel extends Model {
// a really large number of rows. However, trying to untagle this
// without changing a bunch of core code is near impossible.
var $paginate_rows_save;
function paginate($conditions, $fields, $order, $limit, $page = 1, $recursive = null, $extra = null) {
//var $paginate_rows_save;
function paginate($conditions, $fields, $order, $limit, $page = 1, $recursive = null, &$extra = null) {
/* pr("paginate"); */
/* pr(array_merge(compact('conditions', 'fields', 'order', 'limit', 'page', 'recursive', 'extra'))); */
if ($page > 1 && isset($limit))
$offset = ($page - 1) * $limit;
else
$offset = 0;
return array_slice($this->paginate_rows_save, $offset, $limit);
if (!isset($extra['results']))
die("Why isn't results set!?!");
$results = $extra['results'];
unset($extra['results']);
return array_slice($results, $offset, $limit);
}
function paginateCount($conditions = null, $recursive = null, $extra = null) {
function paginateCount($conditions = null, $recursive = null, &$extra = null) {
/* pr("paginateCount"); */
/* pr(array_merge(compact('conditions', 'recursive', 'extra'))); */
/* pr(compact('conditions', 'recursive', 'extra')); */
if (!isset($recursive))
$recursive = $this->recursive;
$parameters = array_merge(compact('conditions', 'recursive'), $extra);
$results = $this->find('all', $parameters);
if (isset($extra['results'])) {
// Beauty! The results are already in!
// This happens if the user sets up a complex query
// and passes us the result to paginate.
$results = $extra['results'];
}
elseif (isset($extra['query'])) {
// Perform the query directly... forget all the find B.S.
$results = $this->query($extra['query']);
}
else {
if (!isset($recursive))
$recursive = $this->recursive;
$this->paginate_rows_save = $results;
return count($this->paginate_rows_save);
$parameters = array_merge(compact('conditions', 'recursive'), $extra);
$results = $this->find('all', $parameters);
}
//$this->paginate_rows_save = $results;
//return count($this->paginate_rows_save);
if (!isset($extra['results']))
$extra['results'] = $results;
return count($results);
}
}