public function copyAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->getHelper('layout')->disableLayout(); $request = $this->getRequest(); if ($request->isPost()) { $id = (int) $this->_getParam('id', 0); $position = new Purchases_Model_DbTable_Purchaseorderpos(); $data = $position->getPosition($id); $orderings = $this->getOrdering($data['purchaseorderid']); foreach ($orderings as $ordering => $positionId) { if ($ordering > $data['ordering']) { $position->updatePosition($positionId, array('ordering' => $ordering + 1)); } } $data['ordering'] += 1; $data['created'] = $this->_date; $data['createdby'] = $this->_user['id']; $data['modified'] = '0000-00-00'; $data['modifiedby'] = 0; unset($data['id']); $position->addPosition($data); //Calculate $this->_helper->Calculate($data['purchaseorderid'], $this->_currency, $this->_date, $this->_user['id']); } }