Bug 23319: Implement blocking errors for neworderbiblio and basket.pl
authorNick Clemens <nick@bywatersolutions.com>
Mon, 15 Jul 2019 17:46:36 +0000 (17:46 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 13 Aug 2019 10:27:03 +0000 (11:27 +0100)
To test:
1 - Hit neworderbiblio with a query and no vendor
    http://localhost:8081/cgi-bin/koha/acqui/neworderbiblio.pl?q=cat
    Or, add to basket from existing record with a search
    Refresh the page (url has no parameters)
2 - Get an internal server error
3 - Add bookseller
    http://localhost:8081/cgi-bin/koha/acqui/neworderbiblio.pl?q=cat&booksellerid=1
4 - Click 'Order' on a result
5 - Internal server error
6 - Apply patch
7 - Repeat 1-4, you get 'Vendor not found' or 'Basket not found'

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

acqui/neworderbiblio.pl
acqui/neworderempty.pl
koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderbiblio.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt

index aed5d56..931429f 100755 (executable)
@@ -97,6 +97,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     }
 );
 
+output_and_exit( $input, $cookie, $template, 'unknown_vendor') unless $bookseller;
+
 # Searching the catalog.
 
 my @operands = $query;
index fb1b66a..29acca7 100755 (executable)
@@ -138,6 +138,9 @@ my $basketobj = Koha::Acquisition::Baskets->find( $basketno );
 $booksellerid = $basket->{booksellerid} unless $booksellerid;
 my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
 
+output_and_exit( $input, $cookie, $template, 'unknown_basket') unless $basketobj;
+output_and_exit( $input, $cookie, $template, 'unknown_vendor') unless $bookseller;
+
 my $contract = GetContract({
     contractnumber => $basket->{contractnumber}
 });
index 68eb554..8db6e95 100644 (file)
@@ -11,6 +11,8 @@
         <div class="dialog message">Subscription not found.</div>
     [% CASE 'unknown_basket' %]
         <div class="dialog message">Basket not found.</div>
+    [% CASE 'unknown_vendor' %]
+        <div class="dialog message">Vendor not found.</div>
     [% CASE 'wrong_csrf_token' %]
         <div class="dialog message">The form submission failed (Wrong CSRF token). Try to come back, refresh the page, then try again.</div>
     [% CASE %][% blocking_error | html %]
index d4642a1..7cd031c 100644 (file)
@@ -12,6 +12,8 @@
 
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% name | html %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | html %]">Basket [% basketno | html %]</a> &rsaquo; Search existing records</div>
 
+[% INCLUDE 'blocking_errors.inc' %]
+
 <div class="main container-fluid">
     <div class="row">
         <div class="col-sm-10 col-sm-push-2">
index ff0113f..df96f1a 100644 (file)
@@ -17,6 +17,8 @@
 
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% name | html %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | html %]">Basket [% basketno | html %]</a> &rsaquo; [% IF ( ordernumber ) %]Modify order details (line #[% ordernumber | html %])[% ELSE %]New order[% END %]</div>
 
+[% INCLUDE 'blocking_errors.inc' %]
+
 <div class="main container-fluid">
     <div class="row">
         <div class="col-sm-10 col-sm-push-2">