Bug 17981: Better error handling

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2017-01-24 17:13:07 +01:00
parent a236b684fd
commit c9e23381f3
2 changed files with 11 additions and 6 deletions

View file

@ -12,6 +12,9 @@
[% CASE 'preview_not_available' %]Preview is not available for letters '[% m.letter_code %]'.
[% CASE 'not_checked_in_yet' %]Do not forget that the issue has not been checked in yet.
[% CASE 'not_checked_out_yet' %]Do not forget that the issue has not been checked out yet.
[% CASE 'no_checkout' %]This item is not checked out.
[% CASE 'no_item_or_no_patron' %]The item or the patron does not exist.
[% CASE 'no_hold' %]No hold is placed by this patron on this bibliographic record.
[% CASE %][% m.code %]
[% END %]
</div>
@ -28,7 +31,7 @@
</fieldset>
[% END %]
[% IF tt_content %]
[% IF rendered_tt_message %]
<fieldset class="brief">
<legend>Converted version</legend>
<pre>[% tt_content | html %]</pre>
@ -41,7 +44,7 @@
[% END %]
</div>
[% IF tt_content %]
[% IF rendered_tt_message %]
[% IF messages_are_similar %]
<div class="dialog message">The generated notices are exactly the same!</div>
[% ELSE %]

View file

@ -169,7 +169,8 @@ if ( $code eq 'CHECKIN' ) {
push @messages, { code => 'not_checked_in_yet', type => 'message' };
}
else {
warn "No checkout";
push @messages, { code => 'no_checkout', type => 'alert' };
$letter_params = {};
}
}
elsif ( $code eq 'CHECKOUT' ) {
@ -193,7 +194,8 @@ elsif ( $code eq 'CHECKOUT' ) {
push @messages, { code => 'not_checked_out_yet', type => 'message' };
}
else {
warn "No item or no patron";
push @messages, { code => 'no_item_or_no_patron', type => 'alert' };
$letter_params = {};
}
}
elsif ( $code eq 'HOLD_SLIP' ) {
@ -212,11 +214,11 @@ elsif ( $code eq 'HOLD_SLIP' ) {
};
}
else {
warn "No hold placed by this patron on this bibliographic record.";
push @messages, { code => 'no_hold', type => 'alert' };
$letter_params = {};
}
}
else {
warn "Preview for letter code $code is not available";
push @messages, { type => 'alert', code => 'preview_not_available', letter_code => $code, };
}