Bug 18532: (follow-up) Fix notice message, add notice to all installer languages...
[srvgit] / installer / data / mysql / atomicupdate / bug-18532.perl
1 $DBversion = 'XXX'; # will be replaced by the RM
2 if( CheckVersion( $DBversion ) ) {
3     # you can use $dbh here like:
4     $dbh->do( q{
5         INSERT IGNORE INTO letter (module, code, name, title, content, message_transport_type) VALUES ('circulation', 'AUTO_RENEWALS_DGST', 'Notification on auto renewals', 'Auto renewals (Digest)',
6         "Dear [% borrower.firstname %] [% borrower.surname %],
7         [% IF error %]
8             There were [% error %] items that were not renewed.
9         [% END %]
10         [% IF success %]
11             There were [% success %] items that where renewed.
12         [% END %]
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 | $KohaDates as_due_date => 1%]
17             [% ELSE %]
18                 was not renewed with error: [% checkout.auto_renew_error %]
19             [% END %]
20         [% END %]
21         ", 'email');
22     });
23
24     $dbh->do( q{
25         INSERT IGNORE INTO `message_attributes`
26             (`message_attribute_id`, message_name, `takes_days`)
27         VALUES (7, 'Auto_Renewals', 0)
28     });
29
30     $dbh->do( q{
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')
37     });
38
39     $dbh->do( q{
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
43         left join
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;
48     });
49
50      $dbh->do(q{
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')
53      });
54
55     NewVersion( $DBversion, 18532, 'Messaging preferences for auto renewals' );
56 }