Add credit slip to voucher flow
This commit is contained in:
@@ -949,6 +949,64 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{if is_array($returns) && count($returns)}
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-undo"></i> {l s='Refunds'}
|
||||
</div>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-left">{l s='Refund ID'}</th>
|
||||
<th class="text-left">{l s='Status'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$returns item=return_info}
|
||||
<tr>
|
||||
<td class="text-left">
|
||||
<a href="{$link->getAdminLink('AdminOrderRefundRequests')}&vieworder_return&id_order_return={$return_info.id_order_return}" target="_blank">#{$return_info.id_order_return}</a>
|
||||
</td>
|
||||
<td class="text-left">
|
||||
{capture name=refund_status}
|
||||
{if isset($return_info.payment_mode) && $return_info.payment_mode != ''}{l s='Payment Mode: '}{$return_info.payment_mode}<br/>{/if}
|
||||
{if isset($return_info.id_transaction) && $return_info.id_transaction != ''}{l s='Transaction ID: '}{$return_info.id_transaction}<br/>{/if}
|
||||
{if isset($return_info.id_return_type) && isset($return_info.return_type) && $return_info.id_return_type && $return_info.return_type}
|
||||
{if $return_info.return_type == OrderReturn::RETURN_TYPE_CART_RULE}
|
||||
{l s='Voucher ID: '}
|
||||
<a href="{$link->getAdminLink('AdminCartRules')}&updatecart_rule&id_cart_rule={$return_info.id_return_type}" target="_blank">
|
||||
#{$return_info.id_return_type}
|
||||
</a>
|
||||
{elseif $return_info.return_type == OrderReturn::RETURN_TYPE_ORDER_SLIP}
|
||||
{l s='Credit Slip ID: '}
|
||||
#{$return_info.id_return_type}
|
||||
<a href="{$link->getAdminLink('AdminPdf')}&submitAction=generateOrderSlipPDF&id_order_slip={$return_info.id_return_type}" title="#{Configuration::get('PS_CREDIT_SLIP_PREFIX', $current_id_lang)}{$return_info.id_return_type|string_format:'%06d'}">
|
||||
{l s='Download' mod='hotelreservationsystem'}
|
||||
</a>
|
||||
{/if}
|
||||
<br/>
|
||||
{/if}
|
||||
{if isset($return_info.id_cart_rule) && $return_info.id_cart_rule}
|
||||
{l s='Voucher ID: '}
|
||||
<a href="{$link->getAdminLink('AdminCartRules')}&updatecart_rule&id_cart_rule={$return_info.id_cart_rule}" target="_blank">
|
||||
#{$return_info.id_cart_rule}
|
||||
</a>
|
||||
<br/>
|
||||
{/if}
|
||||
{/capture}
|
||||
|
||||
{if $smarty.capture.refund_status|trim != ''}
|
||||
{$smarty.capture.refund_status}
|
||||
{else}
|
||||
{$return_info.state_name}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
{hook h="displayAdminOrderRight" id_order=$order->id}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
{**
|
||||
* 2010-2023 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*}
|
||||
|
||||
<a class="btn btn-link" href="{$link->getAdminLink('AdminCartRules')|escape:'html':'UTF-8'}&updatecart_rule&id_cart_rule={$id_cart_rule}" target="_blank">
|
||||
#{$id_cart_rule}
|
||||
</a>
|
||||
@@ -0,0 +1,24 @@
|
||||
{**
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*}
|
||||
|
||||
{if $redeem_status == OrderSlip::REDEEM_STATUS_REDEEMED}
|
||||
<span class="badge badge-danger">{l s='Redeemed'}</span>
|
||||
{else}
|
||||
<span class="badge badge-success">{l s='Active'}</span>
|
||||
{/if}
|
||||
@@ -0,0 +1,23 @@
|
||||
{**
|
||||
* 2010-2023 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*}
|
||||
|
||||
<a href="{$status_change_link|escape:'html':'UTF-8'}" title="{l s='Change Status'}">
|
||||
<i class="icon-refresh"></i>
|
||||
{l s='Change Status'}
|
||||
</a>
|
||||
@@ -26,6 +26,9 @@
|
||||
|
||||
class OrderReturnCore extends ObjectModel
|
||||
{
|
||||
/** @var int */
|
||||
public $id_order_return;
|
||||
|
||||
/** @var int */
|
||||
public $id_customer;
|
||||
|
||||
@@ -48,12 +51,22 @@ class OrderReturnCore extends ObjectModel
|
||||
/** @var int if request raised by the admin */
|
||||
public $by_admin;
|
||||
|
||||
/** @var int id_cart_rule or id_order_slip */
|
||||
public $id_return_type;
|
||||
|
||||
/** @var int whether $id_return_type is cart_rule or order_slip */
|
||||
public $return_type;
|
||||
|
||||
/** @var string Object creation date */
|
||||
public $date_add;
|
||||
|
||||
/** @var string Object last modification date */
|
||||
public $date_upd;
|
||||
|
||||
/** possible values for $return_type */
|
||||
const RETURN_TYPE_CART_RULE = 1;
|
||||
const RETURN_TYPE_ORDER_SLIP = 2;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
@@ -69,6 +82,8 @@ class OrderReturnCore extends ObjectModel
|
||||
'refunded_amount' => array('type' => self::TYPE_FLOAT),
|
||||
'state' => array('type' => self::TYPE_INT),
|
||||
'by_admin' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||
'id_return_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'return_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
),
|
||||
@@ -232,14 +247,16 @@ class OrderReturnCore extends ObjectModel
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
}
|
||||
$data = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'order_return`
|
||||
WHERE `id_customer` = '.(int)$customer_id.
|
||||
($only_customer ? ' AND `by_admin` = 0' : '').
|
||||
($order_id ? ' AND `id_order` = '.(int)$order_id : '').
|
||||
($no_denied ? ' AND `state` != 4' : '').'
|
||||
ORDER BY `date_add` DESC');
|
||||
$sql = 'SELECT *
|
||||
FROM `'._DB_PREFIX_.'order_return` orr
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_slip` ors
|
||||
ON (ors.`id_order_slip` = orr.`id_return_type` AND orr.`return_type` = '.(int) self::RETURN_TYPE_ORDER_SLIP.')
|
||||
WHERE orr.`id_customer` = '.(int)$customer_id.
|
||||
($only_customer ? ' AND orr.`by_admin` = 0' : '').
|
||||
($order_id ? ' AND orr.`id_order` = '.(int)$order_id : '').
|
||||
($no_denied ? ' AND orr.`state` != 4' : '').'
|
||||
ORDER BY orr.`date_add` DESC';
|
||||
$data = Db::getInstance()->executeS($sql);
|
||||
foreach ($data as $k => $or) {
|
||||
$state = new OrderReturnState($or['state']);
|
||||
$data[$k]['state_name'] = $state->name[$context->language->id];
|
||||
@@ -373,144 +390,112 @@ class OrderReturnCore extends ObjectModel
|
||||
/**
|
||||
* Sets the new order return state
|
||||
* @param int $newOrderReturnState
|
||||
* @param int/object $idOrderReturn
|
||||
*/
|
||||
public function changeIdOrderReturnState($newOrderReturnState, $idOrderReturn, $idLang = 0)
|
||||
public function changeIdOrderReturnState($newOrderReturnState, $idLang = 0)
|
||||
{
|
||||
if (Validate::isLoadedObject($objOrderReturn = new OrderReturn((int)$idOrderReturn))) {
|
||||
$objOrder = new Order($objOrderReturn->id_order);
|
||||
$objOrder = new Order($this->id_order);
|
||||
if (!$idLang) {
|
||||
$idLang = $objOrder->id_lang;
|
||||
}
|
||||
if (Validate::isLoadedObject(
|
||||
$objOrderReturnState = new OrderReturnState((int)$newOrderReturnState, $idLang)
|
||||
)) {
|
||||
if ($this->state != $newOrderReturnState) {
|
||||
$this->state = $newOrderReturnState;
|
||||
$this->save();
|
||||
|
||||
if (!$idLang) {
|
||||
$idLang = $objOrder->id_lang;
|
||||
}
|
||||
if (Validate::isLoadedObject(
|
||||
$objOrderReturnState = new OrderReturnState((int)$newOrderReturnState, $idLang)
|
||||
)) {
|
||||
if ($objOrderReturn->state != $newOrderReturnState) {
|
||||
$objOrderReturn->state = $newOrderReturnState;
|
||||
$objOrderReturn->save();
|
||||
if ($objOrderReturnState->send_email_to_customer
|
||||
|| $objOrderReturnState->send_email_to_superadmin
|
||||
|| $objOrderReturnState->send_email_to_employee
|
||||
|| $objOrderReturnState->send_email_to_hotelier
|
||||
) {
|
||||
// Lets create data for the email templates
|
||||
$objMail = new Mail();
|
||||
$idHotel = 0;
|
||||
|
||||
if ($objOrderReturnState->send_email_to_customer
|
||||
|| $objOrderReturnState->send_email_to_superadmin
|
||||
|| $objOrderReturnState->send_email_to_employee
|
||||
|| $objOrderReturnState->send_email_to_hotelier
|
||||
) {
|
||||
// Lets create data for the email templates
|
||||
$objMail = new Mail();
|
||||
$idHotel = 0;
|
||||
$data = array (
|
||||
'{status_name}' => $objOrderReturnState->name,
|
||||
'{status_color}' => $objOrderReturnState->color,
|
||||
'{order_reference}' => $objOrder->reference,
|
||||
'{order_date}' => date('Y-m-d h:i:s', strtotime($objOrder->date_add)),
|
||||
'{refunded_amount}' => Tools::displayPrice($this->refunded_amount, new Currency($objOrder->id_currency)),
|
||||
'{payment_mode}' => $this->payment_mode,
|
||||
'{id_transaction}' => $this->id_transaction,
|
||||
);
|
||||
|
||||
$data = array (
|
||||
'{status_name}' => $objOrderReturnState->name,
|
||||
'{status_color}' => $objOrderReturnState->color,
|
||||
'{order_reference}' => $objOrder->reference,
|
||||
'{order_date}' => date('Y-m-d h:i:s', strtotime($objOrder->date_add)),
|
||||
'{refunded_amount}' => Tools::displayPrice($objOrderReturn->refunded_amount, new Currency($objOrder->id_currency)),
|
||||
'{payment_mode}' => $objOrderReturn->payment_mode,
|
||||
'{id_transaction}' => $objOrderReturn->id_transaction,
|
||||
);
|
||||
|
||||
// if mail is true for the customer then send mail to customer with selected template
|
||||
$objCustomer = new Customer($objOrderReturn->id_customer);
|
||||
if ($objOrderReturnState->send_email_to_customer && $objOrderReturnState->customer_template) {
|
||||
if ($refundReqBookings = $objOrderReturn->getOrderRefundRequestedBookings(
|
||||
$objOrderReturn->id_order,
|
||||
$objOrderReturn->id,
|
||||
0,
|
||||
1
|
||||
)) {
|
||||
$idHotel = reset($refundReqBookings)['id_hotel'];
|
||||
}
|
||||
|
||||
$refBookHtml = $objMail->getEmailTemplateContent('refund_request_detail_customer', Mail::TYPE_HTML, $refundReqBookings);
|
||||
$refBookTxt = $objMail->getEmailTemplateContent('refund_request_detail_customer', Mail::TYPE_TEXT, $refundReqBookings);
|
||||
|
||||
$data['{refundBookingHtml}'] = $refBookHtml;
|
||||
$data['{refundBookingTxt}'] = $refBookTxt;
|
||||
|
||||
// send customer information
|
||||
$link = new Link();
|
||||
$data['{refund_reqests_url}'] = $link->getPageLink('order-follow');
|
||||
$data['{firstname}'] = $objCustomer->firstname;
|
||||
$data['{lastname}'] = $objCustomer->lastname;
|
||||
|
||||
Mail::Send(
|
||||
(int)$idLang,
|
||||
$objOrderReturnState->customer_template,
|
||||
$objOrderReturnState->name,
|
||||
$data,
|
||||
$objCustomer->email,
|
||||
$objCustomer->firstname.' '.$objCustomer->lastname,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
_PS_MAIL_DIR_,
|
||||
false,
|
||||
(int)$objOrder->id_shop
|
||||
);
|
||||
// if mail is true for the customer then send mail to customer with selected template
|
||||
$objCustomer = new Customer($this->id_customer);
|
||||
if ($objOrderReturnState->send_email_to_customer && $objOrderReturnState->customer_template) {
|
||||
if ($refundReqBookings = $this->getOrderRefundRequestedBookings(
|
||||
$this->id_order,
|
||||
$this->id,
|
||||
0,
|
||||
1
|
||||
)) {
|
||||
$idHotel = reset($refundReqBookings)['id_hotel'];
|
||||
}
|
||||
|
||||
if ($objOrderReturnState->admin_template) {
|
||||
if ($refundReqBookings = $objOrderReturn->getOrderRefundRequestedBookings(
|
||||
$objOrderReturn->id_order,
|
||||
$objOrderReturn->id
|
||||
)) {
|
||||
$idHotel = $refundReqBookings[0]['id_hotel'];
|
||||
}
|
||||
$refBookHtml = $objMail->getEmailTemplateContent('refund_request_detail_customer', Mail::TYPE_HTML, $refundReqBookings);
|
||||
$refBookTxt = $objMail->getEmailTemplateContent('refund_request_detail_customer', Mail::TYPE_TEXT, $refundReqBookings);
|
||||
|
||||
$refBookHtml = $objMail->getEmailTemplateContent('refund_request_detail_admin', Mail::TYPE_HTML, $refundReqBookings);
|
||||
$refBookTxt = $objMail->getEmailTemplateContent('refund_request_detail_admin', Mail::TYPE_TEXT, $refundReqBookings);
|
||||
$data['{refundBookingHtml}'] = $refBookHtml;
|
||||
$data['{refundBookingTxt}'] = $refBookTxt;
|
||||
|
||||
$data['{cancelation_reason}'] = $objOrderReturn->question;
|
||||
$data['{refundBookingHtml}'] = $refBookHtml;
|
||||
$data['{refundBookingTxt}'] = $refBookTxt;
|
||||
// send customer information
|
||||
$link = new Link();
|
||||
$data['{refund_reqests_url}'] = $link->getPageLink('order-follow');
|
||||
$data['{firstname}'] = $objCustomer->firstname;
|
||||
$data['{lastname}'] = $objCustomer->lastname;
|
||||
|
||||
// send mail to the super admin
|
||||
if ($objOrderReturnState->send_email_to_superadmin) {
|
||||
// send superadmin information
|
||||
if (Validate::isLoadedObject($superAdmin = new Employee(_PS_ADMIN_PROFILE_))) {
|
||||
if (Validate::isEmail($superAdmin->email)) {
|
||||
$data['{customer_name}'] = $objCustomer->firstname.' '.$objCustomer->lastname;
|
||||
$data['{customer_email}'] = $objCustomer->email;
|
||||
$data['{firstname}'] = $superAdmin->firstname;
|
||||
$data['{lastname}'] = $superAdmin->lastname;
|
||||
Mail::Send(
|
||||
(int)$idLang,
|
||||
$objOrderReturnState->customer_template,
|
||||
$objOrderReturnState->name,
|
||||
$data,
|
||||
$objCustomer->email,
|
||||
$objCustomer->firstname.' '.$objCustomer->lastname,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
_PS_MAIL_DIR_,
|
||||
false,
|
||||
(int)$objOrder->id_shop
|
||||
);
|
||||
}
|
||||
|
||||
Mail::Send(
|
||||
(int)$idLang,
|
||||
$objOrderReturnState->admin_template,
|
||||
$objOrderReturnState->name,
|
||||
$data,
|
||||
$superAdmin->email,
|
||||
$superAdmin->firstname.' '.$superAdmin->lastname,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
_PS_MAIL_DIR_,
|
||||
false,
|
||||
(int)$objOrder->id_shop
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($idHotel
|
||||
&& Validate::isLoadedObject($objHotel = new HotelBranchInformation($idHotel))
|
||||
) {
|
||||
// send mail to the hotelier
|
||||
if ($objOrderReturnState->send_email_to_hotelier) {
|
||||
if ($objOrderReturnState->admin_template) {
|
||||
if ($refundReqBookings = $this->getOrderRefundRequestedBookings(
|
||||
$this->id_order,
|
||||
$this->id
|
||||
)) {
|
||||
$idHotel = $refundReqBookings[0]['id_hotel'];
|
||||
}
|
||||
|
||||
$refBookHtml = $objMail->getEmailTemplateContent('refund_request_detail_admin', Mail::TYPE_HTML, $refundReqBookings);
|
||||
$refBookTxt = $objMail->getEmailTemplateContent('refund_request_detail_admin', Mail::TYPE_TEXT, $refundReqBookings);
|
||||
|
||||
$data['{cancelation_reason}'] = $this->question;
|
||||
$data['{refundBookingHtml}'] = $refBookHtml;
|
||||
$data['{refundBookingTxt}'] = $refBookTxt;
|
||||
|
||||
// send mail to the super admin
|
||||
if ($objOrderReturnState->send_email_to_superadmin) {
|
||||
// send superadmin information
|
||||
if (Validate::isLoadedObject($superAdmin = new Employee(_PS_ADMIN_PROFILE_))) {
|
||||
if (Validate::isEmail($superAdmin->email)) {
|
||||
$data['{customer_name}'] = $objCustomer->firstname.' '.$objCustomer->lastname;
|
||||
$data['{customer_email}'] = $objCustomer->email;
|
||||
$data['{firstname}'] = '';
|
||||
$data['{lastname}'] = '';
|
||||
$data['{email}'] = $objHotel->email;
|
||||
$data['{firstname}'] = $superAdmin->firstname;
|
||||
$data['{lastname}'] = $superAdmin->lastname;
|
||||
|
||||
Mail::Send(
|
||||
(int)$idLang,
|
||||
$objOrderReturnState->admin_template,
|
||||
$objOrderReturnState->name,
|
||||
$data,
|
||||
$objHotel->email,
|
||||
null,
|
||||
$superAdmin->email,
|
||||
$superAdmin->firstname.' '.$superAdmin->lastname,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
@@ -520,38 +505,66 @@ class OrderReturnCore extends ObjectModel
|
||||
(int)$objOrder->id_shop
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($idHotel
|
||||
&& Validate::isLoadedObject($objHotel = new HotelBranchInformation($idHotel))
|
||||
) {
|
||||
// send mail to the hotelier
|
||||
if ($objOrderReturnState->send_email_to_hotelier) {
|
||||
$data['{customer_name}'] = $objCustomer->firstname.' '.$objCustomer->lastname;
|
||||
$data['{customer_email}'] = $objCustomer->email;
|
||||
$data['{firstname}'] = '';
|
||||
$data['{lastname}'] = '';
|
||||
$data['{email}'] = $objHotel->email;
|
||||
|
||||
// send mail to the employee
|
||||
if ($objOrderReturnState->send_email_to_employee) {
|
||||
if ($htlAccesses = $objHotel->getHotelAccess($idHotel)) {
|
||||
$data['{customer_name}'] = $objCustomer->firstname.' '.$objCustomer->lastname;
|
||||
$data['{customer_email}'] = $objCustomer->email;
|
||||
foreach ($htlAccesses as $access) {
|
||||
if ($access['id_profile'] != _PS_ADMIN_PROFILE_) {
|
||||
if ($htlEmployees = Employee::getEmployeesByProfile($access['id_profile'])) {
|
||||
foreach ($htlEmployees as $empl) {
|
||||
if (Validate::isEmail($empl['email'])) {
|
||||
// send hotel manager (employee) have permission for this hotel
|
||||
$data['{firstname}'] = $empl['firstname'];
|
||||
$data['{lastname}'] = $empl['lastname'];
|
||||
$data['{email}'] = $empl['email'];
|
||||
Mail::Send(
|
||||
(int)$idLang,
|
||||
$objOrderReturnState->admin_template,
|
||||
$objOrderReturnState->name,
|
||||
$data,
|
||||
$objHotel->email,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
_PS_MAIL_DIR_,
|
||||
false,
|
||||
(int)$objOrder->id_shop
|
||||
);
|
||||
}
|
||||
|
||||
Mail::Send(
|
||||
(int)$idLang,
|
||||
$objOrderReturnState->admin_template,
|
||||
$objOrderReturnState->name,
|
||||
$data,
|
||||
$empl['email'],
|
||||
$empl['firstname'].' '.$empl['lastname'],
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
_PS_MAIL_DIR_,
|
||||
false,
|
||||
(int)$objOrder->id_shop
|
||||
);
|
||||
}
|
||||
// send mail to the employee
|
||||
if ($objOrderReturnState->send_email_to_employee) {
|
||||
if ($htlAccesses = $objHotel->getHotelAccess($idHotel)) {
|
||||
$data['{customer_name}'] = $objCustomer->firstname.' '.$objCustomer->lastname;
|
||||
$data['{customer_email}'] = $objCustomer->email;
|
||||
foreach ($htlAccesses as $access) {
|
||||
if ($access['id_profile'] != _PS_ADMIN_PROFILE_) {
|
||||
if ($htlEmployees = Employee::getEmployeesByProfile($access['id_profile'])) {
|
||||
foreach ($htlEmployees as $empl) {
|
||||
if (Validate::isEmail($empl['email'])) {
|
||||
// send hotel manager (employee) have permission for this hotel
|
||||
$data['{firstname}'] = $empl['firstname'];
|
||||
$data['{lastname}'] = $empl['lastname'];
|
||||
$data['{email}'] = $empl['email'];
|
||||
|
||||
Mail::Send(
|
||||
(int)$idLang,
|
||||
$objOrderReturnState->admin_template,
|
||||
$objOrderReturnState->name,
|
||||
$data,
|
||||
$empl['email'],
|
||||
$empl['firstname'].' '.$empl['lastname'],
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
_PS_MAIL_DIR_,
|
||||
false,
|
||||
(int)$objOrder->id_shop
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -561,18 +574,21 @@ class OrderReturnCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// executes hook
|
||||
Hook::exec(
|
||||
'actionOrderReFundStatusPostUpdate',
|
||||
array(
|
||||
'new_order_return_status' => $newOrderReturnState,
|
||||
'id_order_return' => (int)$idOrderReturn
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// executes hook
|
||||
Hook::exec(
|
||||
'actionOrderReFundStatusPostUpdate',
|
||||
array(
|
||||
'new_order_return_status' => $newOrderReturnState,
|
||||
'id_order_return' => (int) $this->id_order_return,
|
||||
)
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
class OrderSlipCore extends ObjectModel
|
||||
{
|
||||
/** @var int */
|
||||
public $id;
|
||||
public $id_order_slip;
|
||||
|
||||
/** @var int */
|
||||
public $id_customer;
|
||||
@@ -62,6 +62,12 @@ class OrderSlipCore extends ObjectModel
|
||||
/** @var int */
|
||||
public $partial;
|
||||
|
||||
/** @var int */
|
||||
public $redeem_status = self::REDEEM_STATUS_ACTIVE;
|
||||
|
||||
/** @var int */
|
||||
public $id_cart_rule;
|
||||
|
||||
/** @var string Object creation date */
|
||||
public $date_add;
|
||||
|
||||
@@ -71,6 +77,9 @@ class OrderSlipCore extends ObjectModel
|
||||
/** @var int */
|
||||
public $order_slip_type = 0;
|
||||
|
||||
const REDEEM_STATUS_ACTIVE = 1;
|
||||
const REDEEM_STATUS_REDEEMED = 2;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
@@ -90,6 +99,8 @@ class OrderSlipCore extends ObjectModel
|
||||
'shipping_cost_amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
||||
'amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
|
||||
'partial' => array('type' => self::TYPE_INT),
|
||||
'redeem_status' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_cart_rule' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'order_slip_type' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||
@@ -336,6 +347,7 @@ class OrderSlipCore extends ObjectModel
|
||||
$order_slip->{'total_products_tax_'.$inc_or_ex_1} = 0;
|
||||
$order_slip->{'total_products_tax_'.$inc_or_ex_2} = 0;
|
||||
|
||||
$total_products = array();
|
||||
foreach ($booking_list as &$booking) {
|
||||
$objHtlBooking = new HotelBookingDetail($booking['id_htl_booking']);
|
||||
$order_detail = new OrderDetail((int)$objHtlBooking->id_order_detail);
|
||||
@@ -543,6 +555,95 @@ class OrderSlipCore extends ObjectModel
|
||||
return $ecotax_detail;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate voucher and return id of the created rule if successful, false otherwise
|
||||
*/
|
||||
public function generateVoucher($sendMail = true)
|
||||
{
|
||||
if (!Validate::isLoadedObject($this)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->redeem_status != self::REDEEM_STATUS_ACTIVE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$objOrder = new Order($this->id_order);
|
||||
if (!Validate::isLoadedObject($objOrder)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$objCustomer = new Customer($this->id_customer);
|
||||
if (!Validate::isLoadedObject($objCustomer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$context = Context::getContext();
|
||||
$objCartRule = new CartRule();
|
||||
$idsLanguage = Language::getIDs();
|
||||
|
||||
$creditSlipPrefix = Configuration::get('PS_CREDIT_SLIP_PREFIX', $context->language->id);
|
||||
$creditSlipID = sprintf(('%1$s%2$06d'), $creditSlipPrefix, (int) $this->id_order_slip);
|
||||
|
||||
$dateFrom = $this->date_add;
|
||||
$dateTo = date('Y-m-d H:i:s', strtotime($dateFrom) + (3600 * 24 * 365.25)); /* 1 year */
|
||||
|
||||
foreach ($idsLanguage as $idLang) {
|
||||
$objCartRule->name[$idLang] = sprintf('Voucher for credit slip #%s', $creditSlipID);
|
||||
}
|
||||
|
||||
$objCartRule->description = sprintf('Order: #%s', $objOrder->id);
|
||||
$objCartRule->code = 'CS'.(int) ($this->id_order_slip).'C'.(int) ($objCustomer->id).'O'.(int) ($objOrder->id);
|
||||
$objCartRule->quantity = 1;
|
||||
$objCartRule->quantity_per_user = 1;
|
||||
$objCartRule->id_customer = $objCustomer->id;
|
||||
$objCartRule->date_from = $dateFrom;
|
||||
$objCartRule->date_to = $dateTo;
|
||||
$objCartRule->highlight = 1;
|
||||
$objCartRule->active = 1;
|
||||
$objCartRule->reduction_amount = $this->amount;
|
||||
$objCartRule->reduction_tax = true;
|
||||
$objCartRule->minimum_amount_currency = $objOrder->id_currency;
|
||||
$objCartRule->reduction_currency = $objOrder->id_currency;
|
||||
|
||||
if (!$objCartRule->save()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->redeem_status = self::REDEEM_STATUS_REDEEMED;
|
||||
$this->id_cart_rule = (int) $objCartRule->id;
|
||||
$this->save();
|
||||
|
||||
if ($sendMail) {
|
||||
$objCartRule = new CartRule($this->id_cart_rule);
|
||||
$objCustomer = new Customer($objCartRule->id_customer);
|
||||
|
||||
$objCurrency = new Currency($objCartRule->reduction_currency, $context->language->id);
|
||||
$mailVars['{firstname}'] = $objCustomer->firstname;
|
||||
$mailVars['{lastname}'] = $objCustomer->lastname;
|
||||
$mailVars['{credit_slip_id}'] = $creditSlipID;
|
||||
$mailVars['{voucher_code}'] = $objCartRule->code;
|
||||
$mailVars['{voucher_amount}'] = Tools::displayPrice($objCartRule->reduction_amount, $objCurrency, false);
|
||||
|
||||
Mail::Send(
|
||||
$context->language->id,
|
||||
'credit_slip_voucher',
|
||||
sprintf(Mail::l('New voucher for your credit slip #%s', $context->language->id), $creditSlipID),
|
||||
$mailVars,
|
||||
$objCustomer->email,
|
||||
$objCustomer->firstname.' '.$objCustomer->lastname,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
_PS_MAIL_DIR_,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
return $this->id_cart_rule;
|
||||
}
|
||||
|
||||
public function getWsOrderSlipDetails()
|
||||
{
|
||||
$query = 'SELECT id_order_slip as id, id_order_detail, product_quantity, amount_tax_excl, amount_tax_incl
|
||||
|
||||
@@ -34,11 +34,14 @@ class AdminSlipControllerCore extends AdminController
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'order_slip';
|
||||
$this->className = 'OrderSlip';
|
||||
$this->list_no_link = true;
|
||||
|
||||
$this->_select = ' o.`id_shop`';
|
||||
$this->_join .= ' LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = a.`id_order`)';
|
||||
$this->_group = ' GROUP BY a.`id_order_slip`';
|
||||
|
||||
$this->addRowAction('statusChange');
|
||||
|
||||
$this->fields_list = array(
|
||||
'id_order_slip' => array(
|
||||
'title' => $this->l('ID'),
|
||||
@@ -63,7 +66,26 @@ class AdminSlipControllerCore extends AdminController
|
||||
'callback' => 'printPDFIcons',
|
||||
'orderby' => false,
|
||||
'search' => false,
|
||||
'remove_onclick' => true)
|
||||
'remove_onclick' => true
|
||||
),
|
||||
'redeem_status' => array(
|
||||
'title' => $this->l('Status'),
|
||||
'type' => 'select',
|
||||
'list' => array(
|
||||
OrderSlip::REDEEM_STATUS_ACTIVE => $this->l('Active'),
|
||||
OrderSlip::REDEEM_STATUS_REDEEMED => $this->l('Redeemed'),
|
||||
),
|
||||
'align' => 'center',
|
||||
'filter_key' => 'a!redeem_status',
|
||||
'callback' => 'displayRedeemStatus',
|
||||
'class' => 'fixed-width-md',
|
||||
),
|
||||
'id_cart_rule' => array(
|
||||
'title' => $this->l('Voucher'),
|
||||
'align' => 'center',
|
||||
'callback' => 'displayVoucherLink',
|
||||
'class' => 'fixed-width-lg',
|
||||
),
|
||||
);
|
||||
|
||||
$this->_select = 'a.id_order_slip AS id_pdf';
|
||||
@@ -162,6 +184,38 @@ class AdminSlipControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function processStatusChange()
|
||||
{
|
||||
$idOrderSlip = Tools::getValue('id_order_slip');
|
||||
$objOrderSlip = new OrderSlip($idOrderSlip);
|
||||
|
||||
if (!Validate::isLoadedObject($objOrderSlip)) {
|
||||
$this->errors[] = $this->l('The credit slip can not be loaded.');
|
||||
} elseif ($objOrderSlip->redeem_status != OrderSlip::REDEEM_STATUS_ACTIVE) {
|
||||
$this->errors[] = $this->l('The status for this credit slip can not be changed.');
|
||||
} else {
|
||||
$objOrder = new Order($objOrderSlip->id_order);
|
||||
$objCustomer = new Customer($objOrderSlip->id_customer);
|
||||
|
||||
if (!Validate::isLoadedObject($objOrder)) {
|
||||
$this->errors[] = $this->l('The related order for this credit slip can not be loaded.');
|
||||
}
|
||||
|
||||
if (!Validate::isLoadedObject($objCustomer)) {
|
||||
$this->errors[] = $this->l('The related customer for this credit slip can not be loaded.');
|
||||
}
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$objOrderSlip->redeem_status = OrderSlip::REDEEM_STATUS_REDEEMED;
|
||||
if ($objOrderSlip->save()) {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&conf=4');
|
||||
}
|
||||
|
||||
$this->errors[] = $this->l('Something went wrong while changing status.');
|
||||
}
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
$this->initTabModuleList();
|
||||
@@ -202,4 +256,43 @@ class AdminSlipControllerCore extends AdminController
|
||||
|
||||
return $this->createTemplate('_print_pdf_icon.tpl')->fetch();
|
||||
}
|
||||
|
||||
public function displayRedeemStatus($redeemStatus, $row)
|
||||
{
|
||||
$this->context->smarty->assign(array(
|
||||
'redeem_status' => $redeemStatus,
|
||||
));
|
||||
|
||||
return $this->createTemplate('_redeem_status.tpl')->fetch();
|
||||
}
|
||||
|
||||
public function displayVoucherLink($idCartRule, $row)
|
||||
{
|
||||
if ($row['redeem_status'] == OrderSlip::REDEEM_STATUS_REDEEMED && $idCartRule) {
|
||||
$this->context->smarty->assign(array(
|
||||
'id_cart_rule' => (int) $idCartRule,
|
||||
));
|
||||
|
||||
return $this->createTemplate('_display_voucher_link.tpl')->fetch();
|
||||
}
|
||||
|
||||
return '--';
|
||||
}
|
||||
|
||||
public function displayStatusChangeLink($token = null, $id)
|
||||
{
|
||||
$objOrderSlip = new OrderSlip($id);
|
||||
if ($objOrderSlip->redeem_status != OrderSlip::REDEEM_STATUS_REDEEMED) {
|
||||
$statusChangeLink = self::$currentIndex.'&'.$this->identifier.'='.$id.'&action=statusChange'.
|
||||
'&token='.($token != null ? $token : $this->token);
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'status_change_link' => $statusChangeLink,
|
||||
));
|
||||
|
||||
return $this->createTemplate('_status_change_link.tpl')->fetch();
|
||||
}
|
||||
|
||||
return '--';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ class OrderDetailControllerCore extends FrontController
|
||||
}
|
||||
}
|
||||
// Emails to customer, admin on refund request state change
|
||||
$objOrderReturn->changeIdOrderReturnState(OrderReturnState::ORDER_RETRUN_FIRST_STATUS, $objOrderReturn->id);
|
||||
$objOrderReturn->changeIdOrderReturnState(Configuration::get('PS_ORS_PENDING'));
|
||||
|
||||
die(json_encode(array('status' => 1)));
|
||||
}
|
||||
|
||||
@@ -53,4 +53,34 @@ class OrderSlipControllerCore extends FrontController
|
||||
$this->context->smarty->assign('ordersSlip', OrderSlip::getOrdersSlip((int)$this->context->cookie->id_customer));
|
||||
$this->setTemplate(_PS_THEME_DIR_.'order-slip.tpl');
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('generateVoucher')) {
|
||||
$idOrderSlip = Tools::getValue('id_order_slip');
|
||||
$objOrderSlip = new OrderSlip($idOrderSlip);
|
||||
if (!Validate::isLoadedObject($objOrderSlip)) {
|
||||
$this->errors[] = Tools::displayError('The credit slip is invalid.');
|
||||
} elseif ($objOrderSlip->redeem_status == OrderSlip::REDEEM_STATUS_REDEEMED) {
|
||||
$this->errors[] = Tools::displayError('The credit slip has already been redeemed.');
|
||||
} elseif ($objOrderSlip->id_customer != $this->context->customer->id) {
|
||||
$this->errors[] = Tools::displayError('Invalid request.');
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
if ($objOrderSlip->generateVoucher()) {
|
||||
Tools::redirect($this->context->link->getPageLink(
|
||||
$this->php_self,
|
||||
$this->ssl,
|
||||
$this->context->language->id,
|
||||
'confirmation=1'
|
||||
));
|
||||
}
|
||||
|
||||
$this->errors[] = Tools::displayError('The voucher code for this credit slip could not be generated.');
|
||||
}
|
||||
}
|
||||
|
||||
parent::postProcess();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1304,6 +1304,8 @@ CREATE TABLE `PREFIX_order_return` (
|
||||
`refunded_amount` decimal(20,6) NOT NULL DEFAULT '0.000000',
|
||||
`question` text NOT NULL,
|
||||
`by_admin` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`id_return_type` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`return_type` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_order_return`),
|
||||
@@ -1358,6 +1360,8 @@ CREATE TABLE `PREFIX_order_slip` (
|
||||
`amount` DECIMAL(10,2) NOT NULL,
|
||||
`shipping_cost_amount` DECIMAL(10,2) NOT NULL,
|
||||
`partial` TINYINT(1) NOT NULL,
|
||||
`redeem_status` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
`id_cart_rule` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`order_slip_type` TINYINT(1) unsigned NOT NULL DEFAULT '0',
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
|
||||
@@ -605,7 +605,6 @@ function init()
|
||||
$('.row-editing-warning').hide();
|
||||
$('.cancel_product_change_link:visible').trigger('click');
|
||||
closeAddProduct();
|
||||
refundFormStatus = 'closed';
|
||||
|
||||
/*By webkul*/
|
||||
var tr_product = $(this).closest('.product-line-row');
|
||||
@@ -931,26 +930,20 @@ function init()
|
||||
/* Refund system script */
|
||||
var flagRefund = '';
|
||||
|
||||
var refundFormStatus = 'closed';
|
||||
$(document).ready(function() {
|
||||
// Used for Cancel bookings/Initiate refund button
|
||||
$('#desc-order-standard_refund').click(function() {
|
||||
$('.cancel_product_change_link:visible').trigger('click');
|
||||
|
||||
if (refundFormStatus == 'closed') {
|
||||
$('.standard_refund_fields').fadeIn();
|
||||
refundFormStatus = 'open';
|
||||
}
|
||||
|
||||
closeAddProduct();
|
||||
if (order_discount_price)
|
||||
$('.cancel_product_change_link:visible').trigger('click');
|
||||
if (order_discount_price) {
|
||||
actualizeTotalRefundVoucher();
|
||||
|
||||
}
|
||||
$('.standard_refund_fields, .order_action').fadeIn();
|
||||
scroll_if_anchor('#refundForm', 170);
|
||||
});
|
||||
|
||||
$('#cancelRefund').click(function() {
|
||||
$('.standard_refund_fields').hide();
|
||||
refundFormStatus = 'closed';
|
||||
});
|
||||
|
||||
$('#desc-order-partial_refund').click(function() {
|
||||
|
||||
118
mails/en/credit_slip_voucher.html
Normal file
118
mails/en/credit_slip_voucher.html
Normal file
@@ -0,0 +1,118 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
||||
<title>Message from {shop_name}</title>
|
||||
|
||||
|
||||
<style> @media only screen and (max-width: 300px){
|
||||
body {
|
||||
width:218px !important;
|
||||
margin:auto !important;
|
||||
}
|
||||
.table {width:195px !important;margin:auto !important;}
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto !important;display: block !important;}
|
||||
span.title{font-size:20px !important;line-height: 23px !important}
|
||||
span.subtitle{font-size: 14px !important;line-height: 18px !important;padding-top:10px !important;display:block !important;}
|
||||
td.box p{font-size: 12px !important;font-weight: bold !important;}
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
.table-recap{width: 200px!important;}
|
||||
.table-recap tr td, .conf_body td{text-align:center !important;}
|
||||
.address{display: block !important;margin-bottom: 10px !important;}
|
||||
.space_address{display: none !important;}
|
||||
}
|
||||
@media only screen and (min-width: 301px) and (max-width: 500px) {
|
||||
body {width:308px!important;margin:auto!important;}
|
||||
.table {width:285px!important;margin:auto!important;}
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
.table-recap{width: 295px !important;}
|
||||
.table-recap tr td, .conf_body td{text-align:center !important;}
|
||||
|
||||
}
|
||||
@media only screen and (min-width: 501px) and (max-width: 768px) {
|
||||
body {width:478px!important;margin:auto!important;}
|
||||
.table {width:450px!important;margin:auto!important;}
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
|
||||
}
|
||||
@media only screen and (max-device-width: 480px) {
|
||||
body {width:308px!important;margin:auto!important;}
|
||||
.table {width:285px;margin:auto!important;}
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
|
||||
|
||||
.table-recap{width: 295px!important;}
|
||||
.table-recap tr td, .conf_body td{text-align:center!important;}
|
||||
.address{display: block !important;margin-bottom: 10px !important;}
|
||||
.space_address{display: none !important;}
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body style="-webkit-text-size-adjust:none;background-color:#fff;width:650px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto" >
|
||||
<table class="table table-mail" style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
|
||||
<tr>
|
||||
<td class="space" style="width:20px;padding:7px 0"> </td>
|
||||
<td align="center" style="padding:7px 0">
|
||||
<table class="table" bgcolor="#ffffff" style="width:100%">
|
||||
<tr>
|
||||
<td align="center" class="logo" style="border-bottom:4px solid #333333;padding:7px 0">
|
||||
<a title="{shop_name}" href="{shop_url}" style="color:#337ff1">
|
||||
<img src="{shop_logo}" alt="{shop_name}" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center" class="titleblock" style="padding:7px 0">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi {firstname} {lastname},</span>
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box" style="border:1px solid #D6D4D4;background-color:#f8f8f8;padding:7px 0">
|
||||
<table class="table" style="width:100%">
|
||||
<tr>
|
||||
<td width="10" style="padding:7px 0"> </td>
|
||||
<td style="padding:7px 0">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
<p data-html-only="1" style="border-bottom:1px solid #D6D4D4;margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;padding-bottom:10px">
|
||||
VOUCHER GENERATED
|
||||
</p>
|
||||
<span style="color:#777">
|
||||
Your voucher has been generated successfully against your credit slip #{credit_slip_id}.
|
||||
<br/><br/>
|
||||
<span style="color:#333"><strong>Voucher Code: <span>{voucher_code}</span></strong></span> for an amount of <span style="color:#333"><strong>{voucher_amount}.</strong></span><br /><br />
|
||||
To use this voucher just copy and paste this code during payment process for your next order.
|
||||
</span>
|
||||
</font>
|
||||
</td>
|
||||
<td width="10" style="padding:7px 0"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="footer" style="border-top:4px solid #333333;padding:7px 0">
|
||||
<span><a href="{shop_url}" style="color:#337ff1">{shop_name}</a> powered by <a href="http://www.webkul.com/" style="color:#337ff1">Webkul™</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="space" style="width:20px;padding:7px 0"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
16
mails/en/credit_slip_voucher.txt
Normal file
16
mails/en/credit_slip_voucher.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
[/{shop_url}]
|
||||
|
||||
Hi {firstname} {lastname},
|
||||
|
||||
VOUCHER GENERATED
|
||||
|
||||
Your voucher has been generated successfully against your credit slip #{credit_slip_id}.
|
||||
|
||||
VOUCHER CODE: {voucher_code} for an amount of {voucher_amount}.
|
||||
|
||||
To use this voucher just copy and paste this code during payment process for your next
|
||||
order.
|
||||
|
||||
{shop_name} [/{shop_url}] powered by Webkul(tm)
|
||||
[http://www.webkul.com/]
|
||||
@@ -73,7 +73,7 @@
|
||||
<td align="center" class="titleblock" style="padding:7px 0">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
<span class="title" style="font-weight:500;font-size:28px;text-transform:capitalize;line-height:33px">Hi {firstname} {lastname},</span><br/>
|
||||
<span class="subtitle" style="font-weight:500;font-size:16px;line-height:25px">A request has been generated for the booking cancellation.</span>
|
||||
<span class="subtitle" style="font-weight:500;font-size:16px;line-height:25px">A request has been generated for booking cancellations.</span>
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -104,7 +104,7 @@
|
||||
<tr>
|
||||
<td style="padding:7px 0">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
<p data-html-only="1" style="margin:10px 0 7px;text-transform:uppercase;font-weight:500;font-size:16px;padding-bottom:0px">Booking details</p>
|
||||
<p data-html-only="1" style="margin:10px 0 7px;text-transform:uppercase;font-weight:500;font-size:16px;padding-bottom:0px">Requested Booking Cancellations</p>
|
||||
<table class="table table-recap" bgcolor="#ffffff" style="width:100%;border-collapse:collapse"><!-- Title -->
|
||||
<tr>
|
||||
<tr>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Message from {shop_name}
|
||||
|
||||
Hi {firstname} {lastname},
|
||||
A request has been generated for the booking cancellation.
|
||||
A request has been generated for booking cancellations.
|
||||
|
||||
Order details
|
||||
|
||||
@@ -9,7 +9,7 @@ Order: {order_reference} Placed on {order_date}
|
||||
Refund Status: {status_name}
|
||||
Cancelation Reason: {cancelation_reason}
|
||||
|
||||
Booking details
|
||||
Requested Booking Cancellations
|
||||
|
||||
Room Num
|
||||
Room Type
|
||||
|
||||
@@ -46,7 +46,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
|
||||
/*for showing status of booking with badge_danger or success*/
|
||||
$this->fields_list = array(
|
||||
'id_order' => array(
|
||||
'title' => $this->l('Id Order'),
|
||||
'title' => $this->l('Order ID'),
|
||||
'align' => 'center',
|
||||
'class' => 'fixed-width-xs',
|
||||
'callback' => 'setOrderLink',
|
||||
@@ -164,12 +164,12 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
|
||||
}
|
||||
$this->fields_list = array(
|
||||
'id_order_return' => array(
|
||||
'title' => $this->l('Id'),
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'center',
|
||||
'class' => 'fixed-width-xs',
|
||||
),
|
||||
'id_order' => array(
|
||||
'title' => $this->l('Id Order'),
|
||||
'title' => $this->l('Order ID'),
|
||||
'align' => 'center',
|
||||
'class' => 'fixed-width-xs',
|
||||
'callback' => 'setOrderLink',
|
||||
@@ -249,6 +249,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
|
||||
$this->context->language->id),
|
||||
'currentStateInfo' => (array) new OrderReturnState($objOrderReturn->state,
|
||||
$this->context->language->id),
|
||||
'current_id_lang' => $this->context->language->id,
|
||||
'refundStatuses' => $refundStatuses,
|
||||
'isRefundCompleted' => $objOrderReturn->hasBeenCompleted(),
|
||||
'paymentMethods' => $paymentMethods,
|
||||
@@ -402,7 +403,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
|
||||
$objOrderReturn->refunded_amount = $totalRefundedAmount;
|
||||
if ($objOrderReturn->save()) {
|
||||
// change state of the order refund
|
||||
$objOrderReturn->changeIdOrderReturnState($idRefundState, $idOrderReturn);
|
||||
$objOrderReturn->changeIdOrderReturnState($idRefundState);
|
||||
|
||||
if ($objRefundState->refunded || $objRefundState->denied) {
|
||||
// check if order is paid the set status of the order to refunded
|
||||
@@ -434,6 +435,10 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
|
||||
if (!$idCreditSlip = OrderSlip::create($objOrder, $bookingList, 0, 0, 0, 0)) {
|
||||
$this->errors[] = $this->l('A credit slip cannot be generated. ');
|
||||
} else {
|
||||
$objOrderReturn->id_return_type = $idCreditSlip;
|
||||
$objOrderReturn->return_type = OrderReturn::RETURN_TYPE_ORDER_SLIP;
|
||||
$objOrderReturn->save();
|
||||
|
||||
Hook::exec('actionOrderSlipAdd', array('order' => $objOrder, 'bookingList' => $bookingList));
|
||||
|
||||
@Mail::Send(
|
||||
@@ -452,13 +457,11 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
|
||||
(int)$objOrder->id_shop
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Generate voucher
|
||||
if (Tools::isSubmit('generateDiscount') && !count($this->errors)) {
|
||||
} elseif (Tools::isSubmit('generateDiscount') && !count($this->errors)) {
|
||||
// Generate voucher
|
||||
$cartrule = new CartRule();
|
||||
$language_ids = Language::getIDs();
|
||||
$cartrule->description = sprintf($this->l('Credit card slip for order #%d'), $objOrder->id);
|
||||
$cartrule->description = sprintf($this->l('Voucher for order #%d'), $objOrder->id);
|
||||
foreach ($language_ids as $id_lang) {
|
||||
// Define a temporary name
|
||||
$cartrule->name[$id_lang] = 'V0C'.(int)($objOrder->id_customer).'O'.(int)($objOrder->id);
|
||||
@@ -483,7 +486,8 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
|
||||
if (!$cartrule->add()) {
|
||||
$this->errors[] = $this->errors('You cannot generate a voucher.');
|
||||
} else {
|
||||
$objOrderReturn->id_transaction = $cartrule->id;
|
||||
$objOrderReturn->id_return_type = $cartrule->id;
|
||||
$objOrderReturn->return_type = OrderReturn::RETURN_TYPE_CART_RULE;
|
||||
$objOrderReturn->save();
|
||||
// Update the voucher code and name
|
||||
foreach ($language_ids as $id_lang) {
|
||||
|
||||
@@ -42,11 +42,11 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
$('#refundTransactionAmount, #generateDiscount').click(function() {
|
||||
$('#generateCreditSlip, #generateDiscount').click(function() {
|
||||
if ($(this).is(':checked')) {
|
||||
$('#refundTransactionAmount, #generateDiscount').prop('checked', false);
|
||||
$('#generateCreditSlip, #generateDiscount').prop('checked', false);
|
||||
$(this).prop('checked', true);
|
||||
}
|
||||
$('#refundTransactionAmount').change();
|
||||
$('#generateCreditSlip').change();
|
||||
});
|
||||
});
|
||||
@@ -159,28 +159,57 @@
|
||||
{if $currentStateInfo['refunded']}
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-3">
|
||||
<strong>{l s='Payment mode' mod='hotelreservationsystem'} :</strong>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
{$orderReturnInfo['payment_mode']|escape:'html':'UTF-8'}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-3">
|
||||
<strong>{l s='Transaction ID' mod='hotelreservationsystem'} :</strong>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
{$orderReturnInfo['id_transaction']|escape:'html':'UTF-8'}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-3">
|
||||
<strong>{l s='Refunded amount' mod='hotelreservationsystem'} :</strong>
|
||||
<strong>{l s='Refunded amount:' mod='hotelreservationsystem'}</strong>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
{displayPrice price=$orderReturnInfo['refunded_amount'] currency=$orderInfo['id_currency']}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $orderReturnInfo['payment_mode'] != '' && $orderReturnInfo['id_transaction'] != ''}
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-3">
|
||||
<strong>{l s='Payment mode:' mod='hotelreservationsystem'}</strong>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
{$orderReturnInfo['payment_mode']|escape:'html':'UTF-8'}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-3">
|
||||
<strong>{l s='Transaction ID:' mod='hotelreservationsystem'}</strong>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
{$orderReturnInfo['id_transaction']|escape:'html':'UTF-8'}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if isset($orderReturnInfo['return_type'])}
|
||||
{if $orderReturnInfo['return_type'] == OrderReturn::RETURN_TYPE_CART_RULE}
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-3">
|
||||
<strong>{l s='Voucher ID:' mod='hotelreservationsystem'}</strong>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<a href="{$link->getAdminLink('AdminCartRules')}&updatecart_rule&id_cart_rule={$orderReturnInfo['id_return_type']}" target="_blank">#{$orderReturnInfo['id_return_type']}</a>
|
||||
</div>
|
||||
</div>
|
||||
{elseif $orderReturnInfo['return_type'] == OrderReturn::RETURN_TYPE_ORDER_SLIP}
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-3">
|
||||
<strong>{l s='Credit Slip ID:' mod='hotelreservationsystem'}</strong>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
#{$orderReturnInfo['id_return_type']}
|
||||
<a class="btn btn-default" href="{$link->getAdminLink('AdminPdf')}&submitAction=generateOrderSlipPDF&id_order_slip={$orderReturnInfo['id_return_type']}" title="#{Configuration::get('PS_CREDIT_SLIP_PREFIX', $current_id_lang)}{$orderReturnInfo['id_return_type']|string_format:'%06d'}">
|
||||
<i class="icon-file-text"></i>
|
||||
{l s='Download' mod='hotelreservationsystem'}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
{else}
|
||||
<div class="form-group">
|
||||
@@ -207,7 +236,7 @@
|
||||
<div class="col-sm-3">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input value="1" type="checkbox" name="generateCreditSlip" id="generateCreditSlip"/> {l s='Create Refund Slip' mod='hotelreservationsystem'}
|
||||
<input value="1" type="checkbox" name="generateCreditSlip" id="generateCreditSlip"/> {l s='Create Credit Slip' mod='hotelreservationsystem'}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -31,6 +31,15 @@
|
||||
<p class="info-title">
|
||||
{l s='Credit slips you have received after canceled orders'}.
|
||||
</p>
|
||||
|
||||
{include file="$tpl_dir./errors.tpl"}
|
||||
|
||||
{if isset($smarty.get.confirmation) && $smarty.get.confirmation}
|
||||
<p class="alert alert-success">
|
||||
{l s='Your voucher has been generated successfully and sent via email.'} <a href="{$link->getPageLink('discount', true)|escape:'html':'UTF-8'}">{'Click here'}</a> {' to see your all vouchers.'}
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<div class="block-center" id="block-history">
|
||||
{if $ordersSlip && count($ordersSlip)}
|
||||
<table id="order-list" class="table table-bordered footab">
|
||||
@@ -39,7 +48,9 @@
|
||||
<th data-sort-ignore="true" class="first_item">{l s='Credit slip'}</th>
|
||||
<th data-sort-ignore="true" class="item">{l s='Order'}</th>
|
||||
<th class="item">{l s='Date issued'}</th>
|
||||
<th data-sort-ignore="true" data-hide="phone" class="last_item">{l s='View credit slip'}</th>
|
||||
<th data-sort-ignore="true" data-hide="phone">{l s='View credit slip'}</th>
|
||||
<th data-sort-ignore="true">{l s='Status'}</th>
|
||||
<th data-sort-ignore="true" data-hide="phone" class="last_item">{l s='Actions'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -47,22 +58,40 @@
|
||||
<tr class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if} {if $smarty.foreach.myLoop.index % 2}alternate_item{/if}">
|
||||
<td class="bold">
|
||||
<span class="color-myaccount">
|
||||
{l s='#%s' sprintf=$slip.id_order_slip|string_format:"%06d"}
|
||||
#{Configuration::get('PS_CREDIT_SLIP_PREFIX', $lang_id)}{$slip.id_order_slip|string_format:"%06d"}
|
||||
</span>
|
||||
</td>
|
||||
<td class="history_method">
|
||||
<a class="color-myaccount" href="javascript:showOrder(1, {$slip.id_order|intval}, '{$link->getPageLink('order-detail')|escape:'html':'UTF-8'}');">
|
||||
{l s='#%s' sprintf=$slip.id_order|string_format:"%06d"}
|
||||
#{$slip.id_order|string_format:"%06d"}
|
||||
</a>
|
||||
</td>
|
||||
<td class="bold" data-value="{$slip.date_add|regex_replace:"/[\-\:\ ]/":""}">
|
||||
{dateFormat date=$slip.date_add full=0}
|
||||
</td>
|
||||
<td class="history_invoice">
|
||||
<a class="link-button" href="{$link->getPageLink('pdf-order-slip', true, NULL, "id_order_slip={$slip.id_order_slip|intval}")|escape:'html':'UTF-8'}" title="{l s='Credit slip'} {l s='#%s' sprintf=$slip.id_order_slip|string_format:"%06d"}">
|
||||
<a class="link-button" href="{$link->getPageLink('pdf-order-slip', true, NULL, "id_order_slip={$slip.id_order_slip|intval}")|escape:'html':'UTF-8'}" title="{l s='Credit slip'} #{Configuration::get('PS_CREDIT_SLIP_PREFIX', $lang_id)}{$slip.id_order_slip|string_format:"%06d"}">
|
||||
<i class="icon-file-text large"></i>{l s='PDF'}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{if $slip.redeem_status == OrderSlip::REDEEM_STATUS_REDEEMED}
|
||||
<span class="badge badge-danger">{l s='Redeemed'}</span>
|
||||
{else}
|
||||
<span class="badge badge-success">{l s='Active'}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
{if $slip.redeem_status == OrderSlip::REDEEM_STATUS_ACTIVE && !$slip.id_cart_rule}
|
||||
<a href="{$link->getPageLink('order-slip', true, NULL, "generateVoucher=1&id_order_slip={$slip.id_order_slip|intval}")|escape:'html':'UTF-8'}" title="{l s='Generate voucher for credit slip '} #{Configuration::get('PS_CREDIT_SLIP_PREFIX', $lang_id)}{$slip.id_order_slip|string_format:"%06d"}">
|
||||
<u>{l s='Generate Voucher'}</u>
|
||||
</a>
|
||||
{elseif $slip.redeem_status == OrderSlip::REDEEM_STATUS_REDEEMED && $slip.id_cart_rule}
|
||||
<span class="badge badge-danger">{l s='Voucher Generated'}</span>
|
||||
{elseif $slip.redeem_status == OrderSlip::REDEEM_STATUS_REDEEMED && !$slip.id_cart_rule}
|
||||
--
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user