From a09f17fa70f6571a9e7432339032623da5272621 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 22 Jul 2016 10:26:12 +0100 Subject: [PATCH] Bug 15451: Better error handling 1/ If a librarian edit (add_validate) a non-existing csv profile, we explicitely die 2/ If you try to delete a non-existing csv profile, you will now get a nice alert box --- .../prog/en/modules/tools/csv-profiles.tt | 22 +++++++++++-------- tools/csv-profiles.pl | 3 ++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt index 5fe6a9152d..46fc1559d8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt @@ -199,15 +199,19 @@ function reloadPage(p) { [% IF op == 'delete_confirm' %]
-

Delete CSV Profile "[% csv_profile.profile %]?"

-
- - - -
-
- -
+ [% IF csv_profile %] +

Delete CSV Profile "[% csv_profile.profile %]?"

+
+ + + +
+
+ +
+ [% ELSE %] + This CSV Profile does not exist. + [% END %]
[% END %] diff --git a/tools/csv-profiles.pl b/tools/csv-profiles.pl index 7db0f67417..a9b8525fa9 100755 --- a/tools/csv-profiles.pl +++ b/tools/csv-profiles.pl @@ -82,7 +82,8 @@ if ( $op eq 'add_form' ) { my $encoding = $input->param("encoding"); if ($export_format_id) { - my $csv_profile = Koha::CsvProfiles->find($export_format_id); + my $csv_profile = Koha::CsvProfiles->find($export_format_id) + or die "Something went wrong! This export_format_id does not match any existing CSV profile."; $csv_profile->profile($profile); $csv_profile->description($description); $csv_profile->content($content); -- 2.39.5