Bug 19367

Summary: $biblio variable redefined in same scope in ISBDdetail
Product: Koha Reporter: David Cook <dcook>
Component: CatalogingAssignee: David Cook <dcook>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: jonathan.druart, m.de.rooy, mtompset
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 17736    
Bug Blocks:    
Attachments: Bug 19367 - $biblio variable redefined in same scope in ISBDdetail
Bug 19367 - $biblio variable redefined in same scope in ISBDdetail
Bug 19367 - $biblio variable redefined in same scope in ISBDdetail

Description David Cook 2017-09-26 00:42:03 UTC
I've been running "perl -c" through Koha files to check for compilation errors, and I came across the following:

my" variable $biblio masks earlier declaration in same scope at ./catalogue/ISBDdetail.pl line 171.

Sure enough, it looks like "my $biblio" is written twice in the same scope unnecessarily. I'll look at fixing that...
Comment 1 David Cook 2017-09-26 01:50:53 UTC
Created attachment 67356 [details] [review]
Bug 19367 - $biblio variable redefined in same scope in ISBDdetail

The following warning is generated by ISBDdetail.pl:
my" variable $biblio masks earlier declaration in same scope
at ./catalogue/ISBDdetail.pl line 171.

This patch removes this unnecessary declaration, which removes the
warning.

_TEST PLAN_

After applying patch:

1) Check code compilation with "KOHA_CONF=/path/to/koha-conf.xml perl -c catalogue/ISBDdetail.pl"
2) Note the only message is "./catalogue/ISBDdetail.pl syntax OK"
2) On /cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=1,
view the source of the page and verify that the Javascript
contains a holdcount e.g. "var holdcount = 0".
Comment 2 Mark Tompsett 2017-09-26 13:18:16 UTC
I just need to check if $biblio isn't subject to spooky scoping action between those two points. It eyeballs well, though, without 'my' would be safe and not require any thought. :)
Comment 3 Jonathan Druart 2017-09-26 17:26:37 UTC
Created attachment 67370 [details] [review]
Bug 19367 - $biblio variable redefined in same scope in ISBDdetail

The following warning is generated by ISBDdetail.pl:
my" variable $biblio masks earlier declaration in same scope
at ./catalogue/ISBDdetail.pl line 171.

This patch removes this unnecessary declaration, which removes the
warning.

_TEST PLAN_

After applying patch:

1) Check code compilation with "KOHA_CONF=/path/to/koha-conf.xml perl -c catalogue/ISBDdetail.pl"
2) Note the only message is "./catalogue/ISBDdetail.pl syntax OK"
2) On /cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=1,
view the source of the page and verify that the Javascript
contains a holdcount e.g. "var holdcount = 0".

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 4 Jonathan Druart 2017-09-26 17:27:05 UTC
(In reply to M. Tompsett from comment #2)
> I just need to check if $biblio isn't subject to spooky scoping action
> between those two points. It eyeballs well, though, without 'my' would be
> safe and not require any thought. :)

Looks safe to me.
Comment 5 Nick Clemens 2017-10-07 02:16:14 UTC
Created attachment 67780 [details] [review]
Bug 19367 - $biblio variable redefined in same scope in ISBDdetail

The following warning is generated by ISBDdetail.pl:
my" variable $biblio masks earlier declaration in same scope
at ./catalogue/ISBDdetail.pl line 171.

This patch removes this unnecessary declaration, which removes the
warning.

_TEST PLAN_

After applying patch:

1) Check code compilation with "KOHA_CONF=/path/to/koha-conf.xml perl -c catalogue/ISBDdetail.pl"
2) Note the only message is "./catalogue/ISBDdetail.pl syntax OK"
2) On /cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=1,
view the source of the page and verify that the Javascript
contains a holdcount e.g. "var holdcount = 0".

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 6 Jonathan Druart 2017-10-09 19:19:27 UTC
Pushed to master for 17.11, thanks to everybody involved!