From c531463a5bcf270e6d952818852c3745ff5b4cfa Mon Sep 17 00:00:00 2001 From: Chloe Date: Thu, 21 Jan 2016 03:20:58 +0000 Subject: [PATCH] Bug 15584 - Staff client list errors are incorrectly styled To Test- 1-In the Staff Client, go to Lists (/cgi-bin/koha/virtualshelves/shelves.pl) and create a new list with the same name as an existing one. --note that it has some red in it like an error 2- apply patch 3-In the Staff Client, go to Lists (/cgi-bin/koha/virtualshelves/shelves.pl) and create a new list with the same name as an existing one. --note that now it should be just yellow with black writing as an alert Signed-off-by: Mirko Tietgen --- virtualshelves/shelves.pl | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl index 691e215..52ee670 100755 --- a/virtualshelves/shelves.pl +++ b/virtualshelves/shelves.pl @@ -59,11 +59,11 @@ if ( $op eq 'add_form' ) { my $patron = GetMember( 'borrowernumber' => $shelf->owner ); $template->param( owner => $patron, ); unless ( $shelf->can_be_managed( $loggedinuser ) ) { - push @messages, { type => 'error', code => 'unauthorized_on_update' }; + push @messages, { type => 'alert', code => 'unauthorized_on_update' }; $op = 'list'; } } else { - push @messages, { type => 'error', code => 'does_not_exist' }; + push @messages, { type => 'alert', code => 'does_not_exist' }; } } elsif ( $op eq 'add' ) { eval { @@ -81,9 +81,10 @@ if ( $op eq 'add_form' ) { $shelfnumber = $shelf->shelfnumber; }; if ($@) { - push @messages, { type => 'error', code => ref($@), msg => $@ }; + push @messages, { type => 'alert', code => ref($@), msg => $@ }; } elsif ( not $shelf ) { - push @messages, { type => 'error', code => 'error_on_insert' }; + push @messages, { type => 'alert', code => 'error_on_insert' }; + } else { push @messages, { type => 'message', code => 'success_on_insert' }; $op = 'view'; @@ -104,16 +105,16 @@ if ( $op eq 'add_form' ) { eval { $shelf->store }; if ($@) { - push @messages, { type => 'error', code => 'error_on_update' }; + push @messages, { type => 'alert', code => 'error_on_update' }; $op = 'edit_form'; } else { push @messages, { type => 'message', code => 'success_on_update' }; } } else { - push @messages, { type => 'error', code => 'unauthorized_on_update' }; + push @messages, { type => 'alert', code => 'unauthorized_on_update' }; } } else { - push @messages, { type => 'error', code => 'does_not_exist' }; + push @messages, { type => 'alert', code => 'does_not_exist' }; } } elsif ( $op eq 'delete' ) { $shelfnumber = $query->param('shelfnumber'); @@ -122,15 +123,15 @@ if ( $op eq 'add_form' ) { if ( $shelf->can_be_deleted( $loggedinuser ) ) { eval { $shelf->delete; }; if ($@) { - push @messages, { type => 'error', code => ref($@), msg => $@ }; + push @messages, { type => 'alert', code => ref($@), msg => $@ }; } else { push @messages, { type => 'message', code => 'success_on_delete' }; } } else { - push @messages, { type => 'error', code => 'unauthorized_on_delete' }; + push @messages, { type => 'alert', code => 'unauthorized_on_delete' }; } } else { - push @messages, { type => 'error', code => 'does_not_exist' }; + push @messages, { type => 'alert', code => 'does_not_exist' }; } $op = 'list'; } elsif ( $op eq 'add_biblio' ) { @@ -144,21 +145,21 @@ if ( $op eq 'add_form' ) { if ( $shelf->can_biblios_be_added( $loggedinuser ) ) { my $added = eval { $shelf->add_biblio( $biblio->{biblionumber}, $loggedinuser ); }; if ($@) { - push @messages, { type => 'error', code => ref($@), msg => $@ }; + push @messages, { type => 'alert', code => ref($@), msg => $@ }; } elsif ( $added ) { push @messages, { type => 'message', code => 'success_on_add_biblio' }; } else { push @messages, { type => 'message', code => 'error_on_add_biblio' }; } } else { - push @messages, { type => 'error', code => 'unauthorized_on_add_biblio' }; + push @messages, { type => 'alert', code => 'unauthorized_on_add_biblio' }; } } else { - push @messages, { type => 'error', code => 'item_does_not_exist' }; + push @messages, { type => 'alert', code => 'item_does_not_exist' }; } } } else { - push @messages, { type => 'error', code => 'does_not_exist' }; + push @messages, { type => 'alert', code => 'does_not_exist' }; } $op = $referer; } elsif ( $op eq 'remove_biblios' ) { @@ -176,17 +177,17 @@ if ( $op eq 'add_form' ) { ); }; if ($@) { - push @messages, { type => 'error', code => ref($@), msg => $@ }; + push @messages, { type => 'alert', code => ref($@), msg => $@ }; } elsif ( $number_of_biblios_removed ) { push @messages, { type => 'message', code => 'success_on_remove_biblios' }; } else { - push @messages, { type => 'error', code => 'no_biblio_removed' }; + push @messages, { type => 'alert', code => 'no_biblio_removed' }; } } else { - push @messages, { type => 'error', code => 'unauthorized_on_remove_biblios' }; + push @messages, { type => 'alert', code => 'unauthorized_on_remove_biblios' }; } } else { - push @messages, { type => 'error', code => 'does_not_exist' }; + push @messages, { type => 'alert', code => 'does_not_exist' }; } $op = $referer; } @@ -304,7 +305,7 @@ if ( $op eq 'view' ) { undef $shelf; } } else { - push @messages, { type => 'error', code => 'does_not_exist' }; + push @messages, { type => 'alert', code => 'does_not_exist' }; } } -- 2.1.4