Merge pull request #1261 from sumitwebkul/order-detail-issues

Fixed: Issues in Admin Order detail page in back-office
This commit is contained in:
Rohit Jain
2024-10-04 19:15:11 +05:30
committed by GitHub
10 changed files with 1169 additions and 947 deletions

View File

@@ -35,9 +35,11 @@
<a class="btn btn-info" href="{$link->getAdminLink('AdminBookingDocument')}&action=getDocument&id_document={$booking_document.id_htl_booking_document}">
<i class="icon icon-cloud-download"></i>
</a>
<a class="btn btn-danger btn-delete-document" data-id-htl-booking-document="{$booking_document.id_htl_booking_document}">
<i class="icon icon-trash"></i>
</a>
{if $can_edit}
<a class="btn btn-danger btn-delete-document" data-id-htl-booking-document="{$booking_document.id_htl_booking_document}">
<i class="icon icon-trash"></i>
</a>
{/if}
</td>
</tr>
{/foreach}

View File

@@ -95,7 +95,7 @@
<i class="icon-pencil"></i> &nbsp;{l s='Edit note'}
{/if}
</a>
{if $document->getRestPaid()}
{if $can_edit && $document->getRestPaid()}
<a href="#form_add_payment_panel" class="btn btn-default js-set-payment anchor pull-right" data-amount="{$document->getRestPaid()}" data-id-invoice="{$document->id}" title="{l s='Set payment form'}">
<i class="icon-money"></i> &nbsp;{l s='Enter payment'}
</a>
@@ -117,7 +117,7 @@
</tbody>
</table>
{if !$orderDocuments|count && isset($invoice_management_active) && $invoice_management_active}
{if $can_edit && !$orderDocuments|count && isset($invoice_management_active) && $invoice_management_active}
<div class="well hidden-print">
<a class="btn btn-primary" href="{$current_index}&amp;viewOrder&amp;submitGenerateInvoice&amp;id_order={$order->id}{if isset($smarty.get.token)}&amp;token={$smarty.get.token|escape:'html':'UTF-8'}{/if}">
<i class="icon-file-text"></i> {l s='Generate invoice'}

View File

@@ -146,7 +146,7 @@
{if isset($refundReqBookings) && $refundReqBookings && $data.id|in_array:$refundReqBookings && $data.is_refunded}
<span class="badge badge-danger">{if $data.is_cancelled}{l s='Cancelled'}{else}{l s='Refunded'}{/if}</span>
{else}
{elseif $can_edit}
<a class="open_room_status_form btn btn-default" href="#" data-id_hotel_booking_detail="{$data['id']}" data-id_order="{$data['id_order']}" data-id_status="{$data['id_status']}" data-id_room="{$data['id_room']}" data-date_from="{$data['date_from']|date_format:"%Y-%m-%d"}" data-date_to="{$data['date_to']|date_format:"%Y-%m-%d"}" data-check_in_time="{$data['check_in_time']}" data-check_out_time="{$data['check_out_time']}">
<i class="icon-pencil"></i> {l s='Edit'}
</a>
@@ -220,14 +220,17 @@
<td style="background-color:{$row['color']};color:{$row['text-color']}">{$row['ostate_name']|stripslashes}</td>
<td style="background-color:{$row['color']};color:{$row['text-color']}">{if $row['employee_lastname']}{$row['employee_firstname']|stripslashes} {$row['employee_lastname']|stripslashes}{/if}</td>
<td style="background-color:{$row['color']};color:{$row['text-color']}">{dateFormat date=$row['date_add'] full=true}</td>
<td style="background-color:{$row['color']};color:{$row['text-color']}" class="text-right">
{if $row['send_email']|intval}
<a class="btn btn-default" href="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&amp;vieworder&amp;id_order={$order->id|intval}&amp;sendStateEmail={$row['id_order_state']|intval}&amp;id_order_history={$row['id_order_history']|intval}" title="{l s='Resend this email to the customer'}">
<i class="icon-mail-reply"></i>
{l s='Resend email'}
</a>
{/if}
</td>
{if $can_edit}
<td style="background-color:{$row['color']};color:{$row['text-color']}" class="text-right">
{if $row['send_email']|intval}
<a class="btn btn-default" href="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&amp;vieworder&amp;id_order={$order->id|intval}&amp;sendStateEmail={$row['id_order_state']|intval}&amp;id_order_history={$row['id_order_history']|intval}" title="{l s='Resend this email to the customer'}">
<i class="icon-mail-reply"></i>
{l s='Resend email'}
</a>
{/if}
</td>
{/if}
</tr>
{else}
<tr>
@@ -235,14 +238,16 @@
<td>{$row['ostate_name']|stripslashes}</td>
<td>{if $row['employee_lastname']}{$row['employee_firstname']|stripslashes} {$row['employee_lastname']|stripslashes}{else}&nbsp;{/if}</td>
<td>{dateFormat date=$row['date_add'] full=true}</td>
<td class="text-right">
{if $row['send_email']|intval}
<a href="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&amp;vieworder&amp;id_order={$order->id|intval}&amp;sendStateEmail={$row['id_order_state']|intval}&amp;id_order_history={$row['id_order_history']|intval}" title="{l s='Resend this email to the customer'}">
<i class="icon-mail-reply"></i>
{l s='Resend email'}
</a>
{/if}
</td>
{if $can_edit}
<td class="text-right">
{if $row['send_email']|intval}
<a href="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&amp;vieworder&amp;id_order={$order->id|intval}&amp;sendStateEmail={$row['id_order_state']|intval}&amp;id_order_history={$row['id_order_history']|intval}" title="{l s='Resend this email to the customer'}">
<i class="icon-mail-reply"></i>
{l s='Resend email'}
</a>
{/if}
</td>
{/if}
</tr>
{/if}
{/foreach}
@@ -251,7 +256,7 @@
</div>
<!-- Change status form -->
{* If current state is refunded or cancelled the further order status changes are not allowed *}
{if !isset($currentState) || (isset($currentState) && ($currentState->id != Configuration::get('PS_OS_REFUND') && $currentState->id != Configuration::get('PS_OS_CANCELED')))}
{if $can_edit && (!isset($currentState) || (isset($currentState) && ($currentState->id != Configuration::get('PS_OS_REFUND') && $currentState->id != Configuration::get('PS_OS_CANCELED'))))}
<form action="{$currentIndex|escape:'html':'UTF-8'}&amp;vieworder&amp;id_order={$order->id|intval}&amp;token={$smarty.get.token}" method="post" class="form-horizontal well hidden-print">
<div class="row">
<div class="col-lg-9">
@@ -475,12 +480,14 @@
</table>
</div>
</div>
<div class="form-group">
<button class="btn btn-primary add_new_payment" id="add_new_payment">
<i class="icon-plus-sign"></i> {l s='Add new payment'}
</button>
</div>
{if (!$order->valid && sizeof($currencies) > 1)}
{if $can_edit}
<div class="form-group">
<button class="btn btn-primary add_new_payment" id="add_new_payment">
<i class="icon-plus-sign"></i> {l s='Add new payment'}
</button>
</div>
{/if}
{if $can_edit && (!$order->valid && sizeof($currencies) > 1)}
<form class="form-horizontal well" method="post" action="{$currentIndex|escape:'html':'UTF-8'}&amp;vieworder&amp;id_order={$order->id}&amp;token={$smarty.get.token|escape:'html':'UTF-8'}">
<div class="form-group">
<label class="control-label col-lg-2 col-md-3 text-left">{l s='Change currency'}</label>
@@ -561,8 +568,11 @@
</dl>
<form method="post" action="index.php?tab=AdminCustomers&amp;id_customer={$customer->id}&amp;id_order={$order->id|intval}&amp;token={getAdminToken tab='AdminCustomers'}">
<input type="hidden" name="id_lang" value="{$order->id_lang}" />
<input class="btn btn-primary" type="submit" name="submitGuestToCustomer" value="{l s='Transform this guest into a customer'}" />
<p class="help-block">{l s='This feature will generate a random password and send an email to the customer.'}</p>
{if $can_edit}
<button class="btn btn-primary" type="submit" name="submitGuestToCustomer"><i class='icon-refresh'></i> {l s='Transform this guest into a customer'}</button>
<p class="help-block">{l s='This feature will generate a random password and send an email to the customer.'}</p>
{/if}
</form>
{else}
<div class="alert alert-warning">
@@ -604,13 +614,15 @@
<textarea rows="3" name="note" id="noteContent" class="textarea-autosize" onkeyup="$(this).val().length > 0 ? $('#submitCustomerNote').removeAttr('disabled') : $('#submitCustomerNote').attr('disabled', 'disabled')">{$customer->note}</textarea>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<button type="submit" id="submitCustomerNote" class="btn btn-primary pull-right" disabled="disabled">
<i class="icon-save"></i> {l s='Add Note'}
</button>
{if $can_edit}
<div class="row">
<div class="col-lg-12">
<button type="submit" id="submitCustomerNote" class="btn btn-primary pull-right" disabled="disabled">
<i class="icon-save"></i> {l s='Add Note'}
</button>
</div>
</div>
</div>
{/if}
<span id="note_feedback"></span>
</form>
</div>
@@ -812,7 +824,7 @@
<div class="panel" id="refundForm">
<div class="panel-heading">
<i class="icon-bed"></i> &nbsp;{l s='Rooms Booking Detail'} <span class="badge">{$order_detail_data|@count}</span>
{if !$order->hasBeenDelivered() && $currentState->id != Configuration::get('PS_OS_REFUND') && $currentState->id != Configuration::get('PS_OS_CANCELED')}
{if $can_edit && (!$order->hasBeenDelivered() && $currentState->id != Configuration::get('PS_OS_REFUND') && $currentState->id != Configuration::get('PS_OS_CANCELED'))}
<button type="button" id="add_room" class="btn btn-primary pull-right">
<i class="icon-plus-sign"></i> {l s='Add Rooms'}
</button>
@@ -851,61 +863,66 @@
{assign var=order_shipping_price value=$order->total_shipping_tax_incl}
{/if}
{assign var=room_price_tax_excl value=$order->getTotalProductsWithoutTaxes(false, true)}
{assign var=room_price_tax_incl value=$order->getTotalProductsWithTaxes(false, true)}
{assign var=service_products_price_tax_excl value=$order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE)}
{assign var=service_products_price_tax_incl value=$order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE)}
{assign var=convenience_fee_price_tax_excl value=$order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT)}
{assign var=convenience_fee_price_tax_incl value=$order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT)}
{assign var=additional_service_price_tax_excl value=($order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $totalDemandsPriceTE)}
{assign var=additional_service_price_tax_incl value=($order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $totalDemandsPriceTI)}
{if $room_price_tax_excl}
{* total extra demands prices *}
{* $totalDemandsPriceTE
$totalDemandsPriceTI *}
{* Get total rooms prices *}
{assign var=total_rooms_price_tax_excl value=$order->getTotalProductsWithoutTaxes(false, true)}
{assign var=total_rooms_price_tax_incl value=$order->getTotalProductsWithTaxes(false, true)}
{* Get total extra services including convenience fees prices *}
{assign var=total_services_price_tax_excl value=$order->getTotalProductsWithoutTaxes(false, false)}
{assign var=total_services_price_tax_incl value=$order->getTotalProductsWithTaxes(false, false)}
{* Get total of extra services and extra demands prices(excluding convenience fee) *}
{assign var=total_room_services_and_demands_tax_excl value=($order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $totalDemandsPriceTE)}
{assign var=total_room_services_and_demands_tax_incl value=($order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $totalDemandsPriceTI)}
{* Get total of only convenience fees prices *}
{assign var=total_convenience_fee_tax_excl value=$order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT)}
{assign var=total_convenience_fee_tax_incl value=$order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT)}
{assign var=order_total_price_tax_excl value=($total_rooms_price_tax_excl + $total_services_price_tax_excl + $totalDemandsPriceTE)}
{assign var=order_total_price_tax_incl value=($total_rooms_price_tax_incl + $total_services_price_tax_incl + $totalDemandsPriceTI)}
{if $total_rooms_price_tax_excl}
<tr id="total_products">
<td class="text-right">{l s='Total Rooms Cost (Tax excl.)'}</td>
<td class="amount text-right nowrap">
{displayPrice price=$room_price_tax_excl currency=$currency->id}
{displayPrice price=$total_rooms_price_tax_excl currency=$currency->id}
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{if isset($additional_service_price_tax_excl) && $additional_service_price_tax_excl > 0}
{if isset($total_room_services_and_demands_tax_excl) && $total_room_services_and_demands_tax_excl > 0}
<tr id="total_products">
<td class="text-right">{l s='Total Extra services (Tax excl.)'}</td>
<td class="amount text-right nowrap">
{displayPrice price=($additional_service_price_tax_excl - $convenience_fee_price_tax_excl) currency=$currency->id}
{displayPrice price=($total_room_services_and_demands_tax_excl - $total_convenience_fee_tax_excl) currency=$currency->id}
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{if $service_products_price_tax_excl}
<tr id="total_products">
<td class="text-right">{l s='Total service products cost (Tax excl.)'}</td>
<td class="amount text-right nowrap">
{displayPrice price=$service_products_price_tax_excl currency=$currency->id}
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{if isset($convenience_fee_price_tax_excl) && $convenience_fee_price_tax_excl > 0}
{if isset($total_convenience_fee_tax_excl) && $total_convenience_fee_tax_excl > 0}
<tr id="total_products">
<td class="text-right">
{l s='Convenience Fee (Tax excl.)'}
{if isset($booking_auto_added_services) && count($booking_auto_added_services)}
{if isset($order_convenience_fee_services) && count($order_convenience_fee_services)}
<span role="button" id="view_convenience_services" class="pull-left"><i class="icon-angle-down icon-bold"></i><i class="icon-angle-up icon-bold" style="display:none;"></i></span>
{/if}
</td>
<td class="amount text-right nowrap">
{displayPrice price=$convenience_fee_price_tax_excl currency=$currency->id}
{displayPrice price=$total_convenience_fee_tax_excl currency=$currency->id}
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{if isset($booking_auto_added_services) && count($booking_auto_added_services)}
{if isset($order_convenience_fee_services) && count($order_convenience_fee_services)}
<tr id="convenience_services" style="display:none;">
<td colspan="3" class="panel">
<table class="table table-responsive">
<tbody>
{foreach $booking_auto_added_services as $service}
{foreach $order_convenience_fee_services as $service}
<tr>
<td class="text-left"><span>{$service.name}</span></td>
<td class="text-right"><span>{displayPrice price=$service.total_price_tax_excl currency=$currency->id}</span></td>
@@ -921,41 +938,41 @@
<tr id="total_taxes">
<td class="text-right">
<strong>{l s='Total Taxes'} </strong>
{if ($order->total_paid_tax_incl - $order->total_paid_tax_excl) > 0}
{if ($order_total_price_tax_incl - $order_total_price_tax_excl) > 0}
<span role="button" id="view_order_tax_details" class="pull-left"><i class="icon-angle-down icon-bold"></i><i class="icon-angle-up icon-bold" style="display:none;"></i></span>
{/if}
</td>
<td class="amount text-right nowrap" ><strong>{displayPrice price=(($order->total_paid_tax_incl + $order->total_discounts_tax_incl) - ($order->total_paid_tax_excl + $order->total_discounts_tax_excl)) currency=$currency->id}</strong>
<td class="amount text-right nowrap" ><strong>{displayPrice price=($order_total_price_tax_incl - $order_total_price_tax_excl) currency=$currency->id}</strong>
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{if ($order->total_paid_tax_incl - $order->total_paid_tax_excl) > 0}
{if ($order_total_price_tax_incl - $order_total_price_tax_excl) > 0}
<tr id="order_tax_details" style="display:none;">
<td colspan="3" class="panel">
<table class="table table-responsive">
<tbody>
{if $room_price_tax_excl}
{if $total_rooms_price_tax_excl}
<tr>
<td class="text-left">{l s='Total Rooms Tax'}</td>
<td class="text-right">
{displayPrice price=($room_price_tax_incl - $room_price_tax_excl) currency=$currency->id}
{displayPrice price=($total_rooms_price_tax_incl - $total_rooms_price_tax_excl) currency=$currency->id}
</td>
</tr>
{/if}
{if isset($additional_service_price_tax_incl) && (($additional_service_price_tax_incl - $additional_service_price_tax_excl) - ($convenience_fee_price_tax_incl - $convenience_fee_price_tax_excl)) > 0}
{if isset($total_room_services_and_demands_tax_incl) && (($total_room_services_and_demands_tax_incl - $total_room_services_and_demands_tax_excl) - ($total_convenience_fee_tax_incl - $total_convenience_fee_tax_excl)) > 0}
<tr>
<td class="text-left">{l s='Extra services Tax'}</td>
<td class="text-right nowrap">
{displayPrice price=(($additional_service_price_tax_incl - $additional_service_price_tax_excl) - ($convenience_fee_price_tax_incl - $convenience_fee_price_tax_excl)) currency=$currency->id}
{displayPrice price=(($total_room_services_and_demands_tax_incl - $total_room_services_and_demands_tax_excl) - ($total_convenience_fee_tax_incl - $total_convenience_fee_tax_excl)) currency=$currency->id}
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
{/if}
{if isset($convenience_fee_price_tax_excl) && $convenience_fee_price_tax_excl > 0}
{if isset($total_convenience_fee_tax_excl) && $total_convenience_fee_tax_excl > 0}
<tr id="total_products">
<td class="text-left">{l s='Convenience Fee Tax'}</td>
<td class="amount text-right nowrap">
{displayPrice price=($convenience_fee_price_tax_incl - $convenience_fee_price_tax_excl) currency=$currency->id}
{displayPrice price=($total_convenience_fee_tax_incl - $total_convenience_fee_tax_excl) currency=$currency->id}
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
@@ -969,7 +986,7 @@
<tr id="total_discounts" {if $order->total_discounts_tax_incl == 0}style="display: none;"{/if}>
<td class="text-right"><strong>{l s='Total Booking Amount'}</strong></td>
<td class="amount text-right nowrap">
<strong>{displayPrice price=($order->total_paid_tax_incl + $order->total_discounts_tax_incl) currency=$currency->id}</strong>
<strong>{displayPrice price=($order_total_price_tax_incl) currency=$currency->id}</strong>
</td>
<td class="partial_refund_fields current-edit" style="display:none;"></td>
</tr>
@@ -1023,7 +1040,7 @@
<div class="panel panel-vouchers">
<div class="panel-heading">
<span><i class="icon-tag"></i> &nbsp;{l s='Voucher'}</span>
{if $can_edit}
{if $can_edit && $order->total_paid > 0}
<button id="add_voucher" class="btn btn-primary pull-right" type="button" >
<i class="icon-ticket"></i> {l s='Add new voucher'}
</button>
@@ -1139,49 +1156,53 @@
<a href="{$link->getAdminLink('AdminCustomerThreads')|escape:'html':'UTF-8'}&amp;id_order={$order->id|intval}" class="pull-right">{l s='Show all messages'}</a>
</div>
<div id="messages">
<form action="{$smarty.server.REQUEST_URI|escape:'html':'UTF-8'}&amp;token={$smarty.get.token|escape:'html':'UTF-8'}" method="post" onsubmit="if (getE('visibility').checked == true) return confirm('{l s='Do you want to send this message to the customer?'}');">
<div id="message" class="form-horizontal">
{if $can_edit}
<form action="{$smarty.server.REQUEST_URI|escape:'html':'UTF-8'}&amp;token={$smarty.get.token|escape:'html':'UTF-8'}" method="post" onsubmit="if (getE('visibility').checked == true) return confirm('{l s='Do you want to send this message to the customer?'}');">
<div id="message" class="form-horizontal">
<div class="form-group">
<label class="control-label">{l s='Choose a standard message'}</label>
<p>
<select class="chosen form-control" name="order_message" id="order_message" onchange="orderOverwriteMessage(this, '{l s='Do you want to overwrite your existing message?'}')">
<option value="0" selected="selected">-</option>
{foreach from=$orderMessages item=orderMessage}
<option value="{$orderMessage['message']|escape:'html':'UTF-8'}">{$orderMessage['name']}</option>
{/foreach}
</select>
</p>
<div>
<a href="{$link->getAdminLink('AdminOrderMessage')|escape:'html':'UTF-8'}">
{l s='Configure predefined messages'}
<i class="icon-external-link"></i>
</a>
</div>
</div>
<div class="row">
<label class="control-label">{l s='Message'}</label>
<textarea rows="3" id="txt_msg" class="textarea-autosize" name="message">{Tools::getValue('message')|escape:'html':'UTF-8'}</textarea>
</div>
<div class="form-group">
<label class="control-label">{l s='Choose a standard message'}</label>
<p>
<select class="chosen form-control" name="order_message" id="order_message" onchange="orderOverwriteMessage(this, '{l s='Do you want to overwrite your existing message?'}')">
<option value="0" selected="selected">-</option>
{foreach from=$orderMessages item=orderMessage}
<option value="{$orderMessage['message']|escape:'html':'UTF-8'}">{$orderMessage['name']}</option>
{/foreach}
</select>
</p>
<div>
<a href="{$link->getAdminLink('AdminOrderMessage')|escape:'html':'UTF-8'}">
{l s='Configure predefined messages'}
<i class="icon-external-link"></i>
</a>
<p class="checkbox">
<label class="control-label" for="visibility">
<input type="checkbox" name="visibility" id="visibility" value="1" />
{l s='Display Message to Customer?'}
</label>
</p>
</div>
<input type="hidden" name="id_order" value="{$order->id}" />
<input type="hidden" name="id_customer" value="{$order->id_customer}" />
<div class="row">
<button type="submit" id="submitMessage" class="btn btn-primary pull-right" name="submitMessage">
<i class="icon-paper-plane"></i> {l s='Send Message'}
</button>
</div>
</div>
<div class="row">
<label class="control-label">{l s='Message'}</label>
<textarea rows="3" id="txt_msg" class="textarea-autosize" name="message">{Tools::getValue('message')|escape:'html':'UTF-8'}</textarea>
</div>
<div class="form-group">
<p class="checkbox">
<label class="control-label" for="visibility">
<input type="checkbox" name="visibility" id="visibility" value="1" />
{l s='Display Message to Customer?'}
</label>
</p>
</div>
<input type="hidden" name="id_order" value="{$order->id}" />
<input type="hidden" name="id_customer" value="{$order->id_customer}" />
<div class="row">
<button type="submit" id="submitMessage" class="btn btn-primary pull-right" name="submitMessage">
<i class="icon-paper-plane"></i> {l s='Send Message'}
</button>
</div>
</div>
</form>
</form>
{else}
<div class="alert alert-warning">{l s='You do not have permission to edit this order.'}</div>
{/if}
</div>
</div>
</div>

View File

@@ -34,47 +34,49 @@
<tbody></tbody>
</table>
</div>
<hr>
<div class="well add-new-document-form" style="margin-top: 10px;">
<form class="form-horizontal" id="form-add-new-document" method="post" action="#">
<input type="hidden" name="id_htl_booking" value="0">
<div class="form-group">
<div class="col-sm-12">
<label class="control-label">
<span class="label-tooltip" data-toggle="tooltip" title="" data-original-title="{l s='Write the title for the document. Invalid characters <>;=#{}'}">
{l s='Title'}
</span>
</label>
<input class="form-control" type="text" name="title" value="" placeholder="{l s='eg. passport, driving license'}" />
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<label class="control-label required">
<span class="label-tooltip" data-toggle="tooltip" title="" data-original-title="{l s='Choose the document file to be uploaded.'}">
{l s='File'}
</span>
</label>
<div class="input-file-wrap"></div>
<div class="input-group">
<input class="form-control file-name" type="text" readonly="">
<span class="input-group-btn">
<button type="button" class="btn btn-primary btn-add-file">
<i class="icon-folder-open"></i>
{l s='Add file'}
</button>
</span>
{if $can_edit}
<hr>
<div class="well add-new-document-form" style="margin-top: 10px;">
<form class="form-horizontal" id="form-add-new-document" method="post" action="#">
<input type="hidden" name="id_htl_booking" value="0">
<div class="form-group">
<div class="col-sm-12">
<label class="control-label">
<span class="label-tooltip" data-toggle="tooltip" title="" data-original-title="{l s='Write the title for the document. Invalid characters <>;=#{}'}">
{l s='Title'}
</span>
</label>
<input class="form-control" type="text" name="title" value="" placeholder="{l s='eg. passport, driving license'}" />
</div>
<p class="text-left" style="margin-top: 4px; font-style: italic;">
{l s='Upload a PDF or an image file. Allowed image formats: .gif, .jpg, .jpeg and .png'}
</p>
</div>
</div>
<button class="btn btn-primary pull-right upload" type="submit" name="uploadDocument" id="uploadDocument" style="display:none;">
{l s='Upload'}
</button>
</form>
</div>
<div class="form-group">
<div class="col-sm-12">
<label class="control-label required">
<span class="label-tooltip" data-toggle="tooltip" title="" data-original-title="{l s='Choose the document file to be uploaded.'}">
{l s='File'}
</span>
</label>
<div class="input-file-wrap"></div>
<div class="input-group">
<input class="form-control file-name" type="text" readonly="">
<span class="input-group-btn">
<button type="button" class="btn btn-primary btn-add-file">
<i class="icon-folder-open"></i>
{l s='Add file'}
</button>
</span>
</div>
<p class="text-left" style="margin-top: 4px; font-style: italic;">
{l s='Upload a PDF or an image file. Allowed image formats: .gif, .jpg, .jpeg and .png'}
</p>
</div>
</div>
<button class="btn btn-primary pull-right upload" type="submit" name="uploadDocument" id="uploadDocument" style="display:none;">
{l s='Upload'}
</button>
</form>
</div>
{/if}
</div>
</div>

View File

@@ -191,14 +191,14 @@ abstract class PaymentModuleCore extends Module
if (!$this->active) {
PrestaShopLogger::addLog('PaymentModule::validateOrder - Module is not active', 3, null, 'Cart', (int)$id_cart, true);
die(Tools::displayError());
die(Tools::displayError('Error in processing order. Payment module is not active.'));
}
// Does order already exists ?
if (Validate::isLoadedObject($this->context->cart) && $this->context->cart->OrderExists() == false) {
if ($secure_key !== false && $secure_key != $this->context->cart->secure_key) {
PrestaShopLogger::addLog('PaymentModule::validateOrder - Secure key does not match', 3, null, 'Cart', (int)$id_cart, true);
die(Tools::displayError());
die(Tools::displayError('Error processing order. Secure key does not match.'));
}
// For each package, generate an order

View File

@@ -867,6 +867,12 @@ class OrderCore extends ObjectModel
WHERE ocr.`id_order` = '.(int)$this->id);
}
public function getCartRulesTotal($useTax = false)
{
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(
'SELECT '.($useTax ? 'SUM(ocr.`value`)' : 'SUM(ocr.`value_tax_excl`)').' FROM `'._DB_PREFIX_.'order_cart_rule` ocr WHERE ocr.`id_order` = '.(int)$this->id);
}
public static function getDiscountsCustomer($id_customer, $id_cart_rule)
{
$cache_id = 'Order::getDiscountsCustomer_'.(int)$id_customer.'-'.(int)$id_cart_rule;
@@ -2847,4 +2853,32 @@ class OrderCore extends ObjectModel
return $result;
}
/**
* @param bool $useTax: if true, total with tax, if false, total without tax
* @param bool $withDiscounts: if true, total including discount, if false, total excluding discount
* @return float total of the order
*/
public function getOrderTotal($useTax = true, $withDiscounts = true)
{
// Get total of rooms and services
if ($useTax) {
$totalRoomsAndServices = $this->getTotalProductsWithTaxes();
} else {
$totalRoomsAndServices = $this->getTotalProductsWithoutTaxes();
}
// Get total of extra demands
$objBookingDemand = new HotelBookingDemands();
$totalExtraDemands = $objBookingDemand->getRoomTypeBookingExtraDemands($this->id, 0, 0, 0, 0, 0, 1, $useTax);
// Get cart rules total
$orderTotalDiscount = $this->getCartRulesTotal($useTax);
// Update order with new amounts after removing cart rule
$totalOrder = ($totalExtraDemands + $totalRoomsAndServices) - $orderTotalDiscount;
$totalOrder = $totalOrder > 0 ? $totalOrder : 0;
return $totalOrder;
}
}

View File

@@ -310,8 +310,11 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$this->context = Context::getContext();
$cart_htl_data = array();
$service_product_data = array();
$room_extra_demands = array();
$room_additinal_services = array();
if (Module::isInstalled('hotelreservationsystem')) {
$obj_htl_bk_dtl = new HotelBookingDetail();
$obj_rm_type = new HotelRoomType();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
@@ -319,11 +322,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$customer = new Customer($this->order->id_customer);
if (!empty($order_details)) {
$processed_product = array();
$cart_htl_data = array();
$service_product_data = array();
$room_extra_demands = array();
$room_additinal_services = array();
$totalDemandsPriceTE = 0;
$totalDemandsPriceTI = 0;
foreach ($order_details as $type_key => $type_value) {

File diff suppressed because it is too large Load Diff

View File

@@ -2017,30 +2017,33 @@ const BookingDocumentsModal = {
});
},
deleteDocument: function($this) {
BookingDocumentsModal.hideErrors();
let idHtlBookingDocument = parseInt($($this).attr('data-id-htl-booking-document'));
let data = {
ajax: true,
action: 'deleteBookingDocument',
id_htl_booking_document: idHtlBookingDocument,
};
BookingDocumentsModal.beforeSubmit(function() {
let idHtlBookingDocument = parseInt($($this).attr('data-id-htl-booking-document'));
let data = {
ajax: true,
action: 'deleteBookingDocument',
id_htl_booking_document: idHtlBookingDocument,
};
$(".loading_overlay").show();
$.ajax({
url: admin_order_tab_link,
data: data,
type: 'POST',
dataType: 'JSON',
success: function(response) {
if (response.status) {
BookingDocumentsModal.setBodyHtml(response.html);
BookingDocumentsModal.setDocumentsCount(response.num_checkin_documents);
showSuccessMessage(txt_booking_document_delete_success);
$(".loading_overlay").show();
$.ajax({
url: admin_order_tab_link,
data: data,
type: 'POST',
dataType: 'JSON',
success: function(response) {
if (response.status) {
BookingDocumentsModal.setBodyHtml(response.html);
BookingDocumentsModal.setDocumentsCount(response.num_checkin_documents);
showSuccessMessage(txt_booking_document_delete_success);
} else {
BookingDocumentsModal.showErrors(response.errors);
}
},
complete: function() {
$(".loading_overlay").hide();
}
},
complete: function() {
$(".loading_overlay").hide();
}
});
});
},
showErrors: function(errors) {

View File

@@ -268,7 +268,7 @@ class HotelBookingDemands extends ObjectModel
$numDays = $objBkDetail->getNumberOfDays($objBkDetail->date_from, $objBkDetail->date_to);
}
$totalTaxBase = $unitAmount * $numDays;
$totalTaxBase = $priceTaxExcl * $numDays;
$detail['total_tax_base'] = $totalTaxBase;
}