From 9371504d9854b95d86b08fcd9ef52d177b12ef7f Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 8 Sep 2026 15:01:35 +0100 Subject: [PATCH] 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 Signed-off-by: Pedro Amorim --- acqui/neworderempty.pl | 6 +++++ .../prog/en/modules/acqui/neworderempty.tt | 22 ++++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 8db1e0a5a1..4af35262df 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -92,6 +92,7 @@ use Koha::Acquisition::Booksellers; use Koha::Acquisition::Currencies; use Koha::Biblios; use Koha::BiblioFrameworks; +use Koha::Database; use Koha::DateUtils qw( dt_from_string ); use Koha::MarcSubfieldStructures; use Koha::ItemTypes; @@ -446,6 +447,10 @@ $template->param( 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 my @servicing_instruction_authorised_values = Koha::AuthorisedValues->search( { category => 'EDIFACT_SI' }, @@ -496,6 +501,7 @@ $template->param( orderdiscount => $data->{'discount'}, order_internalnote => $data->{'order_internalnote'}, order_vendornote => $data->{'order_vendornote'}, + ediaccount => $ediaccount, servicing_instruction_groups => $servicing_instruction_groups, servicing_instruction_groups_json => $servicing_instruction_groups_json, servicing_instruction_avs_json => $servicing_instruction_avs_json, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt index 8222aef258..83279cb321 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -962,16 +962,18 @@ -
  • - -
    - -
    - - - -
    EDIFACT servicing instructions (GIR LVT/LVC). Each group can contain multiple coded (LVC) and/or free-text (LVT) instructions that work together.
    -
  • + [% IF Koha.Preference('EDIFACT') && ediaccount %] +
  • + +
    + +
    + + + +
    EDIFACT servicing instructions (GIR LVT/LVC). Each group can contain multiple coded (LVC) and/or free-text (LVT) instructions that work together.
    +
  • + [% END %]