Bug 16955 - Internal Server Error while populating new framework
Summary: Internal Server Error while populating new framework
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
: 16987 (view as bug list)
Depends on: 11842
Blocks: 17009
  Show dependency treegraph
 
Reported: 2016-07-21 16:32 UTC by Marc Véron
Modified: 2019-06-27 09:24 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 16955: Internal Server Error while populating new framework (2.75 KB, patch)
2016-07-21 19:48 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 16955: Internal Server Error while populating new framework (2.80 KB, patch)
2016-07-30 09:01 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 16955: Do not clear from cache when adding a new framework (1.65 KB, patch)
2016-08-02 08:46 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 16955: Do not clear from cache when adding a new framework (1.71 KB, patch)
2016-08-06 23:12 UTC, Christopher Brannon
Details | Diff | Splinter Review
Bug 16955: Do not clear from cache when adding a new framework (1.76 KB, patch)
2016-08-12 16:41 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Véron 2016-07-21 16:32:36 UTC
While populating a new framework, an internal server error occurs.

It happens on an installation with Plack.

Steps to reproduce:

- Go to  Home > Administration > MARC frameworks 
- Add framework e.g. TEST, submit
- In List of frameworks, go to framework TEST, Actions, 
  MARC Structure
- Create framework for... : Select DEFAULT 
Result: Internal Server Error (rest of sceen blank)
Comment 1 Marc Véron 2016-07-21 16:35:28 UTC
Lines from plack-error.log:

Variable "$cache" is not available at (...)/admin/marctagstructure.pl line 360.
Variable "$frameworkcode" is not available at /home/marc/koha/admin/marctagstructure.pl line 362.
Variable "$cache" is not available at (...)/admin/marctagstructure.pl line 360.
Variable "$frameworkcode" is not available at (...)a/admin/marctagstructure.pl line 362.
Can't call method "clear_from_cache" on an undefined value at /home/marc/koha/admin/marctagstructure.pl line 360.
Comment 2 Marc Véron 2016-07-21 19:48:02 UTC Comment hidden (obsolete)
Comment 3 Josef Moravec 2016-07-30 08:55:48 UTC
*** Bug 16987 has been marked as a duplicate of this bug. ***
Comment 4 Josef Moravec 2016-07-30 09:01:40 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2016-08-01 12:06:23 UTC
Introduced by bug 11842.
Comment 6 Jonathan Druart 2016-08-01 12:18:54 UTC
There was a wrong c/p here (you can blame me), the last 2 lines are using $frameworkcode instead of $newframeworkcode.
Moreover the 4 clear_from_cache calls are inside the while loop, which means that we are clearing the cache 4 times per subfield (!).
Finally these calls are actually not needed :) As we are creating a new framework, the cache should be empty...
Comment 7 Jonathan Druart 2016-08-01 12:20:15 UTC
(In reply to Jonathan Druart from comment #6)
> Moreover the 4 clear_from_cache calls are inside the while loop, which means
> that we are clearing the cache 4 times per subfield (!).

Ha, it is added by this patch.
Comment 8 Marc Véron 2016-08-01 20:18:48 UTC
Hi Jonathan,

Sorry, I have no time at the mmoment to fix this.

Can you provide an alternative patch?

Thanks
Marc
Comment 9 Jonathan Druart 2016-08-02 08:46:54 UTC Comment hidden (obsolete)
Comment 10 Christopher Brannon 2016-08-06 23:12:20 UTC Comment hidden (obsolete)
Comment 11 Nick Clemens (kidclamp) 2016-08-12 16:41:49 UTC
Created attachment 54387 [details] [review]
Bug 16955: Do not clear from cache when adding a new framework

There are several issues with these lines:
1/ $cache is not defined correctly and it not visible inside
duplicate_framework
2/ $frameworkcode is a wrong c/p, it should be $newframeworkcode
3/ these calls are not needed. As we are creating a new framework, the cache
should be empty...

This patch will simply remove these calls

Test plan:
Duplicate a framework and confirm that you do not get any error in your
logs.

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 12 Kyle M Hall 2016-08-18 15:49:06 UTC
Pushed to master for 16.11, thanks Jonathan!
Comment 13 Frédéric Demians 2016-08-23 10:34:46 UTC
Pushed in 16.05. Will be in 16.05.03.
Comment 14 Julian Maurice 2016-08-24 10:41:54 UTC
Pushed to 3.22.x, will be in 3.22.10