From d995613eaf22647aea860b411d1d0b10ddaf9149 Mon Sep 17 00:00:00 2001 From: Hector Castro Date: Thu, 17 Mar 2016 10:42:10 -0600 Subject: [PATCH] Bug 16092: Fix error dialog and introduce the Font Awesome icons when delete a branch category MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Also change admin/branch.pl type => 'error' to type => 'alert' to fit with wiki To test: 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 Signed-off-by: Marc Véron NOTE: Patch rebased and reword title according with QA comment 4 Signed-off-by: Jonathan Druart Signed-off-by: Brendan A Gallagher --- admin/branches.pl | 16 ++++++++-------- .../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 c2ec0877c8..6031f2f465 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' }; } @@ -196,7 +196,7 @@ if ( $op eq 'add_form' ) { my $category = Koha::LibraryCategories->find($categorycode); if ( my $libraries_count = $category->libraries->count ) { push @messages, - { type => 'error', + { type => 'alert', code => 'cannot_delete_category', data => { libraries_count => $libraries_count, }, }; @@ -209,7 +209,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 aceec04a21..47da93434e 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' %] @@ -381,13 +381,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 %] -- 2.39.5