Bug 14723: Add error codes and replace strings with them in template
This patch adds error codes for delivery notes and replaces English strings with them in template. To test confirm everything works as intended. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
5e58256d7f
commit
2405a21d6e
2 changed files with 17 additions and 12 deletions
|
@ -1335,7 +1335,8 @@ sub _send_message_by_email {
|
|||
warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
|
||||
_set_message_status( { message_id => $message->{'message_id'},
|
||||
status => 'failed',
|
||||
delivery_note => 'Invalid borrowernumber '.$message->{borrowernumber} } );
|
||||
delivery_note => 'Invalid borrowernumber '.$message->{borrowernumber},
|
||||
error_code => 'INVALID_BORNUMBER' } );
|
||||
return;
|
||||
}
|
||||
$to_address = $patron->notice_email_address;
|
||||
|
@ -1344,7 +1345,8 @@ sub _send_message_by_email {
|
|||
# warning too verbose for this more common case?
|
||||
_set_message_status( { message_id => $message->{'message_id'},
|
||||
status => 'failed',
|
||||
delivery_note => 'Unable to find an email address for this borrower' } );
|
||||
delivery_note => 'Unable to find an email address for this borrower',
|
||||
error_code => 'NO_EMAIL' } );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1483,14 +1485,16 @@ sub _send_message_by_sms {
|
|||
unless ( $patron and $patron->smsalertnumber ) {
|
||||
_set_message_status( { message_id => $message->{'message_id'},
|
||||
status => 'failed',
|
||||
delivery_note => 'Missing SMS number' } );
|
||||
delivery_note => 'Missing SMS number',
|
||||
error_code => 'MISSING_SMS' } );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( _is_duplicate( $message ) ) {
|
||||
_set_message_status( { message_id => $message->{'message_id'},
|
||||
status => 'failed',
|
||||
delivery_note => 'Message is duplicate' } );
|
||||
delivery_note => 'Message is duplicate',
|
||||
error_code => 'DUPLICATE_MESSAGE' } );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1499,7 +1503,8 @@ sub _send_message_by_sms {
|
|||
} );
|
||||
_set_message_status( { message_id => $message->{'message_id'},
|
||||
status => ($success ? 'sent' : 'failed'),
|
||||
delivery_note => ($success ? '' : 'No notes from SMS driver') } );
|
||||
delivery_note => ($success ? '' : 'No notes from SMS driver'),
|
||||
error_code => 'NO_NOTES' } );
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
|
|
@ -91,13 +91,13 @@
|
|||
</td>
|
||||
<td data-order="[% QUEUED_MESSAGE.updated_on | html %]">[% QUEUED_MESSAGE.updated_on | $KohaDates with_hours => 1 %]</td>
|
||||
<td data-order="[% QUEUED_MESSAGE.time_queued | html %]">[% QUEUED_MESSAGE.time_queued | $KohaDates with_hours => 1 %]</td>
|
||||
<td>
|
||||
[% IF ( QUEUED_MESSAGE.delivery_note ) %]
|
||||
[% IF ( QUEUED_MESSAGE.delivery_note == "Invalid borrowernumber $borrowernumber" ) %]Invalid borrowernumber [% borrowernumber | html %]
|
||||
[% ELSIF ( QUEUED_MESSAGE.delivery_note == 'Unable to find an email address for this borrower' ) %]Unable to find an email address for this borrower
|
||||
[% ELSIF ( QUEUED_MESSAGE.delivery_note == 'Missing SMS number' ) %]Missing SMS number
|
||||
[% ELSIF ( QUEUED_MESSAGE.delivery_note == 'Message is duplicate' ) %]Message is duplicate
|
||||
[% ELSIF ( QUEUED_MESSAGE.delivery_note == 'No notes from SMS driver' ) %]No notes from SMS driver
|
||||
<td>
|
||||
[% IF ( QUEUED_MESSAGE.error_code ) %]
|
||||
[% IF ( QUEUED_MESSAGE.error_code == "INVALID_BORNUMBER" ) %]Invalid borrowernumber [% borrowernumber | html %]
|
||||
[% ELSIF ( QUEUED_MESSAGE.error_code == 'NO_EMAIL' ) %]Unable to find an email address for this borrower
|
||||
[% ELSIF ( QUEUED_MESSAGE.error_code == 'MISSING_SMS' ) %]Missing SMS number
|
||||
[% ELSIF ( QUEUED_MESSAGE.error_code == 'DUPLICATE_MESSAGE' ) %]Message is duplicate
|
||||
[% ELSIF ( QUEUED_MESSAGE.error_code == 'NO_NOTES' ) %]No notes from SMS driver
|
||||
[% ELSE %]Error occured while sending email.
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
|
Loading…
Reference in a new issue