/** * This is the default 'index' action that is invoked * when an action is not explicitly requested by users. */ public function actionIndex() { if (!Yii::app()->user->id) { $this->redirect(array('site/login')); } $user = User::model()->findByPk(Yii::app()->user->uid); $status = CHtml::listData(Status::getStatus(), 'status', 'image'); if ($user->role_id == 2) { Yii::app()->user->setState('role', 2); } if (Yii::app()->user->isUser()) { $model = new Customer('search'); $model->franchise(); $model->desc(); $model->unsetAttributes(); if (isset($_GET['Customer'])) { $model->attributes = $_GET['Customer']; } $this->render('//customer/admin1', array('model' => $model, 'statuses' => json_encode($status))); } else { $criteria = new CDbCriteria(); $criteria->order = 'id desc'; if (Yii::app()->user->isFranchiseAdmin()) { $criteria->compare('franchise', Yii::app()->user->franchise); } $dataProvider = new CActiveDataProvider('Customer', array('criteria' => $criteria, 'pagination' => array('pageSize' => 10))); $this->render('welcome', array('dataProvider' => $dataProvider)); } }
public function getList() { $addCreditRequests = Messaging::getSystemMessages(array('systemMessageType' => SYS_MSG_ADD_CREDIT, 'filterCustomerId' => array($this->customer->getId()))); // $this->log->write(print_r($addCreditRequests, true)); foreach ($addCreditRequests as $addCreditRequest) { // if ($addCreditRequest['senderId'] != $this->customer->getId()) // continue; $this->data['requests'][] = array('requestId' => $addCreditRequest['messageId'], 'amount' => $addCreditRequest['data']->amount, 'comment' => $addCreditRequest['data']->comment, 'currency' => $addCreditRequest['data']->currency, 'status' => Status::getStatus($addCreditRequest['data']->status, $this->config->get('language_id'), true), 'statusId' => $addCreditRequest['data']->status, 'timeAdded' => $addCreditRequest['timeAdded']); } /// Initialize interface $this->setBreadcrumps(); $this->data['textAmount'] = $this->language->get('AMOUNT'); $this->data['textComment'] = $this->language->get('COMMENT'); $this->data['textRequestId'] = $this->language->get('REQUEST_ID'); $this->data['textStatus'] = $this->language->get('STATUS'); $this->data['textTimeAdded'] = $this->language->get('TIME_ADDED'); $templateName = '/template/account/creditHistory.tpl'; if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . $templateName)) { $this->template = $this->config->get('config_template') . $templateName; } else { $this->template = 'default' . $templateName; } $this->children = array('common/footer', 'common/header', 'common/column_right', 'common/column_left', 'common/content_top', 'common/content_bottom'); $this->getResponse()->setOutput($this->render()); }
public function getOrderItemStatus($order_item_status_id) { $order_item_status_data = $this->cache->get('order_item_status.' . (int) $this->config->get('config_language_id')); $this->load->library("Status"); return Status::getStatus($order_item_status_id, $this->config->get('config_language_id')); if (!$order_item_status_data) { $order_item_status_data = $this->getOrderItemStatuses(); } foreach ($order_item_status_data as $order_item_status) { if ($order_item_status['order_item_status_id'] == $order_item_status_id) { return $order_item_status; } } return null; }
private function getCreditRequests($customer) { $this->getLoader()->library('Messaging'); $this->getLoader()->library('Status'); $addCreditRequests = Messaging::getSystemMessages(array('systemMessageType' => SYS_MSG_ADD_CREDIT, 'filterCustomerId' => array($customer['customer_id']), 'start' => ($this->parameters['creditRequestsPage'] - 1) * 10, 'limit' => 10)); // $this->log->write(print_r($addCreditRequests, true)); foreach ($addCreditRequests as $addCreditRequest) { $this->data['requests'][] = array('requestId' => $addCreditRequest['messageId'], 'amount' => $addCreditRequest['data']->amount, 'comment' => $addCreditRequest['data']->comment, 'currency' => $addCreditRequest['data']->currency, 'status' => Status::getStatus($addCreditRequest['data']->status, $this->config->get('language_id'), true), 'statusId' => $addCreditRequest['data']->status, 'timeAdded' => $addCreditRequest['timeAdded']); } /// Initialize interface $this->data['textAmount'] = $this->language->get('AMOUNT'); $this->data['textComment'] = $this->language->get('COMMENT'); $this->data['textRequestId'] = $this->language->get('REQUEST_ID'); $this->data['textStatus'] = $this->language->get('STATUS'); $this->data['textTimeAdded'] = $this->language->get('TIME_ADDED'); $pagination = new Pagination(); $pagination->total = Messaging::getSystemMessagesCount(SYS_MSG_ADD_CREDIT, $customer['customer_id']); $pagination->page = $this->parameters['creditRequestsPage']; $pagination->limit = 10; $pagination->text = $this->language->get('text_pagination'); $pagination->url = $this->url->link('sale/customer/transaction', 'creditRequestsPage={page}&transactionsPage=' . $this->parameters['transactionsPage'] . '&token=' . $this->parameters['token'] . '&customerId=' . $this->parameters['customerId'], 'SSL'); $this->data['creditRequestsPagination'] = $pagination->render(); }
if (isset($_POST["txtStatusColor"])) { $Status->setStatusColor($_POST["txtStatusColor"]); } if ($control == Controls::Insert) { $Status->insert(); $insert = true; } else { if ($control == Controls::Update) { $Status->update(); $update = true; } } } else { if (isset($_GET["StatusID"]) && isset($_GET["control"])) { $control->setValue($_GET["control"]); $Status = Status::getStatus($_GET["StatusID"]); if ($control == Controls::Update) { echo "<script> \$(function () { \$(window).load(function(){ \$('#modalStatus').modal( { backdrop: 'static', keyboard: false }, 'show');}); });</script>"; } else { if ($control == Controls::Delete) { $Status->delete(); $delete = true; } } } } ?> <div class="page-header"> <div class="pull-right"> <span class="btn btn-default btn-file"> <span><i class="entypo-upload"></i></span>
public function set_status() { $this->load->language('sale/order_items'); $orderItems = array(); if (isset($this->parameters['selectedItems'])) { $orderItems = array_values($this->parameters['selectedItems']); } else { $this->error['warning'] = $this->language->get('error_no_selected_items'); } $orderItemNewStatus = null; if (isset($_REQUEST['order_item_new_status'])) { $orderItemNewStatus = $_REQUEST['order_item_new_status']; } else { $this->error['warning'] = $this->language->get('error_no_status_set'); } if (!isset($this->error['warning'])) { $this->error['warning'] = ''; $this->session->data['success'] = ''; $this->load->model('localisation/order_item_status'); foreach ($orderItems as $orderItemId) { if (OrderItemDAO::getInstance()->setStatus($orderItemId, $orderItemNewStatus)) { $this->session->data['success'] .= sprintf($this->language->get("text_status_set"), $orderItemId, Status::getStatus($orderItemNewStatus, $this->config->get('language_id'))); } else { $this->error['warning'] .= sprintf($this->language->get('error_status_already_set'), $orderItemId, Status::getStatus($orderItemNewStatus, $this->config->get('language_id'))); } $orderItem = OrderItemDAO::getInstance()->getOrderItem($orderItemId); $this->modelSaleOrder->verifyOrderCompletion($orderItem->getOrderId()); } // $this->clearSelection(); } $this->index(); }
public function setStatus() { if (empty($_REQUEST['statusId'])) { return; } /** @var ModelSaleOrder $modelSaleOrder */ $modelSaleOrder = $this->load->model('sale/order'); foreach ($this->parameters['selectedItems'] as $orderId) { RepurchaseOrderDAO::getInstance()->setStatus($orderId, $_REQUEST['statusId']); $repurchaseOrder = RepurchaseOrderDAO::getInstance()->getOrder($orderId); $modelSaleOrder->verifyOrderCompletion($repurchaseOrder['orderId']); } $json['newStatusName'] = Status::getStatus($_REQUEST['statusId'], $this->config->get('config_language_id')); $this->getResponse()->setOutput(json_encode($json)); }
public function setStatus() { $order_items = array(); if (isset($_REQUEST['selectedItems'])) { $order_items = array_values($_REQUEST['selectedItems']); } else { $this->error['warning'] = $this->language->get('error_no_selected_items'); } if (isset($_REQUEST['order_item_new_status'])) { $order_item_new_status = $_REQUEST['order_item_new_status']; } else { $this->error['warning'] = $this->language->get('error_no_status_set'); } if (!isset($this->error['warning'])) { $this->error['warning'] = ''; $this->session->data['success'] = ''; $this->load->model('localisation/order_item_status'); $this->log->write("Setting status '{$order_item_new_status}' to items:\n" . print_r($order_items, true)); foreach ($order_items as $order_item_id) { if (OrderItemDAO::getInstance()->setStatus($order_item_id, $order_item_new_status)) { $this->session->data['success'] .= sprintf($this->language->get("text_status_set"), $order_item_id, Status::getStatus($order_item_new_status, $this->config->get('language_id'))); } else { $this->error['warning'] .= sprintf($this->language->get('error_status_already_set'), $order_item_id, Status::getStatus($order_item_new_status, $this->config->get('language_id'))); } } $this->clearSelection(); } //print_r($this->data);exit(); $this->index(); }
public function detailAction() { if (isset($_REQUEST["resource_id"]) && isset($_REQUEST["service_id"]) && isset($_REQUEST["time"])) { $resource_id = (int) $_REQUEST["resource_id"]; $service_id = (int) $_REQUEST["service_id"]; $time = (int) $_REQUEST["time"]; $this->view->detail_service_id = $service_id; $this->view->detail_time = $time; //get service information $model = new ResourceServices(); $params = array("resource_id" => $resource_id, "service_id" => $service_id); $this->view->detail_service = $model->get($params); //get statuses at specified timestamp $metricdata_model = new MetricData(); $params = array("resource_id" => $resource_id, "time" => $time); $latest_metrics = $metricdata_model->get($params); //pull metric info $model = new Metric(); $this->view->metric_details = $model->getindex(); //pull all metric for this service $model = new MetricService(); $this->view->detail_critical_metrics = array(); $this->view->detail_noncritical_metrics = array(); foreach ($model->get(array("service_id" => $service_id)) as $metric) { $info = array(); $info["metric_id"] = $metric->metric_id; //find the reported detail (if not, leave it empty) foreach ($latest_metrics as $latest_metric) { if ($latest_metric->metric_id == $metric->metric_id) { $info["detail_id"] = $latest_metric->id; $info["detail"] = $this->fetchMetricDetail($latest_metric->id); $info["status"] = Status::getStatus($latest_metric->metric_status_id); $info["timestamp"] = $latest_metric->timestamp; break; } } if ($metric->critical == 1) { $this->view->detail_critical_metrics[] = $info; } else { $this->view->detail_noncritical_metrics[] = $info; } } //load service status $service_status_model = new ServiceStatusChange(); $params = array(); $params["resource_id"] = $resource_id; $params["service_id"] = $service_id; $params["start_time"] = $time; $params["end_time"] = $time; $service_statuses = $service_status_model->get($params); $this->view->detail_service_status = null; if (isset($service_statuses[0])) { $this->view->detail_service_status = $service_statuses[0]; } //load downtime $downtime_model = new Downtime(); $params = array("resource_id" => $resource_id, "start_time" => $time, "end_time" => $time); $downtimes = $downtime_model->get($params); $downtimes_forservice = $this->getDowntimesForService($downtimes, $service_id); if (count($downtimes_forservice) > 0) { $this->view->downtime = $downtimes_forservice[0]; //grab first one for this service } } }
public function info() { if (isset($this->session->data['note'])) { $this->data['note'] = $this->session->data['note']; unset($this->session->data['note']); } else { $this->data['note'] = ''; } $this->modelToolImage = $this->load->model('tool/image'); if (isset($this->request->get['order_id'])) { $order_id = $this->request->get['order_id']; } else { $order_id = 0; } if (!$this->customer->isLogged()) { $this->session->data['redirect'] = $this->url->link('account/order/info', 'order_id=' . $order_id, 'SSL'); $this->redirect($this->url->link('account/login', '', 'SSL')); } $this->language->load('account/order'); $this->load->model('account/order'); $order_info = $this->model_account_order->getOrder($order_id); if ($order_info) { $orderItems = OrderItemDAO::getInstance()->getOrderItems(array('filterOrderId' => $order_id), null, true); if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) { if ($this->request->post['action'] == 'reorder') { foreach ($orderItems as $orderItem) { if (in_array($orderItem->getId(), $this->request->post['selected'])) { $option_data = array(); $order_options = $this->model_account_order->getOrderOptions($order_id, $orderItem->getId()); foreach ($order_options as $order_option) { if ($order_option['type'] == 'select' || $order_option['type'] == 'radio') { $option_data[$order_option['product_option_id']] = $order_option['product_option_value_id']; } elseif ($order_option['type'] == 'checkbox') { $option_data[$order_option['product_option_id']][] = $order_option['product_option_value_id']; } elseif ($order_option['type'] == 'input' || $order_option['type'] == 'textarea' || $order_option['type'] == 'file' || $order_option['type'] == 'date' || $order_option['type'] == 'datetime' || $order_option['type'] == 'time') { $option_data[$order_option['product_option_id']] = $order_option['value']; } } $this->cart->add($orderItem->getProductId(), $orderItem->getQuantity(), $option_data); } } $this->redirect($this->url->link('checkout/cart', '', 'SSL')); } } $this->setBreadcrumbs(); $url = ''; if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } $this->data['text_order_detail'] = $this->language->get('text_order_detail'); $this->data['text_invoice_no'] = $this->language->get('text_invoice_no'); $this->data['text_order_id'] = $this->language->get('text_order_id'); $this->data['text_date_added'] = $this->language->get('text_date_added'); $this->data['text_shipping_method'] = $this->language->get('text_shipping_method'); $this->data['text_shipping_address'] = $this->language->get('text_shipping_address'); $this->data['text_payment_method'] = $this->language->get('text_payment_method'); $this->data['text_payment_address'] = $this->language->get('text_payment_address'); $this->data['text_history'] = $this->language->get('text_history'); $this->data['text_comment'] = $this->language->get('text_comment'); $this->data['text_action'] = $this->language->get('text_action'); $this->data['text_selected'] = $this->language->get('text_selected'); $this->data['text_reorder'] = $this->language->get('text_reorder'); $this->data['text_return'] = $this->language->get('text_return'); $this->data['textAction'] = $this->language->get('ACTION'); $this->data['textComment'] = $this->language->get('COMMENT'); $this->data['textOrderItemId'] = $this->language->get('ORDER_ITEM_ID'); $this->data['textOrderItemImage'] = $this->language->get('IMAGE'); $this->data['column_name'] = $this->language->get('column_name'); $this->data['column_model'] = $this->language->get('column_model'); $this->data['column_quantity'] = $this->language->get('column_quantity'); $this->data['column_price'] = $this->language->get('column_price'); $this->data['column_total'] = $this->language->get('column_total'); $this->data['column_date_added'] = $this->language->get('column_date_added'); $this->data['column_status'] = $this->language->get('column_status'); $this->data['button_continue'] = $this->language->get('button_continue'); $this->data['button_invoice'] = $this->language->get('button_invoice'); if (isset($this->error['warning'])) { $this->data['error_warning'] = $this->error['warning']; } else { $this->data['error_warning'] = ''; } $this->data['action'] = $this->url->link('account/order/info', 'order_id=' . $this->request->get['order_id'], 'SSL'); if ($order_info['invoice_no']) { $this->data['invoice_no'] = $order_info['invoice_prefix'] . $order_info['invoice_no']; } else { $this->data['invoice_no'] = ''; } $this->data['order_id'] = $this->request->get['order_id']; $this->data['date_added'] = date($this->language->get('date_format_short'), strtotime($order_info['date_added'])); if ($order_info['shipping_address_format']) { $format = $order_info['shipping_address_format']; } else { $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}'; } $find = array('{firstname}', '{lastname}', '{company}', '{address_1}', '{address_2}', '{city}', '{postcode}', '{zone}', '{zone_code}', '{country}'); $replace = array('firstname' => $order_info['shipping_firstname'], 'lastname' => $order_info['shipping_lastname'], 'company' => $order_info['shipping_company'], 'address_1' => $order_info['shipping_address_1'], 'address_2' => $order_info['shipping_address_2'], 'city' => $order_info['shipping_city'], 'postcode' => $order_info['shipping_postcode'], 'zone' => $order_info['shipping_zone'], 'zone_code' => $order_info['shipping_zone_code'], 'country' => $order_info['shipping_country']); $this->data['shipping_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\\s\\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format)))); $this->data['shipping_method'] = ShippingMethodDAO::getInstance()->getMethod(explode('.', $order_info['shipping_method'])[0])->getName(); if ($order_info['payment_address_format']) { $format = $order_info['payment_address_format']; } else { $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}'; } $find = array('{firstname}', '{lastname}', '{company}', '{address_1}', '{address_2}', '{city}', '{postcode}', '{zone}', '{zone_code}', '{country}'); $replace = array('firstname' => $order_info['payment_firstname'], 'lastname' => $order_info['payment_lastname'], 'company' => $order_info['payment_company'], 'address_1' => $order_info['payment_address_1'], 'address_2' => $order_info['payment_address_2'], 'city' => $order_info['payment_city'], 'postcode' => $order_info['payment_postcode'], 'zone' => $order_info['payment_zone'], 'zone_code' => $order_info['payment_zone_code'], 'country' => $order_info['payment_country']); $this->data['payment_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\\s\\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format)))); $this->data['payment_method'] = $order_info['payment_method']; // ----- deposit modules START ----- $this->data['text_payment_method'] = ''; $this->load->model('account/multi_pay'); $this->data['payment_method'] = $this->model_account_multi_pay->order_info($order_info); // ----- deposit modules END ----- $this->data['products'] = array(); // $orderItems = OrderItemDAO::getInstance()->getOrderItems( // array('filterOrderId' => $this->request->get['order_id']), null, true // ); // $products = $this->model_account_order->getOrderProducts($this->request->get['order_id']); foreach ($orderItems as $orderItem) { $actions = array(); if (($orderItem->getStatusId() & 0xffff) <= 2) { $actions[] = array('text' => $this->language->get('CANCEL'), 'href' => $this->url->link('account/orderItems/cancel', 'orderItemId=' . $orderItem->getId() . '&returnUrl=' . urlencode($this->selfUrl))); } $option_data = array(); $options = OrderItemDAO::getInstance()->getOptions($orderItem->getId()); foreach ($options as $option) { if ($option['type'] != 'file') { $option_data[] = array('name' => $option['name'], 'value' => utf8_truncate($option['value'])); } else { $filename = substr($option['value'], 0, strrpos($option['value'], '.')); $option_data[] = array('name' => $option['name'], 'value' => utf8_truncate($filename)); } } $product_image = ProductDAO::getInstance()->getImage($orderItem->getProductId()); if ($orderItem->getImagePath() == '' || $orderItem->getImagePath() == "data/event/agent-moomidae.jpg") { $options = OrderItemDAO::getInstance()->getOptions($orderItem->getId()); $itemUrl = !empty($options[REPURCHASE_ORDER_IMAGE_URL_OPTION_ID]['value']) ? $options[REPURCHASE_ORDER_IMAGE_URL_OPTION_ID]['value'] : ''; $orderItem->setImagePath(!empty($itemUrl) ? $itemUrl : $orderItem->getImagePath()); } if ($orderItem->getImagePath() && file_exists(DIR_IMAGE . $orderItem->getImagePath())) { $image = $this->modelToolImage->resize($orderItem->getImagePath(), 100, 100); } else { $image = $this->modelToolImage->resize($product_image, 100, 100); } $this->data['products'][] = array('order_product_id' => $orderItem->getId(), 'actions' => $actions, 'comment' => $orderItem->getPublicComment(), 'name' => $orderItem->getName(), 'model' => $orderItem->getModel(), 'option' => $option_data, 'quantity' => $orderItem->getModel(), 'price' => $this->getCurrency()->format($orderItem->getPrice(true), $order_info['currency_code'], 1), 'total' => $this->getCurrency()->format($orderItem->getTotal(true), $order_info['currency_code'], 1), 'imagePath' => $image, 'item_status' => Status::getStatus($orderItem->getStatusId(), $this->config->get('language_id'), true), 'selected' => false); } $this->data['totals'] = $this->model_account_order->getOrderTotals($this->request->get['order_id']); $this->data['comment'] = $order_info['comment']; $this->data['histories'] = array(); $results = $this->model_account_order->getOrderHistories($this->request->get['order_id']); foreach ($results as $result) { $this->data['histories'][] = array('date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])), 'status' => $result['status'], 'comment' => nl2br($result['comment'])); } $this->data['continue'] = $this->url->link('account/order', '', 'SSL'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/order_info.tpl.php')) { $this->template = $this->config->get('config_template') . '/template/account/order_info.tpl.php'; } else { $this->template = 'default/template/account/order_info.tpl.php'; } $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header'); $this->getResponse()->setOutput($this->render()); } else { $this->document->setTitle($this->language->get('text_order')); $this->data['heading_title'] = $this->language->get('text_order'); $this->data['text_error'] = $this->language->get('text_error'); $this->data['button_continue'] = $this->language->get('button_continue'); $this->setBreadcrumbs(); $this->data['continue'] = $this->url->link('account/order', '', 'SSL'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) { $this->template = $this->config->get('config_template') . '/template/error/not_found.tpl'; } else { $this->template = 'default/template/error/not_found.tpl'; } $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header'); $this->getResponse()->setOutput($this->render()); } }
public function setStatus() { $this->load->language('sale/order'); $this->load->library('Status'); if (!isset($this->error['warning'])) { $this->error['warning'] = ''; $this->session->data['success'] = ''; $this->load->model('sale/order'); $this->load->model('localisation/order_status'); foreach ($this->parameters['selected'] as $orderId) { $this->modelSaleOrder->addOrderHistory($orderId, array('order_status_id' => $this->parameters['orderStatusId'])); $this->session->data['success'] .= sprintf($this->language->get("STATUS_SET"), $orderId, Status::getStatus(0x80000 + $this->parameters['orderStatusId'], $this->config->get('language_id'))); } } $this->redirect($this->url->link('sale/order', $this->buildUrlParameterString($this->parameters), 'SSL')); }
private function setStatus($orderId, $statusId) { RepurchaseOrderDAO::getInstance()->setStatus($orderId, $statusId); $json['newStatusName'] = Status::getStatus($statusId, $this->config->get('config_language_id')); // $this->log->write(print_r($json, true)); $this->getResponse()->setOutput(json_encode($json)); }