Bugzilla – Attachment 50042 Details for
Bug 9004
Talking Tech doesn't account for holidays when calculating a holds last pickup date
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9004 - Talking Tech doesn't account for holidays when calculating a holds last pickup date - Perltidy script.
Bug-9004---Talking-Tech-doesnt-account-for-holiday.patch (text/plain), 8.38 KB, created by
Nicole C. Engard
on 2016-04-07 18:27:25 UTC
(
hide
)
Description:
Bug 9004 - Talking Tech doesn't account for holidays when calculating a holds last pickup date - Perltidy script.
Filename:
MIME Type:
Creator:
Nicole C. Engard
Created:
2016-04-07 18:27:25 UTC
Size:
8.38 KB
patch
obsolete
>From ea4be9e3121012cdb56538ddb25cb1ae58faac61 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 2 Nov 2012 08:23:37 -0400 >Subject: [PATCH] Bug 9004 - Talking Tech doesn't account for holidays when > calculating a holds last pickup date - Perltidy script. > >Signed-off-by: Chris William <chrisw@pascolibraries.org> >--- > .../thirdparty/TalkingTech_itiva_outbound.pl | 86 +++++++--------------- > 1 file changed, 25 insertions(+), 61 deletions(-) > >diff --git a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >index 18e9f86..c4515ef 100755 >--- a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >+++ b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >@@ -44,8 +44,7 @@ sub usage { > exit; > } > >-die >- "TalkingTechItivaPhoneNotification system preference not activated... dying\n" >+die "TalkingTechItivaPhoneNotification system preference not activated... dying\n" > unless ( C4::Context->preference("TalkingTechItivaPhoneNotification") ); > > # Database handle >@@ -92,8 +91,7 @@ pod2usage( -verbose => 1 ) if $help; > my $OUT; > if ( defined $outfile ) { > open( $OUT, '>', "$outfile" ) || die("Cannot open output file"); >-} >-else { >+} else { > print "No output file defined; printing to STDOUT\n" > if ( defined $verbose ); > open( $OUT, '>', "&STDOUT" ) || die("Couldn't duplicate STDOUT: $!"); >@@ -103,21 +101,17 @@ my $format = 'V'; # format for phone notifications > > foreach my $type (@types) { > $type = uc($type); #just in case lower or mixed-case was supplied >- my $module = >- $type_module_map->{$type}; #since the module is required to get the letter >- my $code = $type_notice_map->{$type}; #to get the Koha name of the notice >+ my $module = $type_module_map->{$type}; #since the module is required to get the letter >+ my $code = $type_notice_map->{$type}; #to get the Koha name of the notice > > my @loop; > if ( $type eq 'OVERDUE' ) { > @loop = GetOverdueIssues(); >- } >- elsif ( $type eq 'PREOVERDUE' ) { >+ } elsif ( $type eq 'PREOVERDUE' ) { > @loop = GetPredueIssues(); >- } >- elsif ( $type eq 'RESERVE' ) { >+ } elsif ( $type eq 'RESERVE' ) { > @loop = GetWaitingHolds(); >- } >- else { >+ } else { > print "Unknown or unsupported message type $type; skipping...\n" > if ( defined $verbose ); > next; >@@ -143,20 +137,16 @@ foreach my $type (@types) { > my $message_id = 0; > if ($outfile) { > $message_id = C4::Letters::EnqueueLetter( >- { >- letter => $letter, >+ { letter => $letter, > borrowernumber => $issues->{'borrowernumber'}, > message_transport_type => 'phone', > } > ); > } > >- print $OUT >-"\"$format\",\"$language\",\"$type\",\"$issues->{level}\",\"$issues->{cardnumber}\",\"$issues->{patron_title}\",\"$issues->{firstname}\","; >- print $OUT >-"\"$issues->{surname}\",\"$issues->{phone}\",\"$issues->{email}\",\"$library_code\","; >- print $OUT >-"\"$issues->{site}\",\"$issues->{site_name}\",\"$issues->{barcode}\",\"$due_date\",\"$issues->{title}\",\"$message_id\"\n"; >+ print $OUT "\"$format\",\"$language\",\"$type\",\"$issues->{level}\",\"$issues->{cardnumber}\",\"$issues->{patron_title}\",\"$issues->{firstname}\","; >+ print $OUT "\"$issues->{surname}\",\"$issues->{phone}\",\"$issues->{email}\",\"$library_code\","; >+ print $OUT "\"$issues->{site}\",\"$issues->{site_name}\",\"$issues->{barcode}\",\"$due_date\",\"$issues->{title}\",\"$message_id\"\n"; > } > } > >@@ -218,8 +208,7 @@ This field can be blank if all messages are from a single library. > =cut > > sub GetOverdueIssues { >- my $query = >-"SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname, >+ my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname, > borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, issues.date_due, > max(overduerules.branchcode) as rulebranch, TO_DAYS(NOW())-TO_DAYS(date_due) as daysoverdue, delay1, delay2, delay3, > issues.branchcode as site, branches.branchname as site_name >@@ -240,14 +229,11 @@ sub GetOverdueIssues { > while ( my $issue = $sth->fetchrow_hashref() ) { > if ( $issue->{'daysoverdue'} == $issue->{'delay1'} ) { > $issue->{'level'} = 1; >- } >- elsif ( $issue->{'daysoverdue'} == $issue->{'delay2'} ) { >+ } elsif ( $issue->{'daysoverdue'} == $issue->{'delay2'} ) { > $issue->{'level'} = 2; >- } >- elsif ( $issue->{'daysoverdue'} == $issue->{'delay3'} ) { >+ } elsif ( $issue->{'daysoverdue'} == $issue->{'delay3'} ) { > $issue->{'level'} = 3; >- } >- else { >+ } else { > > # this shouldn't ever happen, based our SQL criteria > } >@@ -257,8 +243,7 @@ sub GetOverdueIssues { > } > > sub GetPredueIssues { >- my $query = >-"SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname, >+ my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname, > borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, issues.date_due, > issues.branchcode as site, branches.branchname as site_name > FROM borrowers JOIN issues USING (borrowernumber) >@@ -283,8 +268,7 @@ sub GetPredueIssues { > } > > sub GetWaitingHolds { >- my $query = >-"SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname, >+ my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname, > borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, reserves.waitingdate, > reserves.branchcode AS site, branches.branchname AS site_name, > TO_DAYS(NOW())-TO_DAYS(reserves.waitingdate) AS days_since_waiting >@@ -305,39 +289,19 @@ sub GetWaitingHolds { > my @results; > while ( my $issue = $sth->fetchrow_hashref() ) { > my @waitingdate = split( /-/, $issue->{'waitingdate'} ); >- my @date_due = >- Add_Delta_Days( $waitingdate[0], $waitingdate[1], $waitingdate[2], >- $pickupdelay ); >- $issue->{'date_due'} = >- sprintf( "%04d-%02d-%02d", $date_due[0], $date_due[1], $date_due[2] ); >- $issue->{'level'} = 1; # only one level for Hold Waiting notifications >+ my @date_due = Add_Delta_Days( $waitingdate[0], $waitingdate[1], $waitingdate[2], $pickupdelay ); >+ $issue->{'date_due'} = sprintf( "%04d-%02d-%02d", $date_due[0], $date_due[1], $date_due[2] ); >+ $issue->{'level'} = 1; # only one level for Hold Waiting notifications > > my $days_to_subtract = 0; > my $calendar = C4::Calendar->new( branchcode => $issue->{'site'} ); >- while ( >- $calendar->isHoliday( >- reverse( >- Add_Delta_Days( >- $waitingdate[0], $waitingdate[1], >- $waitingdate[2], $days_to_subtract >- ) >- ) >- ) >- ) >- { >+ while ( $calendar->isHoliday( reverse( Add_Delta_Days( $waitingdate[0], $waitingdate[1], $waitingdate[2], $days_to_subtract ) ) ) ) { > $days_to_subtract++; > } >- $issue->{'days_since_waiting'} = >- $issue->{'days_since_waiting'} - $days_to_subtract; >- >- if ( >- ( >- grep $_ eq $issue->{'days_since_waiting'}, >- @holds_waiting_days_to_call >- ) >- || !scalar(@holds_waiting_days_to_call) >- ) >- { >+ $issue->{'days_since_waiting'} = $issue->{'days_since_waiting'} - $days_to_subtract; >+ >+ if ( ( grep $_ eq $issue->{'days_since_waiting'}, @holds_waiting_days_to_call ) >+ || !scalar(@holds_waiting_days_to_call) ) { > push @results, $issue; > } > } >-- >2.1.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 9004
:
13176
|
13212
|
13213
|
50042
|
50043
|
50082
|
50085
|
50086
|
50111
|
50112
|
50113
|
50114