/** * editAction * Get a record and populate the application form * @return unknown_type */ public function editAction() { $form = $this->getForm('/admin/services/process'); $service_domains = new OrdersItemsDomains(); $id = $this->getRequest()->getParam('id'); // Create the buttons in the edit form $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/services/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/services/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null))); try { if (!empty($id) && is_numeric($id)) { $form->getElement('domains')->setMultiOptions(Domains::getFreeOrderDomainsList($id)); $rs = $this->services->getAllInfo($id, null, true); if (!empty($rs)) { $form->getElement('domains_selected')->setMultiOptions($service_domains->getList($id)); $rs['date_start'] = Shineisp_Commons_Utilities::formatDateOut($rs['date_start']); $rs['date_end'] = Shineisp_Commons_Utilities::formatDateOut($rs['date_end']); $rs['customer_id'] = $rs['Orders']['customer_id']; $form->populate($rs); $this->view->buttons[] = array("url" => "/admin/services/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null)); $this->view->buttons[] = array("url" => "/admin/orders/edit/id/" . $rs['Orders']['order_id'], "label" => $this->translator->translate('Order'), "params" => array('css' => null)); } // Get all the messages attached to the ordersitems $this->view->messages = Messages::getbyServiceId($id); $this->view->owner_datagrid = $this->ownerGrid($rs['Orders']['customer_id']); } } catch (Exception $e) { echo $e->getMessage(); } $this->view->title = $this->translator->translate("Service Details"); $this->view->description = $this->translator->translate("Here you can see the details of the service subscribed by the customer."); $this->view->mex = $this->getRequest()->getParam('mex'); $this->view->mexstatus = $this->getRequest()->getParam('status'); $this->view->form = $form; $this->render('applicantform'); }
/** * 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'); }