コード例 #1
0
 public function _new()
 {
     parent::_new();
     // For new actions the stitem_id and from_uom_id will be set
     // For edit actions, the id will be set pointing to the uom conversion to be edited
     if ($this->_data['action'] == 'edit') {
         $stuom = $this->_uses[$this->modeltype];
         $stitem_id = $stuom->stitem_id;
         $stitem_uom_id = $stuom->from_uom_id;
         $stitem_uom_name = $stuom->from_uom_name;
     } else {
         $stitem = new STitem();
         $stitem->load($this->_data['stitem_id']);
         $stitem_id = $stitem->id;
         $stitem_uom_id = $stitem->uom_id;
         $stitem_uom_name = $stitem->uom_name;
     }
     $this->view->set('stitem_id', $stitem_id);
     $this->view->set('stitem_uom_id', $stitem_uom_id);
     $this->view->set('stitem_uom_name', $stitem_uom_name);
     $this->view->set('stitem', Stuomconversion::getStockItem($stitem_id));
     $elements = new STuomconversionCollection(new STuomconversion());
     $sh = new SearchHandler($elements, false);
     $sh->extract();
     $sh->addConstraint(new Constraint('stitem_id', '=', $stitem_id));
     $sh->setOrderBy('from_uom_name');
     $sh->extractOrdering();
     $sh->extractPaging();
     $elements->load($sh);
     $this->view->set('elements', $elements);
     $this->view->set('no_ordering', true);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
ファイル: Controller.php プロジェクト: uzerpllp/uzerp
 /**
  * fills a collection of the specified model type with the fields specified,
  * also gives correct click controller, action and edit handlers so
  * that smarty datatable will work correctly.
  * finally outputs specified smarty variable as the collection for
  * datatable to use
  * used for alternate controller to display specific contents of a different
  * controller
  */
 public function fillCollection($modelname, $fields, $constraints, $clickcontroller, $clickaction, $editclickaction, $deletecontroller, $smartyname, $tablename = null, $deleteaction = null, $newtext = null, $limit = null, $orderdir = null, $offset = null)
 {
     $collectionname = $modelname . 'Collection';
     $collection = new $collectionname();
     $sh = new SearchHandler($collection);
     $sh->fields = $fields;
     $sh->constraints = $constraints;
     $sh->extractOrdering();
     $sh->extractPaging();
     $sh->perpage = 900000;
     if (isset($orderdir)) {
         $sh->orderdir = $orderdir;
     }
     if (isset($limit) && isset($offset)) {
         $sh->setLimit($limit, $offset);
     }
     if (isset($tablename)) {
         $collection->_tablename = $tablename;
     }
     $collection->load($sh);
     $collection->clickcontroller = $clickcontroller;
     $collection->clickaction = $clickaction;
     $collection->editclickaction = $editclickaction;
     $collection->deletecontroller = $deletecontroller;
     if (isset($deleteaction)) {
         $collection->deleteclickaction = $deleteaction;
     }
     if (isset($newtext)) {
         $collection->newtext = $newtext;
     }
     $this->view->set($smartyname, $collection);
 }
コード例 #4
0
 public function showFulfilled()
 {
     $mfworkorders = new MFWorkorderCollection($this->_templateobject);
     $sh = new SearchHandler($mfworkorders);
     $sh->extract();
     $sh->addConstraint(new Constraint('status', '=', 'O'));
     $sh->addConstraint(new Constraint('made_qty', '>=', '(order_qty)'));
     $sh->extractOrdering();
     $sh->extractPaging();
     $mfworkorders->load($sh);
     $this->view->set('clickaction', 'view');
     $this->view->set('mfworkorders', $mfworkorders);
     $sidebar = new SidebarController($this->view);
     $sidebarlist = array();
     $sidebarlist['viewAll'] = array('tag' => 'View', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index'));
     $sidebar->addList('All Works Orders', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }