|
Lines 62-67
my $help;
Link Here
|
| 62 |
my $outfile; |
62 |
my $outfile; |
| 63 |
my $skip_patrons_with_email; |
63 |
my $skip_patrons_with_email; |
| 64 |
my $patron_branchcode; |
64 |
my $patron_branchcode; |
|
|
65 |
my $use_tt; |
| 65 |
|
66 |
|
| 66 |
# maps to convert I-tiva terms to Koha terms |
67 |
# maps to convert I-tiva terms to Koha terms |
| 67 |
my $type_module_map = { |
68 |
my $type_module_map = { |
|
Lines 77-91
my $type_notice_map = {
Link Here
|
| 77 |
}; |
78 |
}; |
| 78 |
|
79 |
|
| 79 |
GetOptions( |
80 |
GetOptions( |
| 80 |
'o|output:s' => \$outfile, |
81 |
'o|output:s' => \$outfile, |
| 81 |
'v' => \$verbose, |
82 |
'v' => \$verbose, |
| 82 |
'lang:s' => \$language, |
83 |
'lang:s' => \$language, |
| 83 |
'type:s' => \@types, |
84 |
'type:s' => \@types, |
| 84 |
'w|waiting-hold-day:s' => \@holds_waiting_days_to_call, |
85 |
'w|waiting-hold-day:s' => \@holds_waiting_days_to_call, |
| 85 |
'c|code|library-code:s' => \$library_code, |
86 |
'c|code|library-code:s' => \$library_code, |
| 86 |
's|skip-patrons-with-email' => \$skip_patrons_with_email, |
87 |
's|skip-patrons-with-email' => \$skip_patrons_with_email, |
| 87 |
'pb|patron-branchcode:s' => \$patron_branchcode, |
88 |
'pb|patron-branchcode:s' => \$patron_branchcode, |
| 88 |
'h|help' => \$help, |
89 |
'tt|template-toolkit' => \$use_tt, |
|
|
90 |
'h|help' => \$help, |
| 89 |
); |
91 |
); |
| 90 |
|
92 |
|
| 91 |
$language = uc($language); |
93 |
$language = uc($language); |
|
Lines 141-149
foreach my $type (@types) {
Link Here
|
| 141 |
letter_code => $code, |
143 |
letter_code => $code, |
| 142 |
lang => 'default', # It does not sound useful to send a lang here |
144 |
lang => 'default', # It does not sound useful to send a lang here |
| 143 |
tables => { |
145 |
tables => { |
| 144 |
borrowers => $issues->{'borrowernumber'}, |
146 |
borrowers => $issues->{borrowernumber}, |
| 145 |
biblio => $issues->{'biblionumber'}, |
147 |
biblio => $issues->{biblionumber}, |
| 146 |
biblioitems => $issues->{'biblionumber'}, |
148 |
biblioitems => $issues->{biblionumber}, |
|
|
149 |
items => $issues->{itemnumber}, |
| 150 |
issues => $issues->{itemnumber}, |
| 151 |
branches => $issues->{site}, |
| 152 |
}, |
| 153 |
substitute => { |
| 154 |
format => $format, |
| 155 |
language => $language, |
| 156 |
type => $type, |
| 157 |
level => $issues->{level}, |
| 158 |
library_code => $library_code, |
| 159 |
due_date => $due_date, |
| 147 |
}, |
160 |
}, |
| 148 |
message_transport_type => 'itiva', |
161 |
message_transport_type => 'itiva', |
| 149 |
); |
162 |
); |
|
Lines 160-168
foreach my $type (@types) {
Link Here
|
| 160 |
); |
173 |
); |
| 161 |
} |
174 |
} |
| 162 |
|
175 |
|
| 163 |
print $OUT "\"$format\",\"$language\",\"$type\",\"$issues->{level}\",\"$issues->{cardnumber}\",\"$issues->{patron_title}\",\"$issues->{firstname}\","; |
176 |
if ( $use_tt ) { |
| 164 |
print $OUT "\"$issues->{surname}\",\"$issues->{phone}\",\"$issues->{email}\",\"$library_code\","; |
177 |
$letter->{content} =~ s/__MESSAGE_ID__/$message_id/g; |
| 165 |
print $OUT "\"$issues->{site}\",\"$issues->{site_name}\",\"$issues->{barcode}\",\"$due_date\",\"$issues->{title}\",\"$message_id\"\n"; |
178 |
print $OUT $letter->{content}; |
|
|
179 |
} else { |
| 180 |
print $OUT "\"$format\",\"$language\",\"$type\",\"$issues->{level}\",\"$issues->{cardnumber}\",\"$issues->{patron_title}\",\"$issues->{firstname}\","; |
| 181 |
print $OUT "\"$issues->{surname}\",\"$issues->{phone}\",\"$issues->{email}\",\"$library_code\","; |
| 182 |
print $OUT "\"$issues->{site}\",\"$issues->{site_name}\",\"$issues->{barcode}\",\"$due_date\",\"$issues->{title}\",\"$message_id\"\n"; |
| 183 |
} |
| 166 |
} |
184 |
} |
| 167 |
} |
185 |
} |
| 168 |
|
186 |
|
|
Lines 230-235
OPTIONAL
Link Here
|
| 230 |
Limits the the patrons to generate notices for based on the patron's home library. |
248 |
Limits the the patrons to generate notices for based on the patron's home library. |
| 231 |
Items and holds from other libraries will still be included for the given patron. |
249 |
Items and holds from other libraries will still be included for the given patron. |
| 232 |
|
250 |
|
|
|
251 |
=item B<--template-toolkit> |
| 252 |
|
| 253 |
OPTIONAL. If set, processes the notice content as Template Toolkit syntax and sends the content as the CSV line instead |
| 254 |
of generated a fixed CSV line. This allows the contents of the CSV file to be created dynamically instead of using the |
| 255 |
fixed format that is outputted without this flag. |
| 256 |
|
| 233 |
=back |
257 |
=back |
| 234 |
|
258 |
|
| 235 |
=cut |
259 |
=cut |
|
Lines 242-248
sub GetOverdueIssues {
Link Here
|
| 242 |
my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname, |
266 |
my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname, |
| 243 |
borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, issues.date_due, |
267 |
borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, issues.date_due, |
| 244 |
max(overduerules.branchcode) as rulebranch, TO_DAYS(NOW())-TO_DAYS(date_due) as daysoverdue, delay1, delay2, delay3, |
268 |
max(overduerules.branchcode) as rulebranch, TO_DAYS(NOW())-TO_DAYS(date_due) as daysoverdue, delay1, delay2, delay3, |
| 245 |
issues.branchcode as site, branches.branchname as site_name |
269 |
issues.branchcode as site, branches.branchname as site_name, items.itemnumber |
| 246 |
FROM borrowers JOIN issues USING (borrowernumber) |
270 |
FROM borrowers JOIN issues USING (borrowernumber) |
| 247 |
JOIN items USING (itemnumber) |
271 |
JOIN items USING (itemnumber) |
| 248 |
JOIN biblio USING (biblionumber) |
272 |
JOIN biblio USING (biblionumber) |
|
Lines 283-289
sub GetPredueIssues {
Link Here
|
| 283 |
|
307 |
|
| 284 |
my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname, |
308 |
my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname, |
| 285 |
borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, issues.date_due, |
309 |
borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, issues.date_due, |
| 286 |
issues.branchcode as site, branches.branchname as site_name |
310 |
issues.branchcode as site, branches.branchname as site_name, items.itemnumber |
| 287 |
FROM borrowers JOIN issues USING (borrowernumber) |
311 |
FROM borrowers JOIN issues USING (borrowernumber) |
| 288 |
JOIN items USING (itemnumber) |
312 |
JOIN items USING (itemnumber) |
| 289 |
JOIN biblio USING (biblionumber) |
313 |
JOIN biblio USING (biblionumber) |
|
Lines 313-319
sub GetWaitingHolds {
Link Here
|
| 313 |
|
337 |
|
| 314 |
my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname, borrowers.categorycode, |
338 |
my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname, borrowers.categorycode, |
| 315 |
borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, reserves.waitingdate, |
339 |
borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, reserves.waitingdate, |
| 316 |
reserves.branchcode AS site, branches.branchname AS site_name, |
340 |
reserves.branchcode AS site, branches.branchname AS site_name, items.itemnumber, |
| 317 |
TO_DAYS(NOW())-TO_DAYS(reserves.waitingdate) AS days_since_waiting |
341 |
TO_DAYS(NOW())-TO_DAYS(reserves.waitingdate) AS days_since_waiting |
| 318 |
FROM borrowers JOIN reserves USING (borrowernumber) |
342 |
FROM borrowers JOIN reserves USING (borrowernumber) |
| 319 |
JOIN items USING (itemnumber) |
343 |
JOIN items USING (itemnumber) |
| 320 |
- |
|
|