Bug 3150: Adapt reporting to skeleton.pl
[koha-ffzg.git] / installer / data / mysql / atomicupdate / bug_3150_-_add_LIST_and_CART_notices.pl
1 use Modern::Perl;
2
3 return {
4     bug_number => "3150",
5     description => "Add LIST and CART notices",
6     up => sub {
7         my ($args) = @_;
8         my ($dbh, $out) = @$args{qw(dbh out)};
9
10         $dbh->do(q{ INSERT IGNORE INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES
11 ('catalogue','LIST','','Send list',1,'Your list: [% listname | html %]',"[%- USE Branches -%]
12 [%- USE AuthorisedValues -%]
13 [%- USE Koha -%]
14 [%- PROCESS 'html_helpers.inc' -%]
15 Hi,<br><br>
16 [% borrower.firstname | html %] [% borrower.surname | html %] sent you a list from our online catalog called: [% listname | html %].<br>
17 Please note that the attached file is a MARC bibliographic records file which can be imported into personal bibliographic software like EndNote, Reference Manager or ProCite.<br>
18 [% IF ( comment ) %]<hr><br>[% comment | html | html_line_break %]<br><br>[% END %]<hr>
19 <ol>[% FOREACH biblio IN biblios %]<li>
20 [% biblio.title | html %]
21 [% IF ( biblio.subtitle ) %][% FOREACH subtitle IN biblio.subtitle.split(' | ') %][% subtitle | html %][% END %][% END %]
22 [% biblio.part_number | html %] [% biblio.part_name | html %]<br>
23 [% IF ( biblio.author || biblio.get_marc_contributors.size ) %]Author(s): [% IF ( biblio.author ) %][% biblio.author | html %][% END %][% IF ( biblio.get_marc_contributors ) %][% IF ( biblio.author ) %]; [% END %][% FOREACH author IN biblio.get_marc_contributors %][% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %][% subfield.separator | html %][% subfield.value | html %][% END %][% UNLESS ( loop.last ) %];[% END %][% END %][% END %]<br>[% END %]
24 [% SET biblioitem = biblio.biblioitem %][% IF ( biblioitem.isbn ) %]ISBN: [% FOREACH isbn IN biblioitem.isbn %][% isbn | html %][% UNLESS ( loop.last ) %]; [% END %][% END %]<br>[% END %]
25 [% IF ( biblioitem.publishercode ) %]Published by: [% biblioitem.publishercode | html %][% IF ( biblioitem.publicationyear ) %] in [% biblioitem.publicationyear | html %][% END %][% IF ( biblioitem.pages ) %], [% biblioitem.pages | html %][% END %]<br>[% END %]
26 [% IF ( biblio.seriestitle ) %]Collection: [% biblio.seriestitle | html %]<br>[% END %]
27 [% IF ( biblio.copyrightdate ) %]Copyright year: [% biblio.copyrightdate | html %]<br>[% END %]
28 [% IF ( biblio.notes ) %]Notes: [% biblio.notes | html %]<br>[% END %]
29 [% IF ( biblio.unititle ) %]Unified title: [% biblio.unititle | html %]<br>[% END %]
30 [% IF ( biblio.serial ) %]Serial: [% biblio.serial | html %]<br>[% END %]
31 [% IF ( biblioitem.lccn ) %]LCCN: [% biblioitem.lccn | html %]<br>[% END %]
32 [% IF ( biblio.get_marc_host_only || biblio.get_marc_hostinfo_only ) %]In: [% IF biblio.get_marc_host_only.biblionumber %][% INCLUDE 'biblio-title.inc'  biblio=biblio.get_marc_host_only %] [% biblio.get_marc_relatedparts_only %][% ELSE %][% biblio.get_marc_hostinfo_only %][% END %]<br>[% END %]
33 [% IF ( biblioitem.url ) %]URL: [% biblioitem.url | html %]<br>[% END %]
34 <a href='[% Koha.Preference('OpacBaseUrl') %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]'>View in online catalog</a>
35 [% IF ( biblio.items.count > 0 ) %]<br>Items: <ul>[% FOREACH item IN biblio.items %]<li>[% Branches.GetName( item.holdingbranch ) | html %]
36 [% IF ( item.location ) %], [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %][% END %]
37 [% IF item.itemcallnumber %]([% item.itemcallnumber | html %])[% END %]
38 [% item.barcode | html %]</li>[% END %]</ul>[% END %]
39 <hr></li>[% END %]</ol>", 'email','default' ),
40 ('catalogue','CART','','Send cart',1,'Your cart',"[%- USE Branches -%]
41 [%- USE AuthorisedValues -%]
42 [%- USE Koha -%]
43 [%- PROCESS 'html_helpers.inc' -%]
44 Hi,<br><br>
45 [% borrower.firstname | html %] [% borrower.surname | html %] sent you a cart from our online catalog.<br>
46 Please note that the attached file is a MARC bibliographic records file which can be imported into personal bibliographic software like EndNote, Reference Manager or ProCite.<br>
47 [% IF ( comment ) %]<hr><br>[% comment | html | html_line_break %]<br><br>[% END %]<hr>
48 <ol>[% FOREACH biblio IN biblios %]<li>
49 [% biblio.title | html %]
50 [% IF ( biblio.subtitle ) %][% FOREACH subtitle IN biblio.subtitle.split(' | ') %][% subtitle | html %][% END %][% END %]
51 [% biblio.part_number | html %] [% biblio.part_name | html %]<br>
52 [% IF ( biblio.author || biblio.get_marc_contributors.size ) %]Author(s): [% IF ( biblio.author ) %][% biblio.author | html %][% END %][% IF ( biblio.get_marc_contributors ) %][% IF ( biblio.author ) %]; [% END %][% FOREACH author IN biblio.get_marc_contributors %][% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %][% subfield.separator | html %][% subfield.value | html %][% END %][% UNLESS ( loop.last ) %];[% END %][% END %][% END %]<br>[% END %]
53 [% SET biblioitem = biblio.biblioitem %][% IF ( biblioitem.isbn ) %]ISBN: [% FOREACH isbn IN biblioitem.isbn %][% isbn | html %][% UNLESS ( loop.last ) %]; [% END %][% END %]<br>[% END %]
54 [% IF ( biblioitem.publishercode ) %]Published by: [% biblioitem.publishercode | html %][% IF ( biblioitem.publicationyear ) %] in [% biblioitem.publicationyear | html %][% END %][% IF ( biblioitem.pages ) %], [% biblioitem.pages | html %][% END %]<br>[% END %]
55 [% IF ( biblio.seriestitle ) %]Collection: [% biblio.seriestitle | html %]<br>[% END %]
56 [% IF ( biblio.copyrightdate ) %]Copyright year: [% biblio.copyrightdate | html %]<br>[% END %]
57 [% IF ( biblio.notes ) %]Notes: [% biblio.notes | html %]<br>[% END %]
58 [% IF ( biblio.unititle ) %]Unified title: [% biblio.unititle | html %]<br>[% END %]
59 [% IF ( biblio.serial ) %]Serial: [% biblio.serial | html %]<br>[% END %]
60 [% IF ( biblioitem.lccn ) %]LCCN: [% biblioitem.lccn | html %]<br>[% END %]
61 [% IF ( biblio.get_marc_host_only || biblio.get_marc_hostinfo_only ) %]In: [% IF biblio.get_marc_host_only.biblionumber %][% INCLUDE 'biblio-title.inc'  biblio=biblio.get_marc_host_only %] [% biblio.get_marc_relatedparts_only %][% ELSE %][% biblio.get_marc_hostinfo_only %][% END %]<br>[% END %]
62 [% IF ( biblioitem.url ) %]URL: [% biblioitem.url | html %]<br>[% END %]
63 <a href='[% Koha.Preference('OpacBaseUrl') %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]'>View in online catalog</a>
64 [% IF ( biblio.items.count > 0 ) %]<br>Items: <ul>[% FOREACH item IN biblio.items %]<li>[% Branches.GetName( item.holdingbranch ) | html %]
65 [% IF ( item.location ) %], [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %][% END %]
66 [% IF item.itemcallnumber %]([% item.itemcallnumber | html %])[% END %]
67 [% item.barcode | html %]</li>[% END %]</ul>[% END %]
68 <hr></li>[% END %]</ol>",'email','default') });
69
70         say $out "Added new letter 'LIST' (email)";
71         say $out "Added new letter 'CART' (email)";
72     },
73 };