Bugzilla – Attachment 79484 Details for
Bug 16739
Generate EDIFACT on basket groups falsely showing when configuration is incomplete
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16739: Show note instead of 500 error for 'Generate EDIFACT' when no EDI account is configured
Bug-16739-Show-note-instead-of-500-error-for-Gener.patch (text/plain), 9.65 KB, created by
Katrin Fischer
on 2018-09-27 11:49:46 UTC
(
hide
)
Description:
Bug 16739: Show note instead of 500 error for 'Generate EDIFACT' when no EDI account is configured
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2018-09-27 11:49:46 UTC
Size:
9.65 KB
patch
obsolete
>From 3925a905b541032adfac1c2b4cab0b3f60003652 Mon Sep 17 00:00:00 2001 >From: Jon Knight <J.P.Knight@lboro.ac.uk> >Date: Mon, 14 May 2018 15:30:55 +0000 >Subject: [PATCH] Bug 16739: Show note instead of 500 error for 'Generate > EDIFACT' when no EDI account is configured > >When a book seller (vendor) does not have EDI account information configured >the basketgroup display still shows a button to generate EDIFACT output which >results in 500 error when clicked. This patch fixes two aspects of this: > >a) it stops the button being displayed in the first place, replacing it with >a message that explains there is not EDIFACT configuration for the vendor. > >b) if, somehow, an edifact print operation is passed to the basketgroup >script it detects the lack of an EAN and redirects back to the basket group >display page with a warning message. > >To test: >1) Create a vendor with no EDI details. >2) Create a basket with some items in, then close it and add it to a basket > group for this vendor. > 3) Go to that vendor's basket groups, click on the "Closed" tab and then > click on the 'generate edifact order' button. You should get a 500 error. > 4) Apply this patch. > 5) Repeat 3, except this time you should find that the 'generate edifact > order' button has been replaced with a note that there is > "No EDIFACT configuration for <vendor>". > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > acqui/basketgroup.pl | 30 ++++++++++++++++--- > .../prog/en/modules/acqui/basketgroup.tt | 17 +++++++---- > 2 files changed, 38 insertions(+), 9 deletions(-) > >diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl >index 78514ba2ac..05c505ad54 100755 >--- a/acqui/basketgroup.pl >+++ b/acqui/basketgroup.pl >@@ -220,8 +220,15 @@ sub generate_edifact_orders { > my $baskets = GetBasketsByBasketgroup($basketgroupid); > my $ean = get_edifact_ean(); > >- for my $basket ( @{$baskets} ) { >- create_edi_order( { ean => $ean, basketno => $basket->{basketno}, } ); >+ if($ean) { >+ for my $basket ( @{$baskets} ) { >+ create_edi_order( { ean => $ean, basketno => $basket->{basketno}, } ); >+ } >+ } else { >+ my $booksellerid = $input->param('booksellerid') || 0; >+ print $input->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=' . >+ $booksellerid . >+ '&message=No%20EDIFACT%20Setup'); > } > return; > } >@@ -240,6 +247,12 @@ my $op = $input->param('op') || 'display'; > # - display : display the list of all basketgroups for a vendor > my $booksellerid = $input->param('booksellerid'); > $template->param(booksellerid => $booksellerid); >+my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid ); >+ >+my $schema = Koha::Database->new()->schema(); >+my $rs = $schema->resultset('VendorEdiAccount')->search( >+ { vendor_id => $booksellerid, } ); >+$template->param( ediaccount => ($rs->count > 0)); > > if ( $op eq "add" ) { > # >@@ -391,8 +404,17 @@ if ( $op eq "add" ) { > > } elsif ( $op eq 'ediprint') { > my $basketgroupid = $input->param('basketgroupid'); >- generate_edifact_orders( $basketgroupid ); >- exit; >+ if ($template->param( 'ediaccount' )) { >+ generate_edifact_orders( $basketgroupid ); >+ exit; >+ } else { >+ $template->param('NoEDIMessage' => 1); >+ my $basketgroups = &GetBasketgroups($booksellerid); >+ my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid ); >+ my $baskets = &GetBasketsByBookseller($booksellerid); >+ >+ displaybasketgroups($basketgroups, $bookseller, $baskets); >+ } > }else{ > # no param : display the list of all basketgroups for a given vendor > my $basketgroups = &GetBasketgroups($booksellerid); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt >index 7847ff49c9..6f4ac6d745 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt >@@ -144,10 +144,12 @@ function submitForm(form) { > [% IF ( grouping ) %] > [% IF (closedbg) %] > <div id="toolbar" class="btn-toolbar"> >- <div class="btn-group"><a href="[% script_name | html %]?op=reopen&basketgroupid=[% basketgroupid | html %]&booksellerid=[% booksellerid | html %]&mode=singlebg" class="btn btn-default btn-sm" id="reopenbutton"><i class="fa fa-download"></i> Reopen this basket group</a></div> >- <div class="btn-group"><a href="[% script_name | html %]?op=export&basketgroupid=[% basketgroupid | html %]&booksellerid=[% booksellerid | html %]" class="btn btn-default btn-sm" id="exportbutton"><i class="fa fa-download"></i> Export this basket group as CSV</a></div> >- <div class="btn-group"><a href="[% script_name | html %]?op=print&basketgroupid=[% basketgroupid | html %]&booksellerid=[% booksellerid | html %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Print this basket group in PDF</a></div> >- <div class="btn-group"><a href="[% script_name | html %]?op=ediprint&basketgroupid=[% basketgroupid | html %]&booksellerid=[% booksellerid | html %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Generate EDIFACT order</a></div> >+ <div class="btn-group"><a href="[% script_name | uri %]?op=reopen&basketgroupid=[% basketgroupid | uri %]&booksellerid=[% booksellerid | uri %]&mode=singlebg" class="btn btn-default btn-sm" id="reopenbutton"><i class="fa fa-download"></i> Reopen this basket group</a></div> >+ <div class="btn-group"><a href="[% script_name | uri %]?op=export&basketgroupid=[% basketgroupid | uri %]&booksellerid=[% booksellerid | uri %]" class="btn btn-default btn-sm" id="exportbutton"><i class="fa fa-download"></i> Export this basket group as CSV</a></div> >+ <div class="btn-group"><a href="[% script_name | uri %]?op=print&basketgroupid=[% basketgroupid | uri %]&booksellerid=[% booksellerid | uri %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Print this basket group in PDF</a></div> >+ [% IF (ediaccount) %] >+ <div class="btn-group"><a href="[% script_name | uri %]?op=ediprint&basketgroupid=[% basketgroupid | uri %]&booksellerid=[% booksellerid | uri %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Generate EDIFACT order</a></div> >+ [% END %] > </div> > [% END %] > [% IF (name && closedbg) %] >@@ -295,7 +297,8 @@ function submitForm(form) { > <div id="toolbar" class="btn-toolbar"> > <div class="btn-group"><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% booksellerid | html %]" class="btn btn-default btn-sm" id="newbasketgroup"><i class="fa fa-plus"></i> New basket group</a></div> > </div> >- <h1>Basket grouping for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a></h1> >+ <h1>Basket grouping for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1> >+ [% IF (NoEDIMessage) %]<div><strong>No EDIFACT configuration for [% booksellername | html %]</strong></div>[% END %] > <div id="basket_groups" class="toptabs"> > <ul class="ui-tabs-nav"> > [% UNLESS ( listclosed) %]<li class="ui-tabs-active"><a href="#opened">Open</a></li> >@@ -374,7 +377,11 @@ function submitForm(form) { > <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="reopen" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Reopen" /></form> > <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="print" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Export as PDF" /></form> > <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="export" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Export as CSV" /></form> >+ [% IF (ediaccount) %] > <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="ediprint" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Generate EDIFACT order" /></form> >+ [% ELSE %] >+ <div>No EDIFACT configuration for [% booksellername | html %]</div> >+ [% END %] > </td> > </tr> > [% END %] >-- >2.17.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16739
:
75173
|
75316
|
79174
|
79466
| 79484