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

(-)a/C4/Letters.pm (-2 / +15 lines)
Lines 708-713 sub GetPreparedLetter { Link Here
708
        {
708
        {
709
            content => $letter->{content},
709
            content => $letter->{content},
710
            tables  => $tables,
710
            tables  => $tables,
711
            substitute => $substitute,
711
        }
712
        }
712
    );
713
    );
713
714
Lines 949-955 ENDSQL Link Here
949
        $params->{'from_address'},                # from_address
950
        $params->{'from_address'},                # from_address
950
        $params->{'letter'}->{'content-type'},    # content_type
951
        $params->{'letter'}->{'content-type'},    # content_type
951
    );
952
    );
952
    return $dbh->last_insert_id(undef,undef,'message_queue', undef);
953
954
    my $id = $dbh->last_insert_id(undef,undef,'message_queue', undef);
955
956
    $content = $params->{letter}->{content};
957
    if ( $content =~ /__MESSAGE_ID__/ ) {
958
        $content =~ s/__MESSAGE_ID__/$id/g;
959
        $dbh->do( "UPDATE message_queue SET content = ? WHERE message_id = ?", undef, ($content, $id) );
960
    }
961
962
    return $id;
953
}
963
}
954
964
955
=head2 SendQueuedMessages ([$hashref]) 
965
=head2 SendQueuedMessages ([$hashref]) 
Lines 1374-1379 sub _process_tt { Link Here
1374
1384
1375
    my $content = $params->{content};
1385
    my $content = $params->{content};
1376
    my $tables = $params->{tables};
1386
    my $tables = $params->{tables};
1387
    my $substitute = $params->{substitute};
1377
1388
1378
    my $use_template_cache = C4::Context->config('template_cache_dir') && defined $ENV{GATEWAY_INTERFACE};
1389
    my $use_template_cache = C4::Context->config('template_cache_dir') && defined $ENV{GATEWAY_INTERFACE};
1379
    my $template           = Template->new(
1390
    my $template           = Template->new(
Lines 1388-1394 sub _process_tt { Link Here
1388
        }
1399
        }
1389
    ) or die Template->error();
1400
    ) or die Template->error();
1390
1401
1391
    my $tt_params = _get_tt_params( $tables );
1402
    my $table_params = _get_tt_params( $tables );
1403
1404
    my $tt_params = $substitute ? { %$substitute, %$table_params } : $table_params;
1392
1405
1393
    my $output;
1406
    my $output;
1394
    $template->process( \$content, $tt_params, \$output ) || croak "ERROR PROCESSING TEMPLATE: " . $template->error();
1407
    $template->process( \$content, $tt_params, \$output ) || croak "ERROR PROCESSING TEMPLATE: " . $template->error();
(-)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 124-132 foreach my $type (@types) { Link Here
124
            module      => $module,
126
            module      => $module,
125
            letter_code => $code,
127
            letter_code => $code,
126
            tables      => {
128
            tables      => {
127
                borrowers   => $issues->{'borrowernumber'},
129
                borrowers   => $issues->{borrowernumber},
128
                biblio      => $issues->{'biblionumber'},
130
                biblio      => $issues->{biblionumber},
129
                biblioitems => $issues->{'biblionumber'},
131
                biblioitems => $issues->{biblionumber},
132
                items       => $issues->{itemnumber},
133
                issues      => $issues->{itemnumber},
134
                branches    => $issues->{site},
135
            },
136
            substitute => {
137
                format       => $format,
138
                language     => $language,
139
                type         => $type,
140
                level        => $issues->{level},
141
                library_code => $library_code,
142
                due_date     => $due_date,
130
            },
143
            },
131
            message_transport_type => 'phone',
144
            message_transport_type => 'phone',
132
        );
145
        );
Lines 143-151 foreach my $type (@types) { Link Here
143
            );
156
            );
144
        }
157
        }
145
158
146
        print $OUT "\"$format\",\"$language\",\"$type\",\"$issues->{level}\",\"$issues->{cardnumber}\",\"$issues->{patron_title}\",\"$issues->{firstname}\",";
159
        if ( $use_tt ) {
147
        print $OUT "\"$issues->{surname}\",\"$issues->{phone}\",\"$issues->{email}\",\"$library_code\",";
160
            $letter->{content} =~ s/__MESSAGE_ID__/$message_id/g;
148
        print $OUT "\"$issues->{site}\",\"$issues->{site_name}\",\"$issues->{barcode}\",\"$due_date\",\"$issues->{title}\",\"$message_id\"\n";
161
            print $OUT $letter->{content};
162
        } else {
163
            print $OUT "\"$format\",\"$language\",\"$type\",\"$issues->{level}\",\"$issues->{cardnumber}\",\"$issues->{patron_title}\",\"$issues->{firstname}\",";
164
            print $OUT "\"$issues->{surname}\",\"$issues->{phone}\",\"$issues->{email}\",\"$library_code\",";
165
            print $OUT "\"$issues->{site}\",\"$issues->{site_name}\",\"$issues->{barcode}\",\"$due_date\",\"$issues->{title}\",\"$message_id\"\n";
166
        }
149
    }
167
    }
150
}
168
}
151
169
Lines 206-211 consortium purposes and apply library specific settings, such as Link Here
206
prompts, to those notices.
224
prompts, to those notices.
207
This field can be blank if all messages are from a single library.
225
This field can be blank if all messages are from a single library.
208
226
227
=item B<--template-toolkit>
228
229
OPTIONAL. If set, processes the notice content as Template Toolkit syntax and sends the content as the CSV line instead
230
of generated a fixed CSV line. This allows the contents of the CSV file to be created dynamically instead of using the
231
fixed format that is outputted without this flag.
232
209
=back
233
=back
210
234
211
=cut
235
=cut
Lines 214-220 sub GetOverdueIssues { Link Here
214
    my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname,
238
    my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname,
215
                borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, issues.date_due,
239
                borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, issues.date_due,
216
                max(overduerules.branchcode) as rulebranch, TO_DAYS(NOW())-TO_DAYS(date_due) as daysoverdue, delay1, delay2, delay3,
240
                max(overduerules.branchcode) as rulebranch, TO_DAYS(NOW())-TO_DAYS(date_due) as daysoverdue, delay1, delay2, delay3,
217
                issues.branchcode as site, branches.branchname as site_name
241
                issues.branchcode as site, branches.branchname as site_name, items.itemnumber
218
                FROM borrowers JOIN issues USING (borrowernumber)
242
                FROM borrowers JOIN issues USING (borrowernumber)
219
                JOIN items USING (itemnumber)
243
                JOIN items USING (itemnumber)
220
                JOIN biblio USING (biblionumber)
244
                JOIN biblio USING (biblionumber)
Lines 248-254 sub GetOverdueIssues { Link Here
248
sub GetPredueIssues {
272
sub GetPredueIssues {
249
    my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname,
273
    my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname,
250
                borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, issues.date_due,
274
                borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, issues.date_due,
251
                issues.branchcode as site, branches.branchname as site_name
275
                issues.branchcode as site, branches.branchname as site_name, items.itemnumber
252
                FROM borrowers JOIN issues USING (borrowernumber)
276
                FROM borrowers JOIN issues USING (borrowernumber)
253
                JOIN items USING (itemnumber)
277
                JOIN items USING (itemnumber)
254
                JOIN biblio USING (biblionumber)
278
                JOIN biblio USING (biblionumber)
Lines 273-279 sub GetPredueIssues { Link Here
273
sub GetWaitingHolds {
297
sub GetWaitingHolds {
274
    my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname,
298
    my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname,
275
                borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, reserves.waitingdate,
299
                borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, reserves.waitingdate,
276
                reserves.branchcode AS site, branches.branchname AS site_name,
300
                reserves.branchcode AS site, branches.branchname AS site_name, items.itemnumber,
277
                TO_DAYS(NOW())-TO_DAYS(reserves.waitingdate) AS days_since_waiting
301
                TO_DAYS(NOW())-TO_DAYS(reserves.waitingdate) AS days_since_waiting
278
                FROM borrowers JOIN reserves USING (borrowernumber)
302
                FROM borrowers JOIN reserves USING (borrowernumber)
279
                JOIN items USING (itemnumber)
303
                JOIN items USING (itemnumber)
280
- 

Return to bug 15969