public function indexAction() { $this->_helper->getHelper('layout')->disableLayout(); $processid = $this->_getParam('processid', 0); $locale = Zend_Registry::get('Zend_Locale'); //Get process $processDb = new Processes_Model_DbTable_Process(); $process = $processDb->getProcess($processid); //Get positions $positions = $this->getPositions($processid); //Get units of measurements $uoms = $this->_helper->Uom->getUoms(); $uoms = array_combine($uoms, $uoms); //Get shipping methods $shippingmethods = $this->_helper->ShippingMethod->getShippingMethods($this->_user['clientid']); $forms = array(); $orderings = array(); foreach ($positions as $position) { $orderings[$position->ordering] = $position->ordering; } foreach ($positions as $position) { $position->price = $this->_currency->toCurrency($position->price); $position->supplierinvoicetotal = $this->_currency->toCurrency($position->supplierinvoicetotal); $position->quantity = Zend_Locale_Format::toNumber($position->quantity, array('precision' => 2, 'locale' => $locale)); $form = new Processes_Form_Processpos(); $forms[$position->id] = $form->populate($position->toArray()); $forms[$position->id]->uom->addMultiOptions($uoms); $forms[$position->id]->ordering->addMultiOptions($orderings); $forms[$position->id]->shippingmethod->addMultiOptions($shippingmethods); foreach ($forms[$position->id] as $element) { $id = $element->getId(); $forms[$position->id]->{$id}->setAttrib('id', $id . $position->id); if (!$process['editpositionsseparately']) { $element->setAttrib('disabled', 'disabled'); } } } $this->view->forms = $forms; $this->view->toolbar = new Processes_Form_ToolbarPositions(); }