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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-07-22 10:26:12 +01:00 committed by Kyle M Hall
parent 00eeb41162
commit ec2271227c
2 changed files with 15 additions and 10 deletions

View File

@ -199,15 +199,19 @@ function reloadPage(p) {
[% IF op == 'delete_confirm' %]
<div class="dialog alert">
<h3>Delete CSV Profile "[% csv_profile.profile %]?"</h3>
<form action="/cgi-bin/koha/tools/csv-profiles.pl" method="post">
<input type="hidden" name="op" value="delete_confirmed" />
<input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id %]" />
<input type="submit" class="approve" value="Yes, delete" />
</form>
<form action="/cgi-bin/koha/tools/csv-profiles.pl" method="get">
<input type="submit" class="deny" value="No, do not Delete" />
</form>
[% IF csv_profile %]
<h3>Delete CSV Profile "[% csv_profile.profile %]?"</h3>
<form action="/cgi-bin/koha/tools/csv-profiles.pl" method="post">
<input type="hidden" name="op" value="delete_confirmed" />
<input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id %]" />
<input type="submit" class="approve" value="Yes, delete" />
</form>
<form action="/cgi-bin/koha/tools/csv-profiles.pl" method="get">
<input type="submit" class="deny" value="No, do not Delete" />
</form>
[% ELSE %]
This CSV Profile does not exist.
[% END %]
</div>
[% END %]

View File

@ -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);