public function init() { $cold_chain = new Model_ColdChain(); $result1 = $cold_chain->getLocationsName(); $this->_list["asset_id"][''] = "Select Location"; if ($result1) { foreach ($result1 as $row1) { $this->_list["asset_id"][$row1['pkId']] = $row1['assetId']; } } $non_ccm_loc = new Model_NonCcmLocations(); $result2 = $non_ccm_loc->getLocationsName(); $this->_list["non_ccm_location_id"][''] = "Select Location"; if ($result2) { foreach ($result2 as $row2) { $this->_list["non_ccm_location_id"][$row2['pkId']] = $row2['locationName']; } } foreach ($this->_fields as $col => $name) { switch ($col) { case "quantity": $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; default: break; } if (in_array($col, array_keys($this->_list))) { $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option")))))); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); } } }
public function init() { $cold_chain = new Model_ColdChain(); $result3 = $cold_chain->getLocationsName(); $this->_list["asset_id"][''] = "Select Location"; if ($result3) { foreach ($result3 as $row3) { $this->_list["asset_id"][$row3['pkId']] = $row3['assetId']; } } foreach ($this->_fields as $col => $name) { switch ($col) { case "item_pack_size_id": case "stock_batch_id": case "quantity": $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; default: break; } if (in_array($col, array_keys($this->_list))) { $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option")))))); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); } } foreach ($this->_hidden as $col => $name) { switch ($col) { // case "asset_name": // // $this->addElement("hidden", $col); // $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); // break; default: break; } } }
public function ajaxGetPlacementLocationsAction() { $this->_helper->layout->disableLayout(); $detail_id = $this->_request->id; $p = $this->_request->p; $stock_master = new Model_StockMaster(); $stock_master->form_values['$detail_id'] = $detail_id; $result = $stock_master->getIssueDetail(); $item_category_id = $result['item_category_id']; if ($item_category_id == 1) { $cold_chain_loc = new Model_ColdChain(); $ccm_locations = $cold_chain_loc->getLocationsName(); $this->view->locations = $ccm_locations; } else { $non_ccm_loc = new Model_NonCcmLocations(); $non_ccm_locations = $non_ccm_loc->getLocationsName(); $this->view->locations = $non_ccm_locations; } $this->view->item_cat_id = $item_category_id; $this->view->result = $result; $this->view->p = $p; $this->view->detail_id = $detail_id; }