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

(-)a/C4/Letters.pm (-2 / +15 lines)
Lines 770-775 sub GetPreparedLetter { Link Here
770
        {
770
        {
771
            content => $letter->{content},
771
            content => $letter->{content},
772
            tables  => $tables,
772
            tables  => $tables,
773
            substitute => $substitute,
773
        }
774
        }
774
    );
775
    );
775
776
Lines 1015-1021 ENDSQL Link Here
1015
        $params->{'from_address'},                # from_address
1016
        $params->{'from_address'},                # from_address
1016
        $params->{'letter'}->{'content-type'},    # content_type
1017
        $params->{'letter'}->{'content-type'},    # content_type
1017
    );
1018
    );
1018
    return $dbh->last_insert_id(undef,undef,'message_queue', undef);
1019
1020
    my $id = $dbh->last_insert_id(undef,undef,'message_queue', undef);
1021
1022
    $content = $params->{letter}->{content};
1023
    if ( $content =~ /__MESSAGE_ID__/ ) {
1024
        $content =~ s/__MESSAGE_ID__/$id/g;
1025
        $dbh->do( "UPDATE message_queue SET content = ? WHERE message_id = ?", undef, ($content, $id) );
1026
    }
1027
1028
    return $id;
1019
}
1029
}
1020
1030
1021
=head2 SendQueuedMessages ([$hashref]) 
1031
=head2 SendQueuedMessages ([$hashref]) 
Lines 1440-1445 sub _process_tt { Link Here
1440
1450
1441
    my $content = $params->{content};
1451
    my $content = $params->{content};
1442
    my $tables = $params->{tables};
1452
    my $tables = $params->{tables};
1453
    my $substitute = $params->{substitute};
1443
1454
1444
    my $use_template_cache = C4::Context->config('template_cache_dir') && defined $ENV{GATEWAY_INTERFACE};
1455
    my $use_template_cache = C4::Context->config('template_cache_dir') && defined $ENV{GATEWAY_INTERFACE};
1445
    my $template           = Template->new(
1456
    my $template           = Template->new(
Lines 1454-1460 sub _process_tt { Link Here
1454
        }
1465
        }
1455
    ) or die Template->error();
1466
    ) or die Template->error();
1456
1467
1457
    my $tt_params = _get_tt_params( $tables );
1468
    my $table_params = _get_tt_params( $tables );
1469
1470
    my $tt_params = $substitute ? { %$substitute, %$table_params } : $table_params;
1458
1471
1459
    my $output;
1472
    my $output;
1460
    $template->process( \$content, $tt_params, \$output ) || croak "ERROR PROCESSING TEMPLATE: " . $template->error();
1473
    $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