$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_select'] = $this->language->get('text_select');
$this->data['text_opened'] = $this->language->get('text_opened');
$this->data['text_unopened'] = $this->language->get('text_unopened');
$this->data['entry_customer'] = $this->language->get('entry_customer');
$this->data['entry_order_id'] = $this->language->get('entry_order_id');
$this->data['entry_date_ordered'] = $this->language->get('entry_date_ordered');
$this->data['entry_firstname'] = $this->language->get('entry_firstname');
$this->data['entry_lastname'] = $this->language->get('entry_lastname');
$this->data['entry_email'] = $this->language->get('entry_email');
$this->data['entry_telephone'] = $this->language->get('entry_telephone');
$this->data['entry_return_status'] = $this->language->get('entry_return_status');
$this->data['entry_comment'] = $this->language->get('entry_comment');
$this->data['entry_product'] = $this->language->get('entry_product');
$this->data['entry_model'] = $this->language->get('entry_model');
$this->data['entry_quantity'] = $this->language->get('entry_quantity');
$this->data['entry_reason'] = $this->language->get('entry_reason');
$this->data['entry_opened'] = $this->language->get('entry_opened');
$this->data['entry_action'] = $this->language->get('entry_action');
$this->data['button_save'] = $this->language->get('button_save');
$this->data['button_cancel'] = $this->language->get('button_cancel');
$this->data['tab_return'] = $this->language->get('tab_return');
$this->data['tab_product'] = $this->language->get('tab_product');
$this->data['token'] = $this->session->data['token'];
if (isset($this->error['warning'])) {
$this->data['error_warning'] = $this->error['warning'];
} else {
$this->data['error_warning'] = '';
}
if (isset($this->error['order_id'])) {
$this->data['error_order_id'] = $this->error['order_id'];
} else {
$this->data['error_order_id'] = '';
}
if (isset($this->error['firstname'])) {
$this->data['error_firstname'] = $this->error['firstname'];
} else {
$this->data['error_firstname'] = '';
}
if (isset($this->error['lastname'])) {
$this->data['error_lastname'] = $this->error['lastname'];
} else {
$this->data['error_lastname'] = '';
}
if (isset($this->error['email'])) {
$this->data['error_email'] = $this->error['email'];
} else {
$this->data['error_email'] = '';
}
if (isset($this->error['telephone'])) {
$this->data['error_telephone'] = $this->error['telephone'];
} else {
$this->data['error_telephone'] = '';
}
if (isset($this->error['product'])) {
$this->data['error_product'] = $this->error['product'];
} else {
$this->data['error_product'] = '';
}
if (isset($this->error['model'])) {
$this->data['error_model'] = $this->error['model'];
} else {
$this->data['error_model'] = '';
}
$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'];
}
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
'separator' => false
);
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('sale/return', 'token=' . $this->session->data['token'] . $url, 'SSL'),
'separator' => ' :: '
);
if (!isset($this->request->get['return_id'])) {
$this->data['action'] = $this->url->link('sale/return/insert', 'token=' . $this->session->data['token'] . $url, 'SSL');
} else {
$this->data['action'] = $this->url->link('sale/return/update', 'token=' . $this->session->data['token'] . '&return_id=' . $this->request->get['return_id'] . $url, 'SSL');
}
$this->data['cancel'] = $this->url->link('sale/return', 'token=' . $this->session->data['token'] . $url, 'SSL');
if (isset($this->request->get['return_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
$return_info = $this->model_sale_return->getReturn($this->request->get['return_id']);
}
if (isset($this->request->post['order_id'])) {
$this->data['order_id'] = $this->request->post['order_id'];
} elseif (!empty($return_info)) {
$this->data['order_id'] = $return_info['order_id'];
} else {
$this->data['order_id'] = '';
}
if (isset($this->request->post['date_ordered'])) {
$this->data['date_ordered'] = $this->request->post['date_ordered'];
} elseif (!empty($return_info)) {
$this->data['date_ordered'] = $return_info['date_ordered'];
} else {
$this->data['date_ordered'] = '';
}
if (isset($this->request->post['customer'])) {
$this->data['customer'] = $this->request->post['customer'];
} elseif (!empty($return_info)) {
$this->data['customer'] = $return_info['customer'];
} else {
$this->data['customer'] = '';
}
if (isset($this->request->post['customer_id'])) {
$this->data['customer_id'] = $this->request->post['customer_id'];
} elseif (!empty($return_info)) {
$this->data['customer_id'] = $return_info['customer_id'];
} else {
$this->data['customer_id'] = '';
}
if (isset($this->request->post['firstname'])) {
$this->data['firstname'] = $this->request->post['firstname'];
} elseif (!empty($return_info)) {
$this->data['firstname'] = $return_info['firstname'];
} else {
$this->data['firstname'] = '';
}
if (isset($this->request->post['lastname'])) {
$this->data['lastname'] = $this->request->post['lastname'];
} elseif (!empty($return_info)) {
$this->data['lastname'] = $return_info['lastname'];
} else {
$this->data['lastname'] = '';
}
if (isset($this->request->post['email'])) {
$this->data['email'] = $this->request->post['email'];
} elseif (!empty($return_info)) {
$this->data['email'] = $return_info['email'];
} else {
$this->data['email'] = '';
}
if (isset($this->request->post['telephone'])) {
$this->data['telephone'] = $this->request->post['telephone'];
} elseif (!empty($return_info)) {
$this->data['telephone'] = $return_info['telephone'];
} else {
$this->data['telephone'] = '';
}
if (isset($this->request->post['product'])) {
$this->data['product'] = $this->request->post['product'];
} elseif (!empty($return_info)) {
$this->data['product'] = $return_info['product'];
} else {
$this->data['product'] = '';
}
if (isset($this->request->post['product_id'])) {
$this->data['product_id'] = $this->request->post['product_id'];
} elseif (!empty($return_info)) {
$this->data['product_id'] = $return_info['product_id'];
} else {
$this->data['product_id'] = '';
}
if (isset($this->request->post['model'])) {
$this->data['model'] = $this->request->post['model'];
} elseif (!empty($return_info)) {
$this->data['model'] = $return_info['model'];
} else {
$this->data['model'] = '';
}
if (isset($this->request->post['quantity'])) {
$this->data['quantity'] = $this->request->post['quantity'];
} elseif (!empty($return_info)) {
$this->data['quantity'] = $return_info['quantity'];
} else {
$this->data['quantity'] = '';
}
if (isset($this->request->post['opened'])) {
$this->data['opened'] = $this->request->post['opened'];
} elseif (!empty($return_info)) {
$this->data['opened'] = $return_info['opened'];
} else {
$this->data['opened'] = '';
}
if (isset($this->request->post['return_reason_id'])) {
$this->data['return_reason_id'] = $this->request->post['return_reason_id'];
} elseif (!empty($return_info)) {
$this->data['return_reason_id'] = $return_info['return_reason_id'];
} else {
$this->data['return_reason_id'] = '';
}
$this->load->model('localisation/return_reason');
$this->data['return_reasons'] = $this->model_localisation_return_reason->getReturnReasons();
if (isset($this->request->post['return_action_id'])) {
$this->data['return_action_id'] = $this->request->post['return_action_id'];
} elseif (!empty($return_info)) {
$this->data['return_action_id'] = $return_info['return_action_id'];
} else {
$this->data['return_action_id'] = '';
}
$this->load->model('localisation/return_action');
$this->data['return_actions'] = $this->model_localisation_return_action->getReturnActions();
if (isset($this->request->post['comment'])) {
$this->data['comment'] = $this->request->post['comment'];
} elseif (!empty($return_info)) {
$this->data['comment'] = $return_info['comment'];
} else {
$this->data['comment'] = '';
}
if (isset($this->request->post['return_status_id'])) {
$this->data['return_status_id'] = $this->request->post['return_status_id'];
} elseif (!empty($return_info)) {
$this->data['return_status_id'] = $return_info['return_status_id'];
} else {
$this->data['return_status_id'] = '';
}
$this->load->model('localisation/return_status');
$this->data['return_statuses'] = $this->model_localisation_return_status->getReturnStatuses();
$this->template = 'sale/return_form.tpl';
$this->children = array(
'common/header',
'common/footer'
);
$this->response->setOutput($this->render());