Bugzilla – Attachment 75173 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: generate edifact showing on basket groups
Bug-16739-generate-edifact-showing-on-basket-group.patch (text/plain), 8.05 KB, created by
Jon Knight
on 2018-05-08 16:41:23 UTC
(
hide
)
Description:
Bug 16739: generate edifact showing on basket groups
Filename:
MIME Type:
Creator:
Jon Knight
Created:
2018-05-08 16:41:23 UTC
Size:
8.05 KB
patch
obsolete
>From a8035f72bda70c9a3f67844d8572dbfc573fc549 Mon Sep 17 00:00:00 2001 >From: Jon Knight <J.P.Knight@lboro.ac.uk> >Date: Tue, 8 May 2018 16:28:57 +0000 >Subject: [PATCH] Bug 16739: generate edifact showing on basket groups > >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>". >--- > acqui/basketgroup.pl | 29 +++++++++++++++++++--- > .../prog/en/modules/acqui/basketgroup.tt | 11 +++++++- > 2 files changed, 35 insertions(+), 5 deletions(-) > >diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl >index df625af..0947040 100755 >--- a/acqui/basketgroup.pl >+++ b/acqui/basketgroup.pl >@@ -216,8 +216,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; > } >@@ -236,6 +243,11 @@ 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" ) { > # >@@ -387,8 +399,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 dab44d8..a90a643 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt >@@ -146,7 +146,11 @@ function submitForm(form) { > <div class="btn-group"><a href="[% script_name %]?op=reopen&basketgroupid=[% basketgroupid %]&booksellerid=[% booksellerid %]&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 %]?op=export&basketgroupid=[% basketgroupid %]&booksellerid=[% booksellerid %]" 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 %]?op=print&basketgroupid=[% basketgroupid %]&booksellerid=[% booksellerid %]" 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 %]?op=ediprint&basketgroupid=[% basketgroupid %]&booksellerid=[% booksellerid %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Generate EDIFACT order</a></div> >+ [% ELSE %] >+ <div class="btn-group"><a href="[% script_name %]?op=ediprint&basketgroupid=[% basketgroupid %]&booksellerid=[% booksellerid %]" class="btn btn-default btn-sm" id="printbutton"></div> >+ [% END %] > </div> > [% END %] > [% IF (name && closedbg) %] >@@ -291,6 +295,7 @@ function submitForm(form) { > <div class="btn-group"><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% booksellerid %]" 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 %]">[% 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> >@@ -369,7 +374,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 %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><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 %]" /><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 %]" /><input type="submit" value="Export as CSV" /></form> >- <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 %]" /><input type="submit" value="Generate EDIFACT order" /></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 %]" /><input type="hidden" name="booksellerid" value="[% booksellerid %]" ><input type="submit" value="Generate EDIFACT order" /></form> >+ [% ELSE %] >+ <div>No EDIFACT configuration for [% booksellername %]</div> >+ [% END %] > </td> > </tr> > [% END %] >-- >2.1.4
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