Bug 30144: (QA follow-up) Only show servicing instructions when EDIFACT is available
The new servicing instructions UI on the "add order" form was showing
unconditionally, even when the EDIFACT system preference is disabled
or the vendor has no EDI account configured. Elsewhere in acquisitions
(e.g. acqui/basket.tt) EDI-only UI is gated on
Koha.Preference('EDIFACT') && ediaccount, so apply the same check here.
Test plan:
1. With EDIFACT disabled, or EDIFACT enabled but the vendor has no
entry in vendor_edi_accounts, open Acquisitions > a basket > Add
order (neworderempty.pl)
=> No "Servicing instructions" field is shown
2. Enable EDIFACT and add a vendor_edi_accounts row for the vendor
=> The "Servicing instructions" field appears and behaves as before
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
b210605ef7
commit
9371504d98
|
|
@ -92,6 +92,7 @@ use Koha::Acquisition::Booksellers;
|
||||||
use Koha::Acquisition::Currencies;
|
use Koha::Acquisition::Currencies;
|
||||||
use Koha::Biblios;
|
use Koha::Biblios;
|
||||||
use Koha::BiblioFrameworks;
|
use Koha::BiblioFrameworks;
|
||||||
|
use Koha::Database;
|
||||||
use Koha::DateUtils qw( dt_from_string );
|
use Koha::DateUtils qw( dt_from_string );
|
||||||
use Koha::MarcSubfieldStructures;
|
use Koha::MarcSubfieldStructures;
|
||||||
use Koha::ItemTypes;
|
use Koha::ItemTypes;
|
||||||
|
|
@ -446,6 +447,10 @@ $template->param(
|
||||||
items => $items,
|
items => $items,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Only offer EDIFACT servicing instructions when EDIFACT is enabled and the vendor has an EDI account
|
||||||
|
my $ediaccount =
|
||||||
|
Koha::Database->new()->schema()->resultset('VendorEdiAccount')->search( { vendor_id => $booksellerid } )->count > 0;
|
||||||
|
|
||||||
# Get servicing instruction authorized values for EDIFACT_SI category
|
# Get servicing instruction authorized values for EDIFACT_SI category
|
||||||
my @servicing_instruction_authorised_values = Koha::AuthorisedValues->search(
|
my @servicing_instruction_authorised_values = Koha::AuthorisedValues->search(
|
||||||
{ category => 'EDIFACT_SI' },
|
{ category => 'EDIFACT_SI' },
|
||||||
|
|
@ -496,6 +501,7 @@ $template->param(
|
||||||
orderdiscount => $data->{'discount'},
|
orderdiscount => $data->{'discount'},
|
||||||
order_internalnote => $data->{'order_internalnote'},
|
order_internalnote => $data->{'order_internalnote'},
|
||||||
order_vendornote => $data->{'order_vendornote'},
|
order_vendornote => $data->{'order_vendornote'},
|
||||||
|
ediaccount => $ediaccount,
|
||||||
servicing_instruction_groups => $servicing_instruction_groups,
|
servicing_instruction_groups => $servicing_instruction_groups,
|
||||||
servicing_instruction_groups_json => $servicing_instruction_groups_json,
|
servicing_instruction_groups_json => $servicing_instruction_groups_json,
|
||||||
servicing_instruction_avs_json => $servicing_instruction_avs_json,
|
servicing_instruction_avs_json => $servicing_instruction_avs_json,
|
||||||
|
|
|
||||||
|
|
@ -962,16 +962,18 @@
|
||||||
<label for="order_vendornote">Vendor note: </label>
|
<label for="order_vendornote">Vendor note: </label>
|
||||||
<textarea id="order_vendornote" cols="30" rows="3" name="order_vendornote">[% IF ( order_vendornote ) %][% order_vendornote | html %][% END %]</textarea>
|
<textarea id="order_vendornote" cols="30" rows="3" name="order_vendornote">[% IF ( order_vendornote ) %][% order_vendornote | html %][% END %]</textarea>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
[% IF Koha.Preference('EDIFACT') && ediaccount %]
|
||||||
<label for="servicing_instructions">Servicing instructions: </label>
|
<li>
|
||||||
<div id="servicing_instructions_container">
|
<label for="servicing_instructions">Servicing instructions: </label>
|
||||||
<!-- Servicing instruction groups will be populated here -->
|
<div id="servicing_instructions_container">
|
||||||
</div>
|
<!-- Servicing instruction groups will be populated here -->
|
||||||
<button type="button" id="add_servicing_group" class="btn btn-default btn-xs"> <i class="fa fa-plus"></i> Add servicing group </button>
|
</div>
|
||||||
<input type="hidden" id="servicing_instruction_groups_json" name="servicing_instruction_groups_json" value="[% servicing_instruction_groups_json | html %]" />
|
<button type="button" id="add_servicing_group" class="btn btn-default btn-xs"> <i class="fa fa-plus"></i> Add servicing group </button>
|
||||||
<input type="hidden" id="servicing_instruction_avs_json" value="[% servicing_instruction_avs_json | html %]" />
|
<input type="hidden" id="servicing_instruction_groups_json" name="servicing_instruction_groups_json" value="[% servicing_instruction_groups_json | html %]" />
|
||||||
<div class="hint">EDIFACT servicing instructions (GIR LVT/LVC). Each group can contain multiple coded (LVC) and/or free-text (LVT) instructions that work together.</div>
|
<input type="hidden" id="servicing_instruction_avs_json" value="[% servicing_instruction_avs_json | html %]" />
|
||||||
</li>
|
<div class="hint">EDIFACT servicing instructions (GIR LVT/LVC). Each group can contain multiple coded (LVC) and/or free-text (LVT) instructions that work together.</div>
|
||||||
|
</li>
|
||||||
|
[% END %]
|
||||||
<li>
|
<li>
|
||||||
<label for="estimated_delivery_date">Estimated delivery date: </label>
|
<label for="estimated_delivery_date">Estimated delivery date: </label>
|
||||||
<input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="flatpickr" value="[% estimated_delivery_date | html %]" />
|
<input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="flatpickr" value="[% estimated_delivery_date | html %]" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue