public function preorder() { // foreach ($this->_data as $key=>$value) { // echo $key.'='.$value.'<br>'; // } if (isset($this->_data['stitem_id'])) { $id = $this->_data['stitem_id']; $stitem = DataObjectFactory::Factory('STItem'); $stitem->load($id); $this->view->set('transaction', $stitem); $s_data = array('stitem_id' => $id, 'start_date/end_date' => date(DATE_FORMAT)); $this->search = structuresSearch::useDefault($s_data, $errors); if (count($errors) == 0) { self::showParts(); } if (!isset($this->_data['qty'])) { $this->_data['qty'] = 1; } $this->view->set('qty', $this->_data['qty']); $this->view->set('clickmodule', array('module' => 'purchase_order')); $this->view->set('clickcontroller', 'poproductlineheaders'); $this->view->set('clickaction', 'viewbydates'); $this->view->set('linkvaluefield', 'ststructure_id'); $this->view->set('no_ordering', true); $this->view->set('page_title', 'Pre-Order Requirements'); } }
public function getItemData($_stitem_id = '') { // Used by Ajax to get the From/To Locations/Bins based on Stock Item if (isset($this->_data['ajax'])) { if (!empty($this->_data['stitem_id'])) { $_stitem_id = $this->_data['stitem_id']; } } else { // if this is Save and Add Another then need to get $_POST values to set context $_stitem_id = isset($_POST[$modeltype]['stitem_id']) ? $_POST[$modeltype]['stitem_id'] : $_stitem_id; } // store the ajax status in a different var, then unset the current one // we do this because we don't want the functions we all to get confused $ajax = isset($this->_data['ajax']); unset($this->_data['ajax']); $uom_list = $this->getUomList($_stitem_id); if ($ajax) { $output['uom_list'] = array('data' => $uom_list, 'is_array' => is_array($uom_list)); } else { $this->view->set('uom_list', $uom_list); } $errors = array(); $s_data = array('stitem_id' => $_stitem_id, 'start_date/end_date' => date(DATE_FORMAT)); $this->search = structuresSearch::useDefault($s_data, $errors); if (count($errors) == 0) { self::showParts(); } if ($ajax) { $html = $this->view->fetch($this->getTemplateName('show_parts')); $output['show_parts'] = array('data' => $html, 'is_array' => is_array($html)); } // **************************************************************************** // Finally, if this is an ajax call, set the return data area if ($ajax) { $this->view->set('data', $output); $this->setTemplateName('ajax_multiple'); } }