Files
pmgr/controllers/ledger_entries_controller.php

56 lines
1.9 KiB
PHP

<?php
class LedgerEntriesController extends AppController {
var $paginate = array('limit' => 100,
'group' => 'Entry.id',
'order' => array('Entry.stamp' => 'ASC'));
var $sidemenu_links =
array(array('name' => 'Entries', 'header' => true),
array('name' => 'Cleared', 'url' => array('controller' => 'ledger_entries', 'action' => 'cleared')),
array('name' => 'Unresolved', 'url' => array('controller' => 'ledger_entries', 'action' => 'unresolved')),
);
/**************************************************************************
**************************************************************************
**************************************************************************
* override: sideMenuLinks
* - Generates controller specific links for the side menu
*/
function sideMenuLinks() {
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
}
/**************************************************************************
**************************************************************************
**************************************************************************
* action: view
* - Displays information about a specific entry
*/
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid Item.', true));
$this->redirect(array('controller' => 'accounts', 'action'=>'index'));
}
$this->LedgerEntry->Behaviors->attach('Containable');
$this->LedgerEntry->contain
(array(// Models
'MonetarySource' => array('MonetaryType'),
'Transaction',
'DebitLedger',
'CreditLedger',
)
);
$entry = $this->LedgerEntry->read(null, $id);
pr($entry);
$title = "Entry #{$entry['LedgerEntry']['id']} ({$entry['LedgerEntry']['name']})";
$this->set(compact('entry', 'title'));
//$this->autoRender = false;
}
}