/** * editAction * Get a record and populate the application form * @return unknown_type */ public function editAction() { $currency = Shineisp_Registry::getInstance()->Zend_Currency; $id = $this->getRequest()->getParam('id'); if (!empty($id) && is_numeric($id)) { $NS = new Zend_Session_Namespace('Default'); $NS->productid = $id; $form = $this->getForm('/services/process'); //Add upgrade service if exists $fields = "o.order_id as order, pd.name as product, CONCAT(d.domain, '.', ws.tld) as domain, oi.status_id, oi.detail_id, DATE_FORMAT(o.order_date, '%d/%m/%Y') as order_date, DATE_FORMAT(oi.date_end, '%d/%m/%Y') as next_deadline, (DATEDIFF(oi.date_end, CURRENT_DATE)) as daysleft, b.name, oi.price as price, t.name as tax, t.percentage as vat, s.status as status, bc.name as billing_cycle, oi.autorenew as autorenew, oi.note as note"; $rs = $this->services->getAllInfo($id, $fields, 'c.customer_id = ' . $NS->customer['customer_id'] . ' OR c.parent_id = ' . $NS->customer['customer_id']); if (empty($rs)) { $this->_helper->redirector('list', 'services', 'default', array('mex' => 'The service selected has been not found.', 'status' => 'danger')); } if (!empty($rs['vat']) && $rs['price'] > 0) { $rs['total_with_tax'] = $currency->toCurrency($rs['price'] * (100 + $rs['vat']) / 100, array('currency' => Settings::findbyParam('currency'))); $rs['tax'] = $rs['vat'] . "% " . $this->translator->translate($rs['tax']); } $form->populate($rs); // Hide these fields and values inside the vertical grid object unset($rs['autorenew']); unset($rs['vat']); unset($rs['note']); if ($rs['status_id'] == Statuses::id("complete", "orders")) { $this->view->expired = true; } else { $this->view->expired = false; } $this->view->datagrid = array('records' => array($rs)); $this->view->id = $id; $this->view->setup = OrdersItems::getSetupConfig($id); // Get all the messages attached to the ordersitems $this->view->messages = Messages::getbyServiceId($id); $this->view->title = $rs['product']; } else { $this->view->title = $this->translator->translate("Detail of the service"); } $this->view->description = $this->translator->translate("Here you can see the detail of the service."); $this->view->dnsdatagrid = $this->dnsGrid(); $this->view->form = $form; $this->_helper->viewRenderer('customform'); }