From df4b555230e2c1073491a9014bd2b62a58fa0f5b 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! Signed-off-by: Katrin Fischer --- Koha/Schema/Result/EdifactMessage.pm | 10 ++++++++++ koha-tmpl/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 9c69e8afcb..2248e2d8f0 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.11.0