uawdijnntqw1x1x1
IP : 13.58.74.131
Hostname : ns1.eurodns.top
Kernel : Linux ns1.eurodns.top 4.18.0-553.5.1.lve.1.el7h.x86_64 #1 SMP Fri Jun 14 14:24:52 UTC 2024 x86_64
Disable Function : mail,sendmail,exec,passthru,shell_exec,system,popen,curl_multi_exec,show_source,eval,open_base
OS : Linux
PATH:
/
home
/
sudancam
/
public_html
/
..
/
.trash
/
.
/
admin.1
/
controller
/
.
/
sale
/
returns.php
/
/
<?php namespace Opencart\Admin\Controller\Sale; class Returns extends \Opencart\System\Engine\Controller { public function index(): void { $this->load->language('sale/return'); $this->document->setTitle($this->language->get('heading_title')); $url = ''; if (isset($this->request->get['filter_return_id'])) { $url .= '&filter_return_id=' . $this->request->get['filter_return_id']; } if (isset($this->request->get['filter_order_id'])) { $url .= '&filter_order_id=' . $this->request->get['filter_order_id']; } if (isset($this->request->get['filter_customer'])) { $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_product'])) { $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_model'])) { $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_return_status_id'])) { $url .= '&filter_return_status_id=' . $this->request->get['filter_return_status_id']; } if (isset($this->request->get['filter_date_added'])) { $url .= '&filter_date_added=' . $this->request->get['filter_date_added']; } if (isset($this->request->get['filter_date_modified'])) { $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } $data['breadcrumbs'] = []; $data['breadcrumbs'][] = [ 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token']) ]; $data['breadcrumbs'][] = [ 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('sale/returns', 'user_token=' . $this->session->data['user_token'] . $url) ]; $data['add'] = $this->url->link('sale/returns|form', 'user_token=' . $this->session->data['user_token'] . $url); $data['delete'] = $this->url->link('sale/returns|delete', 'user_token=' . $this->session->data['user_token']); $data['list'] = $this->getList(); $data['user_token'] = $this->session->data['user_token']; $data['header'] = $this->load->controller('common/header'); $data['column_left'] = $this->load->controller('common/column_left'); $data['footer'] = $this->load->controller('common/footer'); $this->response->setOutput($this->load->view('sale/return', $data)); } public function list(): void { $this->load->language('sale/return'); $this->response->setOutput($this->getList()); } protected function getList(): string { if (isset($this->request->get['filter_return_id'])) { $filter_return_id = (int)$this->request->get['filter_return_id']; } else { $filter_return_id = ''; } if (isset($this->request->get['filter_order_id'])) { $filter_order_id = (int)$this->request->get['filter_order_id']; } else { $filter_order_id = ''; } if (isset($this->request->get['filter_customer'])) { $filter_customer = $this->request->get['filter_customer']; } else { $filter_customer = ''; } if (isset($this->request->get['filter_product'])) { $filter_product = $this->request->get['filter_product']; } else { $filter_product = ''; } if (isset($this->request->get['filter_model'])) { $filter_model = $this->request->get['filter_model']; } else { $filter_model = ''; } if (isset($this->request->get['filter_return_status_id'])) { $filter_return_status_id = (int)$this->request->get['filter_return_status_id']; } else { $filter_return_status_id = ''; } if (isset($this->request->get['filter_date_added'])) { $filter_date_added = $this->request->get['filter_date_added']; } else { $filter_date_added = ''; } if (isset($this->request->get['filter_date_modified'])) { $filter_date_modified = $this->request->get['filter_date_modified']; } else { $filter_date_modified = ''; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; } else { $sort = 'r.return_id'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; } else { $order = 'DESC'; } if (isset($this->request->get['page'])) { $page = (int)$this->request->get['page']; } else { $page = 1; } $url = ''; if (isset($this->request->get['filter_return_id'])) { $url .= '&filter_return_id=' . $this->request->get['filter_return_id']; } if (isset($this->request->get['filter_order_id'])) { $url .= '&filter_order_id=' . $this->request->get['filter_order_id']; } if (isset($this->request->get['filter_customer'])) { $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_product'])) { $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_model'])) { $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_return_status_id'])) { $url .= '&filter_return_status_id=' . $this->request->get['filter_return_status_id']; } if (isset($this->request->get['filter_date_added'])) { $url .= '&filter_date_added=' . $this->request->get['filter_date_added']; } if (isset($this->request->get['filter_date_modified'])) { $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } $data['action'] = $this->url->link('sale/returns|list', 'user_token=' . $this->session->data['user_token'] . $url); $data['returns'] = []; $filter_data = [ 'filter_return_id' => $filter_return_id, 'filter_order_id' => $filter_order_id, 'filter_customer' => $filter_customer, 'filter_product' => $filter_product, 'filter_model' => $filter_model, 'filter_return_status_id' => $filter_return_status_id, 'filter_date_added' => $filter_date_added, 'filter_date_modified' => $filter_date_modified, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $this->config->get('config_pagination_admin'), 'limit' => $this->config->get('config_pagination_admin') ]; $this->load->model('sale/returns'); $return_total = $this->model_sale_returns->getTotalReturns($filter_data); $results = $this->model_sale_returns->getReturns($filter_data); foreach ($results as $result) { $data['returns'][] = [ 'return_id' => $result['return_id'], 'order_id' => $result['order_id'], 'customer' => $result['customer'], 'product' => $result['product'], 'model' => $result['model'], 'return_status' => $result['return_status'], 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])), 'date_modified' => date($this->language->get('date_format_short'), strtotime($result['date_modified'])), 'edit' => $this->url->link('sale/returns|form', 'user_token=' . $this->session->data['user_token'] . '&return_id=' . $result['return_id'] . $url) ]; } $url = ''; if (isset($this->request->get['filter_return_id'])) { $url .= '&filter_return_id=' . $this->request->get['filter_return_id']; } if (isset($this->request->get['filter_order_id'])) { $url .= '&filter_order_id=' . $this->request->get['filter_order_id']; } if (isset($this->request->get['filter_customer'])) { $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_product'])) { $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_model'])) { $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_return_status_id'])) { $url .= '&filter_return_status_id=' . $this->request->get['filter_return_status_id']; } if (isset($this->request->get['filter_date_added'])) { $url .= '&filter_date_added=' . $this->request->get['filter_date_added']; } if (isset($this->request->get['filter_date_modified'])) { $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified']; } if ($order == 'ASC') { $url .= '&order=DESC'; } else { $url .= '&order=ASC'; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } $data['sort_return_id'] = $this->url->link('sale/returns|list', 'user_token=' . $this->session->data['user_token'] . '&sort=r.return_id' . $url); $data['sort_order_id'] = $this->url->link('sale/returns|list', 'user_token=' . $this->session->data['user_token'] . '&sort=r.order_id' . $url); $data['sort_customer'] = $this->url->link('sale/returns|list', 'user_token=' . $this->session->data['user_token'] . '&sort=customer' . $url); $data['sort_product'] = $this->url->link('sale/returns|list', 'user_token=' . $this->session->data['user_token'] . '&sort=r.product' . $url); $data['sort_model'] = $this->url->link('sale/returns|list', 'user_token=' . $this->session->data['user_token'] . '&sort=r.model' . $url); $data['sort_status'] = $this->url->link('sale/returns|list', 'user_token=' . $this->session->data['user_token'] . '&sort=return_status' . $url); $data['sort_date_added'] = $this->url->link('sale/returns|list', 'user_token=' . $this->session->data['user_token'] . '&sort=r.date_added' . $url); $data['sort_date_modified'] = $this->url->link('sale/returns|list', 'user_token=' . $this->session->data['user_token'] . '&sort=r.date_modified' . $url); $url = ''; if (isset($this->request->get['filter_return_id'])) { $url .= '&filter_return_id=' . $this->request->get['filter_return_id']; } if (isset($this->request->get['filter_order_id'])) { $url .= '&filter_order_id=' . $this->request->get['filter_order_id']; } if (isset($this->request->get['filter_customer'])) { $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_product'])) { $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_model'])) { $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_return_status_id'])) { $url .= '&filter_return_status_id=' . $this->request->get['filter_return_status_id']; } if (isset($this->request->get['filter_date_added'])) { $url .= '&filter_date_added=' . $this->request->get['filter_date_added']; } if (isset($this->request->get['filter_date_modified'])) { $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $data['pagination'] = $this->load->controller('common/pagination', [ 'total' => $return_total, 'page' => $page, 'limit' => $this->config->get('config_pagination_admin'), 'url' => $this->url->link('sale/returns|list', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}') ]); $data['results'] = sprintf($this->language->get('text_pagination'), ($return_total) ? (($page - 1) * $this->config->get('config_pagination_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_pagination_admin')) > ($return_total - $this->config->get('config_pagination_admin'))) ? $return_total : ((($page - 1) * $this->config->get('config_pagination_admin')) + $this->config->get('config_pagination_admin')), $return_total, ceil($return_total / $this->config->get('config_pagination_admin'))); $data['filter_return_id'] = $filter_return_id; $data['filter_order_id'] = $filter_order_id; $data['filter_customer'] = $filter_customer; $data['filter_product'] = $filter_product; $data['filter_model'] = $filter_model; $data['filter_return_status_id'] = $filter_return_status_id; $data['filter_date_added'] = $filter_date_added; $data['filter_date_modified'] = $filter_date_modified; $this->load->model('localisation/return_status'); $data['return_statuses'] = $this->model_localisation_return_status->getReturnStatuses(); $data['sort'] = $sort; $data['order'] = $order; return $this->load->view('sale/return_list', $data); } public function form(): void { $this->load->language('sale/return'); $this->document->setTitle($this->language->get('heading_title')); $data['text_form'] = !isset($this->request->get['return_id']) ? $this->language->get('text_add') : $this->language->get('text_edit'); $url = ''; if (isset($this->request->get['filter_return_id'])) { $url .= '&filter_return_id=' . $this->request->get['filter_return_id']; } if (isset($this->request->get['filter_order_id'])) { $url .= '&filter_order_id=' . $this->request->get['filter_order_id']; } if (isset($this->request->get['filter_customer'])) { $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_product'])) { $url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_model'])) { $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['filter_return_status_id'])) { $url .= '&filter_return_status_id=' . $this->request->get['filter_return_status_id']; } if (isset($this->request->get['filter_date_added'])) { $url .= '&filter_date_added=' . $this->request->get['filter_date_added']; } if (isset($this->request->get['filter_date_modified'])) { $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } $data['breadcrumbs'] = []; $data['breadcrumbs'][] = [ 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token']) ]; $data['breadcrumbs'][] = [ 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('sale/returns', 'user_token=' . $this->session->data['user_token'] . $url) ]; $data['save'] = $this->url->link('sale/returns|save', 'user_token=' . $this->session->data['user_token']); $data['back'] = $this->url->link('sale/returns', 'user_token=' . $this->session->data['user_token'] . $url); if (isset($this->request->get['return_id'])) { $this->load->model('sale/returns'); $return_info = $this->model_sale_returns->getReturn($this->request->get['return_id']); } if (isset($this->request->get['return_id'])) { $data['return_id'] = (int)$this->request->get['return_id']; } else { $data['return_id'] = 0; } if (!empty($return_info)) { $data['order_id'] = $return_info['order_id']; } else { $data['order_id'] = ''; } if (!empty($return_info)) { $data['date_ordered'] = ($return_info['date_ordered'] != '0000-00-00' ? $return_info['date_ordered'] : ''); } else { $data['date_ordered'] = ''; } if (!empty($return_info)) { $data['customer'] = $return_info['customer']; } else { $data['customer'] = ''; } if (!empty($return_info)) { $data['customer_id'] = $return_info['customer_id']; } else { $data['customer_id'] = ''; } if (!empty($return_info)) { $data['firstname'] = $return_info['firstname']; } else { $data['firstname'] = ''; } if (!empty($return_info)) { $data['lastname'] = $return_info['lastname']; } else { $data['lastname'] = ''; } if (!empty($return_info)) { $data['email'] = $return_info['email']; } else { $data['email'] = ''; } if (!empty($return_info)) { $data['telephone'] = $return_info['telephone']; } else { $data['telephone'] = ''; } if (!empty($return_info)) { $data['product'] = $return_info['product']; } else { $data['product'] = ''; } if (!empty($return_info)) { $data['product_id'] = $return_info['product_id']; } else { $data['product_id'] = ''; } if (!empty($return_info)) { $data['model'] = $return_info['model']; } else { $data['model'] = ''; } if (!empty($return_info)) { $data['quantity'] = $return_info['quantity']; } else { $data['quantity'] = ''; } if (!empty($return_info)) { $data['opened'] = $return_info['opened']; } else { $data['opened'] = ''; } $this->load->model('localisation/return_reason'); $data['return_reasons'] = $this->model_localisation_return_reason->getReturnReasons(); if (!empty($return_info)) { $data['return_reason_id'] = $return_info['return_reason_id']; } else { $data['return_reason_id'] = 0; } $this->load->model('localisation/return_action'); $data['return_actions'] = $this->model_localisation_return_action->getReturnActions(); if (!empty($return_info)) { $data['return_action_id'] = $return_info['return_action_id']; } else { $data['return_action_id'] = 0; } if (!empty($return_info)) { $data['comment'] = $return_info['comment']; } else { $data['comment'] = ''; } $this->load->model('localisation/return_status'); $data['return_statuses'] = $this->model_localisation_return_status->getReturnStatuses(); if (!empty($return_info)) { $data['return_status_id'] = $return_info['return_status_id']; } else { $data['return_status_id'] = ''; } $data['history'] = $this->getHistory(); $data['user_token'] = $this->session->data['user_token']; $data['header'] = $this->load->controller('common/header'); $data['column_left'] = $this->load->controller('common/column_left'); $data['footer'] = $this->load->controller('common/footer'); $this->response->setOutput($this->load->view('sale/return_form', $data)); } public function save(): void { $this->load->language('sale/return'); $json = []; if (!$this->user->hasPermission('modify', 'sale/returns')) { $json['error']['warning'] = $this->language->get('error_permission'); } if (empty($this->request->post['order_id'])) { $json['error']['order_id'] = $this->language->get('error_order_id'); } if ((utf8_strlen($this->request->post['firstname']) < 1) || (utf8_strlen($this->request->post['firstname']) > 32)) { $json['error']['firstname'] = $this->language->get('error_firstname'); } if ((utf8_strlen($this->request->post['lastname']) < 1) || (utf8_strlen($this->request->post['lastname']) > 32)) { $json['error']['lastname'] = $this->language->get('error_lastname'); } if ((utf8_strlen($this->request->post['email']) > 96) || !filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) { $json['error']['email'] = $this->language->get('error_email'); } if ((utf8_strlen($this->request->post['telephone']) < 3) || (utf8_strlen($this->request->post['telephone']) > 32)) { $json['error']['telephone'] = $this->language->get('error_telephone'); } if ((utf8_strlen($this->request->post['product']) < 1) || (utf8_strlen($this->request->post['product']) > 255)) { $json['error']['product'] = $this->language->get('error_product'); } if ((utf8_strlen($this->request->post['model']) < 1) || (utf8_strlen($this->request->post['model']) > 64)) { $json['error']['model'] = $this->language->get('error_model'); } if (empty($this->request->post['return_reason_id'])) { $json['error']['reason'] = $this->language->get('error_reason'); } if (isset($json['error']) && !isset($json['error']['warning'])) { $json['error']['warning'] = $this->language->get('error_warning'); } if (!$json) { $this->load->model('sale/returns'); if (!$this->request->post['return_id']) { $json['return_id'] = $this->model_sale_returns->addReturn($this->request->post); } else { $this->model_sale_returns->editReturn($this->request->post['return_id'], $this->request->post); } $json['success'] = $this->language->get('text_success'); } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); } public function delete(): void { $this->load->language('sale/return'); $json = []; if (isset($this->request->post['selected'])) { $selected = $this->request->post['selected']; } else { $selected = []; } if (!$this->user->hasPermission('modify', 'sale/returns')) { $json['error'] = $this->language->get('error_permission'); } if (!$json) { $this->load->model('sale/returns'); foreach ($selected as $return_id) { $this->model_sale_returns->deleteReturn($return_id); } $json['success'] = $this->language->get('text_success'); } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); } public function history(): void { $this->load->language('sale/return'); $this->response->setOutput($this->getHistory()); } public function getHistory(): string { if (isset($this->request->get['return_id'])) { $return_id = (int)$this->request->get['return_id']; } else { $return_id = 0; } if (isset($this->request->get['page'])) { $page = (int)$this->request->get['page']; } else { $page = 1; } $data['histories'] = []; $this->load->model('sale/returns'); $results = $this->model_sale_returns->getHistories($return_id, ($page - 1) * 10, 10); foreach ($results as $result) { $data['histories'][] = [ 'notify' => $result['notify'] ? $this->language->get('text_yes') : $this->language->get('text_no'), 'status' => $result['status'], 'comment' => nl2br($result['comment']), 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])) ]; } $history_total = $this->model_sale_returns->getTotalHistories($return_id); $data['pagination'] = $this->load->controller('common/pagination', [ 'total' => $history_total, 'page' => $page, 'limit' => 10, 'url' => $this->url->link('sale/returns|history', 'user_token=' . $this->session->data['user_token'] . '&return_id=' . $return_id . '&page={page}') ]); $data['results'] = sprintf($this->language->get('text_pagination'), ($history_total) ? (($page - 1) * 10) + 1 : 0, ((($page - 1) * 10) > ($history_total - 10)) ? $history_total : ((($page - 1) * 10) + 10), $history_total, ceil($history_total / 10)); return $this->load->view('sale/return_history', $data); } public function addHistory(): void { $this->load->language('sale/return'); $json = []; if (isset($this->request->get['return_id'])) { $return_id = (int)$this->request->get['return_id']; } else { $return_id = 0; } if (!$this->user->hasPermission('modify', 'sale/returns')) { $json['error'] = $this->language->get('error_permission'); } $this->load->model('sale/returns'); $return_info = $this->model_sale_returns->getReturn($return_id); if (!$return_info) { $json['error'] = $this->language->get('error_return'); } if (!$json) { $this->model_sale_returns->addHistory($return_id, $this->request->post['return_status_id'], $this->request->post['comment'], $this->request->post['notify']); $json['success'] = $this->language->get('text_success'); } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); } }
/home/sudancam/public_html/../.trash/./admin.1/controller/./sale/returns.php