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 |
- |
|
|