sidemenu_links); } /************************************************************************** ************************************************************************** ************************************************************************** * action: index / all * - Generate a listing of MonetarySources */ function index() { $this->all(); } function all() { $this->jqGridView('All MonetarySources', 'all'); } /************************************************************************** ************************************************************************** ************************************************************************** * virtuals: jqGridData * - With the application controller handling the jqGridData action, * these virtual functions ensure that the correct data is passed * to jqGrid. */ function jqGridDataTables(&$params, &$model) { return array ('contain' => false, ); } function jqGridRecordLinks(&$params, &$model, &$records, $links) { $links['MonetarySource'] = array('id'); return parent::jqGridRecordLinks($params, $model, $records, $links); } /************************************************************************** ************************************************************************** ************************************************************************** * action: nsf * - Marks a monetary source as having insufficient funds. */ function nsf($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid Item.', true)); $this->redirect(array('action'=>'index')); } // REVISIT : 20090713 // For testing purposes, must be deleted $stamp = '2009-07-09'; $this->MonetarySource->nsf($id, $stamp); } /************************************************************************** ************************************************************************** ************************************************************************** * 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')); } // Get the MonetarySource and related fields $monetary_source = $this->MonetarySource->find ('first', array ('contain' => false, )); // REVISIT : 20090713 // Consider allowing the NSF operation only if the source is used on // a ledger entry that is debited on a "payable" account (perhaps // even restricted to "payable" ASSET accounts), credited on Receipt // (or A/R), and reconciles the credit to an entry that debits on a // "depositable" account. // Set up dynamic menu items $this->sidemenu_links[] = array('name' => 'Operations', 'header' => true); $this->sidemenu_links[] = array('name' => 'NSF', 'url' => array('action' => 'nsf', $id)); // Prepare to render. $title = "Monetary Source #{$monetary_source['MonetarySource']['id']}"; $this->set(compact('monetary_source', 'title')); } }