Bug 36487

Summary: Add an option to add new conditions for processing failure_code on members/notices.pl
Product: Koha Reporter: Anni Rajala <anni.rajala>
Component: NoticesAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Anni Rajala 2024-04-02 07:39:40 UTC
At the moment on borrowers notices.pl page there is a column "Delivery note" that displays the reason the delivery has failed. The reason is displayed based on the following conditions:

[% IF ( QUEUED_MESSAGE.failure_code ) %]
[% IF ( QUEUED_MESSAGE.failure_code == "INVALID_BORNUMBER" ) %]Invalid borrowernumber [% borrowernumber | html %]
[% ELSIF ( QUEUED_MESSAGE.failure_code == 'NO_EMAIL' ) %]Unable to find an email address for this borrower
[% ELSIF (matches = QUEUED_MESSAGE.failure_code.match('INVALID_EMAIL:(\w+)') ) %]Invalid [% matches.0 | html %] email address found [% borrowernumber | html %]
[% ELSIF ( QUEUED_MESSAGE.failure_code == 'NO_FROM' ) %]Missing from email address
[% ELSIF ( QUEUED_MESSAGE.failure_code == 'MISSING_SMS' ) %]Missing SMS number
[% ELSIF ( QUEUED_MESSAGE.failure_code == 'DUPLICATE_MESSAGE' ) %]Message is duplicate
[% ELSIF ( QUEUED_MESSAGE.failure_code == 'NO_NOTES' ) %]No notes from SMS driver
[% ELSIF ( QUEUED_MESSAGE.failure_code == 'SENDMAIL' ) %]Unhandled email failure, check the logs for further details
[% ELSIF ( QUEUED_MESSAGE.failure_code == "UNKNOWN_ERROR" ) %]Unknown error
[% ELSE %]Error occurred while sending email.
[% END %]
[% END %]

Sms providers might send back failure_codes outside that list. In those cases "Delivery note" -colum displays the text "Error occurred while sending email" which doesn't give the proper info for the librarian. If it would be possible to add your own ELSIF conditions, we could provide accurate information for the librarians dealing with the failed messages.