Bug 9801: display facet labels in search results only when there are facet values
[koha.git] / rotating_collections / editCollections.pl
blobe38660864e9caab7e90fa445969e0410e98f6bfe
1 #!/usr/bin/perl
3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
8 # version.
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA 02111-1307 USA
18 use strict;
19 #use warnings; FIXME - Bug 2505
20 require Exporter;
22 use CGI;
24 use C4::Output;
25 use C4::Auth;
26 use C4::Context;
28 use C4::RotatingCollections;
30 my $query = new CGI;
31 my ($template, $loggedinuser, $cookie)
32 = get_template_and_user({template_name => "rotating_collections/editCollections.tmpl",
33 query => $query,
34 type => "intranet",
35 authnotrequired => 0,
36 flagsrequired => { tools => 'rotating_collections' },
37 debug => 1,
38 });
40 # Create new Collection
41 if ( $query->param('action') eq 'create' ) {
42 my $title = $query->param('title');
43 my $description = $query->param('description');
45 my ( $createdSuccessfully, $errorCode, $errorMessage ) = CreateCollection( $title, $description );
47 $template->param(
48 previousActionCreate => 1,
49 createdTitle => $title,
52 if ( $createdSuccessfully ) {
53 $template->param( createSuccess => 1 );
54 } else {
55 $template->param( createFailure => 1 );
56 $template->param( failureMessage => $errorMessage );
60 ## Delete a club or service
61 elsif ( $query->param('action') eq 'delete' ) {
62 my $colId = $query->param('colId');
63 my ( $success, $errorCode, $errorMessage ) = DeleteCollection( $colId );
65 $template->param( previousActionDelete => 1 );
66 if ( $success ) {
67 $template->param( deleteSuccess => 1 );
68 } else {
69 $template->param( deleteFailure => 1 );
70 $template->param( failureMessage => $errorMessage );
74 ## Edit a club or service: grab data, put in form.
75 elsif ( $query->param('action') eq 'edit' ) {
76 my $colId = $query->param('colId');
77 my ( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection( $colId );
79 $template->param(
80 previousActionEdit => 1,
81 editColId => $colId,
82 editColTitle => $colTitle,
83 editColDescription => $colDesc,
87 # Update a Club or Service
88 elsif ( $query->param('action') eq 'update' ) {
89 my $colId = $query->param('colId');
90 my $title = $query->param('title');
91 my $description = $query->param('description');
93 my ( $createdSuccessfully, $errorCode, $errorMessage )
94 = UpdateCollection( $colId, $title, $description );
96 $template->param(
97 previousActionUpdate => 1,
98 updatedTitle => $title,
101 if ( $createdSuccessfully ) {
102 $template->param( updateSuccess => 1 );
103 } else {
104 $template->param( updateFailure => 1 );
105 $template->param( failureMessage => $errorMessage );
109 my $collections = GetCollections();
111 $template->param(
112 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
113 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
114 IntranetNav => C4::Context->preference("IntranetNav"),
116 collectionsLoop => $collections,
119 output_html_with_http_headers $query, $cookie, $template->output;