Bug 39787 - Sending EDI order from basket fails if only one Library EAN exists
Summary: Sending EDI order from basket fails if only one Library EAN exists
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Slava Shishkin
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on:
Blocks: 37993
  Show dependency treegraph
 
Reported: 2025-04-30 12:29 UTC by Kyle M Hall (khall)
Modified: 2025-05-09 07:14 UTC (History)
3 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.05.00
Circulation function:


Attachments
Bug 39787: Fix missing sender EAN when only one EAN is defined (2.76 KB, patch)
2025-05-07 16:52 UTC, Slava Shishkin
Details | Diff | Splinter Review
Bug 39787: Fix missing sender EAN when only one EAN is defined (2.81 KB, patch)
2025-05-08 10:56 UTC, David Nind
Details | Diff | Splinter Review
Bug 39787: Fix missing sender EAN when only one EAN is defined (2.87 KB, patch)
2025-05-08 12:20 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall (khall) 2025-04-30 12:29:02 UTC
If there is only one EAN defined, the button has no pulldown. Clicking the button to send the edi order results in the error:
No sender ean passed to order creation: basket = Koha::Schema::Result::Aqbasket=HASH(0x5574bf315b98)->basketno()
Comment 1 Slava Shishkin 2025-05-07 16:52:42 UTC
Created attachment 182036 [details] [review]
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.
Comment 2 David Nind 2025-05-08 10:56:49 UTC
Created attachment 182067 [details] [review]
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>
Comment 3 David Nind 2025-05-08 11:01:27 UTC
Testing notes (using KTD):

1. Enable the EDIFACT system preference.
2. Create an EDI account for "My Vendor" (Koha administration > Acquisition parameters > EDI accounts).
3. Create a library EAN (Koha administration > Acquisition parameters > Library EANs).
4. Then the "Create EDIFACT order" button will appear on the basket page.
Comment 4 Martin Renvoize (ashimema) 2025-05-08 12:20:32 UTC
Created attachment 182074 [details] [review]
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>
Comment 5 Katrin Fischer 2025-05-09 07:14:39 UTC
Pushed for 25.05!

Well done everyone, thank you!