Bug 20351 - Implement blocking errors for serials scripts
Summary: Implement blocking errors for serials scripts
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Serials (show other bugs)
Version: master
Hardware: All All
: P5 - low trivial (vote)
Target Milestone: ---
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on: 20661 20730
Blocks:
  Show dependency treegraph
 
Reported: 2018-03-07 16:13 UTC by Maria
Modified: 2018-11-28 15:35 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 20351: Shortcut serials scripts if a blocking error appeared (10.42 KB, patch)
2018-05-08 17:41 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 20351: Shortcut serials scripts if a blocking error appeared (12.06 KB, patch)
2018-05-08 18:55 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 20351: Shortcut serials scripts if a blocking error appeared (12.12 KB, patch)
2018-05-11 17:16 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 20351: Shortcut serials scripts if a blocking error appeared (12.17 KB, patch)
2018-08-31 18:00 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 20351: Shortcut serials scripts if a blocking error appeared (12.30 KB, patch)
2018-09-15 20:28 UTC, sandboxes@biblibre.com
Details | Diff | Splinter Review
Bug 20351: Shortcut serials scripts if a blocking error appeared (12.36 KB, patch)
2018-10-10 21:33 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Maria 2018-03-07 16:13:49 UTC
When you go to subscription details, like

cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=108

and use a subscriptionid which is not in the subscriptions table

you get an empty subscription item, but

should get a page telling you the subscription doesn't exist.
Comment 1 Jonathan Druart 2018-05-08 17:41:03 UTC
Created attachment 75178 [details] [review]
Bug 20351: Shortcut serials scripts if a blocking error appeared

The idea of output_and_exit_if_error (added by bug 18403) is to make sure
parameters are valid before executing the script.
If not (old or broken URLs), we shortcut everything coming next to display a
generic error ("object does not exist", "you do not have permission to do that", etc.)

This bug report fixes the scripts under serials/*.

Test plan:
Hit the script under the serials directory with an invalid subscriptionid parameter
and confirm you get an error instead of the normal view with empty values.

The goal is not to be exhaustive during the first iteration, but at least to fix
the most common views.

For instance:
/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=XXX
/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=XXX
/cgi-bin/koha/serials/routing.pl?subscriptionid=XXX&op=new
/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=XXx
/cgi-bin/koha/serials/subscription-add.pl?op=dup&subscriptionid=XXX
Comment 2 Jonathan Druart 2018-05-08 18:55:04 UTC
Created attachment 75185 [details] [review]
Bug 20351: Shortcut serials scripts if a blocking error appeared

The idea of output_and_exit_if_error (added by bug 18403) is to make sure
parameters are valid before executing the script.
If not (old or broken URLs), we shortcut everything coming next to display a
generic error ("object does not exist", "you do not have permission to do that", etc.)

This bug report fixes the scripts under serials/*.

Test plan:
Hit the script under the serials directory with an invalid subscriptionid parameter
and confirm you get an error instead of the normal view with empty values.

The goal is not to be exhaustive during the first iteration, but at least to fix
the most common views.

For instance:
/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=XXX
/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=XXX
/cgi-bin/koha/serials/routing.pl?subscriptionid=XXX&op=new
/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=XXx
/cgi-bin/koha/serials/subscription-add.pl?op=dup&subscriptionid=XXX
Comment 3 Maria 2018-05-11 15:02:10 UTC
I did an attempt to set up a sandbox and sign it off, but got this result.

The sandbox you've requested is not ready.
Some problems occurred applying patches from bug 20351:
<h1>Something went wrong !</h1>Applying: Bug 20351: Shortcut serials scripts if a blocking error appeared
.git/rebase-apply/patch:61: trailing whitespace.
   
.git/rebase-apply/patch:107: trailing whitespace.
   
.git/rebase-apply/patch:120: trailing whitespace.
  
fatal: sha1 information is lacking or useless (koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc).
error: could not build fake ancestor
Patch failed at 0001 Bug 20351: Shortcut serials scripts if a blocking error appeared
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem run git bz apply --continue.
If you would prefer to skip this patch, instead run git bz apply --skip.
To restore the original branch and stop patching run git bz apply --abort.
Bug 20351 - Implement blocking errors for serials scripts

75185 - Bug 20351: Shortcut serials scripts if a blocking error appeared

Apply? [(y)es, (n)o, (i)nteractive] Patch left in /tmp/Bug-20351-Shortcut-serials-scripts-if-a-blocking-e-EBl7TX.patch .
Comment 4 Jonathan Druart 2018-05-11 17:16:01 UTC
Created attachment 75274 [details] [review]
Bug 20351: Shortcut serials scripts if a blocking error appeared

The idea of output_and_exit_if_error (added by bug 18403) is to make sure
parameters are valid before executing the script.
If not (old or broken URLs), we shortcut everything coming next to display a
generic error ("object does not exist", "you do not have permission to do that", etc.)

This bug report fixes the scripts under serials/*.

Test plan:
Hit the script under the serials directory with an invalid subscriptionid parameter
and confirm you get an error instead of the normal view with empty values.

The goal is not to be exhaustive during the first iteration, but at least to fix
the most common views.

For instance:
/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=XXX
/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=XXX
/cgi-bin/koha/serials/routing.pl?subscriptionid=XXX&op=new
/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=XXx
/cgi-bin/koha/serials/subscription-add.pl?op=dup&subscriptionid=XXX
Comment 5 Jonathan Druart 2018-05-11 17:16:39 UTC
(In reply to Maria from comment #3)
> I did an attempt to set up a sandbox and sign it off, but got this result.
> 

You need to apply patches from bug 20661 and bug 20730 first.
Comment 6 Katrin Fischer 2018-08-30 06:08:27 UTC
Patch doesn't apply, can you please fix?
Comment 7 Jonathan Druart 2018-08-31 18:00:08 UTC
Created attachment 78344 [details] [review]
Bug 20351: Shortcut serials scripts if a blocking error appeared

The idea of output_and_exit_if_error (added by bug 18403) is to make sure
parameters are valid before executing the script.
If not (old or broken URLs), we shortcut everything coming next to display a
generic error ("object does not exist", "you do not have permission to do that", etc.)

This bug report fixes the scripts under serials/*.

Test plan:
Hit the script under the serials directory with an invalid subscriptionid parameter
and confirm you get an error instead of the normal view with empty values.

The goal is not to be exhaustive during the first iteration, but at least to fix
the most common views.

For instance:
/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=XXX
/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=XXX
/cgi-bin/koha/serials/routing.pl?subscriptionid=XXX&op=new
/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=XXx
/cgi-bin/koha/serials/subscription-add.pl?op=dup&subscriptionid=XXX
Comment 8 sandboxes@biblibre.com 2018-09-15 20:28:13 UTC
Patch tested with a sandbox, by Séverine QUEUNE <severine.queune@bulac.fr>
Comment 9 sandboxes@biblibre.com 2018-09-15 20:28:38 UTC
Created attachment 78887 [details] [review]
Bug 20351: Shortcut serials scripts if a blocking error appeared

The idea of output_and_exit_if_error (added by bug 18403) is to make sure
parameters are valid before executing the script.
If not (old or broken URLs), we shortcut everything coming next to display a
generic error ("object does not exist", "you do not have permission to do that", etc.)

This bug report fixes the scripts under serials/*.

Test plan:
Hit the script under the serials directory with an invalid subscriptionid parameter
and confirm you get an error instead of the normal view with empty values.

The goal is not to be exhaustive during the first iteration, but at least to fix
the most common views.

For instance:
/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=XXX
/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=XXX
/cgi-bin/koha/serials/routing.pl?subscriptionid=XXX&op=new
/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=XXx
/cgi-bin/koha/serials/subscription-add.pl?op=dup&subscriptionid=XXX

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 10 Katrin Fischer 2018-10-10 21:33:11 UTC
Created attachment 80371 [details] [review]
Bug 20351: Shortcut serials scripts if a blocking error appeared

The idea of output_and_exit_if_error (added by bug 18403) is to make sure
parameters are valid before executing the script.
If not (old or broken URLs), we shortcut everything coming next to display a
generic error ("object does not exist", "you do not have permission to do that", etc.)

This bug report fixes the scripts under serials/*.

Test plan:
Hit the script under the serials directory with an invalid subscriptionid parameter
and confirm you get an error instead of the normal view with empty values.

The goal is not to be exhaustive during the first iteration, but at least to fix
the most common views.

For instance:
/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=XXX
/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=XXX
/cgi-bin/koha/serials/routing.pl?subscriptionid=XXX&op=new
/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=XXx
/cgi-bin/koha/serials/subscription-add.pl?op=dup&subscriptionid=XXX

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Nick Clemens 2018-10-17 19:21:48 UTC
Awesome work all!

Pushed to master for 18.11
Comment 12 Martin Renvoize 2018-10-26 13:15:54 UTC
Pushed to 18.05.x for 18.05.06
Comment 13 Fridolin SOMERS 2018-11-09 15:14:33 UTC
Depends on Bug 20661 not in 17.11.x