Bug 22031: Add SQL::Abstract like syntax to haspermission
[koha.git] / C4 / RotatingCollections.pm
index ea75eaa..709eaf2 100644 (file)
@@ -9,18 +9,18 @@ package C4::RotatingCollections;
 #
 # This file is part of Koha.
 #
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
 #
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use Modern::Perl;
 
@@ -33,10 +33,8 @@ use DBI;
 
 use Data::Dumper;
 
-use vars qw($VERSION @ISA @EXPORT);
+use vars qw(@ISA @EXPORT);
 
-# set the version for version checking
-$VERSION = 3.07.00.049;
 
 =head1 NAME
 
@@ -88,7 +86,7 @@ sub CreateCollection {
     my $schema = Koha::Database->new()->schema();
     my $duplicate_titles = $schema->resultset('Collection')->count({ colTitle => $title });
 
-    ## Check for all neccessary parameters
+    ## Check for all necessary parameters
     if ( !$title ) {
         return ( 0, 1, "NO_TITLE" );
     } elsif ( $duplicate_titles ) {
@@ -136,7 +134,7 @@ sub UpdateCollection {
     my $schema = Koha::Database->new()->schema();
     my $duplicate_titles = $schema->resultset('Collection')->count({ colTitle => $title,  -not => { colId => $colId } });
 
-    ## Check for all neccessary parameters
+    ## Check for all necessary parameters
     if ( !$colId ) {
         return ( 0, 1, "NO_ID" );
     }
@@ -171,7 +169,7 @@ sub UpdateCollection {
  Deletes a collection of the given id
 
  Input:
-   $colId : id of the Archtype to be deleted
+   $colId : id of the Archetype to be deleted
 
  Output:
    $success: 1 if all database operations were successful, 0 otherwise
@@ -183,7 +181,7 @@ sub UpdateCollection {
 sub DeleteCollection {
     my ($colId) = @_;
 
-    ## Paramter check
+    ## Parameter check
     if ( !$colId ) {
         return ( 0, 1, "NO_ID" );
     }
@@ -247,7 +245,7 @@ sub GetCollections {
 sub GetItemsInCollection {
     my ($colId) = @_;
 
-    ## Paramter check
+    ## Parameter check
     if ( !$colId ) {
         return ( 0, 0, 1, "NO_ID" );
     }
@@ -326,7 +324,7 @@ Adds an item to a rotating collection.
 sub AddItemToCollection {
     my ( $colId, $itemnumber ) = @_;
 
-    ## Check for all neccessary parameters
+    ## Check for all necessary parameters
     if ( !$colId ) {
         return ( 0, 1, "NO_ID" );
     }
@@ -376,7 +374,7 @@ Removes an item to a collection
 sub RemoveItemFromCollection {
     my ( $colId, $itemnumber ) = @_;
 
-    ## Check for all neccessary parameters
+    ## Check for all necessary parameters
     if ( !$itemnumber ) {
         return ( 0, 2, "NO_ITEM" );
     }
@@ -417,7 +415,7 @@ Transfers a collection to another branch
 sub TransferCollection {
     my ( $colId, $colBranchcode ) = @_;
 
-    ## Check for all neccessary parameters
+    ## Check for all necessary parameters
     if ( !$colId ) {
         return ( 0, 1, "NO_ID" );
     }
@@ -447,8 +445,8 @@ sub TransferCollection {
     my @results;
     while ( my $item = $sth->fetchrow_hashref ) {
         my ($status) = CheckReserves( $item->{itemnumber} );
-        my @transfers = GetTransfers( $item->{itemnumber} );
-        transferbook( $colBranchcode, $item->{barcode}, my $ignore_reserves = 1 ) unless ( $status eq 'Waiting' || @transfers );
+        my @transfers = C4::Circulation::GetTransfers( $item->{itemnumber} );
+        C4::Circulation::transferbook( $colBranchcode, $item->{barcode}, my $ignore_reserves = 1 ) unless ( $status eq 'Waiting' || @transfers );
     }
 
     return 1;