From 42483f651a03d6826775a809c314782e0c59df8e Mon Sep 17 00:00:00 2001 From: Agustin Moyano Date: Tue, 16 Mar 2021 11:44:19 -0300 Subject: [PATCH] Bug 18532: (follow-up) fix messages and bug in automatic_renewals script Signed-off-by: Jonathan Druart --- .../data/mysql/en/mandatory/sample_notices.yml | 18 +++++++++++++++--- .../mysql/fr-CA/obligatoire/sample_notices.sql | 18 +++++++++++++++--- .../fr-FR/1-Obligatoire/sample_notices.sql | 18 +++++++++++++++--- .../nb-NO/1-Obligatorisk/sample_notices.sql | 18 +++++++++++++++--- .../mysql/pl-PL/mandatory/sample_notices.sql | 18 +++++++++++++++--- .../mysql/ru-RU/mandatory/sample_notices.sql | 18 +++++++++++++++--- .../mysql/uk-UA/mandatory/sample_notices.sql | 18 +++++++++++++++--- misc/cronjobs/automatic_renewals.pl | 2 +- 8 files changed, 106 insertions(+), 22 deletions(-) diff --git a/installer/data/mysql/en/mandatory/sample_notices.yml b/installer/data/mysql/en/mandatory/sample_notices.yml index 745321f717..bbcddf545c 100644 --- a/installer/data/mysql/en/mandatory/sample_notices.yml +++ b/installer/data/mysql/en/mandatory/sample_notices.yml @@ -1493,13 +1493,25 @@ tables: - "There were [% error %] items that were not renewed." - "[% END %]" - "[% IF success %]" - - "There were [% success %] items that where renewed." + - "There were [% success %] items that were renewed." - "[% END %]" - "[% FOREACH checkout IN checkouts %]" - "[% checkout.item.biblio.title %] : [% checkout.item.barcode %]" - "[% IF !checkout.auto_renew_error %]" - "was renewed until [% checkout.date_due | $KohaDates as_due_date => 1%]" - - "[% ELSE %]" - - "was not renewed with error: [% checkout.auto_renew_error %]" + - "[% ELSIF checkout.auto_renew_error == 'too_many' %]" + - "You have reached the maximum number of checkouts possible." + - "[% ELSIF checkout.auto_renew_error == 'on_reserve' %]" + - "This item is on hold for another patron." + - "[% ELSIF checkout.auto_renew_error == 'restriction' %]" + - "You are currently restricted." + - "[% ELSIF checkout.auto_renew_error == 'overdue' %]" + - "You have overdue items." + - "[% ELSIF checkout.auto_renew_error == 'auto_too_late' %]" + - "It's too late to renew this item." + - "[% ELSIF checkout.auto_renew_error == 'auto_too_much_oweing' %]" + - "Your total unpaid fines are too high." + - "[% ELSIF checkout.auto_renew_error == 'too_unseen' %]" + - "This item must be renewed at the library." - "[% END %]" - "[% END %]" diff --git a/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql b/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql index 94aa4deec8..0f88bccf19 100644 --- a/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql +++ b/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql @@ -323,14 +323,26 @@ INSERT IGNORE INTO letter (module, code, name, title, content, message_transport There were [% error %] items that were not renewed. [% END %] [% IF success %] - There were [% success %] items that where renewed. + There were [% success %] items that were renewed. [% END %] [% FOREACH checkout IN checkouts %] [% checkout.item.biblio.title %] : [% checkout.item.barcode %] [% IF !checkout.auto_renew_error %] was renewed until [% checkout.date_due | $KohaDates as_due_date => 1%] - [% ELSE %] - was not renewed with error: [% checkout.auto_renew_error %] + [% ELSIF checkout.auto_renew_error == 'too_many' %] + You have reached the maximum number of checkouts possible. + [% ELSIF checkout.auto_renew_error == 'on_reserve' %] + This item is on hold for another patron. + [% ELSIF checkout.auto_renew_error == 'restriction' %] + You are currently restricted. + [% ELSIF checkout.auto_renew_error == 'overdue' %] + You have overdue items. + [% ELSIF checkout.auto_renew_error == 'auto_too_late' %] + It's too late to renew this item. + [% ELSIF checkout.auto_renew_error == 'auto_too_much_oweing' %] + Your total unpaid fines are too high. + [% ELSIF checkout.auto_renew_error == 'too_unseen' %] + This item must be renewed at the library. [% END %] [% END %] ", 'email'); \ No newline at end of file diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql index 745d46acec..779ba021a2 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql @@ -436,14 +436,26 @@ INSERT IGNORE INTO letter (module, code, name, title, content, message_transport There were [% error %] items that were not renewed. [% END %] [% IF success %] - There were [% success %] items that where renewed. + There were [% success %] items that were renewed. [% END %] [% FOREACH checkout IN checkouts %] [% checkout.item.biblio.title %] : [% checkout.item.barcode %] [% IF !checkout.auto_renew_error %] was renewed until [% checkout.date_due | $KohaDates as_due_date => 1%] - [% ELSE %] - was not renewed with error: [% checkout.auto_renew_error %] + [% ELSIF checkout.auto_renew_error == 'too_many' %] + You have reached the maximum number of checkouts possible. + [% ELSIF checkout.auto_renew_error == 'on_reserve' %] + This item is on hold for another patron. + [% ELSIF checkout.auto_renew_error == 'restriction' %] + You are currently restricted. + [% ELSIF checkout.auto_renew_error == 'overdue' %] + You have overdue items. + [% ELSIF checkout.auto_renew_error == 'auto_too_late' %] + It's too late to renew this item. + [% ELSIF checkout.auto_renew_error == 'auto_too_much_oweing' %] + Your total unpaid fines are too high. + [% ELSIF checkout.auto_renew_error == 'too_unseen' %] + This item must be renewed at the library. [% END %] [% END %] ", 'email'); \ No newline at end of file diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql b/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql index e0c7048909..d89a445f50 100644 --- a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql +++ b/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql @@ -454,14 +454,26 @@ INSERT IGNORE INTO letter (module, code, name, title, content, message_transport There were [% error %] items that were not renewed. [% END %] [% IF success %] - There were [% success %] items that where renewed. + There were [% success %] items that were renewed. [% END %] [% FOREACH checkout IN checkouts %] [% checkout.item.biblio.title %] : [% checkout.item.barcode %] [% IF !checkout.auto_renew_error %] was renewed until [% checkout.date_due | $KohaDates as_due_date => 1%] - [% ELSE %] - was not renewed with error: [% checkout.auto_renew_error %] + [% ELSIF checkout.auto_renew_error == 'too_many' %] + You have reached the maximum number of checkouts possible. + [% ELSIF checkout.auto_renew_error == 'on_reserve' %] + This item is on hold for another patron. + [% ELSIF checkout.auto_renew_error == 'restriction' %] + You are currently restricted. + [% ELSIF checkout.auto_renew_error == 'overdue' %] + You have overdue items. + [% ELSIF checkout.auto_renew_error == 'auto_too_late' %] + It's too late to renew this item. + [% ELSIF checkout.auto_renew_error == 'auto_too_much_oweing' %] + Your total unpaid fines are too high. + [% ELSIF checkout.auto_renew_error == 'too_unseen' %] + This item must be renewed at the library. [% END %] [% END %] ", 'email'); \ No newline at end of file diff --git a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql b/installer/data/mysql/pl-PL/mandatory/sample_notices.sql index 7764c1ec18..550901eb7b 100644 --- a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql +++ b/installer/data/mysql/pl-PL/mandatory/sample_notices.sql @@ -433,14 +433,26 @@ INSERT IGNORE INTO letter (module, code, name, title, content, message_transport There were [% error %] items that were not renewed. [% END %] [% IF success %] - There were [% success %] items that where renewed. + There were [% success %] items that were renewed. [% END %] [% FOREACH checkout IN checkouts %] [% checkout.item.biblio.title %] : [% checkout.item.barcode %] [% IF !checkout.auto_renew_error %] was renewed until [% checkout.date_due | $KohaDates as_due_date => 1%] - [% ELSE %] - was not renewed with error: [% checkout.auto_renew_error %] + [% ELSIF checkout.auto_renew_error == 'too_many' %] + You have reached the maximum number of checkouts possible. + [% ELSIF checkout.auto_renew_error == 'on_reserve' %] + This item is on hold for another patron. + [% ELSIF checkout.auto_renew_error == 'restriction' %] + You are currently restricted. + [% ELSIF checkout.auto_renew_error == 'overdue' %] + You have overdue items. + [% ELSIF checkout.auto_renew_error == 'auto_too_late' %] + It's too late to renew this item. + [% ELSIF checkout.auto_renew_error == 'auto_too_much_oweing' %] + Your total unpaid fines are too high. + [% ELSIF checkout.auto_renew_error == 'too_unseen' %] + This item must be renewed at the library. [% END %] [% END %] ", 'email'); diff --git a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql b/installer/data/mysql/ru-RU/mandatory/sample_notices.sql index b4ff4efc45..0d28d7c31f 100644 --- a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql +++ b/installer/data/mysql/ru-RU/mandatory/sample_notices.sql @@ -435,14 +435,26 @@ INSERT IGNORE INTO letter (module, code, name, title, content, message_transport There were [% error %] items that were not renewed. [% END %] [% IF success %] - There were [% success %] items that where renewed. + There were [% success %] items that were renewed. [% END %] [% FOREACH checkout IN checkouts %] [% checkout.item.biblio.title %] : [% checkout.item.barcode %] [% IF !checkout.auto_renew_error %] was renewed until [% checkout.date_due | $KohaDates as_due_date => 1%] - [% ELSE %] - was not renewed with error: [% checkout.auto_renew_error %] + [% ELSIF checkout.auto_renew_error == 'too_many' %] + You have reached the maximum number of checkouts possible. + [% ELSIF checkout.auto_renew_error == 'on_reserve' %] + This item is on hold for another patron. + [% ELSIF checkout.auto_renew_error == 'restriction' %] + You are currently restricted. + [% ELSIF checkout.auto_renew_error == 'overdue' %] + You have overdue items. + [% ELSIF checkout.auto_renew_error == 'auto_too_late' %] + It's too late to renew this item. + [% ELSIF checkout.auto_renew_error == 'auto_too_much_oweing' %] + Your total unpaid fines are too high. + [% ELSIF checkout.auto_renew_error == 'too_unseen' %] + This item must be renewed at the library. [% END %] [% END %] ", 'email'); \ No newline at end of file diff --git a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql b/installer/data/mysql/uk-UA/mandatory/sample_notices.sql index 16c26b1f5d..da38015d2a 100644 --- a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql +++ b/installer/data/mysql/uk-UA/mandatory/sample_notices.sql @@ -526,14 +526,26 @@ INSERT IGNORE INTO letter (module, code, name, title, content, message_transport There were [% error %] items that were not renewed. [% END %] [% IF success %] - There were [% success %] items that where renewed. + There were [% success %] items that were renewed. [% END %] [% FOREACH checkout IN checkouts %] [% checkout.item.biblio.title %] : [% checkout.item.barcode %] [% IF !checkout.auto_renew_error %] was renewed until [% checkout.date_due | $KohaDates as_due_date => 1%] - [% ELSE %] - was not renewed with error: [% checkout.auto_renew_error %] + [% ELSIF checkout.auto_renew_error == 'too_many' %] + You have reached the maximum number of checkouts possible. + [% ELSIF checkout.auto_renew_error == 'on_reserve' %] + This item is on hold for another patron. + [% ELSIF checkout.auto_renew_error == 'restriction' %] + You are currently restricted. + [% ELSIF checkout.auto_renew_error == 'overdue' %] + You have overdue items. + [% ELSIF checkout.auto_renew_error == 'auto_too_late' %] + It's too late to renew this item. + [% ELSIF checkout.auto_renew_error == 'auto_too_much_oweing' %] + Your total unpaid fines are too high. + [% ELSIF checkout.auto_renew_error == 'too_unseen' %] + This item must be renewed at the library. [% END %] [% END %] ", 'email'); \ No newline at end of file diff --git a/misc/cronjobs/automatic_renewals.pl b/misc/cronjobs/automatic_renewals.pl index e407b3f114..c8958cdc9d 100755 --- a/misc/cronjobs/automatic_renewals.pl +++ b/misc/cronjobs/automatic_renewals.pl @@ -183,7 +183,7 @@ while ( my $auto_renew = $auto_renews->next ) { # cache this one to process after we've run through all of the items. if ($digest_per_branch) { $renew_digest->{ $auto_renew->branchcode }->{ $auto_renew->borrowernumber }->{success}++ if $error eq 'auto_renew'; - $renew_digest->{ $auto_renew->branchcode }->{ $auto_renew->borrowernumber }->{error}++ unless $error eq 'auto_renew' || $error == 'auto_too_soon' ; + $renew_digest->{ $auto_renew->branchcode }->{ $auto_renew->borrowernumber }->{error}++ unless $error eq 'auto_renew' || $error eq 'auto_too_soon' ; push @{$renew_digest->{ $auto_renew->branchcode }->{ $auto_renew->borrowernumber }->{issues}}, $auto_renew->itemnumber; } else { $renew_digest->{ $auto_renew->borrowernumber }->{success} ++ if $error eq 'auto_renew'; -- 2.39.5