From c872319108e7dcbfc3b7dfd379719cf4566800fc Mon Sep 17 00:00:00 2001 From: Hector Castro Date: Thu, 17 Mar 2016 10:42:10 -0600 Subject: [PATCH] Bug 16092: Introduce the Font Awesome icons when delete a branch category. Also change admin/branch.pl type => 'error' to type => 'alert' to fit with wiki To test: 1) Apply on top 16047 and 16091 1) Go to Admin -> Libraries and groups 2) Try to delete a library with patrons and bib items 3) See the error message in yellow 4) Try to delete a branch category/group without any library attached to it 5) Apply patch and repeat steps 1 to 4. Notice about the changes 6) Test buttons Yes, delete and No, do not delete and verify that they work as expected --- admin/branches.pl | 16 ++++++++-------- .../intranet-tmpl/prog/en/modules/admin/branches.tt | 12 +++++++----- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/admin/branches.pl b/admin/branches.pl index ebaa0ef..ef3e301 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -93,7 +93,7 @@ if ( $op eq 'add_form' ) { eval { $library->store; }; if ($@) { - push @messages, { type => 'error', code => 'error_on_update' }; + push @messages, { type => 'alert', code => 'error_on_update' }; } else { push @messages, { type => 'message', code => 'success_on_update' }; } @@ -107,7 +107,7 @@ if ( $op eq 'add_form' ) { eval { $library->store; }; $library->add_to_categories( \@categories ); if ($@) { - 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' }; } @@ -126,7 +126,7 @@ if ( $op eq 'add_form' ) { if ( $items_count or $patrons_count ) { push @messages, - { type => 'error', + { type => 'alert', code => 'cannot_delete_library', data => { items_count => $items_count, @@ -147,7 +147,7 @@ if ( $op eq 'add_form' ) { my $deleted = eval { $library->delete; }; if ( $@ or not $deleted ) { - push @messages, { type => 'error', code => 'error_on_delete' }; + push @messages, { type => 'alert', code => 'error_on_delete' }; } else { push @messages, { type => 'message', code => 'success_on_delete' }; } @@ -173,7 +173,7 @@ if ( $op eq 'add_form' ) { $category->show_in_pulldown( $input->param('show_in_pulldown') eq 'on' ); eval { $category->store; }; if ($@) { - push @messages, { type => 'error', code => 'error_on_update_category' }; + push @messages, { type => 'alert', code => 'error_on_update_category' }; } else { push @messages, { type => 'message', code => 'success_on_update_category' }; } @@ -186,7 +186,7 @@ if ( $op eq 'add_form' ) { $category->show_in_pulldown( $input->param('show_in_pulldown') eq 'on' ); eval { $category->store; }; if ($@) { - push @messages, { type => 'error', code => 'error_on_insert_category' }; + push @messages, { type => 'alert', code => 'error_on_insert_category' }; } else { push @messages, { type => 'message', code => 'success_on_insert_category' }; } @@ -197,7 +197,7 @@ if ( $op eq 'add_form' ) { my $libraries_count = scalar( $category->libraries ); if ( $libraries_count > 0 ) { push @messages, - { type => 'error', + { type => 'alert', code => 'cannot_delete_category', data => { libraries_count => $libraries_count, }, }; @@ -210,7 +210,7 @@ if ( $op eq 'add_form' ) { my $deleted = eval { $category->delete; }; if ( $@ or not $deleted ) { - push @messages, { type => 'error', code => 'error_on_delete_category' }; + push @messages, { type => 'alert', code => 'error_on_delete_category' }; } else { push @messages, { type => 'message', code => 'success_on_delete_category' }; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt index 9c34ee0..a94ce40 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt @@ -79,7 +79,7 @@ tinyMCE.init({
-[% FOR m IN messages %] +[% FOREACH m IN messages %]
[% SWITCH m.code %] [% CASE 'error_on_update' %] @@ -387,13 +387,15 @@ tinyMCE.init({ [% END %] [% IF op == 'delete_confirm_category' %] -
- Are you sure you want to delete the group '[% category.codedescription %]' ([% category.categorycode %])? +
+

Are you sure you want to delete the group '[% category.codedescription %]' ([% category.categorycode %])?

- - Cancel + +
+
+
[% END %] -- 1.7.10.4