From 2ab7d6602ad56061829dec30f3f66032083e3043 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 15 Jun 2020 11:56:13 -0400 Subject: [PATCH] Bug 25759: Invoices hyperlink is broken on edifactmsgs.pl The "Invoices" hyperlink on edifactmsgs.pl has always been broken. We can parse out the invoice number from the message and have the link search for that invoice number in Koha. Test Plan: 1) Locate an imported invoice from edifactmsgs.pl 2) Click the "Invoices" link for that invoice 3) Note no invoice is found 4) Apply this patch 5) Restart all the things! 6) Reload the page 7) Note the link now reads "Invoice: $invoice_number" 8) Click the new link 9) Note it is now found by Koha! --- Koha/Schema/Result/EdifactMessage.pm | 10 ++++++++++ .../intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Koha/Schema/Result/EdifactMessage.pm b/Koha/Schema/Result/EdifactMessage.pm index db24e7468c..5f991731dd 100644 --- a/Koha/Schema/Result/EdifactMessage.pm +++ b/Koha/Schema/Result/EdifactMessage.pm @@ -202,4 +202,14 @@ __PACKAGE__->add_columns( '+deleted' => { is_boolean => 1 }, ); +sub invoice_id { + my ( $self ) = @_; + + if ( $self->raw_msg =~ /BGM\+\d{3}\+(\d+)\+/ ) { + return $1; + } else { + return; + } +} + 1; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt index 5f0dc43ac6..ce888e1054 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt @@ -61,8 +61,9 @@ [% END %] [% ELSE %] - - Invoices + [% SET invoice_id = msg.invoice_id %] + + Invoice: [% invoice_id %] [% END %] -- 2.24.1 (Apple Git-126)