Bug 31075 - Obscure notice handling in overdue_notices.pl needs to be improved
Summary: Obscure notice handling in overdue_notices.pl needs to be improved
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-01 06:37 UTC by Marcel de Rooy
Modified: 2022-07-01 07:54 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2022-07-01 06:37:30 UTC
The overdue_notices.pl script contains a lot of code for letter/notice handling that really should not be there. Some regular notice constructs do not work since it is doing its own thing.
Look at this example:

                    my $letter = parse_overdues_letter(
                        {   letter_code     => $overdue_rules->{"letter$i"},
                            borrowernumber  => $borrowernumber,
                            branchcode      => $branchcode,
                            items           => \@items,
                            substitute      => {    # this appears to be a hack to overcome incomplete features in this code.
                                                bib             => $library->branchname, # maybe 'bib' is a typo for 'lib<rary>'?
                                                'items.content' => $titles,
                                                'count'         => $itemcount,
                                               },
                            # If there is no template defined for the requested letter
                            # Fallback on the original type
                            message_transport_type => $letter_exists ? $effective_mtt : $mtt,
                        }
                    );

The comment talks about a hack to overcome incomplete features.
I did mark this as major, and not enhancement for refactoring.
Comment 1 Marcel de Rooy 2022-07-01 06:46:28 UTC
ccing Nick Tomas Jonathan
Comment 2 Marcel de Rooy 2022-07-01 06:51:09 UTC
Lowering severity because I just now see that  parse_overdues_letter does call GetPreparedLetter after all.
This code really needs to be improved. Obscure stuff.
Comment 3 Marcel de Rooy 2022-07-01 07:52:11 UTC
This whole stuff with loops, repeat, substitute in old and new style with or without enclosing tag is such a mess !
Comment 4 Marcel de Rooy 2022-07-01 07:54:37 UTC
A librarian changed a few notices, and I just had a 'diagonal glance' over them. They looked good, but didnt work finally ;)

But resolving it, almost needs debugging Letters and Overdues code. No Koha advertising..