Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased

- The back-office screens are translated again: their labels used the `creditnote.bo.default` domain, which the kernel stopped loading once the Smarty back-office (`templates/backOffice/default/`) was removed, since it registers a `<module>.bo.<template>` domain only for a template the module ships. The domain is now `creditnote.bo.default-twig`, its catalogs moved to `I18n/backOffice/default-twig/`; the side menu reads "Avoirs" again in French. A shop that overrode one of these labels in `local/I18n` with a `creditnote.bo.default.` key renames it.
- A credit note has a language (`lang_id`), chosen in the back-office modal: the language of its order by default, of its customer without an order, the default language of the shop otherwise. It stays editable once the credit note is numbered, since it only changes the printed document. The document is printed in it (still within `document_locales`). The update fills the existing credit notes with the language they were printed in: the one of their customer, of their order when the customer has none.
- The colors of the status and type badges are written into `style` attributes only when they are hexadecimal colors, grey otherwise.
- A credit note created or saved without an invoice address (no customer picked, or "Other" with the name left empty) is refused with a message, and nothing is written. The controller used to save the empty address, which a database in strict mode refuses with an error 500 (`Field 'firstname' doesn't have a default value`). The module's back-office messages use the `danger` type, the one the Twig back office styles.
Expand Down
2 changes: 1 addition & 1 deletion Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>4.3.0</version>
<version>4.3.1</version>
<author>
<name>Gilles Bourgeat</name>
<email>gbourgeat@openstudio.fr</email>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* Back-office domain (creditnote.bo.default): the Twig screens of the module.
* Back-office domain (creditnote.bo.default-twig): the Twig screens of the module.
*/

return [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* Back-office domain (creditnote.bo.default): the Twig screens of the module.
* Back-office domain (creditnote.bo.default-twig): the Twig screens of the module.
*/

return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<li class="nav-item" id="credit_note_menu" data-testid="bo-nav-credit-note">
<a href="#collapse-credit-notes" data-bs-toggle="collapse" aria-expanded="{{ active ? 'true' : 'false' }}" class="nav-link bo-side-nav__toggle {{ active ? 'active' : '' }}">
<i class="bi bi-receipt me-2" aria-hidden="true"></i>
{{ 'Credit Notes'|trans({}, 'creditnote.bo.default') }}
{{ 'Credit Notes'|trans({}, 'creditnote.bo.default-twig') }}
<i class="bi bi-chevron-right ms-auto bo-side-nav__chevron" aria-hidden="true"></i>
</a>
<ul class="nav flex-column collapse {{ active ? 'show' : '' }}" id="collapse-credit-notes">
<li>
<a class="nav-link" href="{{ path('credit_note_list') }}">
{{ 'All Credit Notes'|trans({}, 'creditnote.bo.default') }}
{{ 'All Credit Notes'|trans({}, 'creditnote.bo.default-twig') }}
<span class="bo-side-nav__badge bo-side-nav__badge--neutral">{{ total_count }}</span>
</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<table class="table alert alert-info text-center">
<thead>
<tr>
<th class="text-center">{{ 'Credit Note ref'|trans({}, 'creditnote.bo.default') }}</th>
<th class="text-center">{{ 'Status'|trans({}, 'creditnote.bo.default') }}</th>
<th class="text-center">{{ 'Quantity'|trans({}, 'creditnote.bo.default') }}</th>
<th class="text-center">{{ 'Credit Note ref'|trans({}, 'creditnote.bo.default-twig') }}</th>
<th class="text-center">{{ 'Status'|trans({}, 'creditnote.bo.default-twig') }}</th>
<th class="text-center">{{ 'Quantity'|trans({}, 'creditnote.bo.default-twig') }}</th>
</tr>
</thead>
<tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<tr class="table-info">
<td colspan="2"></td>
<td colspan="3"><strong>
{{ 'Credit Note used :'|trans({'%ref': used.ref}, 'creditnote.bo.default') }}
{{ 'Credit Note used :'|trans({'%ref': used.ref}, 'creditnote.bo.default-twig') }}
<a href="#" data-bs-toggle="modal" data-bs-target="#modal-credit-note"
data-action="view" data-ajax-url="/admin/credit-note/{{ used.credit_note_id }}">{{ used.ref }}</a>
</strong></td>
<td colspan="100" class="text-end"><strong>{{ used.amount }}</strong></td>
</tr>
<tr class="table-info">
<td colspan="2"></td>
<td colspan="3"><strong>{{ 'Remaining to pay :'|trans({}, 'creditnote.bo.default') }}</strong></td>
<td colspan="3"><strong>{{ 'Remaining to pay :'|trans({}, 'creditnote.bo.default-twig') }}</strong></td>
<td colspan="100" class="text-end"><strong>{{ used.remaining }}</strong></td>
</tr>
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,39 @@
<div class="table-responsive">
<table class="table table-striped table-sm">
<caption>
{{ 'Credit notes'|trans({}, 'creditnote.bo.default') }}
{{ 'Credit notes'|trans({}, 'creditnote.bo.default-twig') }}

<a class="btn btn-primary btn-sm"
title="{{ 'Add a new credit note'|trans({}, 'creditnote.bo.default') }}"
title="{{ 'Add a new credit note'|trans({}, 'creditnote.bo.default-twig') }}"
data-bs-toggle="modal"
data-bs-target="#modal-credit-note"
data-customer-id="{{ has_customer_id ? customer_id : '' }}"
data-order-id="{{ has_order_id ? order_id : '' }}"
data-ajax-url="/admin/credit-note/ajax/modal/create"
data-action="create">
<i class="bi bi-plus-lg"></i> {{ 'Add a new credit note'|trans({}, 'creditnote.bo.default') }}
<i class="bi bi-plus-lg"></i> {{ 'Add a new credit note'|trans({}, 'creditnote.bo.default-twig') }}
</a>
</caption>

<thead>
<tr>
<th>{{ '#'|trans({}, 'creditnote.bo.default') }}</th>
<th>{{ 'Ref'|trans({}, 'creditnote.bo.default') }}</th>
<th>{{ 'Invoice ref'|trans({}, 'creditnote.bo.default') }}</th>
<th>{{ 'Invoice date'|trans({}, 'creditnote.bo.default') }}</th>
<th>{{ 'Create date'|trans({}, 'creditnote.bo.default') }}</th>
<th>{{ 'Update date'|trans({}, 'creditnote.bo.default') }}</th>
<th>{{ '#'|trans({}, 'creditnote.bo.default-twig') }}</th>
<th>{{ 'Ref'|trans({}, 'creditnote.bo.default-twig') }}</th>
<th>{{ 'Invoice ref'|trans({}, 'creditnote.bo.default-twig') }}</th>
<th>{{ 'Invoice date'|trans({}, 'creditnote.bo.default-twig') }}</th>
<th>{{ 'Create date'|trans({}, 'creditnote.bo.default-twig') }}</th>
<th>{{ 'Update date'|trans({}, 'creditnote.bo.default-twig') }}</th>
{% if not has_customer_id and not has_order_id %}
<th>{{ 'Customer'|trans({}, 'creditnote.bo.default') }}</th>
<th>{{ 'Customer'|trans({}, 'creditnote.bo.default-twig') }}</th>
{% endif %}
{% if not has_order_id %}
<th>{{ 'Order'|trans({}, 'creditnote.bo.default') }}</th>
<th>{{ 'Order'|trans({}, 'creditnote.bo.default-twig') }}</th>
{% endif %}
<th>{{ 'Status'|trans({}, 'creditnote.bo.default') }}</th>
<th>{{ 'Type'|trans({}, 'creditnote.bo.default') }}</th>
<th>{{ 'Total with tax'|trans({}, 'creditnote.bo.default') }}</th>
<th>{{ 'Total without tax'|trans({}, 'creditnote.bo.default') }}</th>
<th class="action">{{ 'Action'|trans({}, 'creditnote.bo.default') }}</th>
<th>{{ 'Status'|trans({}, 'creditnote.bo.default-twig') }}</th>
<th>{{ 'Type'|trans({}, 'creditnote.bo.default-twig') }}</th>
<th>{{ 'Total with tax'|trans({}, 'creditnote.bo.default-twig') }}</th>
<th>{{ 'Total without tax'|trans({}, 'creditnote.bo.default-twig') }}</th>
<th class="action">{{ 'Action'|trans({}, 'creditnote.bo.default-twig') }}</th>
</tr>
</thead>

Expand Down Expand Up @@ -70,18 +70,18 @@
<button class="btn btn-info btn-sm"
data-bs-toggle="modal" data-bs-target="#modal-credit-note"
data-ajax-url="/admin/credit-note/{{ cn.id }}"
data-action="view">{{ 'Edit'|trans({}, 'creditnote.bo.default') }}</button>
data-action="view">{{ 'Edit'|trans({}, 'creditnote.bo.default-twig') }}</button>
<button class="btn btn-danger btn-sm"
data-bs-toggle="modal" data-bs-target="#modal-credit-note-delete"
data-ajax-url="/admin/credit-note/{{ cn.id }}/_delete"
data-action="delete">{{ 'Delete'|trans({}, 'creditnote.bo.default') }}</button>
data-action="delete">{{ 'Delete'|trans({}, 'creditnote.bo.default-twig') }}</button>
{% else %}
<button class="btn btn-primary btn-sm"
data-bs-toggle="modal" data-bs-target="#modal-credit-note"
data-ajax-url="/admin/credit-note/{{ cn.id }}"
data-action="view">{{ 'View'|trans({}, 'creditnote.bo.default') }}</button>
data-action="view">{{ 'View'|trans({}, 'creditnote.bo.default-twig') }}</button>
<a class="btn btn-secondary btn-sm"
href="/admin/credit-note/pdf/invoice/{{ cn.id }}/0">{{ 'PDF'|trans({}, 'creditnote.bo.default') }}</a>
href="/admin/credit-note/pdf/invoice/{{ cn.id }}/0">{{ 'PDF'|trans({}, 'creditnote.bo.default-twig') }}</a>
{% endif %}
</td>
</tr>
Expand All @@ -92,7 +92,7 @@
<tr>
<td colspan="99">
<div class="alert alert-info">
{{ 'You have no credit notes for the moment.'|trans({}, 'creditnote.bo.default') }}
{{ 'You have no credit notes for the moment.'|trans({}, 'creditnote.bo.default-twig') }}
</div>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
<tr>
<td>
<select class="form-select" name="credit_note_create[free_amount_type][{{ key }}]" {{ invoiced ? 'disabled' : '' }}>
<option value="other" {{ fa and fa.type == 'other' ? 'selected' : '' }}>{{ 'Other'|trans({}, 'creditnote.bo.default') }}</option>
<option value="shipping" {{ fa and fa.type == 'shipping' ? 'selected' : '' }}>{{ 'Shipping'|trans({}, 'creditnote.bo.default') }}</option>
<option value="fees" {{ fa and fa.type == 'fees' ? 'selected' : '' }}>{{ 'Fees'|trans({}, 'creditnote.bo.default') }}</option>
<option value="other" {{ fa and fa.type == 'other' ? 'selected' : '' }}>{{ 'Other'|trans({}, 'creditnote.bo.default-twig') }}</option>
<option value="shipping" {{ fa and fa.type == 'shipping' ? 'selected' : '' }}>{{ 'Shipping'|trans({}, 'creditnote.bo.default-twig') }}</option>
<option value="fees" {{ fa and fa.type == 'fees' ? 'selected' : '' }}>{{ 'Fees'|trans({}, 'creditnote.bo.default-twig') }}</option>
</select>
</td>
<td>
<input type="text" name="credit_note_create[free_amount_title][{{ key }}]" class="form-control"
value="{{ fa ? fa.title : '' }}" placeholder="{{ 'Title'|trans({}, 'creditnote.bo.default') }}" {{ invoiced ? 'disabled' : '' }}>
value="{{ fa ? fa.title : '' }}" placeholder="{{ 'Title'|trans({}, 'creditnote.bo.default-twig') }}" {{ invoiced ? 'disabled' : '' }}>
</td>
<td>
<input type="number" step="0.000001" name="credit_note_create[free_amount_price][{{ key }}]"
class="form-control js-field-amount-without-tax" value="{{ fa ? fa.price : '' }}"
placeholder="{{ 'Amount without tax'|trans({}, 'creditnote.bo.default') }}"
placeholder="{{ 'Amount without tax'|trans({}, 'creditnote.bo.default-twig') }}"
data-url="{{ path('admin.product.calculate-price', {action: 'untaxed_to_taxed'}) }}" {{ invoiced ? 'disabled' : '' }}>
</td>
<td>
Expand All @@ -29,13 +29,13 @@
<td>
<input type="number" step="0.000001" name="credit_note_create[free_amount_price_with_tax][{{ key }}]"
class="form-control js-field-amount-with-tax" value="{{ fa ? fa.price_with_tax : '' }}"
placeholder="{{ 'Amount with tax'|trans({}, 'creditnote.bo.default') }}"
placeholder="{{ 'Amount with tax'|trans({}, 'creditnote.bo.default-twig') }}"
data-url="{{ path('admin.product.calculate-price', {action: 'taxed_to_untaxed'}) }}" {{ invoiced ? 'disabled' : '' }}>
</td>
<td class="action">
<input type="hidden" name="credit_note_create[free_amount_id][{{ key }}]" value="{{ fa ? fa.id : '' }}">
{% if not invoiced %}
<button type="button" class="btn btn-danger btn-sm js-action-delete" title="{{ 'Delete'|trans({}, 'creditnote.bo.default') }}">
<button type="button" class="btn btn-danger btn-sm js-action-delete" title="{{ 'Delete'|trans({}, 'creditnote.bo.default-twig') }}">
<i class="bi bi-trash"></i>
</button>
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
if (!items.length) {
var empty = document.createElement('div');
empty.className = 'list-group-item disabled small';
empty.textContent = '{{ 'No results found'|trans({}, 'creditnote.bo.default')|escape('js') }}';
empty.textContent = '{{ 'No results found'|trans({}, 'creditnote.bo.default-twig')|escape('js') }}';
list.appendChild(empty);
}
items.forEach(function (item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@
<div class="modal-dialog modal-lg" role="document" style="width: 90%; min-width: 1000px; max-width: 1500px;">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">{{ 'Credit note'|trans({}, 'creditnote.bo.default') }}</h4>
<h4 class="modal-title">{{ 'Credit note'|trans({}, 'creditnote.bo.default-twig') }}</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-loader">
<br/><br/><div class="text-center"><span class="loading">{{ 'Please wait, loading'|trans({}, 'creditnote.bo.default') }}</span></div><br/><br/>
<br/><br/><div class="text-center"><span class="loading">{{ 'Please wait, loading'|trans({}, 'creditnote.bo.default-twig') }}</span></div><br/><br/>
</div>
<div class="modal-body"></div>
<div class="modal-error d-none">
<div class="alert alert-danger">
<strong>{{ 'An error has occurred !!!'|trans({}, 'creditnote.bo.default') }}</strong>
<strong>{{ 'An error has occurred !!!'|trans({}, 'creditnote.bo.default-twig') }}</strong>
<br/>
<span>{{ 'Message status : '|trans({}, 'creditnote.bo.default') }} <span class="textStatus"></span></span>
<span>{{ 'Message status : '|trans({}, 'creditnote.bo.default-twig') }} <span class="textStatus"></span></span>
<br/>
<span>{{ 'Message content : '|trans({}, 'creditnote.bo.default') }}</span>
<span>{{ 'Message content : '|trans({}, 'creditnote.bo.default-twig') }}</span>
<br/>
<iframe width="100%" style="height: 400px;"></iframe>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ 'Close'|trans({}, 'creditnote.bo.default') }}</button>
<button type="button" class="btn btn-primary">{{ 'Save'|trans({}, 'creditnote.bo.default') }}</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ 'Close'|trans({}, 'creditnote.bo.default-twig') }}</button>
<button type="button" class="btn btn-primary">{{ 'Save'|trans({}, 'creditnote.bo.default-twig') }}</button>
</div>
</div>
</div>
Expand All @@ -33,16 +33,16 @@
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">{{ 'Delete credit note'|trans({}, 'creditnote.bo.default') }}</h4>
<h4 class="modal-title">{{ 'Delete credit note'|trans({}, 'creditnote.bo.default-twig') }}</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
{{ 'Do you really want to delete this credit note ?'|trans({}, 'creditnote.bo.default') }}
{{ 'Do you really want to delete this credit note ?'|trans({}, 'creditnote.bo.default-twig') }}
</div>
<div class="modal-footer">
<form method="POST" action="" id="credit-note-delete-form">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><i class="bi bi-x-lg"></i> {{ 'No'|trans({}, 'creditnote.bo.default') }}</button>
<button type="submit" class="btn btn-primary"><i class="bi bi-check-lg"></i> {{ 'Yes'|trans({}, 'creditnote.bo.default') }}</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><i class="bi bi-x-lg"></i> {{ 'No'|trans({}, 'creditnote.bo.default-twig') }}</button>
<button type="submit" class="btn btn-primary"><i class="bi bi-check-lg"></i> {{ 'Yes'|trans({}, 'creditnote.bo.default-twig') }}</button>
</form>
</div>
</div>
Expand Down
Loading
Loading