Bug 39787: Fix missing sender EAN when only one EAN is defined

If only one EAN is defined for the library, the Create EDIFACT order
button template used the eans.0 object instead of its ean field.
As a result, the data-ean attribute contained an object, not the EAN
string. Fixed by explicitly accessing the field: eans.0.ean.

Steps to reproduce:
1. Ensure only one Library EAN is configured in
   /cgi-bin/koha/admin/edi_ean_accounts.pl.
2. Create a new basket.
3. Inspect the HTML of the Create EDIFACT order button.
4. The data-ean attribute will show an object instead
   of EAN string — e.g. Koha::Schema::Result... (this is the bug).
5. Apply the patch and reload the basket page.
6. Inspect the HTML again — data-ean should now show
   the EAN string (fixed).
7. Click the button, confirm basket closure, then go to EDIFACT messages
(/cgi-bin/koha/acqui/edifactmsgs.pl) and verify the message was created.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Slava Shishkin 2025-05-07 19:51:22 +03:00 committed by Katrin Fischer
parent 6130a072d3
commit 32eeb4c87c
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 8 additions and 1 deletions

View File

@ -131,7 +131,14 @@
[% ELSE %]
<div class="btn-group">
[% IF eans.size == 1 %]
<a class="btn btn-default btn-xs submit-form-link" href="#" data-ean="[% eans.0 | html %]" data-basketno="[% basketno | html %]" data-action="basket.pl" data-method="post" data-op="cud-ediorder"
<a
class="btn btn-default btn-xs submit-form-link"
href="#"
data-ean="[% eans.0.ean | html %]"
data-basketno="[% basketno | html %]"
data-action="basket.pl"
data-method="post"
data-op="cud-ediorder"
><i class="fa fa-download"></i> Create EDIFACT order</a
>
[% ELSE %]