3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
24 use C4
::RotatingCollections
;
31 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
33 template_name
=> "rotating_collections/addItems.tt",
37 flagsrequired
=> { tools
=> 'rotating_collections' },
42 if ( $query->param('action') eq 'addItem' ) {
43 ## Add the given item to the collection
44 my $colId = $query->param('colId');
45 my $barcode = $query->param('barcode');
46 my $removeItem = $query->param('removeItem');
47 my $itemnumber = GetItemnumberFromBarcode
($barcode);
49 my ( $success, $errorCode, $errorMessage );
51 $template->param( barcode
=> $barcode );
54 ( $success, $errorCode, $errorMessage ) =
55 AddItemToCollection
( $colId, $itemnumber );
58 previousActionAdd
=> 1,
62 $template->param( addSuccess
=> 1 );
65 $template->param( addFailure
=> 1 );
66 $template->param( failureMessage
=> $errorMessage );
70 ## Remove the given item from the collection
71 ( $success, $errorCode, $errorMessage ) =
72 RemoveItemFromCollection
( $colId, $itemnumber );
75 previousActionRemove
=> 1,
80 $template->param( removeSuccess
=> 1 );
83 $template->param( removeFailure
=> 1 );
84 $template->param( failureMessage
=> $errorMessage );
90 my ( $colId, $colTitle, $colDescription, $colBranchcode ) =
91 GetCollection
( $query->param('colId') );
92 my $collectionItems = GetItemsInCollection
($colId);
93 if ($collectionItems) {
94 $template->param( collectionItemsLoop
=> $collectionItems );
99 colTitle
=> $colTitle,
100 colDescription
=> $colDescription,
101 colBranchcode
=> $colBranchcode,
104 output_html_with_http_headers
$query, $cookie, $template->output;