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 104-119
if ( $op eq 'add_form' ) {
Link Here
|
104 |
eval { $shelf->store }; |
105 |
eval { $shelf->store }; |
105 |
|
106 |
|
106 |
if ($@) { |
107 |
if ($@) { |
107 |
push @messages, { type => 'error', code => 'error_on_update' }; |
108 |
push @messages, { type => 'alert', code => 'error_on_update' }; |
108 |
$op = 'edit_form'; |
109 |
$op = 'edit_form'; |
109 |
} else { |
110 |
} else { |
110 |
push @messages, { type => 'message', code => 'success_on_update' }; |
111 |
push @messages, { type => 'message', code => 'success_on_update' }; |
111 |
} |
112 |
} |
112 |
} else { |
113 |
} else { |
113 |
push @messages, { type => 'error', code => 'unauthorized_on_update' }; |
114 |
push @messages, { type => 'alert', code => 'unauthorized_on_update' }; |
114 |
} |
115 |
} |
115 |
} else { |
116 |
} else { |
116 |
push @messages, { type => 'error', code => 'does_not_exist' }; |
117 |
push @messages, { type => 'alert', code => 'does_not_exist' }; |
117 |
} |
118 |
} |
118 |
} elsif ( $op eq 'delete' ) { |
119 |
} elsif ( $op eq 'delete' ) { |
119 |
$shelfnumber = $query->param('shelfnumber'); |
120 |
$shelfnumber = $query->param('shelfnumber'); |
Lines 122-136
if ( $op eq 'add_form' ) {
Link Here
|
122 |
if ( $shelf->can_be_deleted( $loggedinuser ) ) { |
123 |
if ( $shelf->can_be_deleted( $loggedinuser ) ) { |
123 |
eval { $shelf->delete; }; |
124 |
eval { $shelf->delete; }; |
124 |
if ($@) { |
125 |
if ($@) { |
125 |
push @messages, { type => 'error', code => ref($@), msg => $@ }; |
126 |
push @messages, { type => 'alert', code => ref($@), msg => $@ }; |
126 |
} else { |
127 |
} else { |
127 |
push @messages, { type => 'message', code => 'success_on_delete' }; |
128 |
push @messages, { type => 'message', code => 'success_on_delete' }; |
128 |
} |
129 |
} |
129 |
} else { |
130 |
} else { |
130 |
push @messages, { type => 'error', code => 'unauthorized_on_delete' }; |
131 |
push @messages, { type => 'alert', code => 'unauthorized_on_delete' }; |
131 |
} |
132 |
} |
132 |
} else { |
133 |
} else { |
133 |
push @messages, { type => 'error', code => 'does_not_exist' }; |
134 |
push @messages, { type => 'alert', code => 'does_not_exist' }; |
134 |
} |
135 |
} |
135 |
$op = 'list'; |
136 |
$op = 'list'; |
136 |
} elsif ( $op eq 'add_biblio' ) { |
137 |
} elsif ( $op eq 'add_biblio' ) { |
Lines 144-164
if ( $op eq 'add_form' ) {
Link Here
|
144 |
if ( $shelf->can_biblios_be_added( $loggedinuser ) ) { |
145 |
if ( $shelf->can_biblios_be_added( $loggedinuser ) ) { |
145 |
my $added = eval { $shelf->add_biblio( $biblio->{biblionumber}, $loggedinuser ); }; |
146 |
my $added = eval { $shelf->add_biblio( $biblio->{biblionumber}, $loggedinuser ); }; |
146 |
if ($@) { |
147 |
if ($@) { |
147 |
push @messages, { type => 'error', code => ref($@), msg => $@ }; |
148 |
push @messages, { type => 'alert', code => ref($@), msg => $@ }; |
148 |
} elsif ( $added ) { |
149 |
} elsif ( $added ) { |
149 |
push @messages, { type => 'message', code => 'success_on_add_biblio' }; |
150 |
push @messages, { type => 'message', code => 'success_on_add_biblio' }; |
150 |
} else { |
151 |
} else { |
151 |
push @messages, { type => 'message', code => 'error_on_add_biblio' }; |
152 |
push @messages, { type => 'message', code => 'error_on_add_biblio' }; |
152 |
} |
153 |
} |
153 |
} else { |
154 |
} else { |
154 |
push @messages, { type => 'error', code => 'unauthorized_on_add_biblio' }; |
155 |
push @messages, { type => 'alert', code => 'unauthorized_on_add_biblio' }; |
155 |
} |
156 |
} |
156 |
} else { |
157 |
} else { |
157 |
push @messages, { type => 'error', code => 'item_does_not_exist' }; |
158 |
push @messages, { type => 'alert', code => 'item_does_not_exist' }; |
158 |
} |
159 |
} |
159 |
} |
160 |
} |
160 |
} else { |
161 |
} else { |
161 |
push @messages, { type => 'error', code => 'does_not_exist' }; |
162 |
push @messages, { type => 'alert', code => 'does_not_exist' }; |
162 |
} |
163 |
} |
163 |
$op = $referer; |
164 |
$op = $referer; |
164 |
} elsif ( $op eq 'remove_biblios' ) { |
165 |
} elsif ( $op eq 'remove_biblios' ) { |
Lines 176-192
if ( $op eq 'add_form' ) {
Link Here
|
176 |
); |
177 |
); |
177 |
}; |
178 |
}; |
178 |
if ($@) { |
179 |
if ($@) { |
179 |
push @messages, { type => 'error', code => ref($@), msg => $@ }; |
180 |
push @messages, { type => 'alert', code => ref($@), msg => $@ }; |
180 |
} elsif ( $number_of_biblios_removed ) { |
181 |
} elsif ( $number_of_biblios_removed ) { |
181 |
push @messages, { type => 'message', code => 'success_on_remove_biblios' }; |
182 |
push @messages, { type => 'message', code => 'success_on_remove_biblios' }; |
182 |
} else { |
183 |
} else { |
183 |
push @messages, { type => 'error', code => 'no_biblio_removed' }; |
184 |
push @messages, { type => 'alert', code => 'no_biblio_removed' }; |
184 |
} |
185 |
} |
185 |
} else { |
186 |
} else { |
186 |
push @messages, { type => 'error', code => 'unauthorized_on_remove_biblios' }; |
187 |
push @messages, { type => 'alert', code => 'unauthorized_on_remove_biblios' }; |
187 |
} |
188 |
} |
188 |
} else { |
189 |
} else { |
189 |
push @messages, { type => 'error', code => 'does_not_exist' }; |
190 |
push @messages, { type => 'alert', code => 'does_not_exist' }; |
190 |
} |
191 |
} |
191 |
$op = $referer; |
192 |
$op = $referer; |
192 |
} |
193 |
} |
Lines 304-310
if ( $op eq 'view' ) {
Link Here
|
304 |
undef $shelf; |
305 |
undef $shelf; |
305 |
} |
306 |
} |
306 |
} else { |
307 |
} else { |
307 |
push @messages, { type => 'error', code => 'does_not_exist' }; |
308 |
push @messages, { type => 'alert', code => 'does_not_exist' }; |
308 |
} |
309 |
} |
309 |
} |
310 |
} |
310 |
|
311 |
|
311 |
- |
|
|