-
-
-
- {form_field field='currency_id'}
- {if $creditNote->getOrder()}
-
- {intl l="This credit note use the currency : %currency" d="creditnote.bo.default" currency=$creditNote->getCurrency()->getSymbol()}
- {else}
- {capture name="currency"}
-
- {/capture}
- {intl l="This credit note use the currency : %currency" d="creditnote.bo.default" currency=$smarty.capture.currency}
- {/if}
- {/form_field}
-
-
- {if $creditNote->getRef()}
-
- {intl l="Credit note ref : %ref" d="creditnote.bo.default" ref=$creditNote->getRef()}
-
- {/if}
-
- {if $creditNote->getInvoiceRef()}
-
- {intl l="Invoice ref : %ref" d="creditnote.bo.default" ref=$creditNote->getInvoiceRef()}
-
- {/if}
-
- {* Credit note status select *}
-
-
- {form_field field='status_id'}
-
- {/form_field}
-
-
- {* Credit note type select *}
-
-
- {form_field field='type_id'}
-
- {/form_field}
-
-
- {* Credit note customer select *}
-
-
- {form_field field='customer_id'}
-
- {/form_field}
-
-
- {* Credit note order select *}
- {$hasError = false}
- {if $creditNote->getCreditNoteType()->getRequiredOrder() && !$creditNote->getOrder()}
- {$hasError = true}
- {/if}
-
-
-
- {form_field field='order_id'}
-
- {/form_field}
-
-
-
-
- {* address invoice *}
-
-
-
{intl l="Invoice address" d="creditnote.bo.default"}
-
-
- {$other = false}
-
- {form_field field='invoice_address_id'}
- {if !$data}
- {$other = true}
- {/if}
-
- {/form_field}
-
-
-
-
-
-
-
-
- {* Credit note order *}
- {if $creditNote->getOrderId()}
-
- {include file="includes/credit-note-order.html" invoiced=$invoiced}
-
- {/if}
-
- {* Credit note order *}
-
-
-
{intl l="Free amount : " d="creditnote.bo.default"}
-
-
-
-
-
-
- |
- {intl l="Type" d="creditnote.bo.default"}
- |
-
- {intl l="Title" d="creditnote.bo.default"}
- |
-
- {intl l="Amount without tax %currency" d="creditnote.bo.default" currency=$creditNote->getCurrency()->getSymbol()}
- |
-
- {intl l="Tax rule" d="creditnote.bo.default"}
- |
-
- {intl l="Amount with tax %currency" d="creditnote.bo.default" currency=$creditNote->getCurrency()->getSymbol()}
- |
-
- {if !$invoiced}
-
- {/if}
- |
-
-
-
- {$i = 0}
- {foreach from=$creditNote->getCreditNoteDetails() key=key item=creditNoteDetail}
- {if !$creditNoteDetail->getOrderProductId()}
- {$i = $i + 1}
- {include file="includes/credit-note-free-amount.html"}
- {/if}
- {/foreach}
-
- |
-
- {intl l="No free amount." d="creditnote.bo.default"}
-
- |
-
-
-
-
-
-
-
-
-
-
- {if $creditNote->getOrder() !== null && $creditNote->getOrder()->getDiscount() > 0}
-
-
{intl l="Order discount informations : " d="creditnote.bo.default"}
-
-
-
- {form_field field='discount_without_tax'}
-
- {intl l="Discount without tax : " d="creditnote.bo.default"}
- getCreditNoteType()->getCode() == 'order_full_refund'}disabled{/if} />
-
- {/form_field}
-
-
- {form_field field='discount_with_tax'}
-
- {intl l="Discount with tax : " d="creditnote.bo.default"}
- getCreditNoteType()->getCode() == 'order_full_refund'}disabled{/if} />
-
- {/form_field}
-
-
-
-
- {/if}
-
-
-
-
-
{intl l="Credit Note Informations : " d="creditnote.bo.default"}
-
-
-
-
- {intl l="Total without tax : " d="creditnote.bo.default"}{format_money number=$creditNote->getTotalPrice() currency_id=$creditNote->getCurrencyId()}
-
-
-
-
- {intl l="Taxes : " d="creditnote.bo.default"}{format_money number=($creditNote->getTotalPriceWithTax() - $creditNote->getTotalPrice()) currency_id=$creditNote->getCurrencyId()}
-
-
-
-
- {intl l="Total with tax : " d="creditnote.bo.default"}{format_money number=$creditNote->getTotalPriceWithTax() currency_id=$creditNote->getCurrencyId()}
-
-
-
-
-
-
-
- {* Credit note comment *}
-
-
-
{intl l="Internal comment : " d="creditnote.bo.default"}
-
- {form_field field='comment'}
-
- {/form_field}
-
-
- {if $creditNote->getId()}
- {ifloop rel="credit-note-comment"}
-
-
- {loop type="credit-note-comment" name="credit-note-comment" credit_note_id=$creditNote->getId() order="id-reverse"}
-
{intl l="User" d="creditnote.bo.default"} : {$ADMIN_FIRST_NAME} {$ADMIN_LAST_NAME}{format_date date=$CREATE_DATE} :
-
-
- {$COMMENT|nl2br nofilter}
-
-
- {/loop}
-
-
- {/ifloop}
- {elseloop rel="credit-note-comment"}
-
- {intl l="No comments found for this credit note" d="creditnote.bo.default"}
-
- {/elseloop}
- {/if}
-
-
-
-
- {if $invoiced}
-
-
-
{intl l="Credit note used : " d="creditnote.bo.default"}
-
- {loop type="order-credit-note" name="order-credit-note" credit_note_id=$creditNote->getId()}
- {loop type="order" name="order" customer="*" backend_context=true id=$ORDER_ID}
-
- {intl l="Used by order :" d="creditnote.bo.default"}
{$REF}
-
- {/loop}
- {/loop}
-
-
-
- {/if}
-
- {* Credit note version *}
- {*{if $creditNote->getId()}
-
-
-
{intl l="Credit note versions : " d="creditnote.bo.default"}
-
- {ifloop rel="credit-note-version"}
- {loop type="credit-note-version" name="credit-note-version" id=$creditNote->getId()}
- // toto : credit note version
- {/loop}
- {/ifloop}
- {elseloop rel="credit-note-version"}
-
- {intl l="No version found for this credit note" d="creditnote.bo.default"}
-
- {/elseloop}
-
-
-
- {/if}*}
-
-
-
- {form_field field='ui_target'}
-
- {/form_field}
-
- {form_field field='ui_target_id'}
-
- {/form_field}
-
-{/form}
\ No newline at end of file
diff --git a/templates/backOffice/default/assets/js/script.js b/templates/backOffice/default/assets/js/script.js
deleted file mode 100755
index ccfb4e2..0000000
--- a/templates/backOffice/default/assets/js/script.js
+++ /dev/null
@@ -1,364 +0,0 @@
-"use strict";
-(function($) {
- var $modal = $('#modal-credit-note-delete');
-
- $modal.on('show.bs.modal', function(event){
- var url = $(event.relatedTarget).data('ajax-url');
-
- $modal.find('form').attr('action', url);
- });
-
-})(jQuery);
-
-(function($){
- var $modal = $('#modal-credit-note');
- var currentRequest;
- var lastAjaxUrl;
- // fix bug bootstrap 3 and select2
- $.fn.modal.Constructor.prototype.enforceFocus = function() {};
-
- /****** Modal methods ******/
- $modal.loaderOff = function(){
- $modal.find('.modal-loader').addClass('hidden');
- $modal.find('.modal-body').removeClass('hidden');
- };
-
- $modal.loaderOn = function(){
- $modal.find('.modal-loader').removeClass('hidden');
- $modal.find('.modal-body').addClass('hidden');
- };
-
- $modal.reset = function(){
- $modal.hideError();
- $modal.loaderOn();
- };
-
- $modal.loadAjax = function(event, data){
- if (typeof data === 'undefined') {
- data = {};
- }
-
- // kill last ajax request if not if it's not finished
- if (currentRequest) currentRequest.abort();
-
- var url = $(event.relatedTarget).data('ajax-url');
- if (typeof url === 'undefined') {
- url = lastAjaxUrl;
- } else {
- lastAjaxUrl = url;
- $modal.loaderOn();
- }
-
- if ($(event.relatedTarget).data('success-url')) {
- data['success-url'] = $(event.relatedTarget).data('success-url');
- }
-
- if (!data['credit_note_create[action]']) {
- data['credit_note_create[action]'] = 'view';
- }
-
- if ($(event.relatedTarget).data('credit-note-id')) {
- data['credit_note_create[credit_note_id]'] = $(event.relatedTarget).data('credit-note-id');
- }
-
- if ($(event.relatedTarget).data('order-id')) {
- data['credit_note_create[order_id]'] = $(event.relatedTarget).data('order-id');
- }
-
- if ($(event.relatedTarget).data('order-product-id')) {
- data['credit_note_create[order_product_quantity][' + $(event.relatedTarget).data('order-product-id') + ']'] = 1;
- }
-
- if ($(event.relatedTarget).data('type-id')) {
- data['credit_note_create[type_id]'] = $(event.relatedTarget).data('type-id');
- }
-
- if ($(event.relatedTarget).data('customer-id')) {
- data['credit_note_create[customer_id]'] = $(event.relatedTarget).data('customer-id');
- }
-
- // to avoid a display bug with select2
- setTimeout(function(data){
- // ajax start
- currentRequest = $.ajax({
- url: url,
- data: data,
- method: 'POST'
- });
-
- // ajax success
- currentRequest.done(function(data){
- $modal.loaderOff();
- $modal.find('.modal-body').html(data);
- $modal.modalReady();
- });
-
- // ajax error
- currentRequest.fail(function(jqXHR, textStatus){
- $modal.displayError(jqXHR, textStatus);
- });
- }, 100, data);
- };
-
- $modal.displayError = function(jqXHR, textStatus){
- if (jqXHR.statusText === 'abort') return;
- $modal.loaderOff();
- $modal.find('.modal-body').addClass('hidden');
- var $error = $modal.find('.modal-error').removeClass('hidden');
- $error.find('.textStatus').html(textStatus);
- $error.find('iframe').contents().find('html').html(jqXHR.responseText);
- };
-
- $modal.hideError = function(){
- $modal.find('.modal-error').addClass('hidden').find('iframe').contents().find('html').empty();
- };
- /****** End Modal methods ******/
-
- /****** Modal events ******/
- $modal.on('show.bs.modal', function(event){
- $modal.loadAjax(event);
- });
-
- $modal.on('hidden.bs.modal', function(){
- $modal.reset();
- lastAjaxUrl = undefined;
- });
- /****** End Modal events ******/
-
- $modal.modalReady = function(){
- var $form = $modal.find('.modal-body form');
-
- var initSelect = function($target){
- return $target.select2({
- templateResult: function(data){
- if (!data.id) return data.text;
- var prefix = data.element.dataset.color ? '
' : '';
- return $(prefix + '
' + data.text + '');
- },
- templateSelection: function(data){
- var prefix = data.element.dataset.color ? '
' : '';
- return $(prefix + '
' + data.text + '');
- }
- });
- };
-
- var initAjaxSelect = function($target){
- return $target.select2({
- ajax: {
- url: $target.data('url'),
- dataType: 'json',
- delay: 250,
- data: function (params){
- return {
- q: params.term,
- customerId: $target.data('customer-id')
- };
- },
- processResults: function (data){
- return {results: data.items};
- },
- error: function(jqXHR, textStatus){
- if (jqXHR.statusText === 'abort') return;
- $target.select2('destroy');
- $modal.displayError(jqXHR, textStatus);
- },
- cache: false
- },
- minimumInputLength: 3,
- placeholder: $target.data('placeholder'),
- templateResult: function(data){
- if (data.loading) return data.text;
-
- var markup = "
";
- markup += data.ref + ' : (' + data.firstname + ' ' + data.lastname + ')' + '' + data.address + '';
- markup += "
";
-
- return $(markup);
- },
- templateSelection: function(data){
- if (data.text) {
- return data.text;
- }
-
- return data.ref + ' : (' + data.firstname + ' ' + data.lastname + ')';
- }
- });
- };
-
- var $selectType = initSelect($form.find('.js-select-type'));
- var $selectStatus = initSelect($form.find('.js-select-status'));
- var $selectCustomer = initAjaxSelect($form.find('.js-select-customer'));
- var $selectInvoiceAddress = initSelect($form.find('.js-select-invoice-address'));
-
- var $selectOrder = $form.find('.js-select-order');
- if ($selectOrder.data('customer-id')) {
- initSelect($selectOrder);
- } else {
- initAjaxSelect($selectOrder);
- }
-
- var getFormData = function(data){
- var formData = $form.serializeArray();
-
- for (var i in formData) {
- for (var e in data) {
- if (formData[i].name === e) {
- formData[i].value = data[e];
- delete data[e];
- }
- }
- }
-
- for (var e in data) {
- formData.push({
- name: i,
- value: data[i]
- }
- );
- }
-
- return formData
- };
-
- $selectOrder.on('select2:select', function(event){
- $modal.loadAjax(event, getFormData({
- 'credit_note_create[order_id]': event.params.data.id,
- 'credit_note_create[action]': 'refresh'
- }));
- });
-
- $selectCustomer.on('select2:select', function(event){
- $modal.loadAjax(event, getFormData({
- 'credit_note_create[customer_id]': event.params.data.id,
- 'credit_note_create[action]': 'refresh'
- }));
- });
-
- $selectStatus.on('select2:select', function(event){
- $modal.loadAjax(event, getFormData({
- 'credit_note_create[action]': 'refresh'
- }));
- });
-
- $selectInvoiceAddress.on('select2:select', function(event){
- $modal.loadAjax(event, getFormData({
- 'credit_note_create[action]': 'refresh'
- }));
- });
-
- $selectType.on('select2:select', function(event){
- $modal.loadAjax(event, getFormData({
- 'credit_note_create[action]': 'refresh'
- }));
- });
-
- $form.on('change', '.js-field-currency', function(event){
- $modal.loadAjax(event, getFormData({
- 'credit_note_create[action]': 'refresh'
- }));
- });
-
- $form.on('change', '.js-order-product-quantity', function(event){
- $modal.loadAjax(event, getFormData({
- 'credit_note_create[action]': 'refresh'
- }));
- });
-
- $form.on('keyup change', '.js-action-refresh', function(event){
- if ($(this).val().length) {
- refreshWithTimer($form, event);
- }
- });
-
- /*******************************************/
- /*********** Table Free Amount *************/
- /*******************************************/
- var $tableFreeAmount = $form.find('.js-table-free-amount');
- var templateFreeAmount = $('#template-credit-note-free-amount').html();
-
- $tableFreeAmount.on('click', '.js-action-add', function(event){
- event.preventDefault();
- $(this).data('key', parseInt($(this).data('key')) + 1);
-
- var templateFreeAmountWithKey = templateFreeAmount.replace(/\[\]/g, '[' + $(this).data('key') + ']');
- $tableFreeAmount.find('tbody').append(templateFreeAmountWithKey);
-
- if ($tableFreeAmount.find('tbody tr').not('.js-no-free-amount').length) {
- $tableFreeAmount.find('.js-no-free-amount').addClass('hidden');
- } else {
- $tableFreeAmount.find('.js-no-free-amount').removeClass('hidden');
- }
- });
-
- $tableFreeAmount.on('click', '.js-action-delete', function(event){
- event.preventDefault();
- $(this).parents('tr').remove();
-
- if ($tableFreeAmount.find('tbody tr').not('.js-no-free-amount').length) {
- $tableFreeAmount.find('.js-no-free-amount').addClass('hidden');
- } else {
- $tableFreeAmount.find('.js-no-free-amount').removeClass('hidden');
- }
-
- $modal.loadAjax(event, getFormData({
- 'credit_note_create[action]': 'refresh'
- }));
- });
-
- $tableFreeAmount.on('change', '.js-field-tax-rule', function(event){
- $(this).parents('tr').find('.js-field-amount-without-tax').trigger('keyup');
- });
-
- var currentRequestFreeAmount;
- $tableFreeAmount.on('keyup', '.js-field-amount-without-tax, .js-field-amount-with-tax', function(event){
- if (currentRequestFreeAmount) currentRequestFreeAmount.abort();
-
- var $th = $(this), $thr = $th.parents('tr');
-
- currentRequestFreeAmount = $.ajax({
- url: $(this).data('url'),
- dataType: 'json',
- data: {
- price: parseFloat($(this).val()),
- tax_rule: parseInt($thr.find('.js-field-tax-rule').val())
- }
- });
-
- // ajax success
- currentRequestFreeAmount.done(function(data){
- if ($th.hasClass('js-field-amount-without-tax')) {
- $thr.find('.js-field-amount-with-tax').val(data.result);
- } else {
- $thr.find('.js-field-amount-without-tax').val(data.result);
- }
-
- refreshWithTimer(event);
- });
-
- // ajax error
- currentRequestFreeAmount.fail(function(jqXHR, textStatus){
- if (jqXHR.statusText === 'abort') return;
- $modal.displayError(jqXHR, textStatus);
- });
- });
-
- var timer = null;
- function refreshWithTimer(event) {
- if (timer !== null) {
- clearTimeout(timer);
- timer = null;
- }
- timer = setTimeout(function(){
- $modal.loadAjax(event, getFormData({
- 'credit_note_create[action]': 'refresh'
- }));
- }, 700);
- }
-
- /*******************************************/
- /********* End Table Free Amount ***********/
- /*******************************************/
- };
-})(
- jQuery
-);
diff --git a/templates/backOffice/default/credit-note-list.html b/templates/backOffice/default/credit-note-list.html
deleted file mode 100755
index c128899..0000000
--- a/templates/backOffice/default/credit-note-list.html
+++ /dev/null
@@ -1,48 +0,0 @@
-{extends file="admin-layout.tpl"}
-
-{block name="no-return-functions"}
- {$admin_current_location = 'credit-notes'}
-{/block}
-
-{block name="page-title"}{intl l='Credit notes' d="creditnote.bo.default"}{/block}
-
-{block name="check-resource"}admin.credit-note{/block}
-{block name="check-access"}view{/block}
-
-{block name="main-content"}
-
-
-
-
-
- {hook name="credit-notes.top"}
-
- {include file="includes/credit-note-search.html"}
-
-
-
-
- {include file="includes/credit-note-table.html"}
-
-
-
-
- {hook name="credit-notes.bottom"}
-
-
-
- {include file="includes/credit-note-modal.html"}
-
-
-{/block}
-
-{block name="javascript-initialization"}
- {include file="includes/credit-note-js.html"}
-{/block}
-
-{block name="javascript-last-call"}
- {hook name="credit-notes.js"}
-{/block}
diff --git a/templates/backOffice/default/hook/customer.edit.html b/templates/backOffice/default/hook/customer.edit.html
deleted file mode 100755
index 41a6347..0000000
--- a/templates/backOffice/default/hook/customer.edit.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- {include file="includes/credit-note-table.html" customer_id=$customer_id|default:null}
-
-
\ No newline at end of file
diff --git a/templates/backOffice/default/hook/main.footer-js.html b/templates/backOffice/default/hook/main.footer-js.html
deleted file mode 100755
index 00260c9..0000000
--- a/templates/backOffice/default/hook/main.footer-js.html
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
\ No newline at end of file
diff --git a/templates/backOffice/default/hook/order-edit.product-list.html b/templates/backOffice/default/hook/order-edit.product-list.html
deleted file mode 100644
index c2bdc74..0000000
--- a/templates/backOffice/default/hook/order-edit.product-list.html
+++ /dev/null
@@ -1,39 +0,0 @@
-{if $creditNoteDetails|default:[]|count > 0}
-
-
-
- |
- {intl l="Credit Note ref" d="creditnote.bo.default"}
- |
-
- {intl l="Status" d="creditnote.bo.default"}
- |
-
- {intl l="Quantity" d="creditnote.bo.default"}
- |
-
-
-
- {foreach from=$creditNoteDetails item=creditNoteDetail}
- {if $creditNoteDetail.quantity > 0}
-
- |
-
- {$creditNoteDetail.ref}
-
- |
-
- {$creditNoteDetail.status_title}
- |
-
- {$creditNoteDetail.quantity}
- |
-
- {/if}
- {/foreach}
-
-
-{/if}
diff --git a/templates/backOffice/default/hook/order.edit-js.html b/templates/backOffice/default/hook/order.edit-js.html
deleted file mode 100644
index 2ac65e2..0000000
--- a/templates/backOffice/default/hook/order.edit-js.html
+++ /dev/null
@@ -1,37 +0,0 @@
-{include file="includes/credit-note-js.html"}
-
-
-
-
\ No newline at end of file
diff --git a/templates/backOffice/default/hook/order.tab.html b/templates/backOffice/default/hook/order.tab.html
deleted file mode 100755
index e8a5705..0000000
--- a/templates/backOffice/default/hook/order.tab.html
+++ /dev/null
@@ -1,28 +0,0 @@
-{loop type="order" name="order-tab-credit-note" id=$id customer="*" backend_context=true}
- {if $STATUS != 1 && $STATUS != 5}
-
-
- {include file="includes/credit-note-table.html" order_id=$id}
-
-
- {else}
-
-
-
-
- {intl l="Credit notes" d="creditnote.bo.default"}
-
-
-
- |
-
- {intl l="You can not create a credit note for this order because it is not invoiced." d="creditnote.bo.default"}
-
- |
-
-
-
-
-
- {/if}
-{/loop}
\ No newline at end of file
diff --git a/templates/backOffice/default/includes/credit-note-free-amount.html b/templates/backOffice/default/includes/credit-note-free-amount.html
deleted file mode 100755
index f4113db..0000000
--- a/templates/backOffice/default/includes/credit-note-free-amount.html
+++ /dev/null
@@ -1,65 +0,0 @@
-{$creditNoteDetail = $creditNoteDetail|default:null}
-
- |
- {form_field field='free_amount_type' value_key=$key}
-
-
-
- {/form_field}
- |
-
- {form_field field='free_amount_title' value_key=$key}
-
-
-
- {/form_field}
- |
-
- {form_field field='free_amount_price' value_key=$key}
-
-
-
- {/form_field}
- |
-
- {form_field field='free_amount_tax_rule_id' value_key=$key}
-
-
-
- {/form_field}
- |
-
- {form_field field='free_amount_price_with_tax' value_key=$key}
-
-
-
- {/form_field}
- |
-
-
- {form_field field='free_amount_id' value_key=$key}
-
- {/form_field}
-
- {if !$invoiced|default:null}
-
- {/if}
-
- |
-
\ No newline at end of file
diff --git a/templates/backOffice/default/includes/credit-note-js.html b/templates/backOffice/default/includes/credit-note-js.html
deleted file mode 100755
index f32dd1f..0000000
--- a/templates/backOffice/default/includes/credit-note-js.html
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-{javascripts file='assets/js/script.js' source="CreditNote"}
-
-{/javascripts}
-
-
-{javascripts file='assets/js/moment-with-locales.min.js'}
-
-{/javascripts}
-
-{javascripts file='assets/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js'}
-
-{/javascripts}
-
-
diff --git a/templates/backOffice/default/includes/credit-note-modal.html b/templates/backOffice/default/includes/credit-note-modal.html
deleted file mode 100755
index 6418d23..0000000
--- a/templates/backOffice/default/includes/credit-note-modal.html
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
-
-
{intl l="Please wait, loading" d="creditnote.bo.default"}
-
-
-
-
-
-
- {intl l="An error has occurred !!!" d="creditnote.bo.default"}
-
- {intl l="Message status : " d="creditnote.bo.default"}
-
- {intl l="Message content : " d="creditnote.bo.default"}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {intl l="Do you really want to delete this credit note ?" d="creditnote.bo.default"}
-
-
-
-
-
\ No newline at end of file
diff --git a/templates/backOffice/default/includes/credit-note-order.html b/templates/backOffice/default/includes/credit-note-order.html
deleted file mode 100755
index 6a98989..0000000
--- a/templates/backOffice/default/includes/credit-note-order.html
+++ /dev/null
@@ -1,156 +0,0 @@
-{loop type="order" name="the-order" id=$creditNote->getOrderId() customer="*" backend_context=true}
-
-
- {intl l="Order Informations : " d="creditnote.bo.default"}
-
- {loop type="order-status" name="all-status" id=$STATUS}
-
{intl l="Status : %title" d="creditnote.bo.default" title=$TITLE}
- {/loop}
-
-
{intl l="Ref :" d="creditnote.bo.default"} {$REF}
-
-
-
-
-
-
-
- | {intl l="Product" d="creditnote.bo.default"} |
- {hook name="order-edit.order-product-table-header" location="order_edit_table_header" }
- {intl l="Unit. price" d="creditnote.bo.default"} |
- {intl l="Tax" d="creditnote.bo.default"} |
- {intl l="Unit taxed price" d="creditnote.bo.default"} |
- {intl l="Quantity" d="creditnote.bo.default"} |
- {intl l="Total with tax" d="creditnote.bo.default"} |
-
-
-
-
- {loop type="order_product" name="order-products" order=$ID}
- {if $WAS_IN_PROMO == 1}
- {assign "realPrice" $PROMO_PRICE}
- {assign "realTax" $PROMO_PRICE_TAX}
- {assign "realTaxedPrice" $TAXED_PROMO_PRICE}
- {assign "realTotalPrice" $TOTAL_TAXED_PROMO_PRICE}
- {else}
- {assign "realPrice" $PRICE}
- {assign "realTax" $PRICE_TAX}
- {assign "realTaxedPrice" $TAXED_PRICE}
- {assign "realTotalPrice" $TOTAL_TAXED_PRICE}
- {/if}
- {hook name="order-edit.before-order-product-row" location="before-order-product-row" order_id=$order_id order_product_id=$ID}
-
-
- {ifloop rel="my_product_loop"}
- {loop type="product" name="my_product_loop" visible="*" ref=$REF return_url=false}
- {$REF} - {$TITLE}
- {if $VIRTUAL}{/if}
- {/loop}
-
- - {intl l='Combination reference' d="creditnote.bo.default"}
- -
- {$PRODUCT_SALE_ELEMENTS_REF}
-
-
- {/ifloop}
- {elseloop rel="my_product_loop"}
- {* The product doesn't exist anymore *}
- {$TITLE}
- {if $VIRTUAL}{/if}
- {/elseloop}
- {ifloop rel="combinations"}
-
- {loop type="order_product_attribute_combination" name="combinations" order_product=$ID}
- - {$ATTRIBUTE_TITLE}
- - {$ATTRIBUTE_AVAILABILITY_TITLE}
- {/loop}
-
- {/ifloop}
- {hook name="order-edit.product-list" location="order-product-list" order_id=$order_id order_product_id=$ID}
- |
- {hook name="order-edit.order-product-table-row" location="order_edit_table_row" order_product_id={$ID} }
- {format_money number=$realPrice currency_id=$CURRENCY} |
- {format_money number=$realTax currency_id=$CURRENCY} |
- {format_money number=$realTaxedPrice currency_id=$CURRENCY} |
-
- {if $creditNote->getCreditNoteType()}
-
- {$currentQuantity = 0}
-
- {if $creditNote->getCreditNoteType()->getCode() == 'order_full_refund'}
- {$currentQuantity = $QUANTITY}
- {else}
- {foreach from=$creditNote->getCreditNoteDetails() item=creditNoteDetail}
- {if $creditNoteDetail->getOrderProductId() == $ID}
- {$currentQuantity = $creditNoteDetail->getQuantity()}
- {/if}
- {/foreach}
- {/if}
-
- {form_field field='order_product_quantity' key=$ID}
- {if $invoiced|default:null or $creditNote->getCreditNoteType()->getCode() == 'order_full_refund'}
-
- {$currentQuantity}
- {else}
-
- {/if}
- {/form_field}
- {/if}
- / {$QUANTITY}
- |
- {format_money number=$realTotalPrice currency_id=$CURRENCY} |
-
- {hook name="order-edit.after-order-product-row" location="after-order-product-row" order_id=$order_id order_product_id=$ID}
- {/loop}
-
-
-
- |
- |
- {intl l="Total without discount" d="creditnote.bo.default"} |
- {format_money number=$TOTAL_TAXED_AMOUNT-$POSTAGE+$DISCOUNT currency_id=$CURRENCY} |
-
-
- |
- {intl l="Discount" d="creditnote.bo.default"} |
- {format_money number=$DISCOUNT currency_id=$CURRENCY} |
-
-
- |
- {intl l="Coupon code" d="creditnote.bo.default"} |
-
- {loop type="order_coupon" name="couponcode" order=$ID}
- {$CODE}{if $LOOP_COUNT != $LOOP_TOTAL}, {/if}
- {/loop}
- {elseloop rel="couponcode"}
- Ø
- {/elseloop}
- |
-
-
- |
- {intl l="Total including discount" d="creditnote.bo.default"} |
- {format_money number=$TOTAL_TAXED_AMOUNT-$POSTAGE currency_id=$CURRENCY} |
-
-
- |
- {intl l="Postage" d="creditnote.bo.default"} |
-
- {format_money number=$POSTAGE currency_id=$CURRENCY}
- ({format_money number=$POSTAGE_TAX currency_id=$CURRENCY})
- |
-
-
- |
- {intl l="Total" d="creditnote.bo.default"} |
- {format_money number=$TOTAL_TAXED_AMOUNT currency_id=$CURRENCY} |
-
-
-
-
-
-
-
-{/loop}
\ No newline at end of file
diff --git a/templates/backOffice/default/includes/credit-note-search.html b/templates/backOffice/default/includes/credit-note-search.html
deleted file mode 100644
index cece2f5..0000000
--- a/templates/backOffice/default/includes/credit-note-search.html
+++ /dev/null
@@ -1,78 +0,0 @@
-{assign credit_note_ref {$smarty.get.ref|default:null}}
-{assign date_min {$smarty.get.creditNoteDateMin|default:null}}
-{assign date_max {$smarty.get.creditNoteDateMax|default:null}}
-
-{if $date_max}
- {$date_max = date("d/m/Y", strtotime($date_max))}
-{/if}
-
-{if $date_min}
- {$date_min = date("d/m/Y", strtotime($date_min))}
-{/if}
-
-
-
-
-
- {intl l="Search" d="creditnote.bo.default"}
-
-
- {form name='credit_note_search_form'}
-
- {/form}
-
-
-
diff --git a/templates/backOffice/default/includes/credit-note-table.html b/templates/backOffice/default/includes/credit-note-table.html
deleted file mode 100755
index 206ba6b..0000000
--- a/templates/backOffice/default/includes/credit-note-table.html
+++ /dev/null
@@ -1,217 +0,0 @@
-{assign credit_note_page {$smarty.get.credit_note_page|default:1}}
-
-{assign credit_note_order {$smarty.get.credit_note_order|default:'id'}}
-{assign credit_note_status {$smarty.get.status_id|default:null}}
-
-{assign credit_note_ref {$smarty.get.ref|default:null}}
-{assign credit_note_date_min {$smarty.get.creditNoteDateMin|default:null}}
-{assign credit_note_date_max {$smarty.get.creditNoteDateMax|default:null}}
-
-
-
-
-
- {intl l="Credit notes" d="creditnote.bo.default"}
-
-
- {intl l="Add a new credit note" d="creditnote.bo.default"}
-
-
-
-
-
- |
- {intl l="#" d="creditnote.bo.default"}
- |
-
- {intl l="Ref" d="creditnote.bo.default"}
- |
-
- {intl l="Invoice ref" d="creditnote.bo.default"}
- |
-
- {intl l="Invoice date" d="creditnote.bo.default"}
- |
-
- {admin_sortable_header
- current_order=$credit_note_order
- order='create-date'
- reverse_order='create-date-reverse'
- path={url path='/admin/credit-note'}
- request_parameter_name='credit_note_order'
- label="{intl l='Create date' d="creditnote.bo.default"}"
- }
- |
-
- {admin_sortable_header
- current_order=$credit_note_order
- order='update-date'
- reverse_order='update-date-reverse'
- path={url path='/admin/credit-note'}
- request_parameter_name='credit_note_order'
- label="{intl l='Update date' d="creditnote.bo.default"}"
- }
- |
- {if !$customer_id|default:null && !$order_id|default:null}
-
- {intl l="Customer" d="creditnote.bo.default"}
- |
- {/if}
- {if !$order_id|default:null}
-
- {intl l="Order" d="creditnote.bo.default"}
- |
- {/if}
-
- {intl l="Status" d="creditnote.bo.default"}
- |
-
- {intl l="Type" d="creditnote.bo.default"}
- |
-
- {intl l="Total with tax" d="creditnote.bo.default"}
- |
-
- {intl l="Total without tax" d="creditnote.bo.default"}
- |
-
- {intl l="Action" d="creditnote.bo.default"}
- |
-
-
-
- {ifloop rel="credit-note"}
-
- {loop type="credit-note" name="credit-note"
- status_id=$credit_note_status
- order=$credit_note_order
- page=$credit_note_page
- customer_id=$customer_id|default:null
- order_id=$order_id|default:null
- limit={config key="number_default_results_per_page.credit_note_list" default=20}
- search_by_ref=$credit_note_ref
- min_date=$credit_note_date_min|default:null
- max_date=$credit_note_date_max|default:null
- }
-
- |
- {$ID}
- |
-
- {$REF}
- |
-
- {$INVOICE_REF}
- |
-
- {if $INVOICE_DATE != null}
- {format_date date=$INVOICE_DATE}
- {/if}
- |
- {format_date date=$CREATE_DATE} |
- {format_date date=$UPDATE_DATE} |
- {if !($customer_id|default:null) && !$order_id|default:null}
-
- {$CUSTOMER_NAME}
- |
- {/if}
- {if !$order_id|default:null}
-
- {if $ORDER_ID}
- {$ORDER_REF}
- {/if}
- |
- {/if}
-
- {$STATUS_TITLE}
- |
-
- {$TYPE_TITLE}
- |
-
- {format_money number=$TOTAL_PRICE_WITH_TAX currency_id=$CURRENCY_ID}
- |
-
- {format_money number=$TOTAL_PRICE currency_id=$CURRENCY_ID}
- |
-
- {if !$INVOICE_REF}
-
- {else}
-
- {intl l="PDF" d="creditnote.bo.default"}
- {/if}
- {if !$INVOICE_REF}
-
- {/if}
- |
-
- {/loop}
-
-
-
- |
- {include
- file = "includes/pagination.html"
-
- loop_ref = "credit-note"
- page_param_name = 'credit_note_page'
- max_page_count = 10
- page_url = {url path="/admin/credit-note"
- type=$type_filter|default:null
- status_id=$credit_note_status
- credit_note_order=$credit_note_order
- search_term=$search_term|default:null
- search_in=$search_in|default:null
- ref=$credit_note_ref|default:null
- creditNoteDateMin=$credit_note_date_min|default:null
- creditNoteDateMax=$credit_note_date_max|default:null
- }
- }
- |
-
-
- {/ifloop}
-
- {elseloop rel="credit-note"}
-
-
- |
-
- {intl l='You have no credit notes for the moment.' d="creditnote.bo.default"}
-
- |
-
-
- {/elseloop}
-
-
-
diff --git a/templates/backOffice/default/module-configuration.html b/templates/backOffice/default/module-configuration.html
deleted file mode 100644
index e72476a..0000000
--- a/templates/backOffice/default/module-configuration.html
+++ /dev/null
@@ -1,102 +0,0 @@
-{* Credit Note module configuration — Smarty fallback for the legacy back-office.
- Rendered by ConfigHook on module.configuration. Mirrors module-configuration.html.twig. *}
-
-
{intl l="Credit note configuration" d="creditnote"}
-
- {form name="credit_note_config"}
-
- {/form}
-
diff --git a/templates/pdf/default/credit-note.html b/templates/pdf/default/credit-note.html
deleted file mode 100644
index 1c3a43e..0000000
--- a/templates/pdf/default/credit-note.html
+++ /dev/null
@@ -1,309 +0,0 @@
-{* Set the default translation domain, that will be used by {intl} when the 'd' parameter is not set *}
-{default_translation_domain domain="creditnote.pdf.default"}
-{literal}
-
-{/literal}
-
-
- {hook name="pdf.credit-note.header" credit_note_id=$credit_note_id}
-
-
-
- {hook name="pdf.credit-note.footer-top" credit_note_id=$credit_note_id}
-
-
-
-
-
-
- {hook name="pdf.credit-note.imprint" credit_note_id=$credit_note_id}
- {elsehook rel="pdf.credit-note.imprint"}
-
- {config key="store_name"}
- {$addresses="{config key="store_address1"} {config key="store_address2"} {config key="store_address3"}"}
- {$city="{config key="store_zipcode"} {config key="store_city"}"}
- {if $addresses != " "}- {$addresses}{/if}
- {if $city != " " }- {$city}{/if}
- {if {config key="store_country"} }
- {loop type="country" visible="*" name="address.country.title" id={config key="store_country"}} - {$TITLE}{/loop}
- {/if}
- {if {config key="store_business_id"} }
- - {config key="store_business_id"}
- {/if}
-
- {if {config key="store_phone"} }
- {intl l="Phone: "}{config key="store_phone"}
- {/if}
- {if {config key="store_email"} }
- {intl l="Email: "}{config key="store_email"}
- {/if}
- {/elsehook}
- |
- {intl l="page"} [[page_cu]]/[[page_nb]] |
-
-
-
- {hook name="pdf.credit-note.footer-bottom" order=$order_id|default:null}
-
-
- {$taxes = []}
-
- {loop name="credit-note.invoice" type="credit-note" id=$credit_note_id customer="*"}
-
-
-
-
- {intl l="CREDIT NOTE INVOICE"}
- |
-
-
- {intl l="Invoice date"} : {format_date date=$INVOICE_DATE output="date"} |
-
-
- {intl l="Invoice REF"} : {$INVOICE_REF} |
-
-
- {intl l="Credit note REF"} : {$REF} |
-
-
- {intl l="Customer Number"} : {loop type="customer" name="customer.invoice" id=$CUSTOMER_ID current="0"}{$REF}{/loop} |
-
- {if $ORDER_ID}
- {loop name="order" type="order" id=$ORDER_ID customer="*"}
-
- {intl l="Referance invoice REF"} : {$INVOICE_REF} |
-
-
- {intl l="Referance order REF"} : {$REF} |
-
- {/loop}
- {/if}
- {hookblock name="pdf.credit-note.information" credit_note_id=$credit_note_id fields="title,value"}
- {forhook rel="pdf.credit-note.information"}
-
- {$title} : {$value} |
-
- {/forhook}
- {/hookblock}
-
-
- {hook name="pdf.credit-note.after-information" credit_note_id=$credit_note_id}
-
-
-
-
-
-
- {intl l="Invoice address"}
- {credit_note_format_address credit_note_id=$ID locale=$locale}
- |
-
-
-
- {hook name="pdf.credit-note.after-addresses" credit_note_id=$credit_note_id}
-
-
-
-
-
-
-
-
-
-
- {intl l="Product"} |
- {intl l="Unit. price"} |
- {intl l="Tax"} |
- {intl l="Unit taxed price"} |
- {intl l="Quantity"} |
- {intl l="Total with tax"} |
-
- {loop type="credit-note-detail" name="credit-note-detail" credit_note_id=$credit_note_id}
- {$detailRef = ""}
- {$detailPseRef = ""}
- {$detailTitle = $TITLE}
- {if $ORDER_PRODUCT_ID}
- {loop type="order_product" name="order-product-$ORDER_PRODUCT_ID" id=$ORDER_PRODUCT_ID order=$ORDER_ID}
- {$detailRef = $REF}
- {$detailTitle = $TITLE}
- {$detailPseRef = $PRODUCT_SALE_ELEMENTS_REF}
- {/loop}
- {/if}
-
-
- |
- {$TITLE}
-
- {if $detailRef}
- {intl l="Product ref : "}{$detailRef}
- {/if}
- {if $detailPseRef}
- {intl l="Combination ref : "}{$detailPseRef}
- {/if}
-
- {if $ORDER_PRODUCT_ID}
- {ifloop rel="combinations"}
- {loop type="order_product_attribute_combination" name="combinations" order_product=$ORDER_PRODUCT_ID}
- {$ATTRIBUTE_TITLE} - {$ATTRIBUTE_AVAILABILITY_TITLE}
- {/loop}
- {/ifloop}
- {/if}
- {hook name="pdf.credit-note.detail-list" order_product=$ID order=$order_id|default:null}
- |
- {if $QUANTITY}{format_money number={$PRICE / $QUANTITY} currency_id=$CURRENCY_ID}{else}{format_money number=0 currency_id=$CURRENCY_ID}{/if} |
- {if $QUANTITY}{format_money number={{$PRICE_WITH_TAX - $PRICE} / $QUANTITY} currency_id=$CURRENCY_ID}{else}{format_money number=0 currency_id=$CURRENCY_ID}{/if} |
- {if $QUANTITY}{format_money number={$PRICE_WITH_TAX / $QUANTITY} currency_id=$CURRENCY_ID}{else}{format_money number=0 currency_id=$CURRENCY_ID}{/if} |
- {$QUANTITY} |
- {format_money number=$PRICE_WITH_TAX currency_id=$CURRENCY_ID} |
-
-
- {hook name="pdf.credit-note.order-product" credit_note_id=$credit_note_id order_product=$ID}
- {/loop}
-
-
- {hook name="pdf.credit-note.after-products" credit_note_id=$credit_note_id}
-
-
-
-
-
-
-
-
-
-
- {intl l="Discount"} |
- {format_money number=$DISCOUNT_WITH_TAX currency_id=$CURRENCY} |
-
-
- {intl l="Total without tax"} |
- {format_money number=$TOTAL_PRICE currency_id=$CURRENCY} |
-
-
- {intl l="Tax"} |
- {format_money number={$TOTAL_PRICE_WITH_TAX - $TOTAL_PRICE} currency_id=$CURRENCY} |
-
-
- {intl l="Total with tax"} |
- {format_money number=$TOTAL_PRICE_WITH_TAX currency_id=$CURRENCY} |
-
-
- |
-
-
-
- {hook name="pdf.credit-note.after-summary" credit_note_id=$credit_note_id}
-
- {/loop}
-
diff --git a/tests/Integration/CreditNoteDocumentLocaleTest.php b/tests/Integration/CreditNoteDocumentLocaleTest.php
index f3a4ff4..294292f 100644
--- a/tests/Integration/CreditNoteDocumentLocaleTest.php
+++ b/tests/Integration/CreditNoteDocumentLocaleTest.php
@@ -76,14 +76,16 @@ public function aLanguageTheShopPrintsItsCreditNotesInIsServed(): void
?? $this->fixture->factory()->lang(['locale' => 'de_DE', 'code' => 'de', 'title' => 'Deutsch']);
$customer->setLangId($german->getId())->save($this->getPropelConnection());
- // Inside the test transaction: rolled back with the rest.
+ // Inside the test transaction: rolled back with the rest. A shop without demo data has
+ // English as its default language: make it French, so that leaving English is visible.
+ $this->getPropelConnection()->exec("UPDATE lang SET by_default = (locale = 'fr_FR')");
CreditNote::setConfigValue(CreditNote::CONFIG_KEY_DOCUMENT_LOCALES, 'fr_FR, de_DE');
self::assertSame(['fr_FR', 'de_DE'], CreditNote::documentLocales());
self::assertSame('de_DE', $this->locale()->forCreditNote($this->reload($creditNote)));
$customer->setLangId($this->lang('en_US')->getId())->save($this->getPropelConnection());
- self::assertNotSame('en_US', $this->locale()->forCreditNote($this->reload($creditNote)), 'English is no longer in the list');
+ self::assertSame('fr_FR', $this->locale()->forCreditNote($this->reload($creditNote)), 'English is no longer in the list: the default language of the shop answers');
CreditNote::setConfigValue(CreditNote::CONFIG_KEY_DOCUMENT_LOCALES, '');
self::assertSame(CreditNoteDocumentLocale::PREFERRED, CreditNote::documentLocales(), 'empty: English and French');
diff --git a/tests/Unit/ModuleDescriptorTest.php b/tests/Unit/ModuleDescriptorTest.php
index ea031b4..ff42b46 100644
--- a/tests/Unit/ModuleDescriptorTest.php
+++ b/tests/Unit/ModuleDescriptorTest.php
@@ -47,7 +47,7 @@ public function everyDeclaredLoopIsALoopClassOfTheModule(): void
}
self::assertSame(
- ['credit-note', 'credit-note-address', 'credit-note-comment', 'credit-note-detail', 'credit-note-status', 'credit-note-type', 'credit-note-version', 'order-credit-note'],
+ ['credit-note', 'credit-note-address', 'credit-note-detail'],
array_keys(array_change_key_case($this->sorted($loops))),
);
}
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index ce9f142..0cb9804 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -84,6 +84,20 @@
}
}
+// The Propel models of the shop (Base/ and Map/) are generated under var/propel/test/model and
+// only registered once the kernel boots. Map them now: a class_exists() before the first boot
+// (the listener unit test) must see the generated table map, or its stub would be declared and
+// stay in place of the real map for the integration tests of the same run.
+$generatedModelDirectory = dirname($autoload, 2) . '/var/propel/test/model/';
+
+spl_autoload_register(static function (string $class) use ($generatedModelDirectory): void {
+ $file = $generatedModelDirectory . str_replace('\\', '/', $class) . '.php';
+
+ if (is_file($file)) {
+ require $file;
+ }
+});
+
// The module and its tests, when the shop autoloader does not map them already
// (module checked out outside local/modules). Longest prefix first.
spl_autoload_register(static function (string $class): void {