View | Details | Raw Unified | Return to bug 15969
Collapse All | Expand All

(-)a/C4/Letters.pm (-1 / +10 lines)
Lines 1018-1024 ENDSQL Link Here
1018
        $params->{'from_address'},                # from_address
1018
        $params->{'from_address'},                # from_address
1019
        $params->{'letter'}->{'content-type'},    # content_type
1019
        $params->{'letter'}->{'content-type'},    # content_type
1020
    );
1020
    );
1021
    return $dbh->last_insert_id(undef,undef,'message_queue', undef);
1021
1022
    my $id = $dbh->last_insert_id(undef,undef,'message_queue', undef);
1023
1024
    $content = $params->{letter}->{content};
1025
    if ( $content =~ /__MESSAGE_ID__/ ) {
1026
        $content =~ s/__MESSAGE_ID__/$id/g;
1027
        $dbh->do( "UPDATE message_queue SET content = ? WHERE message_id = ?", undef, ($content, $id) );
1028
    }
1029
1030
    return $id;
1022
}
1031
}
1023
1032
1024
=head2 SendQueuedMessages ([$hashref]) 
1033
=head2 SendQueuedMessages ([$hashref]) 
(-)a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl (-14 / +37 lines)
Lines 57-62 my @holds_waiting_days_to_call; Link Here
57
my $library_code;
57
my $library_code;
58
my $help;
58
my $help;
59
my $outfile;
59
my $outfile;
60
my $use_tt;
60
61
61
# maps to convert I-tiva terms to Koha terms
62
# maps to convert I-tiva terms to Koha terms
62
my $type_module_map = {
63
my $type_module_map = {
Lines 73-84 my $type_notice_map = { Link Here
73
74
74
GetOptions(
75
GetOptions(
75
    'o|output:s'            => \$outfile,
76
    'o|output:s'            => \$outfile,
76
    'v'                     => \$verbose,
77
    'v|verbose'             => \$verbose,
77
    'lang:s'                => \$language,
78
    'l|lang:s'              => \$language,
78
    'type:s'                => \@types,
79
    't|type:s'              => \@types,
79
    'w|waiting-hold-day:s'  => \@holds_waiting_days_to_call,
80
    'w|waiting-hold-day:s'  => \@holds_waiting_days_to_call,
80
    'c|code|library-code:s' => \$library_code,
81
    'c|code|library-code:s' => \$library_code,
81
    'help|h'                => \$help,
82
    'tt|template-toolkit'   => \$use_tt,
83
    'h|help'                => \$help,
82
);
84
);
83
85
84
$language = uc($language);
86
$language = uc($language);
Lines 125-133 foreach my $type (@types) { Link Here
125
            letter_code => $code,
127
            letter_code => $code,
126
            lang        => 'default', # It does not sound useful to send a lang here
128
            lang        => 'default', # It does not sound useful to send a lang here
127
            tables      => {
129
            tables      => {
128
                borrowers   => $issues->{'borrowernumber'},
130
                borrowers   => $issues->{borrowernumber},
129
                biblio      => $issues->{'biblionumber'},
131
                biblio      => $issues->{biblionumber},
130
                biblioitems => $issues->{'biblionumber'},
132
                biblioitems => $issues->{biblionumber},
133
                items       => $issues->{itemnumber},
134
                issues      => $issues->{itemnumber},
135
                branches    => $issues->{site},
136
            },
137
            substitute => {
138
                format       => $format,
139
                language     => $language,
140
                type         => $type,
141
                level        => $issues->{level},
142
                library_code => $library_code,
143
                due_date     => $due_date,
131
            },
144
            },
132
            message_transport_type => 'phone',
145
            message_transport_type => 'phone',
133
        );
146
        );
Lines 144-152 foreach my $type (@types) { Link Here
144
            );
157
            );
145
        }
158
        }
146
159
147
        print $OUT "\"$format\",\"$language\",\"$type\",\"$issues->{level}\",\"$issues->{cardnumber}\",\"$issues->{patron_title}\",\"$issues->{firstname}\",";
160
        if ( $use_tt ) {
148
        print $OUT "\"$issues->{surname}\",\"$issues->{phone}\",\"$issues->{email}\",\"$library_code\",";
161
            $letter->{content} =~ s/__MESSAGE_ID__/$message_id/g;
149
        print $OUT "\"$issues->{site}\",\"$issues->{site_name}\",\"$issues->{barcode}\",\"$due_date\",\"$issues->{title}\",\"$message_id\"\n";
162
            print $OUT $letter->{content};
163
        } else {
164
            print $OUT "\"$format\",\"$language\",\"$type\",\"$issues->{level}\",\"$issues->{cardnumber}\",\"$issues->{patron_title}\",\"$issues->{firstname}\",";
165
            print $OUT "\"$issues->{surname}\",\"$issues->{phone}\",\"$issues->{email}\",\"$library_code\",";
166
            print $OUT "\"$issues->{site}\",\"$issues->{site_name}\",\"$issues->{barcode}\",\"$due_date\",\"$issues->{title}\",\"$message_id\"\n";
167
        }
150
    }
168
    }
151
}
169
}
152
170
Lines 207-212 consortium purposes and apply library specific settings, such as Link Here
207
prompts, to those notices.
225
prompts, to those notices.
208
This field can be blank if all messages are from a single library.
226
This field can be blank if all messages are from a single library.
209
227
228
=item B<--template-toolkit>
229
230
OPTIONAL. If set, processes the notice content as Template Toolkit syntax and sends the content as the CSV line instead
231
of generated a fixed CSV line. This allows the contents of the CSV file to be created dynamically instead of using the
232
fixed format that is outputted without this flag.
233
210
=back
234
=back
211
235
212
=cut
236
=cut
Lines 215-221 sub GetOverdueIssues { Link Here
215
    my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname,
239
    my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname,
216
                borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, issues.date_due,
240
                borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, issues.date_due,
217
                max(overduerules.branchcode) as rulebranch, TO_DAYS(NOW())-TO_DAYS(date_due) as daysoverdue, delay1, delay2, delay3,
241
                max(overduerules.branchcode) as rulebranch, TO_DAYS(NOW())-TO_DAYS(date_due) as daysoverdue, delay1, delay2, delay3,
218
                issues.branchcode as site, branches.branchname as site_name
242
                issues.branchcode as site, branches.branchname as site_name, items.itemnumber
219
                FROM borrowers JOIN issues USING (borrowernumber)
243
                FROM borrowers JOIN issues USING (borrowernumber)
220
                JOIN items USING (itemnumber)
244
                JOIN items USING (itemnumber)
221
                JOIN biblio USING (biblionumber)
245
                JOIN biblio USING (biblionumber)
Lines 251-257 sub GetOverdueIssues { Link Here
251
sub GetPredueIssues {
275
sub GetPredueIssues {
252
    my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname,
276
    my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname,
253
                borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, issues.date_due,
277
                borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, issues.date_due,
254
                issues.branchcode as site, branches.branchname as site_name
278
                issues.branchcode as site, branches.branchname as site_name, items.itemnumber
255
                FROM borrowers JOIN issues USING (borrowernumber)
279
                FROM borrowers JOIN issues USING (borrowernumber)
256
                JOIN items USING (itemnumber)
280
                JOIN items USING (itemnumber)
257
                JOIN biblio USING (biblionumber)
281
                JOIN biblio USING (biblionumber)
Lines 276-282 sub GetPredueIssues { Link Here
276
sub GetWaitingHolds {
300
sub GetWaitingHolds {
277
    my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname,
301
    my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname,
278
                borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, reserves.waitingdate,
302
                borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, reserves.waitingdate,
279
                reserves.branchcode AS site, branches.branchname AS site_name,
303
                reserves.branchcode AS site, branches.branchname AS site_name, items.itemnumber,
280
                TO_DAYS(NOW())-TO_DAYS(reserves.waitingdate) AS days_since_waiting
304
                TO_DAYS(NOW())-TO_DAYS(reserves.waitingdate) AS days_since_waiting
281
                FROM borrowers JOIN reserves USING (borrowernumber)
305
                FROM borrowers JOIN reserves USING (borrowernumber)
282
                JOIN items USING (itemnumber)
306
                JOIN items USING (itemnumber)
283
- 

Return to bug 15969