public function init() { //Generate Item Combo $item_pack_size = new Model_ItemPackSizes(); $result = $item_pack_size->getItemsByCategory(); $this->_list["item_pack_size_id"][''] = "Select Product"; if ($result) { foreach ($result as $row) { $this->_list["item_pack_size_id"][$row->getPkId()] = $row->getItemName(); } } //Generate Batch Number Combo $stock_batch = new Model_StockBatch(); $result = $stock_batch->getBatches(); $this->_list["stock_batch_id"][''] = "Select Stock Batch"; if ($result) { foreach ($result as $row) { $this->_list["stock_batch_id"][$row['pkId']] = $row['number']; } } //Generate Location Combo $non_ccm_loc = new Model_NonCcmLocations(); $result = $non_ccm_loc->getLocationsName(); // print_r($result);exit; $this->_list["location"][''] = "Select Location"; if ($result) { foreach ($result as $row) { $this->_list["location"][$row['pkId']] = $row['locationName']; } } foreach ($this->_fields as $col => $name) { switch ($col) { case "item_pack_size_id": case "stock_batch_id": case "number": case "unallocated_quantity": case "total_quantity": case "quantity": case "estimated_pallet_filled": $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; case "location": case "quantity1": $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; default: break; } foreach ($this->_hidden as $col => $name) { switch ($col) { case "placement_location_id": case "itemId": case "batchId": $this->addElement("hidden", $col); $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"); } } }