|
Lines 47-67
if ( $action eq 'create' ) {
Link Here
|
| 47 |
my $title = $query->param('title'); |
47 |
my $title = $query->param('title'); |
| 48 |
my $description = $query->param('description'); |
48 |
my $description = $query->param('description'); |
| 49 |
|
49 |
|
| 50 |
my ( $createdSuccessfully, $errorCode, $errorMessage ) = |
50 |
my $collection = Koha::RotatingCollection->new( |
| 51 |
CreateCollection( $title, $description ); |
51 |
{ colTitle => $title, |
| 52 |
|
52 |
colDesc => $description, |
| 53 |
$template->param( |
53 |
} |
| 54 |
previousActionCreate => 1, |
|
|
| 55 |
createdTitle => $title, |
| 56 |
); |
54 |
); |
| 57 |
|
55 |
|
| 58 |
if ($createdSuccessfully) { |
56 |
eval { $collection->store; }; |
| 59 |
$template->param( createSuccess => 1 ); |
57 |
|
| 60 |
} |
58 |
if ($@) { |
| 61 |
else { |
59 |
push @messages, { type => 'error', code => 'error_on_insert' }; |
| 62 |
$template->param( createFailure => 1 ); |
60 |
} else { |
| 63 |
$template->param( failureMessage => $errorMessage ); |
61 |
push @messages, { type => 'message', code => 'success_on_insert' }; |
| 64 |
} |
62 |
} |
|
|
63 |
|
| 64 |
$action = "list"; |
| 65 |
|
| 65 |
} elsif ( $action eq 'delete' ) { # Delete collection |
66 |
} elsif ( $action eq 'delete' ) { # Delete collection |
| 66 |
my $colId = $query->param('colId'); |
67 |
my $colId = $query->param('colId'); |
| 67 |
my $collection = Koha::RotatingCollections->find($colId); |
68 |
my $collection = Koha::RotatingCollections->find($colId); |
|
Lines 72-82
if ( $action eq 'create' ) {
Link Here
|
| 72 |
} else { |
73 |
} else { |
| 73 |
push @messages, { type => 'message', code => 'success_on_delete' }; |
74 |
push @messages, { type => 'message', code => 'success_on_delete' }; |
| 74 |
} |
75 |
} |
|
|
76 |
|
| 75 |
$action = "list"; |
77 |
$action = "list"; |
| 76 |
} |
|
|
| 77 |
|
78 |
|
| 78 |
## Edit a club or service: grab data, put in form. |
79 |
} elsif ( $action eq 'edit' ) { # Edit page of collection |
| 79 |
elsif ( $action eq 'edit' ) { |
|
|
| 80 |
my $collection = Koha::RotatingCollections->find($query->param('colId')); |
80 |
my $collection = Koha::RotatingCollections->find($query->param('colId')); |
| 81 |
|
81 |
|
| 82 |
$template->param( |
82 |
$template->param( |
| 83 |
- |
|
|