Bugzilla – Attachment 12851 Details for
Bug 8927
Talking Tech cannot handle titles with double quotes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8927 - Talking Tech cannot handle titles with double quotes
Bug-8927---Talking-Tech-cannot-handle-titles-with-.patch (text/plain), 8.74 KB, created by
Kyle M Hall
on 2012-10-16 15:13:39 UTC
(
hide
)
Description:
Bug 8927 - Talking Tech cannot handle titles with double quotes
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2012-10-16 15:13:39 UTC
Size:
8.74 KB
patch
obsolete
>From eb8543f72f7b703f6a686e9e09ec47ff86e2a74f Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 16 Oct 2012 11:14:08 -0400 >Subject: [PATCH] Bug 8927 - Talking Tech cannot handle titles with double quotes >Content-Type: text/plain; charset="utf-8" > >--- > .../thirdparty/TalkingTech_itiva_outbound.pl | 94 +++++++------------- > 1 files changed, 33 insertions(+), 61 deletions(-) > >diff --git a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >index b4d4e9c..87167e0 100755 >--- a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >+++ b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >@@ -31,6 +31,7 @@ BEGIN { > use Getopt::Long; > use Pod::Usage; > use Date::Calc qw(Add_Delta_Days); >+use Text::CSV; > > use C4::Context; > use C4::Items; >@@ -44,13 +45,15 @@ 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 > my $dbh = C4::Context->dbh; > >+# CSV object >+my $csv = Text::CSV->new( { always_quote => 1, eol => "\n", escape_char => '\\', } ) or die "Cannot use CSV: " . Text::CSV->error_diag(); >+ > # Options > my $verbose; > my $language = "EN"; >@@ -92,8 +95,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 +105,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; >@@ -142,20 +140,20 @@ 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"; >+ $csv->print( >+ $OUT, >+ [ $format, $language, $type, $issues->{level}, $issues->{cardnumber}, $issues->{patron_title}, >+ $issues->{firstname}, $issues->{surname}, $issues->{phone}, $issues->{email}, $library_code, $issues->{site}, >+ $issues->{site_name}, $issues->{barcode}, $due_date, $issues->{title}, $message_id >+ ] >+ ); > } > } > >@@ -217,8 +215,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 >@@ -239,14 +236,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 > } >@@ -256,8 +250,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) >@@ -282,8 +275,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 >@@ -304,39 +296,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; > } > } >-- >1.7.2.5
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 8927
: 12851