8 use C4::RotatingCollections;
14 my ($template, $loggedinuser, $cookie)
15 = get_template_and_user({template_name => "rotating_collections/addItems.tmpl",
19 flagsrequired => {parameters => 1},
23 if ( $query->param('action') eq 'addItem' ) {
24 ## Add the given item to the collection
25 my $colId = $query->param('colId');
26 my $barcode = $query->param('barcode');
27 my $removeItem = $query->param('removeItem');
28 my $itemnumber = GetItemnumberFromBarcode( $barcode );
30 my ( $success, $errorCode, $errorMessage );
32 if ( ! $removeItem ) {
33 ( $success, $errorCode, $errorMessage ) = AddItemToCollection( $colId, $itemnumber );
36 previousActionAdd => 1,
37 addedBarcode => $barcode,
41 $template->param( addSuccess => 1 );
43 $template->param( addFailure => 1 );
44 $template->param( failureMessage => $errorMessage );
47 ## Remove the given item from the collection
48 ( $success, $errorCode, $errorMessage ) = RemoveItemFromCollection( $colId, $itemnumber );
51 previousActionRemove => 1,
52 removedBarcode => $barcode,
57 $template->param( removeSuccess => 1 );
59 $template->param( removeFailure => 1 );
60 $template->param( failureMessage => $errorMessage );
66 my ( $colId, $colTitle, $colDescription, $colBranchcode ) = GetCollection( $query->param('colId') );
67 my $collectionItems = GetItemsInCollection( $colId );
68 if ( $collectionItems ) {
69 $template->param( collectionItemsLoop => $collectionItems );
73 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
74 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
75 IntranetNav => C4::Context->preference("IntranetNav"),
78 colTitle => $colTitle,
79 colDescription => $colDescription,
80 colBranchcode => $colBranchcode,
83 output_html_with_http_headers $query, $cookie, $template->output;