Bugzilla – Attachment 20917 Details for
Bug 10845
Multi transport types for holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10845: Multi transport types for holds
Bug-10845-Multi-transport-types-for-holds.patch (text/plain), 7.75 KB, created by
Jonathan Druart
on 2013-09-09 15:15:50 UTC
(
hide
)
Description:
Bug 10845: Multi transport types for holds
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-09-09 15:15:50 UTC
Size:
7.75 KB
patch
obsolete
>From d2592da319311dd29feba4427e70516dd54f9c54 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Mon, 9 Sep 2013 16:58:22 +0200 >Subject: [PATCH] Bug 10845: Multi transport types for holds > >The HOLD_PRINT and HOLD_PHONE notices become useless. >This patch will modify existing notices in order to group them into the >main notices 'HOLD'. >Like that, on one screen, all these notices can be edited. > >Test plan: >- apply the patch and execute the update database entry. >- verify that yours previous HOLD_PHONE and HOLD_PRINT are displayed > when editing the HOLD notice (under phone and print). >- choose a patron and check sms, email, phone for "Hold filled" > (on the patron messaging preferences). >- place a hold. >- check the item in and confirm the hold. >- if the patron has an email *and* a sms number, 2 new messages are put into > the sql message_queue table: 1 sms and 1 email. > if the patron does not have 1 of them, there are 2 new messages: 1 > sms/email and 1 print. > if the user has neither of them, there is 1 new message: 1 print. >- the generated messages should correspond with the notices defined, > depending the message transport type. >--- > C4/Reserves.pm | 58 ++++++-------------- > installer/data/mysql/updatedatabase.pl | 20 +++++++ > .../prog/en/modules/help/tools/letter.tt | 8 +-- > .../thirdparty/TalkingTech_itiva_outbound.pl | 5 +- > 4 files changed, 41 insertions(+), 50 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 5514796..f06c5ae 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1839,15 +1839,11 @@ sub _koha_notify_reserve { > > # Try to get the borrower's email address > my $to_address = C4::Members::GetNoticeEmailAddress($borrowernumber); >- >- my $letter_code; >- my $print_mode = 0; >- my $messagingprefs; >- if ( $to_address || $borrower->{'smsalertnumber'} ) { >- $messagingprefs = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $borrowernumber, message_name => 'Hold_Filled' } ); >- } else { >- $print_mode = 1; >- } >+ >+ my $messagingprefs = C4::Members::Messaging::GetMessagingPreferences( { >+ borrowernumber => $borrowernumber, >+ message_name => 'Hold_Filled' >+ } ); > > my $sth = $dbh->prepare(" > SELECT * >@@ -1874,43 +1870,23 @@ sub _koha_notify_reserve { > substitute => { today => C4::Dates->new()->output() }, > ); > >- >- if ( $print_mode ) { >- $letter_params{ 'letter_code' } = 'HOLD_PRINT'; >- my $letter = C4::Letters::GetPreparedLetter ( %letter_params ) or die "Could not find a letter called '$letter_params{'letter_code'}' in the 'reserves' module"; >+ my $print_sent = 0; >+ while ( my ( $mtt, $letter_code ) = each %{ $messagingprefs->{transports} } ) { >+ if ( ($mtt eq 'email' and not $to_address) or ($mtt eq 'sms' and not $borrower->{smsalertnumber}) ) { >+ # email or sms is requested but not exist, do a print. >+ $mtt = 'print'; >+ } >+ $letter_params{letter_code} = $letter_code; >+ $letter_params{message_transport_type} = $mtt; >+ my $letter = C4::Letters::GetPreparedLetter ( %letter_params ) >+ or die "Could not find a letter called '$letter_params{'letter_code'}' in the 'reserves' module"; > > C4::Letters::EnqueueLetter( { > letter => $letter, > borrowernumber => $borrowernumber, >- message_transport_type => 'print', >+ from_address => $admin_email_address, >+ message_transport_type => $mtt, > } ); >- >- return; >- } >- >- if ( $to_address && defined $messagingprefs->{transports}->{'email'} ) { >- $letter_params{ 'letter_code' } = $messagingprefs->{transports}->{'email'}; >- my $letter = C4::Letters::GetPreparedLetter ( %letter_params ) or die "Could not find a letter called '$letter_params{'letter_code'}' in the 'reserves' module"; >- >- C4::Letters::EnqueueLetter( >- { letter => $letter, >- borrowernumber => $borrowernumber, >- message_transport_type => 'email', >- from_address => $admin_email_address, >- } >- ); >- } >- >- if ( $borrower->{'smsalertnumber'} && defined $messagingprefs->{transports}->{'sms'} ) { >- $letter_params{ 'letter_code' } = $messagingprefs->{transports}->{'sms'}; >- my $letter = C4::Letters::GetPreparedLetter ( %letter_params ) or die "Could not find a letter called '$letter_params{'letter_code'}' in the 'reserves' module"; >- >- C4::Letters::EnqueueLetter( >- { letter => $letter, >- borrowernumber => $borrowernumber, >- message_transport_type => 'sms', >- } >- ); > } > } > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 637ac25..25944db 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -7163,6 +7163,26 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > } > > >+ >+ >+ >+ >+$DBversion = "3.13.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do(q| >+ UPDATE message_transports SET letter_code='HOLD' WHERE letter_code='HOLD_PHONE' OR letter_code='HOLD_PRINT' >+ |); >+ $dbh->do(q| >+ UPDATE letter SET code='HOLD', message_transport_type='print' WHERE code='HOLD_PRINT' >+ |); >+ $dbh->do(q| >+ UPDATE letter SET code='HOLD', message_transport_type='phone' WHERE code='HOLD_PHONE' >+ |); >+ print "Upgrade to $DBversion done (Bug 10845: Multi transport types for holds)\n"; >+ SetVersion($DBversion); >+} >+ >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/letter.tt >index c490504..796f380 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/letter.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/letter.tt >@@ -100,12 +100,6 @@ > <li>When this notice references the branches table it is referring to the pickup library information.</li> > </ul> > </li> >- <li>HOLD_PRINT (Printed notice when hold available for pickup) >-<ul> >- <li>This notice is used for hold confirmation notices that are sent out in print format. This will not effect what the email notice looks like.</li> >- <li>When this notice references the branches table it is referring to the pickup library information.</li> >-</ul> >-</li> > <li>ODUE (Overdue Notice) > <ul> > <li>This notice is used to send Overdue Notices to Patrons</li> >@@ -159,4 +153,4 @@ > > <p><strong>See the full documentation for Notices in the <a href="http://manual.koha-community.org/3.12/en/notices.html">manual</a> (online).</strong></p> > >-[% INCLUDE 'help-bottom.inc' %] >\ No newline at end of file >+[% INCLUDE 'help-bottom.inc' %] >diff --git a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >index b4d4e9c..42728d6 100755 >--- a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >+++ b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >@@ -70,7 +70,7 @@ my $type_module_map = { > my $type_notice_map = { > 'PREOVERDUE' => 'PREDUE_PHONE', > 'OVERDUE' => 'OVERDUE_PHONE', >- 'RESERVE' => 'HOLD_PHONE', >+ 'RESERVE' => 'HOLD', > }; > > GetOptions( >@@ -133,7 +133,8 @@ foreach my $type (@types) { > tables => { > borrowers => $issues->{'borrowernumber'}, > biblio => $issues->{'biblionumber'}, >- biblioitems => $issues->{'biblionumber'} >+ biblioitems => $issues->{'biblionumber'}, >+ message_transport_type => 'phone', > }, > ); > >-- >1.7.10.4
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 10845
:
20917
|
20918
|
24012
|
24013
|
24398
|
24399
|
24400
|
24401
|
24405
|
24406
|
27490
|
27491
|
27493
|
27874