Bug 21500: Remove warnings in rotating collections
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 4 Oct 2018 17:08:32 +0000 (14:08 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Tue, 9 Oct 2018 15:02:45 +0000 (15:02 +0000)
To test:
- Go to Tools > Rotating collections
=> FAIL: Some warinings on the logs
- Apply this patch
- Reload page
=> SUCCESS: No warinings
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
rotating_collections/addItems.pl

index 7d4fd64..4c79328 100755 (executable)
@@ -41,7 +41,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     }
 );
 
-if ( $query->param('action') eq 'addItem' ) {
+if ( defined $query->param('action') and
+     $query->param('action') eq 'addItem' ) {
     ## Add the given item to the collection
     my $colId      = $query->param('colId');
     my $barcode    = $query->param('barcode');
@@ -91,7 +92,7 @@ if ( $query->param('action') eq 'addItem' ) {
 }
 
 my ( $colId, $colTitle, $colDescription, $colBranchcode ) =
-  GetCollection( $query->param('colId') );
+  GetCollection( scalar $query->param('colId') );
 my $collectionItems = GetItemsInCollection($colId);
 if ($collectionItems) {
     $template->param( collectionItemsLoop => $collectionItems );