Lines 59-69
if ( $op eq 'add_form' ) {
Link Here
|
59 |
my $patron = GetMember( 'borrowernumber' => $shelf->owner ); |
59 |
my $patron = GetMember( 'borrowernumber' => $shelf->owner ); |
60 |
$template->param( owner => $patron, ); |
60 |
$template->param( owner => $patron, ); |
61 |
unless ( $shelf->can_be_managed( $loggedinuser ) ) { |
61 |
unless ( $shelf->can_be_managed( $loggedinuser ) ) { |
62 |
push @messages, { type => 'error', code => 'unauthorized_on_update' }; |
62 |
push @messages, { type => 'alert', code => 'unauthorized_on_update' }; |
63 |
$op = 'list'; |
63 |
$op = 'list'; |
64 |
} |
64 |
} |
65 |
} else { |
65 |
} else { |
66 |
push @messages, { type => 'error', code => 'does_not_exist' }; |
66 |
push @messages, { type => 'alert', code => 'does_not_exist' }; |
67 |
} |
67 |
} |
68 |
} elsif ( $op eq 'add' ) { |
68 |
} elsif ( $op eq 'add' ) { |
69 |
eval { |
69 |
eval { |
Lines 81-89
if ( $op eq 'add_form' ) {
Link Here
|
81 |
$shelfnumber = $shelf->shelfnumber; |
81 |
$shelfnumber = $shelf->shelfnumber; |
82 |
}; |
82 |
}; |
83 |
if ($@) { |
83 |
if ($@) { |
84 |
push @messages, { type => 'error', code => ref($@), msg => $@ }; |
84 |
push @messages, { type => 'alert', code => ref($@), msg => $@ }; |
85 |
} elsif ( not $shelf ) { |
85 |
} elsif ( not $shelf ) { |
86 |
push @messages, { type => 'error', code => 'error_on_insert' }; |
86 |
push @messages, { type => 'alert', code => 'error_on_insert' }; |
|
|
87 |
|
87 |
} else { |
88 |
} else { |
88 |
push @messages, { type => 'message', code => 'success_on_insert' }; |
89 |
push @messages, { type => 'message', code => 'success_on_insert' }; |
89 |
$op = 'view'; |
90 |
$op = 'view'; |
Lines 106-121
if ( $op eq 'add_form' ) {
Link Here
|
106 |
eval { $shelf->store }; |
107 |
eval { $shelf->store }; |
107 |
|
108 |
|
108 |
if ($@) { |
109 |
if ($@) { |
109 |
push @messages, { type => 'error', code => 'error_on_update' }; |
110 |
push @messages, { type => 'alert', code => 'error_on_update' }; |
110 |
$op = 'edit_form'; |
111 |
$op = 'edit_form'; |
111 |
} else { |
112 |
} else { |
112 |
push @messages, { type => 'message', code => 'success_on_update' }; |
113 |
push @messages, { type => 'message', code => 'success_on_update' }; |
113 |
} |
114 |
} |
114 |
} else { |
115 |
} else { |
115 |
push @messages, { type => 'error', code => 'unauthorized_on_update' }; |
116 |
push @messages, { type => 'alert', code => 'unauthorized_on_update' }; |
116 |
} |
117 |
} |
117 |
} else { |
118 |
} else { |
118 |
push @messages, { type => 'error', code => 'does_not_exist' }; |
119 |
push @messages, { type => 'alert', code => 'does_not_exist' }; |
119 |
} |
120 |
} |
120 |
} elsif ( $op eq 'delete' ) { |
121 |
} elsif ( $op eq 'delete' ) { |
121 |
$shelfnumber = $query->param('shelfnumber'); |
122 |
$shelfnumber = $query->param('shelfnumber'); |
Lines 124-138
if ( $op eq 'add_form' ) {
Link Here
|
124 |
if ( $shelf->can_be_deleted( $loggedinuser ) ) { |
125 |
if ( $shelf->can_be_deleted( $loggedinuser ) ) { |
125 |
eval { $shelf->delete; }; |
126 |
eval { $shelf->delete; }; |
126 |
if ($@) { |
127 |
if ($@) { |
127 |
push @messages, { type => 'error', code => ref($@), msg => $@ }; |
128 |
push @messages, { type => 'alert', code => ref($@), msg => $@ }; |
128 |
} else { |
129 |
} else { |
129 |
push @messages, { type => 'message', code => 'success_on_delete' }; |
130 |
push @messages, { type => 'message', code => 'success_on_delete' }; |
130 |
} |
131 |
} |
131 |
} else { |
132 |
} else { |
132 |
push @messages, { type => 'error', code => 'unauthorized_on_delete' }; |
133 |
push @messages, { type => 'alert', code => 'unauthorized_on_delete' }; |
133 |
} |
134 |
} |
134 |
} else { |
135 |
} else { |
135 |
push @messages, { type => 'error', code => 'does_not_exist' }; |
136 |
push @messages, { type => 'alert', code => 'does_not_exist' }; |
136 |
} |
137 |
} |
137 |
$op = 'list'; |
138 |
$op = 'list'; |
138 |
} elsif ( $op eq 'add_biblio' ) { |
139 |
} elsif ( $op eq 'add_biblio' ) { |
Lines 146-166
if ( $op eq 'add_form' ) {
Link Here
|
146 |
if ( $shelf->can_biblios_be_added( $loggedinuser ) ) { |
147 |
if ( $shelf->can_biblios_be_added( $loggedinuser ) ) { |
147 |
my $added = eval { $shelf->add_biblio( $biblio->{biblionumber}, $loggedinuser ); }; |
148 |
my $added = eval { $shelf->add_biblio( $biblio->{biblionumber}, $loggedinuser ); }; |
148 |
if ($@) { |
149 |
if ($@) { |
149 |
push @messages, { type => 'error', code => ref($@), msg => $@ }; |
150 |
push @messages, { type => 'alert', code => ref($@), msg => $@ }; |
150 |
} elsif ( $added ) { |
151 |
} elsif ( $added ) { |
151 |
push @messages, { type => 'message', code => 'success_on_add_biblio' }; |
152 |
push @messages, { type => 'message', code => 'success_on_add_biblio' }; |
152 |
} else { |
153 |
} else { |
153 |
push @messages, { type => 'message', code => 'error_on_add_biblio' }; |
154 |
push @messages, { type => 'message', code => 'error_on_add_biblio' }; |
154 |
} |
155 |
} |
155 |
} else { |
156 |
} else { |
156 |
push @messages, { type => 'error', code => 'unauthorized_on_add_biblio' }; |
157 |
push @messages, { type => 'alert', code => 'unauthorized_on_add_biblio' }; |
157 |
} |
158 |
} |
158 |
} else { |
159 |
} else { |
159 |
push @messages, { type => 'error', code => 'item_does_not_exist' }; |
160 |
push @messages, { type => 'alert', code => 'item_does_not_exist' }; |
160 |
} |
161 |
} |
161 |
} |
162 |
} |
162 |
} else { |
163 |
} else { |
163 |
push @messages, { type => 'error', code => 'does_not_exist' }; |
164 |
push @messages, { type => 'alert', code => 'does_not_exist' }; |
164 |
} |
165 |
} |
165 |
$op = $referer; |
166 |
$op = $referer; |
166 |
} elsif ( $op eq 'remove_biblios' ) { |
167 |
} elsif ( $op eq 'remove_biblios' ) { |
Lines 178-194
if ( $op eq 'add_form' ) {
Link Here
|
178 |
); |
179 |
); |
179 |
}; |
180 |
}; |
180 |
if ($@) { |
181 |
if ($@) { |
181 |
push @messages, { type => 'error', code => ref($@), msg => $@ }; |
182 |
push @messages, { type => 'alert', code => ref($@), msg => $@ }; |
182 |
} elsif ( $number_of_biblios_removed ) { |
183 |
} elsif ( $number_of_biblios_removed ) { |
183 |
push @messages, { type => 'message', code => 'success_on_remove_biblios' }; |
184 |
push @messages, { type => 'message', code => 'success_on_remove_biblios' }; |
184 |
} else { |
185 |
} else { |
185 |
push @messages, { type => 'error', code => 'no_biblio_removed' }; |
186 |
push @messages, { type => 'alert', code => 'no_biblio_removed' }; |
186 |
} |
187 |
} |
187 |
} else { |
188 |
} else { |
188 |
push @messages, { type => 'error', code => 'unauthorized_on_remove_biblios' }; |
189 |
push @messages, { type => 'alert', code => 'unauthorized_on_remove_biblios' }; |
189 |
} |
190 |
} |
190 |
} else { |
191 |
} else { |
191 |
push @messages, { type => 'error', code => 'does_not_exist' }; |
192 |
push @messages, { type => 'alert', code => 'does_not_exist' }; |
192 |
} |
193 |
} |
193 |
$op = $referer; |
194 |
$op = $referer; |
194 |
} |
195 |
} |
Lines 307-313
if ( $op eq 'view' ) {
Link Here
|
307 |
undef $shelf; |
308 |
undef $shelf; |
308 |
} |
309 |
} |
309 |
} else { |
310 |
} else { |
310 |
push @messages, { type => 'error', code => 'does_not_exist' }; |
311 |
push @messages, { type => 'alert', code => 'does_not_exist' }; |
311 |
} |
312 |
} |
312 |
} |
313 |
} |
313 |
|
314 |
|
314 |
- |
|
|