Bugzilla – Attachment 159014 Details for
Bug 23781
Recalls notices and messaging preferences
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23781: Make atomic updates executable and perltidy fixes
Bug-23781-Make-atomic-updates-executable-and-perlt.patch (text/plain), 9.49 KB, created by
David Nind
on 2023-11-15 21:17:01 UTC
(
hide
)
Description:
Bug 23781: Make atomic updates executable and perltidy fixes
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-11-15 21:17:01 UTC
Size:
9.49 KB
patch
obsolete
>From f03d90e81d8ef7248539351ef73d54f549f98096 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Thu, 7 Sep 2023 22:44:37 +0000 >Subject: [PATCH] Bug 23781: Make atomic updates executable and perltidy fixes > >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/Recall.pm | 11 ++++++----- > Koha/Recalls.pm | 7 ++++--- > .../bug_23781-recalls_message_attributes.pl | 10 ++++++---- > .../bug_23781-recalls_message_transports.pl | 10 ++++++---- > .../atomicupdate/bug_23781-recalls_sms_notices.pl | 12 +++++++----- > t/db_dependent/Koha/Recall.t | 12 +++++++----- > t/db_dependent/Koha/Recalls.t | 12 +++++++----- > 7 files changed, 43 insertions(+), 31 deletions(-) > mode change 100644 => 100755 installer/data/mysql/atomicupdate/bug_23781-recalls_message_attributes.pl > mode change 100644 => 100755 installer/data/mysql/atomicupdate/bug_23781-recalls_message_transports.pl > mode change 100644 => 100755 installer/data/mysql/atomicupdate/bug_23781-recalls_sms_notices.pl > >diff --git a/Koha/Recall.pm b/Koha/Recall.pm >index 10ca9901c6..334dda1002 100644 >--- a/Koha/Recall.pm >+++ b/Koha/Recall.pm >@@ -358,13 +358,14 @@ sub set_waiting { > }, > ); > >- my $messaging_preferences = C4::Members::Messaging::GetMessagingPreferences({ borrowernumber => $self->patron_id, message_name => 'Recall_Waiting' }); >+ my $messaging_preferences = C4::Members::Messaging::GetMessagingPreferences( >+ { borrowernumber => $self->patron_id, message_name => 'Recall_Waiting' } ); > while ( my ( $transport, $letter_code ) = each %{ $messaging_preferences->{transports} } ) { >- if ( $transport eq 'email' ){ >- C4::Message->enqueue($letter, $self->patron, 'email'); >+ if ( $transport eq 'email' ) { >+ C4::Message->enqueue( $letter, $self->patron, 'email' ); > } >- if ( $transport eq 'sms' ){ >- C4::Message->enqueue($letter, $self->patron, 'sms'); >+ if ( $transport eq 'sms' ) { >+ C4::Message->enqueue( $letter, $self->patron, 'sms' ); > } > } > >diff --git a/Koha/Recalls.pm b/Koha/Recalls.pm >index 02e22867a3..dbafc98f23 100644 >--- a/Koha/Recalls.pm >+++ b/Koha/Recalls.pm >@@ -167,13 +167,14 @@ sub add_recall { > }, > ); > >- my $messaging_preferences = C4::Members::Messaging::GetMessagingPreferences({ borrowernumber => $checkout->borrowernumber, message_name => 'Recall_Requested' }); >+ my $messaging_preferences = C4::Members::Messaging::GetMessagingPreferences( >+ { borrowernumber => $checkout->borrowernumber, message_name => 'Recall_Requested' } ); > > while ( my ( $transport, $letter_code ) = each %{ $messaging_preferences->{transports} } ) { >- if ( $transport eq 'email' ){ >+ if ( $transport eq 'email' ) { > C4::Message->enqueue( $letter, $checkout->patron, 'email' ); > } >- if ( $transport eq 'sms' ){ >+ if ( $transport eq 'sms' ) { > C4::Message->enqueue( $letter, $checkout->patron, 'sms' ); > } > } >diff --git a/installer/data/mysql/atomicupdate/bug_23781-recalls_message_attributes.pl b/installer/data/mysql/atomicupdate/bug_23781-recalls_message_attributes.pl >old mode 100644 >new mode 100755 >index 598ebebcf4..28783ed611 >--- a/installer/data/mysql/atomicupdate/bug_23781-recalls_message_attributes.pl >+++ b/installer/data/mysql/atomicupdate/bug_23781-recalls_message_attributes.pl >@@ -1,12 +1,14 @@ > use Modern::Perl; > > return { >- bug_number => "23781", >+ bug_number => "23781", > description => "Adding message attributes for recalls: Recall_Waiting, Recall_Requested", >- up => sub { >+ up => sub { > my ($args) = @_; >- my ($dbh, $out) = @$args{qw(dbh out)}; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; > >- $dbh->do(q{ INSERT IGNORE INTO message_attributes (message_attribute_id, message_name, takes_days) VALUES (12, 'Recall_Waiting', 0), (13, 'Recall_Requested', 0) }); >+ $dbh->do( >+ q{ INSERT IGNORE INTO message_attributes (message_attribute_id, message_name, takes_days) VALUES (12, 'Recall_Waiting', 0), (13, 'Recall_Requested', 0) } >+ ); > }, > }; >diff --git a/installer/data/mysql/atomicupdate/bug_23781-recalls_message_transports.pl b/installer/data/mysql/atomicupdate/bug_23781-recalls_message_transports.pl >old mode 100644 >new mode 100755 >index c9b8226f2e..8f5b920c88 >--- a/installer/data/mysql/atomicupdate/bug_23781-recalls_message_transports.pl >+++ b/installer/data/mysql/atomicupdate/bug_23781-recalls_message_transports.pl >@@ -1,12 +1,14 @@ > use Modern::Perl; > > return { >- bug_number => "23781", >+ bug_number => "23781", > description => "Adding message transports for recalls notices", >- up => sub { >+ up => sub { > my ($args) = @_; >- my ($dbh, $out) = @$args{qw(dbh out)}; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; > >- $dbh->do(q{ INSERT IGNORE INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code, branchcode) VALUES (12, "email", 0, "circulation", "PICKUP_RECALLED_ITEM", null), (12, "sms", 0, "circulation", "PICKUP_RECALLED_ITEM", null), (13, "email", 0, "circulation", "RETURN_RECALLED_ITEM", null), (13, "sms", 0, "circulation", "RETURN_RECALLED_ITEM", null) }); >+ $dbh->do( >+ q{ INSERT IGNORE INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code, branchcode) VALUES (12, "email", 0, "circulation", "PICKUP_RECALLED_ITEM", null), (12, "sms", 0, "circulation", "PICKUP_RECALLED_ITEM", null), (13, "email", 0, "circulation", "RETURN_RECALLED_ITEM", null), (13, "sms", 0, "circulation", "RETURN_RECALLED_ITEM", null) } >+ ); > }, > }; >diff --git a/installer/data/mysql/atomicupdate/bug_23781-recalls_sms_notices.pl b/installer/data/mysql/atomicupdate/bug_23781-recalls_sms_notices.pl >old mode 100644 >new mode 100755 >index 61aa730ee9..d0062d85da >--- a/installer/data/mysql/atomicupdate/bug_23781-recalls_sms_notices.pl >+++ b/installer/data/mysql/atomicupdate/bug_23781-recalls_sms_notices.pl >@@ -1,13 +1,14 @@ > use Modern::Perl; > > return { >- bug_number => "23781", >+ bug_number => "23781", > description => "Add recalls SMS notices: RETURN_RECALLED_ITEM, PICKUP_RECALLED_ITEM", >- up => sub { >+ up => sub { > my ($args) = @_; >- my ($dbh, $out) = @$args{qw(dbh out)}; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; > >- $dbh->do(q{ INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`) VALUES ('circulation','RETURN_RECALLED_ITEM','','Notification to return a recalled item','0','Notification to return a recalled item','Date: <<today>> >+ $dbh->do( >+ q{ INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`) VALUES ('circulation','RETURN_RECALLED_ITEM','','Notification to return a recalled item','0','Notification to return a recalled item','Date: <<today>> > > <<borrowers.firstname>> <<borrowers.surname>>, > >@@ -19,6 +20,7 @@ Thank you!','sms'), ('circulation','PICKUP_RECALLED_ITEM','','Recalled item awai > > A recall that you requested on the following item: <<biblio.title>> / <<biblio.author>> (<<items.barcode>>) is now ready for you to pick up at <<recalls.branchcode>>. Please pick up your item by <<recalls.expirationdate>>. > >-Thank you!','sms') }); >+Thank you!','sms') } >+ ); > }, > }; >diff --git a/t/db_dependent/Koha/Recall.t b/t/db_dependent/Koha/Recall.t >index 55cec9c069..4d6eff783e 100755 >--- a/t/db_dependent/Koha/Recall.t >+++ b/t/db_dependent/Koha/Recall.t >@@ -126,11 +126,13 @@ $expected_expirationdate = dt_from_string->add({ days => 3 }); > $expirationdate = $recall2->calc_expirationdate; > is( t::lib::Dates::compare( $expirationdate, $expected_expirationdate ), 0, "Expiration date calculated based on circulation rules" ); > >-C4::Members::Messaging::SetMessagingPreference({ >- borrowernumber => $patron1->borrowernumber, >- message_attribute_id => 12, # Recall_Waiting >- message_transport_types => [ qw( email sms ) ], >-}); >+C4::Members::Messaging::SetMessagingPreference( >+ { >+ borrowernumber => $patron1->borrowernumber, >+ message_attribute_id => 12, # Recall_Waiting >+ message_transport_types => [qw( email sms )], >+ } >+); > > $recall2->set_waiting({ expirationdate => $expirationdate }); > is( $recall2->waiting, 1, "Recall is waiting" ); >diff --git a/t/db_dependent/Koha/Recalls.t b/t/db_dependent/Koha/Recalls.t >index 04f845b8e6..ed0193428c 100755 >--- a/t/db_dependent/Koha/Recalls.t >+++ b/t/db_dependent/Koha/Recalls.t >@@ -68,11 +68,13 @@ Koha::CirculationRules->set_rules({ > C4::Circulation::AddIssue( $patron3, $item1->barcode ); > C4::Circulation::AddIssue( $patron3, $item2->barcode ); > >-C4::Members::Messaging::SetMessagingPreference({ >- borrowernumber => $patron3->borrowernumber, >- message_attribute_id => 13, # Recall_Requested >- message_transport_types => [ qw( email sms ) ], >-}); >+C4::Members::Messaging::SetMessagingPreference( >+ { >+ borrowernumber => $patron3->borrowernumber, >+ message_attribute_id => 13, # Recall_Requested >+ message_transport_types => [qw( email sms )], >+ } >+); > > my ( $recall, $due_interval, $due_date ) = Koha::Recalls->add_recall({ > patron => undef, >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23781
:
93905
|
104984
|
131702
|
132044
|
140242
|
140244
|
147107
|
148248
|
148260
|
150430
|
150441
|
155346
|
158696
|
158697
|
158698
|
159013
|
159014
|
159015
|
162377
|
162378
|
162379
|
162380
|
165240
|
165241
|
165242
|
165593
|
165614
|
165615
|
165616
|
165617
|
169201
|
169202
|
169203
|
169204
|
169205