1 $DBversion = 'XXX'; # will be replaced by the RM
2 if( CheckVersion( $DBversion ) ) {
3 # you can use $dbh here like:
5 INSERT IGNORE INTO letter (module, code, name, title, content, message_transport_type) VALUES ('circulation', 'AUTO_RENEWALS_DGST', 'notification on auto renewing', 'Auto renewals (Digest)',
6 "Dear [% borrower.firstname %] [% borrower.surname %],
8 There were [% error %] items that were not correctly renewed.
11 There were [% success %] items that where correctly renewed.
13 [% FOREACH checkout IN checkouts %]
14 [% checkout.item.biblio.title %] : [% checkout.item.barcode %]
15 [% IF !checkout.auto_renew_error %]
16 was renewed until [% checkout.date_due %]
18 was not renewed with error: [% checkout.auto_renew_error %]
25 INSERT IGNORE INTO `message_attributes`
26 (`message_attribute_id`, message_name, `takes_days`)
27 VALUES (7, 'Auto_Renewals', 0)
31 INSERT IGNORE INTO `message_transports`
32 (`message_attribute_id`, `message_transport_type`, `is_digest`, `letter_module`, `letter_code`)
33 VALUES (7, 'email', 0, 'circulation', 'AUTO_RENEWALS'),
34 (7, 'sms', 0, 'circulation', 'AUTO_RENEWALS'),
35 (7, 'email', 1, 'circulation', 'AUTO_RENEWALS_DGST'),
36 (7, 'sms', 1, 'circulation', 'AUTO_RENEWALS_DGST')
40 insert into borrower_message_transport_preferences (borrower_message_preference_id, message_transport_type)
41 select p.borrower_message_preference_id, 'email'
42 from borrower_message_preferences p
44 borrower_message_transport_preferences t
45 on p.borrower_message_preference_id = t.borrower_message_preference_id
46 where p.message_attribute_id = 7
47 and t.borrower_message_preference_id is null;
51 INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type)
52 VALUES ('AutoRenewalNotices','cron','cron|preferences|never','How should Koha determine whether to end autorenewal notices','Choice')
55 NewVersion( $DBversion, 18532, 'Messaging preferences for auto renewals' );