# 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., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
+# 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.
use strict;
+#use warnings; FIXME - Bug 2505
require Exporter;
=head1 FUNCTIONS
-=over 2
-
=cut
@ISA = qw( Exporter );
GetCollectionItemBranches
);
-=item CreateCollection
+=head2 CreateCollection
( $success, $errorcode, $errormessage ) = CreateCollection( $title, $description );
Creates a new collection
$success: 1 if all database operations were successful, 0 otherwise
$errorCode: Code for reason of failure, good for translating errors in templates
$errorMessage: English description of error
+
=cut
+
sub CreateCollection {
my ( $title, $description ) = @_;
$sth->finish;
return 1;
-
+
}
-=item UpdateCollection
+=head2 UpdateCollection
+
( $success, $errorcode, $errormessage ) = UpdateCollection( $colId, $title, $description );
- Updates a collection
+
+Updates a collection
Input:
$colId: id of the collection to be updated
$success: 1 if all database operations were successful, 0 otherwise
$errorCode: Code for reason of failure, good for translating errors in templates
$errorMessage: English description of error
+
=cut
+
sub UpdateCollection {
my ( $colId, $title, $description ) = @_;
}
-=item DeleteCollection
+=head2 DeleteCollection
+
( $success, $errorcode, $errormessage ) = DeleteCollection( $colId );
Deletes a collection of the given id
$success: 1 if all database operations were successful, 0 otherwise
$errorCode: Code for reason of failure, good for translating errors in templates
$errorMessage: English description of error
+
=cut
+
sub DeleteCollection {
my ( $colId ) = @_;
return 1;
}
-=item GetCollections
+=head2 GetCollections
+
$collections = GetCollections();
Returns data about all collections
On Failure:
$errorCode: Code for reason of failure, good for translating errors in templates
$errorMessage: English description of error
+
=cut
+
sub GetCollections {
my $dbh = C4::Context->dbh;
return \@results;
}
-=item GetItemsInCollection
+=head2 GetItemsInCollection
+
( $results, $success, $errorcode, $errormessage ) = GetItemsInCollection( $colId );
+
Returns information about the items in the given collection
Input:
$success: 1 if all database operations were successful, 0 otherwise
$errorCode: Code for reason of failure, good for translating errors in templates
$errorMessage: English description of error
+
=cut
+
sub GetItemsInCollection {
my ( $colId ) = @_;
return \@results;
}
-=item GetCollection
+=head2 GetCollection
+
( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection( $colId );
- Returns information about a collection
+
+Returns information about a collection
Input:
$colId: Id of the collection
Output:
$colId, $colTitle, $colDesc, $colBranchcode
+
=cut
+
sub GetCollection {
my ( $colId ) = @_;
}
-=item AddItemToCollection
+=head2 AddItemToCollection
+
( $success, $errorcode, $errormessage ) = AddItemToCollection( $colId, $itemnumber );
- Adds an item to a rotating collection.
+
+Adds an item to a rotating collection.
Input:
$colId: Collection to add the item to.
$success: 1 if all database operations were successful, 0 otherwise
$errorCode: Code for reason of failure, good for translating errors in templates
$errorMessage: English description of error
+
=cut
+
sub AddItemToCollection {
my ( $colId, $itemnumber ) = @_;
}
-=item RemoveItemFromCollection
+=head2 RemoveItemFromCollection
+
( $success, $errorcode, $errormessage ) = RemoveItemFromCollection( $colId, $itemnumber );
- Removes an item to a collection
+
+Removes an item to a collection
Input:
$colId: Collection to add the item to.
$success: 1 if all database operations were successful, 0 otherwise
$errorCode: Code for reason of failure, good for translating errors in templates
$errorMessage: English description of error
+
=cut
+
sub RemoveItemFromCollection {
my ( $colId, $itemnumber ) = @_;
return 1;
}
-=item TransferCollection
+=head2 TransferCollection
+
( $success, $errorcode, $errormessage ) = TransferCollection( $colId, $colBranchcode );
- Transfers a collection to another branch
+
+Transfers a collection to another branch
Input:
$colId: id of the collection to be updated
$success: 1 if all database operations were successful, 0 otherwise
$errorCode: Code for reason of failure, good for translating errors in templates
$errorMessage: English description of error
+
=cut
+
sub TransferCollection {
my ( $colId, $colBranchcode ) = @_;
}
+=head2 GetCollectionItemBranches
+
+ my ( $holdingBranch, $collectionBranch ) = GetCollectionItemBranches( $itemnumber );
+
+=cut
+
+sub GetCollectionItemBranches {
+ my ( $itemnumber ) = @_;
+
+ if ( ! $itemnumber ) {
+ return;
+ }
+
+ my $dbh = C4::Context->dbh;
+
+ my ( $sth, @results );
+ $sth = $dbh->prepare("SELECT holdingbranch, colBranchcode FROM items, collections, collections_tracking
+ WHERE items.itemnumber = collections_tracking.itemnumber
+ AND collections.colId = collections_tracking.colId
+ AND items.itemnumber = ?");
+ $sth->execute( $itemnumber );
+
+ my $row = $sth->fetchrow_hashref;
+
+ $sth->finish;
+
+ return (
+ $$row{'holdingbranch'},
+ $$row{'colBranchcode'},
+ );
+}
+
+=head2 isItemInThisCollection
+
+ $inCollection = isItemInThisCollection( $itemnumber, $colId );
+
+=cut
-=item isItemInThisCollection
-$inCollection = isItemInThisCollection( $itemnumber, $colId );
-=cut
sub isItemInThisCollection {
my ( $itemnumber, $colId ) = @_;
return $$row{'inCollection'};
}
-=item isItemInAnyCollection
+=head2 isItemInAnyCollection
+
$inCollection = isItemInAnyCollection( $itemnumber );
+
=cut
+
sub isItemInAnyCollection {
my ( $itemnumber ) = @_;
my $row = $sth->fetchrow_hashref;
- my $itemnumber = $$row{'itemnumber'};
+ $itemnumber = $row->{itemnumber};
$sth->finish;
if ( $itemnumber ) {
__END__
-=back
-
=head1 AUTHOR
Kyle Hall <kylemhall@gmail.com>