Bug 15584 - Staff client list errors are incorrectly styled
authorChloe <chloealabaster@gmail.com>
Thu, 21 Jan 2016 03:20:58 +0000 (03:20 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Tue, 14 Feb 2017 14:12:12 +0000 (14:12 +0000)
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 <mirko@abunchofthings.net>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

virtualshelves/shelves.pl

index de4db51..3faa0e5 100755 (executable)
@@ -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';
@@ -106,16 +107,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');
@@ -124,15 +125,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' ) {
@@ -146,21 +147,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' ) {
@@ -178,17 +179,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;
 }
@@ -307,7 +308,7 @@ if ( $op eq 'view' ) {
             undef $shelf;
         }
     } else {
-        push @messages, { type => 'error', code => 'does_not_exist' };
+        push @messages, { type => 'alert', code => 'does_not_exist' };
     }
 }