public function view() { if (!$this->loadData()) { $this->dataError(); sendBack(); } $transaction = $this->_uses[$this->modeltype]; $id = $transaction->id; $this->view->set('transaction', $transaction); $elements = new MFCentreCollection(new MFCentre()); $sh = $this->setSearchHandler($elements); $sh->addConstraint(new Constraint('mfdept_id', '=', $id)); parent::index($elements, $sh); $sidebar = new SidebarController($this->view); $sidebarlist = array(); $sidebarlist['all'] = array('tag' => 'All Departments', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'index'))); $sidebar->addList('Show', $sidebarlist); $sidebarlist = array(); $sidebarlist['edit'] = array('tag' => 'Edit', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'edit', 'id' => $id))); if ($elements->count() == 0) { $sidebarlist['delete'] = array('tag' => 'Delete', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'delete', 'id' => $id))); } $sidebarlist['add'] = array('tag' => 'Add Centre', 'link' => array_merge($this->_modules, array('controller' => 'MFCentres', 'action' => 'new', 'mfdept_id' => $id))); $sidebar->addList('This Department', $sidebarlist); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); $this->view->set('clickaction', 'view'); $this->view->set('clickcontroller', 'MFCentres'); }
public function _new() { $flash = Flash::Instance(); parent::_new(); // Get the Purchase Invoice Line Object - if loaded, this is an edit $pinvoiceline = $this->_uses[$this->modeltype]; if (!$pinvoiceline->isLoaded()) { if (empty($this->_data['invoice_id'])) { $flash->addError('No Purchase Invoice supplied'); sendBack(); } $pinvoiceline->invoice_id = $this->_data['invoice_id']; } else { } $pinvoice = DataObjectFactory::Factory('Pinvoice'); $pinvoice->load($pinvoiceline->invoice_id); if (isset($this->_data[$this->modeltype])) { // We've had an error so refresh the page $pinvoiceline->line_number = $this->_data['PInvoiceLine']['line_number']; $_glaccount_id = $this->_data['PInvoiceLine']['glaccount_id']; } elseif ($pinvoiceline->isLoaded()) { $_glaccount_id = $pinvoiceline->glaccount_id; } else { $pinvoiceline->due_delivery_date = $pinvoice->due_date; } $glaccounts = $this->getAccount(); $this->view->set('glaccount_options', $glaccounts); if (empty($_glaccount_id)) { $_glaccount_id = key($glaccounts); } $this->view->set('glcentre_options', $this->getCentres($_glaccount_id)); $this->view->set('taxrate_options', $this->getTaxRate()); $this->view->set('pinvoice', $pinvoice); }
public function view() { if (!$this->loadData()) { $this->dataError(); sendBack(); } $whbin = $this->_uses[$this->modeltype]; $id = $whbin->id; $this->view->set('transaction', $whbin); $whlocation = new WHLocation(); $whlocation->load($whbin->whlocation_id); $this->view->set('whstore', $whlocation->whstore); $sidebar = new SidebarController($this->view); $sidebarlist = array(); $sidebarlist['stores'] = array('tag' => 'All Stores', 'link' => array_merge($this->_modules, array('controller' => 'WHStores', 'action' => 'index'))); $sidebarlist['locations'] = array('tag' => 'Locations for Store ' . $whlocation->whstore, 'link' => array_merge($this->_modules, array('controller' => 'WHLocations', 'action' => 'index', 'id' => $whbin->whlocation_id))); $sidebarlist['bins'] = array('tag' => 'Bins for Location ' . $whlocation->getIdentifierValue(), 'link' => array_merge($this->_modules, array('controller' => 'WHLocations', 'action' => 'view', 'id' => $whbin->whlocation_id))); $sidebar->addList('Show', $sidebarlist); $sidebarlist = array(); $sidebarlist['edit'] = array('tag' => 'Edit', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'edit', 'id' => $id, 'whlocation_id' => $whbin->whlocation_id))); // Do not allow delete if balances exist if ($whbin->balances->count() === 0) { $sidebarlist['delete'] = array('tag' => 'Delete', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'delete', 'id' => $id, 'whlocation_id' => $whbin->whlocation_id))); } $sidebar->addList('This Bin', $sidebarlist); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); }
public function view() { if (!$this->loadData()) { $this->dataError(); sendBack(); } $accesslist = $this->_uses[$this->modeltype]; // $this->addSidebar($systempolicy); $policy_permissions = new SystemPolicyControlListCollection(); $sh = $this->setSearchHandler($policy_permissions); $sh->addConstraint(new Constraint('access_lists_id', '=', $accesslist->{$accesslist->idField})); parent::index($policy_permissions, $sh); $this->view->set('no_ordering', true); $sidebar = new SidebarController($this->view); $sidebarlist = array(); $sidebarlist['alllists'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index'), 'tag' => 'View All System Access Lists'); $sidebar->addList('Actions', $sidebarlist); $sidebarlist = array(); $sidebarlist['edit'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'edit', 'id' => $accesslist->{$accesslist->idField}), 'tag' => 'edit_access_list'); $sidebarlist['delete'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'delete', 'id' => $accesslist->{$accesslist->idField}), 'tag' => 'delete_access_list'); $sidebarlist['addpermission'] = array('link' => array('modules' => $this->_modules, 'controller' => 'systempolicycontrollists', 'action' => '_new', 'object_policies_id' => $accesslist->{$accesslist->idField}), 'tag' => 'add_policy_permission'); $sidebar->addList('This Policy', $sidebarlist); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); }
public function savejournal() { $flash = Flash::Instance(); $errors = array(); if (!$this->checkParams('Vat')) { sendBack(); } $data = $this->_data['Vat']; if ($data['value']['net'] <= 0 || $data['value']['vat'] <= 0) { $errors[] = 'Net and Vat values must be greater than zero'; } else { $glparams = DataObjectFactory::Factory('GLParams'); $vat_type = 'vat_' . $data['vat_type']; $data['vat_account'] = call_user_func(array($glparams, $vat_type)); if ($data['vat_type'] == 'input') { $data['value']['net'] = bcmul($data['value']['net'], -1); $data['value']['vat'] = bcmul($data['value']['vat'], -1); } $data['transaction_date'] = date(DATE_FORMAT); $gltransactions = GLTransaction::makeFromVATJournalEntry($data, $errors); if (count($errors) == 0 && GLTransaction::saveTransactions($gltransactions, $errors)) { $flash->addMessage('VAT Journal created OK'); sendTo($this->name, '', $this->_modules); } } $flash->addErrors($errors); $this->_data['vat_type'] = $data['vat_type']; $this->_data['glaccount_id'] = $data['glaccount_id']; $this->refresh(); }
public function view() { if (!$this->loadData()) { $this->dataError(); sendBack(); } $transaction = $this->_uses[$this->modeltype]; $id = $transaction->id; $this->view->set('transaction', $transaction); $elements = new WHTransferruleCollection(new WHTransferrule()); $sh = new SearchHandler($elements, false); $sh->extract(); $sh->addConstraint(new Constraint('whaction_id', '=', $id)); $sh->extractOrdering(); $sh->extractPaging(); $elements->load($sh); $this->view->set('elements', $elements); $sidebar = new SidebarController($this->view); $sidebar->addList('Show', array('all' => array('tag' => 'All Actions', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'index'))), 'locations' => array('tag' => 'All Stores', 'link' => array_merge($this->_modules, array('controller' => 'WHStores', 'action' => 'index'))))); $sidebarlist = array(); $sidebarlist['edit'] = array('tag' => 'Edit', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'edit', 'id' => $id))); $sidebarlist['delete'] = array('tag' => 'Delete', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'delete', 'id' => $id))); if (is_null($transaction->max_rules) || $elements->count() < $transaction->max_rules) { $sidebarlist['Add'] = array('tag' => 'Add Rule', 'link' => array_merge($this->_modules, array('controller' => 'WHTransferrules', 'action' => 'new', 'whaction_id' => $id))); } $sidebar->addList('This Action', $sidebarlist); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); $this->view->set('clickaction', 'view'); $this->view->set('clickcontroller', 'WHTransferrules'); $this->view->set('no_ordering', true); }
public function delete() { $flash = Flash::Instance(); $errors = array(); $data = array('id' => $this->_data['id'], 'end_date' => date(DATE_FORMAT)); $outside_op = MFOutsideOperation::Factory($data, $errors, 'MFOutsideOperation'); if (count($errors) > 0 || !$outside_op->save()) { $errors[] = 'Could not delete outside operation'; } if (count($errors) == 0) { $stitem = new STItem(); if ($stitem->load($outside_op->stitem_id)) { //$stitem->calcLatestCost(); if (!$stitem->rollUp(STItem::ROLL_UP_MAX_LEVEL)) { $errors[] = 'Could not roll-up latest costs'; $db->FailTrans(); } } else { $errors[] = 'Could not roll-up latest costs'; $db->FailTrans(); } } if (count($errors) == 0) { $flash->addMessage('Outside operation deleted'); sendTo('STItems', 'viewoutside_operations', $this->_modules, array('id' => $this->_data['stitem_id'])); } else { $flash->addErrors($errors); sendBack(); } }
public function view() { if (!$this->loadData()) { $this->dataError(); sendBack(); } $transaction = $this->_uses[$this->modeltype]; $id = $transaction->id; if ($transaction->bin_controlled == 't') { sendTo('WHBins', 'index', $this->_modules, array('whlocation_id' => $this->_data['id'])); } $this->view->set('transaction', $transaction); $sidebar = new SidebarController($this->view); $sidebarlist = array(); $sidebarlist['stores'] = array('tag' => 'All Stores', 'link' => array_merge($this->_modules, array('controller' => 'WHStores', 'action' => 'index'))); $sidebarlist['locations'] = array('tag' => 'Locations for Store ' . $transaction->whstore, 'link' => array_merge($this->_modules, array('controller' => 'WHStores', 'action' => 'view', 'id' => $transaction->whstore_id))); $sidebar->addList('Show', $sidebarlist); $sidebarlist = array(); $sidebarlist['edit'] = array('tag' => 'Edit', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'edit', 'id' => $id))); if ($transaction->isBinControlled() && $transaction->bins->count() == 0 || !$transaction->isBinControlled() && $transaction->balances->count() == 0) { $sidebarlist['delete'] = array('tag' => 'Delete', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'delete', 'id' => $id, 'whstore_id' => $transaction->whstore_id))); } $sidebar->addList('This Location', $sidebarlist); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); $this->view->set('page_title', $this->getPageName('Location')); }
public function view() { if (!$this->loadData()) { $this->dataError(); sendBack(); } $mappingrule = $this->_uses[$this->modeltype]; $this->view->set('clickaction', 'view'); $this->view->set('mappingrule', $mappingrule); $childrules = new DataMappingRuleCollection(new DataMappingRule()); $sh = $this->setSearchHandler($childrules); $sh->addConstraint(new Constraint('parent_id', '=', $mappingrule->id)); parent::index($childrules, $sh); $sidebar = new SidebarController($this->view); $sidebar->addList('actions', array($mappingrule->name => array('tag' => 'View All Mapping Rules', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index')))); $sidebarlist = array(); $sidebarlist[$mappingrule->name] = array('tag' => 'view', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'view', 'id' => $mappingrule->id)); $sidebarlist['edit'] = array('tag' => 'edit', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'edit', 'id' => $mappingrule->id)); $sidebarlist['delete'] = array('tag' => 'delete', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'delete', 'id' => $mappingrule->id)); $sidebar->addList($mappingrule->external_system . ' ' . $mappingrule->name, $sidebarlist); if (!is_null($mappingrule->parent_id)) { $mappingrule->addLinkRule(array('data_translations' => array())); } $this->sidebarRelatedItems($sidebar, $mappingrule); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); $this->view->set('page_title', $this->getPageName()); }
public function view_allocations() { $flash = Flash::Instance(); $collection = new SLTransactionCollection($this->_templateobject); $this->_templateobject->setAdditional('payment_value', 'numeric'); $allocation = DataObjectFactory::Factory('SLAllocation'); $allocationcollection = new SLAllocationCollection($allocation); $collection->_tablename = $allocationcollection->_tablename; $sh = $this->setSearchHandler($collection); $fields = array("our_reference||'-'||transaction_type as id", 'customer', 'slmaster_id', 'transaction_date', 'transaction_type', 'our_reference', 'ext_reference', 'currency', 'gross_value', 'allocation_date'); $sh->setGroupBy($fields); $fields[] = 'sum(payment_value) as payment_value'; $sh->setFields($fields); if (isset($this->_data['trans_id'])) { $allocation->identifierField = 'allocation_id'; $cc = new ConstraintChain(); $cc->add(new Constraint('transaction_id', '=', $this->_data['trans_id'])); $alloc_ids = $allocation->getAll($cc); if (count($alloc_ids) > 0) { $sh->addConstraint(new Constraint('allocation_id', 'in', '(' . implode(',', $alloc_ids) . ')')); } else { $flash->addError('Error loading allocation'); sendBack(); } } parent::index($collection, $sh); $this->view->set('collection', $collection); $this->view->set('invoice_module', 'sales_invoicing'); $this->view->set('invoice_controller', 'sinvoices'); $this->view->set('clickaction', 'view'); $this->view->set('clickcontroller', 'slcustomers'); $this->view->set('linkvaluefield', 'slmaster_id'); }
public function viewperson() { $view = new Newsletterview(); $view->load($this->_data['id']) or sendBack(); $person = new Person(); $person->load($view->person_id); sendTo('persons', 'view', 'contacts', array('id' => $person->id)); }
public function save() { if (!$this->CheckParams($this->modeltype)) { sendBack(); } $flash = Flash::Instance(); $errors = array(); $db = DB::Instance(); $db->StartTrans(); $current_accounts = array(); if (isset($this->_data[$this->modeltype]['id'])) { $centre = $this->_templateobject; $centre->load($this->_data[$this->modeltype]['id']); if ($centre->isLoaded()) { foreach ($centre->accounts as $accountcentre) { // Delete any existing entries not in the supplied list if (!empty($this->_data[$this->modeltype]['account_id']) && in_array($accountcentre->glaccount_id, $this->_data[$this->modeltype]['account_id'])) { $current_accounts[$accountcentre->glaccount_id] = $accountcentre->glaccount_id; } elseif (!$accountcentre->delete(null, $errors)) { $errors[] = 'Failed to update Account Centre Reference ' . $accountcentre->glaccount; } } } } if (count($errors) === 0 && parent::save_model($this->modeltype)) { if (isset($this->_data[$this->modeltype]['account_id'])) { foreach ($this->_data[$this->modeltype]['account_id'] as $account_id) { if (!key_exists($account_id, $current_accounts)) { $data = array(); $data['glaccount_id'] = $account_id; $data['glcentre_id'] = $this->saved_model->id; $accountcentre = GLAccountCentre::Factory($data, $errors, 'GLAccountCentre'); if ($accountcentre) { $accountcentre->save(); if (!$accountcentre) { $errors[] = 'Failed to save reference to Account'; break; } } else { $errors[] = 'Failed to save reference to Account'; break; } } } } if (count($errors) == 0) { $db->CompleteTrans(); sendTo($this->name, 'index', $this->_modules); } } else { $errors[] = 'Failed to save GL Centre'; } $db->FailTrans(); $flash->addErrors($errors); $this->refresh(); }
public function save() { $flash = Flash::Instance(); if (parent::save('SalesPerson')) { sendBack(); } else { $this->_new(); $this->_templateName = $this->getTemplateName('new'); } }
public function save() { $flash = Flash::Instance(); if (parent::save('CalendarEventAttendee')) { sendBack(); } else { $this->_new(); $this->_templateName = $this->getTemplateName('new'); } }
public function save() { $flash = Flash::Instance(); if (parent::save('OpportunityNote')) { sendBack(); } else { $this->_new(); $this->_templateName = $this->getTemplateName('new'); } }
public function save() { $flash = Flash::Instance(); if (parent::save('Usercompanyaccess')) { sendBack(); } else { $this->_new(); $this->_templateName = $this->getTemplateName('new'); } }
public function delete() { $flash = Flash::Instance(); if (!isModuleAdmin()) { $flash->addError('Sorry, must be a module admin to delete resource templates.'); sendBack(); } parent::delete('Resourcetemplate'); sendTo('resourcetemplate', 'index', 'projects'); }
public function save() { $flash = Flash::Instance(); $errors = array(); if (parent::save('ReportDefinition', '', $errors)) { sendBack(); } else { $flash->addErrors($errors); sendBack(); } }
public function save() { if (!$this->CheckParams($this->modeltype)) { sendBack(); } $flash = Flash::Instance(); if (parent::save($this->modeltype)) { sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null); } $this->refresh(); }
public function view() { if (!$this->loadData()) { $this->dataError(); sendBack(); } $ticket_queue = $this->_uses[$this->modeltype]; $sidebar = new SidebarController($this->view); $sidebar->addList('actions', array('all' => array('tag' => 'View All', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index')), 'edit' => array('tag' => 'Edit', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'edit', 'id' => $ticket_queue->id)), 'spacer', 'delete' => array('tag' => 'Delete', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'delete', 'id' => $ticket_queue->id)))); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); }
function save() { $user = $this->_uses['User']; $user->load(EGS_USERNAME); if ($this->_data['Person']['id'] == $user->person_id) { parent::save(); } else { $flash = Flash::Instance(); $flash->addError('You don\'t have permission to do that'); sendBack(); } }
public function save() { $flash = Flash::Instance(); $errors = array(); $this->_data['ReportPart']['name'] = strtolower($this->_data['ReportPart']['name']); if (parent::save('ReportPart', '', $errors)) { sendBack(); } else { $flash->addErrors($errors); sendBack(); } }
public function view() { if (!$this->loadData()) { $this->dataError(); sendBack(); } $equipment = $this->_uses[$this->modeltype]; $sidebar = new SidebarController($this->view); $sidebar->addList('currently_viewing', array($equipment->name => array('tag' => $equipment->name, 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'view', 'id' => $equipment->id)), 'edit' => array('tag' => 'Edit', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'edit', 'id' => $equipment->id)), 'delete' => array('tag' => 'Delete', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'delete', 'id' => $equipment->id)))); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); }
public function save() { if (!$this->checkParams($this->modeltype)) { sendBack(); } $errors = array(); // echo 'SystempolicycontrollistsController::save data<pre>'.print_r($this->_data, true).'</pre><br>'; // exit; if (count($errors) > 0 || !parent::save($this->modeltype)) { $this->refresh(); } sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null); }
public function save() { if (!$this->CheckParams($this->modeltype)) { sendBack(); } $flash = Flash::Instance(); $errors = array(); if (parent::save_model($this->modeltype, '', $errors)) { sendTo($this->name, 'view', $this->_modules, array($this->saved_model->idField => $this->saved_model->{$this->saved_model->idField})); } $flash->addErrors($errors); $flash->addError('Failed to save ' . $this->modeltype); $this->refresh(); }
public function save() { if (!$this->CheckParams($this->modeltype)) { sendBack(); } $flash = Flash::Instance(); $errors = array(); if (parent::save($this->modeltype, '', $errors)) { sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null); } $flash->addErrors($errors); $flash->addError('Failed to save ' . $this->modeltype); $this->refresh(); }
public function save_transactions() { if (!$this->CheckParams('STTransaction')) { sendBack(); } $flash = Flash::Instance(); $db = DB::Instance(); $db->StartTrans(); $errors = array(); $data = $this->_data['STTransaction']; $stitem = new STItem(); $stitem->load($data['stitem_id']); $converted = round($data['qty'], $stitem->qty_decimals); if ($converted != $data['qty']) { $errors[] = 'Quantity can only have ' . $stitem->qty_decimals . ' decimal places'; } elseif ($data['qty'] <= 0) { $errors[] = 'Quantity must be greater than zero'; } else { $models = STTransaction::prepareMove($data, $errors); if (count($errors) == 0) { foreach ($models as $model) { $result = $model->save($errors); if ($result === false) { $db->FailTrans(); } } } } if (count($errors) > 0) { $errors[] = 'Error transferring stock'; $db->FailTrans(); $db->CompleteTrans(); $flash->addErrors($errors); $this->_data['whaction_id'] = $data['whaction_id']; $this->refresh(); return; } else { $db->CompleteTrans(); $flash->addMessage('Transfer completed successfully'); } if (isset($this->_data['saveAnother'])) { $this->_data['whaction_id'] = $data['whaction_id']; $_POST[$this->modeltype]['qty'] = ''; $_POST[$this->modeltype]['balance'] = ''; $this->refresh(); } else { sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null); } }
public function viewBalances() { if ($this->isPrintDialog()) { // set options $options = $this->reportOptions(); // we use status in other print functions, however here we base it on if ajax print is or isn't set if (!$this->isPrinting()) { return $options; } } if (!$this->loadData()) { $this->dataError(); sendBack(); } $id = $this->_data['id']; $transaction = $this->_uses[$this->modeltype]; $s_data = array(); if (isset($this->_data['id'])) { $s_data['whbin_id'] = $this->_data['id']; } elseif (isset($this->_data['Search']['whbin_id'])) { $s_data['whbin_id'] = $id = $this->_data['Search']['whbin_id']; } if (isset($this->_data['stitem_id'])) { $s_data['stitem_id'] = $this->_data['stitem_id']; } elseif (isset($this->_data['Search']['stitem_id'])) { $s_data['stitem_id'] = $this->_data['Search']['stitem_id']; } $this->setSearch('whbinsSearch', 'withinBin', $s_data); $this->view->set('transaction', $transaction); $stbalances = new STBalanceCollection(); $sh = $this->setSearchHandler($stbalances); $sh->setOrderby('stitem'); parent::index($stbalances, $sh); $this->view->set('clickaction', 'viewTransactions'); $this->view->set('clickcontroller', 'WHBins'); $this->view->set('linkvaluefield', 'whbin_id'); $this->view->set('no_ordering', true); $this->view->set('page_title', $this->getPageName('', 'View Balances for')); $sidebar = new SidebarController($this->view); $whlocation = $this->getLocation($transaction->whlocation_id); $sidebarlist = $this->setGeneralSidebar($whlocation, $transaction); $sidebar->addList('Show', $sidebarlist); $sidebarlist = array(); $sidebarlist['balances'] = array('tag' => 'Stock Balances', 'link' => array('modules' => $this->_modules, 'controller' => 'WHLocations', 'action' => 'printAction', 'filename' => 'BalanceList_' . date('Y-m-d'), 'printaction' => 'printBalanceList', 'id' => $transaction->whlocation_id, 'whbin_id' => $id)); $sidebar->addList('Reports', $sidebarlist); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); }
/** * Insert entry into dedicated table in DB. * * @param array $entry The array representation of the POST payload. * @return JSON On success or failure, returns a prepared JSON response matching the situation. */ function storeEntry($entry) { $connParams = json_decode(file_get_contents('../../config.json')); $conn = mysqli_connect($connParams->sDbHost, $connParams->sDbUser, $connParams->sDbPassword, $connParams->sDbDatabase); if (mysqli_connect_errno()) { echo sendBack(500, 'MySQL error: ' . mysqli_connect_error(), $entry); } $query = "INSERT INTO mango_results_facilitator" . " (id, survey_name, user_token, matching_table_in_limesurvey, matching_row_in_table)" . " VALUES (NULL,'" . $entry['name'] . "', '" . $entry['token'] . "', '" . $entry['table'] . "', '" . $entry['row'] . "')"; $code = 201; $msg = 'Successfully added to DB.'; if (!mysqli_query($conn, $query)) { $code = 500; $msg = 'MySQL error: ' . mysqli_error($conn); } echo sendBack($code, $msg, $entry); }
public function view() { if (!$this->loadData()) { $this->dataError(); sendBack(); } $resource = $this->_uses[$this->modeltype]; $this->view->set('model', $resource); $detail = DataObjectFactory::Factory('MFResource'); $detail->load($resource->resource_id); $resource->setAdditional('resource_rate'); $resource->resource_rate = $detail->resource_rate; $sidebar = new SidebarController($this->view); $sidebar->addList('Actions', array('new' => array('tag' => 'new_project_resource', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new')), 'edit' => array('tag' => 'edit', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'edit', 'id' => $resource->id)))); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); }