View | Details | Raw Unified | Return to bug 3150
Collapse All | Expand All

(-)a/basket/sendbasket.pl (-91 / +44 lines)
Lines 52-163 if ( $email_add ) { Link Here
52
            session_id => scalar $query->cookie('CGISESSID'),
52
            session_id => scalar $query->cookie('CGISESSID'),
53
            token  => scalar $query->param('csrf_token'),
53
            token  => scalar $query->param('csrf_token'),
54
        });
54
        });
55
    my $comment = $query->param('comment');
56
55
57
    # Since we are already logged in, no need to check credentials again
56
    my $patron = Koha::Patrons->find( $borrowernumber );
58
    # when loading a second template.
57
59
    my $template2 = C4::Templates::gettemplate(
58
    my $comment = $query->param('comment');
60
        'basket/sendbasket.tt', 'intranet', $query,
61
    );
62
59
63
    my @bibs = split( /\//, $bib_list );
60
    my @bibs = split( /\//, $bib_list );
64
    my @results;
65
    my $iso2709;
61
    my $iso2709;
66
    my $marcflavour = C4::Context->preference('marcflavour');
67
    foreach my $biblionumber (@bibs) {
68
        $template2->param( biblionumber => $biblionumber );
69
70
        my $dat              = GetBiblioData($biblionumber);
71
        next unless $dat;
72
        my $biblio           = Koha::Biblios->find( $biblionumber );
73
        my $record           = GetMarcBiblio({
74
            biblionumber => $biblionumber,
75
            embed_items => 1 });
76
        my $marcauthorsarray = $biblio->get_authors_from_MARC;
77
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
78
79
        my @items = GetItemsInfo( $biblionumber );
80
81
        my $hasauthors = 0;
82
        if($dat->{'author'} || @$marcauthorsarray) {
83
          $hasauthors = 1;
84
        }
85
	
86
87
        $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
88
        $dat->{MARCAUTHORS}    = $marcauthorsarray;
89
        $dat->{HASAUTHORS}     = $hasauthors;
90
        $dat->{'biblionumber'} = $biblionumber;
91
        $dat->{ITEM_RESULTS}   = \@items;
92
93
        $iso2709 .= $record->as_usmarc();
94
95
        push( @results, $dat );
96
    }
97
98
    my $resultsarray = \@results;
99
    $template2->param(
100
        BIBLIO_RESULTS => $resultsarray,
101
        comment        => $comment
102
    );
103
104
    # Getting template result
105
    my $template_res = $template2->output();
106
    my $body;
107
108
    my $subject;
109
    # Analysing information and getting mail properties
110
    if ( $template_res =~ /<SUBJECT>(?<subject>.*)<END_SUBJECT>/s ) {
111
        $subject = $+{subject};
112
        $subject =~ s|\n?(.*)\n?|$1|;
113
    }
114
    else {
115
        $subject = "no subject";
116
    }
117
62
118
    my $email_header = "";
63
    foreach my $bib ( @bibs ) {
119
    if ( $template_res =~ /<HEADER>(.*)<END_HEADER>/s ) {
64
        my $biblio = Koha::Biblios->find($bib);
120
        $email_header = $1;
65
        $iso2709 .= $biblio->metadata->record->as_usmarc();
121
        $email_header =~ s|\n?(.*)\n?|$1|;
66
    };
122
    }
123
124
    if ( $template_res =~ /<MESSAGE>(.*)<END_MESSAGE>/s ) {
125
        $body = $1;
126
        $body =~ s|\n?(.*)\n?|$1|;
127
    }
128
67
129
    my $THE_body = <<END_OF_BODY;
68
    if ( !defined $iso2709 ) {
130
$email_header
69
        carp "Error sending mail: empty basket";
131
$body
70
        $template->param( error => 1 );
132
END_OF_BODY
133
71
134
    try {
72
    } else {
73
        my %loops = (
74
            biblio => \@bibs,
75
        );
135
76
136
        my $email = Koha::Email->create(
77
        my %substitute = (
137
            {
78
            comment => $comment,
138
                to      => $email_add,
139
                subject => $subject,
140
            }
141
        );
79
        );
142
80
143
        $email->text_body( $THE_body );
81
        my $letter = C4::Letters::GetPreparedLetter(
144
        $email->attach(
82
            module => 'catalog',
145
            Encode::encode( "UTF-8", $iso2709 ),
83
            letter_code => 'CART',
146
            content_type => 'application/octet-stream',
84
            lang => $patron->lang,
147
            name         => 'basket.iso2709',
85
            tables => {
148
            disposition  => 'attachment',
86
                borrowers => $borrowernumber,
87
            },
88
            message_transport_type => 'email',
89
            loops => \%loops,
90
            substitute => \%substitute,
149
        );
91
        );
150
92
151
        my $library = Koha::Patrons->find( $borrowernumber )->library;
93
        my $attachment = {
152
        $email->send_or_die({ transport => $library->smtp_server->transport });
94
            filename => 'basket.iso2709',
153
        $template->param( SENT => "1" );
95
            type => 'application/octet-stream',
96
            content => Encode::encode("UTF-8", $iso2709),
97
        };
98
99
        my $user_email = $patron->first_valid_email_address || C4::Context->preference('KohaAdminEmailAddress');
100
        C4::Letters::EnqueueLetter({
101
            letter => $letter,
102
            message_transport_type => 'email',
103
            borrowernumber => $patron->borrowernumber,
104
            to_address => $email_add,
105
            reply_address => $user_email,
106
            attachments => [$attachment],
107
        });
108
109
        $template->param( SENT => 1 );
154
    }
110
    }
155
    catch {
156
        carp "Error sending mail: $_";
157
        $template->param( error => 1 );
158
    };
159
111
160
    $template->param( email_add => $email_add );
112
    $template->param( email_add => $email_add );
113
161
    output_html_with_http_headers $query, $cookie, $template->output;
114
    output_html_with_http_headers $query, $cookie, $template->output;
162
}
115
}
163
else {
116
else {
(-)a/installer/data/mysql/atomicupdate/bug_3150_-_add_LIST_and_CART_notices.perl (+224 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{ INSERT IGNORE INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES
4
        ('catalog','LIST','','Send list',1,'Your list: [% listname | html %]',"[%- USE raw -%]
5
<p>Hi,</p>
6
<p>[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a list from our online catalog called: [% listname | $raw %].</p>
7
<p>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.</p>
8
<hr/>
9
<p>[% comment | $raw %]</p>
10
<hr/>
11
<ol>
12
[% FOREACH biblio IN biblios %]
13
    <li>
14
        <span>
15
            [% biblio.title | $raw %]
16
            [% IF ( biblio.subtitle ) %]
17
                [% FOREACH subtitle IN biblio.subtitle.split(' | ') %]
18
                    [% subtitle | $raw %]
19
                [% END %]
20
            [% END %]
21
            [% biblio.part_number | $raw %] [% biblio.part_name | $raw %]
22
        </span>
23
        <p>
24
            [% IF ( biblio.author || biblio.get_authors_from_MARC ) %]
25
                <span>Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %]
26
                [% IF ( biblio.get_authors_from_MARC ) %]
27
                    [% IF ( biblio.author ) %]; [% END %]
28
                    [% FOREACH author IN biblio.get_authors_from_MARC %]
29
                        [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %]
30
                            [% subfield.separator | $raw %][% subfield.value | $raw %]
31
                        [% END %]
32
                        [% UNLESS ( loop.last ) %];[% END %]
33
                    [% END %]
34
                [% END %]
35
                </span><br/>
36
            [% END %]
37
            [% SET biblioitem = biblio.biblioitem %]
38
            [% IF ( biblioitem.isbn ) %]
39
                <span>
40
                    ISBN: [% FOREACH isbn IN biblioitem.isbn %]
41
                        [% isbn | $raw %]
42
                        [% UNLESS ( loop.last ) %]; [% END %]
43
                    [% END %]
44
                </span><br/>
45
            [% END %]
46
            [% IF ( biblioitem.publishercode ) %]
47
                <span>
48
                    Published by: [% biblioitem.publishercode | $raw %]
49
                    [% IF ( biblioitem.publicationyear ) %]
50
                        in [% biblioitem.publicationyear | $raw %]
51
                    [% END %]
52
                    [% IF ( biblioitem.pages ) %]
53
                        , [% biblioitem.pages | $raw %]
54
                    [% END %]
55
                </span><br/>
56
            [% END %]
57
            [% IF ( biblio.seriestitle ) %]
58
                <span>
59
                    Collection: [% biblio.seriestitle | $raw %]
60
                </span><br/>
61
            [% END %]
62
            [% IF ( biblio.copyrightdate ) %]
63
                <span>
64
                    Copyright year: [% biblio.copyrightdate | $raw %]
65
                </span><br/>
66
            [% END %]
67
            [% IF ( biblio.notes ) %]
68
                <span>
69
                    Notes: [% biblio.notes | $raw %]
70
                </span><br/>
71
            [% END %]
72
            [% IF ( biblio.unititle ) %]
73
                <span>
74
                    Unified title: [% biblio.unititle | $raw %]
75
                </span><br/>
76
            [% END %]
77
            [% IF ( biblio.serial ) %]
78
                <span>
79
                    Serial: [% biblio.serial | $raw %]
80
                </span><br/>
81
            [% END %]
82
            [% IF ( biblioitem.lccn ) %]
83
                <span>
84
                    LCCN: [% biblioitem.lccn | $raw %]
85
                </span><br/>
86
            [% END %]
87
            [% IF ( biblioitem.url ) %]
88
                <span>
89
                    URL: [% biblioitem.url | html %]
90
                </span>
91
            [% END %]
92
        </p>
93
        [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %]
94
        [% IF ( OPACBaseURL ) %]
95
            <p>In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]</p>
96
        [% END %]
97
        [% IF ( biblio.items.count > 0 ) %]
98
            <p>Items:
99
                <ul>
100
                    [% FOREACH item IN biblio.items %]<li>
101
                        [% item.holding_branch.branchname | $raw %]
102
                        [% item.location | $raw %]
103
                        [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %]
104
                        [% item.barcode | $raw %]
105
                    </li>[% END %]
106
                </ul>
107
            </p>
108
        [% END %]
109
        <hr/>
110
    </li>
111
[% END %]
112
</ol>", 'email','default' ),
113
        ('catalog','CART','','Send cart',1,'Your cart',"[%- USE raw -%]
114
<p>Hi,</p>
115
<p>[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a cart from our online catalog.</p>
116
<p>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.</p>
117
<hr/>
118
<p>[% comment | $raw %]</p>
119
<hr/>
120
<ol>
121
[% FOREACH biblio IN biblios %]
122
    <li>
123
        <span>
124
            [% biblio.title | $raw %]
125
            [% IF ( biblio.subtitle ) %]
126
                [% FOREACH subtitle IN biblio.subtitle.split(' | ') %]
127
                    [% subtitle | $raw %]
128
                [% END %]
129
            [% END %]
130
            [% biblio.part_number | $raw %] [% biblio.part_name | $raw %]
131
        </span>
132
        <p>
133
            [% IF ( biblio.author || biblio.get_authors_from_MARC ) %]
134
                <span>Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %]
135
                [% IF ( biblio.get_authors_from_MARC ) %]
136
                    [% IF ( biblio.author ) %]; [% END %]
137
                    [% FOREACH author IN biblio.get_authors_from_MARC %]
138
                        [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %]
139
                            [% subfield.separator | $raw %][% subfield.value | $raw %]
140
                        [% END %]
141
                        [% UNLESS ( loop.last ) %];[% END %]
142
                    [% END %]
143
                [% END %]
144
                </span><br/>
145
            [% END %]
146
            [% SET biblioitem = biblio.biblioitem %]
147
            [% IF ( biblioitem.isbn ) %]
148
                <span>
149
                    ISBN: [% FOREACH isbn IN biblioitem.isbn %]
150
                        [% isbn | $raw %]
151
                        [% UNLESS ( loop.last ) %]; [% END %]
152
                    [% END %]
153
                </span><br/>
154
            [% END %]
155
            [% IF ( biblioitem.publishercode ) %]
156
                <span>
157
                    Published by: [% biblioitem.publishercode | $raw %]
158
                    [% IF ( biblioitem.publicationyear ) %]
159
                        in [% biblioitem.publicationyear | $raw %]
160
                    [% END %]
161
                    [% IF ( biblioitem.pages ) %]
162
                        , [% biblioitem.pages | $raw %]
163
                    [% END %]
164
                </span><br/>
165
            [% END %]
166
            [% IF ( biblio.seriestitle ) %]
167
                <span>
168
                    Collection: [% biblio.seriestitle | $raw %]
169
                </span><br/>
170
            [% END %]
171
            [% IF ( biblio.copyrightdate ) %]
172
                <span>
173
                    Copyright year: [% biblio.copyrightdate | $raw %]
174
                </span><br/>
175
            [% END %]
176
            [% IF ( biblio.notes ) %]
177
                <span>
178
                    Notes: [% biblio.notes | $raw %]
179
                </span><br/>
180
            [% END %]
181
            [% IF ( biblio.unititle ) %]
182
                <span>
183
                    Unified title: [% biblio.unititle | $raw %]
184
                </span><br/>
185
            [% END %]
186
            [% IF ( biblio.serial ) %]
187
                <span>
188
                    Serial: [% biblio.serial | $raw %]
189
                </span><br/>
190
            [% END %]
191
            [% IF ( biblioitem.lccn ) %]
192
                <span>
193
                    LCCN: [% biblioitem.lccn | $raw %]
194
                </span><br/>
195
            [% END %]
196
            [% IF ( biblioitem.url ) %]
197
                <span>
198
                    URL: [% biblioitem.url | html %]
199
                </span>
200
            [% END %]
201
        </p>
202
        [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %]
203
        [% IF ( OPACBaseURL ) %]
204
            <p>In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]</p>
205
        [% END %]
206
        [% IF ( biblio.items.count > 0 ) %]
207
            <p>Items:
208
                <ul>
209
                    [% FOREACH item IN biblio.items %]<li>
210
                        [% item.holding_branch.branchname | $raw %]
211
                        [% item.location | $raw %]
212
                        [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %]
213
                        [% item.barcode | $raw %]
214
                    </li>[% END %]
215
                </ul>
216
            </p>
217
        [% END %]
218
        <hr/>
219
    </li>
220
[% END %]
221
</ol>",'email','default') });
222
223
    NewVersion( $DBversion, 3150, 'Add LIST and CART notices' );
224
}
(-)a/installer/data/mysql/en/mandatory/sample_notices.yml (+238 lines)
Lines 1541-1543 tables: Link Here
1541
            - "This item must be renewed at the library."
1541
            - "This item must be renewed at the library."
1542
            - "[% END %]"
1542
            - "[% END %]"
1543
            - "[% END %]"
1543
            - "[% END %]"
1544
1545
        - module: catalog
1546
          code: LIST
1547
          branchcode: ""
1548
          name: "Send list"
1549
          is_html: 1
1550
          title: "Your list: [% listname | html %]"
1551
          message_transport_type: email
1552
          lang: default
1553
          content:
1554
            - "[%- USE raw -%]"
1555
            - "<p>Hi,</p>"
1556
            - "<p>[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a list from our online catalog called: [% listname | $raw %].</p>"
1557
            - "<p>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.</p>"
1558
            - "<hr/>"
1559
            - "<p>[% comment | $raw %]</p>"
1560
            - "<hr/>"
1561
            - "<ol>"
1562
            - "[% FOREACH biblio IN biblios %]"
1563
            - "<li>"
1564
            - "<span>"
1565
            - "[% biblio.title | $raw %]"
1566
            - "[% IF ( biblio.subtitle ) %]"
1567
            - "[% FOREACH subtitle IN biblio.subtitle.split(' | ') %]"
1568
            - "[% subtitle | $raw %]"
1569
            - "[% END %]"
1570
            - "[% END %]"
1571
            - "[% biblio.part_number | $raw %] [% biblio.part_name | $raw %]"
1572
            - "</span>"
1573
            - "<p>"
1574
            - "[% IF ( biblio.author || biblio.get_authors_from_MARC ) %]"
1575
            - "<span>Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %]"
1576
            - "[% IF ( biblio.get_authors_from_MARC ) %]"
1577
            - "[% IF ( biblio.author ) %]; [% END %]"
1578
            - "[% FOREACH author IN biblio.get_authors_from_MARC %]"
1579
            - "[% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %]"
1580
            - "[% subfield.separator | $raw %][% subfield.value | $raw %]"
1581
            - "[% END %]"
1582
            - "[% UNLESS ( loop.last ) %];[% END %]"
1583
            - "[% END %]"
1584
            - "[% END %]"
1585
            - "</span><br/>"
1586
            - "[% END %]"
1587
            - "[% SET biblioitem = biblio.biblioitem %]"
1588
            - "[% IF ( biblioitem.isbn ) %]"
1589
            - "<span>"
1590
            - "ISBN: [% FOREACH isbn IN biblioitem.isbn %]"
1591
            - "[% isbn | $raw %]"
1592
            - "[% UNLESS ( loop.last ) %]; [% END %]"
1593
            - "[% END %]"
1594
            - "</span><br/>"
1595
            - "[% END %]"
1596
            - "[% IF ( biblioitem.publishercode ) %]"
1597
            - "<span>"
1598
            - "Published by: [% biblioitem.publishercode | $raw %]"
1599
            - "[% IF ( biblioitem.publicationyear ) %]"
1600
            - "in [% biblioitem.publicationyear | $raw %]"
1601
            - "[% END %]"
1602
            - "[% IF ( biblioitem.pages ) %]"
1603
            - ", [% biblioitem.pages | $raw %]"
1604
            - "[% END %]"
1605
            - "</span><br/>"
1606
            - "[% END %]"
1607
            - "[% IF ( biblio.seriestitle ) %]"
1608
            - "<span>"
1609
            - "Collection: [% biblio.seriestitle | $raw %]"
1610
            - "</span><br/>"
1611
            - "[% END %]"
1612
            - "[% IF ( biblio.copyrightdate ) %]"
1613
            - "<span>"
1614
            - "Copyright year: [% biblio.copyrightdate | $raw %]"
1615
            - "</span><br/>"
1616
            - "[% END %]"
1617
            - "[% IF ( biblio.notes ) %]"
1618
            - "<span>"
1619
            - "Notes: [% biblio.notes | $raw %]"
1620
            - "</span><br/>"
1621
            - "[% END %]"
1622
            - "[% IF ( biblio.unititle ) %]"
1623
            - "<span>"
1624
            - "Unified title: [% biblio.unititle | $raw %]"
1625
            - "</span><br/>"
1626
            - "[% END %]"
1627
            - "[% IF ( biblio.serial ) %]"
1628
            - "<span>"
1629
            - "Serial: [% biblio.serial | $raw %]"
1630
            - "</span><br/>"
1631
            - "[% END %]"
1632
            - "[% IF ( biblioitem.lccn ) %]"
1633
            - "<span>"
1634
            - "LCCN: [% biblioitem.lccn | $raw %]"
1635
            - "</span><br/>"
1636
            - "[% END %]"
1637
            - "[% IF ( biblioitem.url ) %]"
1638
            - "<span>"
1639
            - "URL: [% biblioitem.url | html %]"
1640
            - "</span>"
1641
            - "[% END %]"
1642
            - "</p>"
1643
            - "[% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %]"
1644
            - "[% IF ( OPACBaseURL ) %]"
1645
            - "<p>In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]</p>"
1646
            - "[% END %]"
1647
            - "[% IF ( biblio.items.count > 0 ) %]"
1648
            - "<p>Items:"
1649
            - "<ul>"
1650
            - "[% FOREACH item IN biblio.items %]<li>"
1651
            - "[% item.holding_branch.branchname | $raw %]"
1652
            - "[% item.location | $raw %]"
1653
            - "[% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %]"
1654
            - "[% item.barcode | $raw %]"
1655
            - "</li>[% END %]"
1656
            - "</ul>"
1657
            - "</p>"
1658
            - "[% END %]"
1659
            - "<hr/>"
1660
            - "</li>"
1661
            - "[% END %]"
1662
            - "</ol>"
1663
1664
        - module: catalog
1665
          code: CART
1666
          branchcode: ""
1667
          name: "Send cart"
1668
          is_html: 1
1669
          title: "Your cart"
1670
          message_transport_type: email
1671
          lang: default
1672
          content:
1673
            - "[%- USE raw -%]"
1674
            - "<p>Hi,</p>"
1675
            - "<p>[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a cart from our online catalog.</p>"
1676
            - "<p>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.</p>"
1677
            - "<hr/>"
1678
            - "<p>[% comment | $raw %]</p>"
1679
            - "<hr/>"
1680
            - "<ol>"
1681
            - "[% FOREACH biblio IN biblios %]"
1682
            - "<li>"
1683
            - "<span>"
1684
            - "[% biblio.title | $raw %]"
1685
            - "[% IF ( biblio.subtitle ) %]"
1686
            - "[% FOREACH subtitle IN biblio.subtitle.split(' | ') %]"
1687
            - "[% subtitle | $raw %]"
1688
            - "[% END %]"
1689
            - "[% END %]"
1690
            - "[% biblio.part_number | $raw %] [% biblio.part_name | $raw %]"
1691
            - "</span>"
1692
            - "<p>"
1693
            - "[% IF ( biblio.author || biblio.get_authors_from_MARC ) %]"
1694
            - "<span>Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %]"
1695
            - "[% IF ( biblio.get_authors_from_MARC ) %]"
1696
            - "[% IF ( biblio.author ) %]; [% END %]"
1697
            - "[% FOREACH author IN biblio.get_authors_from_MARC %]"
1698
            - "[% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %]"
1699
            - "[% subfield.separator | $raw %][% subfield.value | $raw %]"
1700
            - "[% END %]"
1701
            - "[% UNLESS ( loop.last ) %];[% END %]"
1702
            - "[% END %]"
1703
            - "[% END %]"
1704
            - "</span><br/>"
1705
            - "[% END %]"
1706
            - "[% SET biblioitem = biblio.biblioitem %]"
1707
            - "[% IF ( biblioitem.isbn ) %]"
1708
            - "<span>"
1709
            - "ISBN: [% FOREACH isbn IN biblioitem.isbn %]"
1710
            - "[% isbn | $raw %]"
1711
            - "[% UNLESS ( loop.last ) %]; [% END %]"
1712
            - "[% END %]"
1713
            - "</span><br/>"
1714
            - "[% END %]"
1715
            - "[% IF ( biblioitem.publishercode ) %]"
1716
            - "<span>"
1717
            - "Published by: [% biblioitem.publishercode | $raw %]"
1718
            - "[% IF ( biblioitem.publicationyear ) %]"
1719
            - "in [% biblioitem.publicationyear | $raw %]"
1720
            - "[% END %]"
1721
            - "[% IF ( biblioitem.pages ) %]"
1722
            - ", [% biblioitem.pages | $raw %]"
1723
            - "[% END %]"
1724
            - "</span><br/>"
1725
            - "[% END %]"
1726
            - "[% IF ( biblio.seriestitle ) %]"
1727
            - "<span>"
1728
            - "Collection: [% biblio.seriestitle | $raw %]"
1729
            - "</span><br/>"
1730
            - "[% END %]"
1731
            - "[% IF ( biblio.copyrightdate ) %]"
1732
            - "<span>"
1733
            - "Copyright year: [% biblio.copyrightdate | $raw %]"
1734
            - "</span><br/>"
1735
            - "[% END %]"
1736
            - "[% IF ( biblio.notes ) %]"
1737
            - "<span>"
1738
            - "Notes: [% biblio.notes | $raw %]"
1739
            - "</span><br/>"
1740
            - "[% END %]"
1741
            - "[% IF ( biblio.unititle ) %]"
1742
            - "<span>"
1743
            - "Unified title: [% biblio.unititle | $raw %]"
1744
            - "</span><br/>"
1745
            - "[% END %]"
1746
            - "[% IF ( biblio.serial ) %]"
1747
            - "<span>"
1748
            - "Serial: [% biblio.serial | $raw %]"
1749
            - "</span><br/>"
1750
            - "[% END %]"
1751
            - "[% IF ( biblioitem.lccn ) %]"
1752
            - "<span>"
1753
            - "LCCN: [% biblioitem.lccn | $raw %]"
1754
            - "</span><br/>"
1755
            - "[% END %]"
1756
            - "[% IF ( biblioitem.url ) %]"
1757
            - "<span>"
1758
            - "URL: [% biblioitem.url | html %]"
1759
            - "</span>"
1760
            - "[% END %]"
1761
            - "</p>"
1762
            - "[% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %]"
1763
            - "[% IF ( OPACBaseURL ) %]"
1764
            - "<p>In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]</p>"
1765
            - "[% END %]"
1766
            - "[% IF ( biblio.items.count > 0 ) %]"
1767
            - "<p>Items:"
1768
            - "<ul>"
1769
            - "[% FOREACH item IN biblio.items %]<li>"
1770
            - "[% item.holding_branch.branchname | $raw %]"
1771
            - "[% item.location | $raw %]"
1772
            - "[% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %]"
1773
            - "[% item.barcode | $raw %]"
1774
            - "</li>[% END %]"
1775
            - "</ul>"
1776
            - "</p>"
1777
            - "[% END %]"
1778
            - "<hr/>"
1779
            - "</li>"
1780
            - "[% END %]"
1781
            - "</ol>"
(-)a/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql (+219 lines)
Lines 362-364 INSERT IGNORE INTO letter (module, code, name, title, content, message_transport Link Here
362
    [% END %]
362
    [% END %]
363
[% END %]
363
[% END %]
364
", 'email');
364
", 'email');
365
366
INSERT IGNORE INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('catalog','LIST','','Send list',1,'Your list: [% listname | html %]',"[%- USE raw -%]
367
<p>Hi,</p>
368
<p>[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a list from our online catalog called: [% listname | $raw %].</p>
369
<p>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.</p>
370
<hr/>
371
<p>[% comment | $raw %]</p>
372
<hr/>
373
<ol>
374
[% FOREACH biblio IN biblios %]
375
    <li>
376
        <span>
377
            [% biblio.title | $raw %]
378
            [% IF ( biblio.subtitle ) %]
379
                [% FOREACH subtitle IN biblio.subtitle.split(' | ') %]
380
                    [% subtitle | $raw %]
381
                [% END %]
382
            [% END %]
383
            [% biblio.part_number | $raw %] [% biblio.part_name | $raw %]
384
        </span>
385
        <p>
386
            [% IF ( biblio.author || biblio.get_authors_from_MARC ) %]
387
                <span>Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %]
388
                [% IF ( biblio.get_authors_from_MARC ) %]
389
                    [% IF ( biblio.author ) %]; [% END %]
390
                    [% FOREACH author IN biblio.get_authors_from_MARC %]
391
                        [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %]
392
                            [% subfield.separator | $raw %][% subfield.value | $raw %]
393
                        [% END %]
394
                        [% UNLESS ( loop.last ) %];[% END %]
395
                    [% END %]
396
                [% END %]
397
                </span><br/>
398
            [% END %]
399
            [% SET biblioitem = biblio.biblioitem %]
400
            [% IF ( biblioitem.isbn ) %]
401
                <span>
402
                    ISBN: [% FOREACH isbn IN biblioitem.isbn %]
403
                        [% isbn | $raw %]
404
                        [% UNLESS ( loop.last ) %]; [% END %]
405
                    [% END %]
406
                </span><br/>
407
            [% END %]
408
            [% IF ( biblioitem.publishercode ) %]
409
                <span>
410
                    Published by: [% biblioitem.publishercode | $raw %]
411
                    [% IF ( biblioitem.publicationyear ) %]
412
                        in [% biblioitem.publicationyear | $raw %]
413
                    [% END %]
414
                    [% IF ( biblioitem.pages ) %]
415
                        , [% biblioitem.pages | $raw %]
416
                    [% END %]
417
                </span><br/>
418
            [% END %]
419
            [% IF ( biblio.seriestitle ) %]
420
                <span>
421
                    Collection: [% biblio.seriestitle | $raw %]
422
                </span><br/>
423
            [% END %]
424
            [% IF ( biblio.copyrightdate ) %]
425
                <span>
426
                    Copyright year: [% biblio.copyrightdate | $raw %]
427
                </span><br/>
428
            [% END %]
429
            [% IF ( biblio.notes ) %]
430
                <span>
431
                    Notes: [% biblio.notes | $raw %]
432
                </span><br/>
433
            [% END %]
434
            [% IF ( biblio.unititle ) %]
435
                <span>
436
                    Unified title: [% biblio.unititle | $raw %]
437
                </span><br/>
438
            [% END %]
439
            [% IF ( biblio.serial ) %]
440
                <span>
441
                    Serial: [% biblio.serial | $raw %]
442
                </span><br/>
443
            [% END %]
444
            [% IF ( biblioitem.lccn ) %]
445
                <span>
446
                    LCCN: [% biblioitem.lccn | $raw %]
447
                </span><br/>
448
            [% END %]
449
            [% IF ( biblioitem.url ) %]
450
                <span>
451
                    URL: [% biblioitem.url | html %]
452
                </span>
453
            [% END %]
454
        </p>
455
        [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %]
456
        [% IF ( OPACBaseURL ) %]
457
            <p>In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]</p>
458
        [% END %]
459
        [% IF ( biblio.items.count > 0 ) %]
460
            <p>Items:
461
                <ul>
462
                    [% FOREACH item IN biblio.items %]<li>
463
                        [% item.holding_branch.branchname | $raw %]
464
                        [% item.location | $raw %]
465
                        [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %]
466
                        [% item.barcode | $raw %]
467
                    </li>[% END %]
468
                </ul>
469
            </p>
470
        [% END %]
471
        <hr/>
472
    </li>
473
[% END %]
474
</ol>", 'email','default' ),
475
('catalog','CART','','Send cart',1,'Your cart',"[%- USE raw -%]
476
<p>Hi,</p>
477
<p>[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a cart from our online catalog.</p>
478
<p>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.</p>
479
<hr/>
480
<p>[% comment | $raw %]</p>
481
<hr/>
482
<ol>
483
[% FOREACH biblio IN biblios %]
484
    <li>
485
        <span>
486
            [% biblio.title | $raw %]
487
            [% IF ( biblio.subtitle ) %]
488
                [% FOREACH subtitle IN biblio.subtitle.split(' | ') %]
489
                    [% subtitle | $raw %]
490
                [% END %]
491
            [% END %]
492
            [% biblio.part_number | $raw %] [% biblio.part_name | $raw %]
493
        </span>
494
        <p>
495
            [% IF ( biblio.author || biblio.get_authors_from_MARC ) %]
496
                <span>Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %]
497
                [% IF ( biblio.get_authors_from_MARC ) %]
498
                    [% IF ( biblio.author ) %]; [% END %]
499
                    [% FOREACH author IN biblio.get_authors_from_MARC %]
500
                        [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %]
501
                            [% subfield.separator | $raw %][% subfield.value | $raw %]
502
                        [% END %]
503
                        [% UNLESS ( loop.last ) %];[% END %]
504
                    [% END %]
505
                [% END %]
506
                </span><br/>
507
            [% END %]
508
            [% SET biblioitem = biblio.biblioitem %]
509
            [% IF ( biblioitem.isbn ) %]
510
                <span>
511
                    ISBN: [% FOREACH isbn IN biblioitem.isbn %]
512
                        [% isbn | $raw %]
513
                        [% UNLESS ( loop.last ) %]; [% END %]
514
                    [% END %]
515
                </span><br/>
516
            [% END %]
517
            [% IF ( biblioitem.publishercode ) %]
518
                <span>
519
                    Published by: [% biblioitem.publishercode | $raw %]
520
                    [% IF ( biblioitem.publicationyear ) %]
521
                        in [% biblioitem.publicationyear | $raw %]
522
                    [% END %]
523
                    [% IF ( biblioitem.pages ) %]
524
                        , [% biblioitem.pages | $raw %]
525
                    [% END %]
526
                </span><br/>
527
            [% END %]
528
            [% IF ( biblio.seriestitle ) %]
529
                <span>
530
                    Collection: [% biblio.seriestitle | $raw %]
531
                </span><br/>
532
            [% END %]
533
            [% IF ( biblio.copyrightdate ) %]
534
                <span>
535
                    Copyright year: [% biblio.copyrightdate | $raw %]
536
                </span><br/>
537
            [% END %]
538
            [% IF ( biblio.notes ) %]
539
                <span>
540
                    Notes: [% biblio.notes | $raw %]
541
                </span><br/>
542
            [% END %]
543
            [% IF ( biblio.unititle ) %]
544
                <span>
545
                    Unified title: [% biblio.unititle | $raw %]
546
                </span><br/>
547
            [% END %]
548
            [% IF ( biblio.serial ) %]
549
                <span>
550
                    Serial: [% biblio.serial | $raw %]
551
                </span><br/>
552
            [% END %]
553
            [% IF ( biblioitem.lccn ) %]
554
                <span>
555
                    LCCN: [% biblioitem.lccn | $raw %]
556
                </span><br/>
557
            [% END %]
558
            [% IF ( biblioitem.url ) %]
559
                <span>
560
                    URL: [% biblioitem.url | html %]
561
                </span>
562
            [% END %]
563
        </p>
564
        [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %]
565
        [% IF ( OPACBaseURL ) %]
566
            <p>In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]</p>
567
        [% END %]
568
        [% IF ( biblio.items.count > 0 ) %]
569
            <p>Items:
570
                <ul>
571
                    [% FOREACH item IN biblio.items %]<li>
572
                        [% item.holding_branch.branchname | $raw %]
573
                        [% item.location | $raw %]
574
                        [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %]
575
                        [% item.barcode | $raw %]
576
                    </li>[% END %]
577
                </ul>
578
            </p>
579
        [% END %]
580
        <hr/>
581
    </li>
582
[% END %]
583
</ol>",'email','default');
(-)a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql (+219 lines)
Lines 474-476 INSERT IGNORE INTO letter (module, code, name, title, content, message_transport Link Here
474
    [% END %]
474
    [% END %]
475
[% END %]
475
[% END %]
476
", 'email');
476
", 'email');
477
478
INSERT IGNORE INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('catalog','LIST','','Send list',1,'Your list: [% listname | html %]',"[%- USE raw -%]
479
<p>Hi,</p>
480
<p>[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a list from our online catalog called: [% listname | $raw %].</p>
481
<p>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.</p>
482
<hr/>
483
<p>[% comment | $raw %]</p>
484
<hr/>
485
<ol>
486
[% FOREACH biblio IN biblios %]
487
    <li>
488
        <span>
489
            [% biblio.title | $raw %]
490
            [% IF ( biblio.subtitle ) %]
491
                [% FOREACH subtitle IN biblio.subtitle.split(' | ') %]
492
                    [% subtitle | $raw %]
493
                [% END %]
494
            [% END %]
495
            [% biblio.part_number | $raw %] [% biblio.part_name | $raw %]
496
        </span>
497
        <p>
498
            [% IF ( biblio.author || biblio.get_authors_from_MARC ) %]
499
                <span>Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %]
500
                [% IF ( biblio.get_authors_from_MARC ) %]
501
                    [% IF ( biblio.author ) %]; [% END %]
502
                    [% FOREACH author IN biblio.get_authors_from_MARC %]
503
                        [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %]
504
                            [% subfield.separator | $raw %][% subfield.value | $raw %]
505
                        [% END %]
506
                        [% UNLESS ( loop.last ) %];[% END %]
507
                    [% END %]
508
                [% END %]
509
                </span><br/>
510
            [% END %]
511
            [% SET biblioitem = biblio.biblioitem %]
512
            [% IF ( biblioitem.isbn ) %]
513
                <span>
514
                    ISBN: [% FOREACH isbn IN biblioitem.isbn %]
515
                        [% isbn | $raw %]
516
                        [% UNLESS ( loop.last ) %]; [% END %]
517
                    [% END %]
518
                </span><br/>
519
            [% END %]
520
            [% IF ( biblioitem.publishercode ) %]
521
                <span>
522
                    Published by: [% biblioitem.publishercode | $raw %]
523
                    [% IF ( biblioitem.publicationyear ) %]
524
                        in [% biblioitem.publicationyear | $raw %]
525
                    [% END %]
526
                    [% IF ( biblioitem.pages ) %]
527
                        , [% biblioitem.pages | $raw %]
528
                    [% END %]
529
                </span><br/>
530
            [% END %]
531
            [% IF ( biblio.seriestitle ) %]
532
                <span>
533
                    Collection: [% biblio.seriestitle | $raw %]
534
                </span><br/>
535
            [% END %]
536
            [% IF ( biblio.copyrightdate ) %]
537
                <span>
538
                    Copyright year: [% biblio.copyrightdate | $raw %]
539
                </span><br/>
540
            [% END %]
541
            [% IF ( biblio.notes ) %]
542
                <span>
543
                    Notes: [% biblio.notes | $raw %]
544
                </span><br/>
545
            [% END %]
546
            [% IF ( biblio.unititle ) %]
547
                <span>
548
                    Unified title: [% biblio.unititle | $raw %]
549
                </span><br/>
550
            [% END %]
551
            [% IF ( biblio.serial ) %]
552
                <span>
553
                    Serial: [% biblio.serial | $raw %]
554
                </span><br/>
555
            [% END %]
556
            [% IF ( biblioitem.lccn ) %]
557
                <span>
558
                    LCCN: [% biblioitem.lccn | $raw %]
559
                </span><br/>
560
            [% END %]
561
            [% IF ( biblioitem.url ) %]
562
                <span>
563
                    URL: [% biblioitem.url | html %]
564
                </span>
565
            [% END %]
566
        </p>
567
        [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %]
568
        [% IF ( OPACBaseURL ) %]
569
            <p>In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]</p>
570
        [% END %]
571
        [% IF ( biblio.items.count > 0 ) %]
572
            <p>Items:
573
                <ul>
574
                    [% FOREACH item IN biblio.items %]<li>
575
                        [% item.holding_branch.branchname | $raw %]
576
                        [% item.location | $raw %]
577
                        [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %]
578
                        [% item.barcode | $raw %]
579
                    </li>[% END %]
580
                </ul>
581
            </p>
582
        [% END %]
583
        <hr/>
584
    </li>
585
[% END %]
586
</ol>", 'email','default' ),
587
('catalog','CART','','Send cart',1,'Your cart',"[%- USE raw -%]
588
<p>Hi,</p>
589
<p>[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a cart from our online catalog.</p>
590
<p>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.</p>
591
<hr/>
592
<p>[% comment | $raw %]</p>
593
<hr/>
594
<ol>
595
[% FOREACH biblio IN biblios %]
596
    <li>
597
        <span>
598
            [% biblio.title | $raw %]
599
            [% IF ( biblio.subtitle ) %]
600
                [% FOREACH subtitle IN biblio.subtitle.split(' | ') %]
601
                    [% subtitle | $raw %]
602
                [% END %]
603
            [% END %]
604
            [% biblio.part_number | $raw %] [% biblio.part_name | $raw %]
605
        </span>
606
        <p>
607
            [% IF ( biblio.author || biblio.get_authors_from_MARC ) %]
608
                <span>Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %]
609
                [% IF ( biblio.get_authors_from_MARC ) %]
610
                    [% IF ( biblio.author ) %]; [% END %]
611
                    [% FOREACH author IN biblio.get_authors_from_MARC %]
612
                        [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %]
613
                            [% subfield.separator | $raw %][% subfield.value | $raw %]
614
                        [% END %]
615
                        [% UNLESS ( loop.last ) %];[% END %]
616
                    [% END %]
617
                [% END %]
618
                </span><br/>
619
            [% END %]
620
            [% SET biblioitem = biblio.biblioitem %]
621
            [% IF ( biblioitem.isbn ) %]
622
                <span>
623
                    ISBN: [% FOREACH isbn IN biblioitem.isbn %]
624
                        [% isbn | $raw %]
625
                        [% UNLESS ( loop.last ) %]; [% END %]
626
                    [% END %]
627
                </span><br/>
628
            [% END %]
629
            [% IF ( biblioitem.publishercode ) %]
630
                <span>
631
                    Published by: [% biblioitem.publishercode | $raw %]
632
                    [% IF ( biblioitem.publicationyear ) %]
633
                        in [% biblioitem.publicationyear | $raw %]
634
                    [% END %]
635
                    [% IF ( biblioitem.pages ) %]
636
                        , [% biblioitem.pages | $raw %]
637
                    [% END %]
638
                </span><br/>
639
            [% END %]
640
            [% IF ( biblio.seriestitle ) %]
641
                <span>
642
                    Collection: [% biblio.seriestitle | $raw %]
643
                </span><br/>
644
            [% END %]
645
            [% IF ( biblio.copyrightdate ) %]
646
                <span>
647
                    Copyright year: [% biblio.copyrightdate | $raw %]
648
                </span><br/>
649
            [% END %]
650
            [% IF ( biblio.notes ) %]
651
                <span>
652
                    Notes: [% biblio.notes | $raw %]
653
                </span><br/>
654
            [% END %]
655
            [% IF ( biblio.unititle ) %]
656
                <span>
657
                    Unified title: [% biblio.unititle | $raw %]
658
                </span><br/>
659
            [% END %]
660
            [% IF ( biblio.serial ) %]
661
                <span>
662
                    Serial: [% biblio.serial | $raw %]
663
                </span><br/>
664
            [% END %]
665
            [% IF ( biblioitem.lccn ) %]
666
                <span>
667
                    LCCN: [% biblioitem.lccn | $raw %]
668
                </span><br/>
669
            [% END %]
670
            [% IF ( biblioitem.url ) %]
671
                <span>
672
                    URL: [% biblioitem.url | html %]
673
                </span>
674
            [% END %]
675
        </p>
676
        [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %]
677
        [% IF ( OPACBaseURL ) %]
678
            <p>In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]</p>
679
        [% END %]
680
        [% IF ( biblio.items.count > 0 ) %]
681
            <p>Items:
682
                <ul>
683
                    [% FOREACH item IN biblio.items %]<li>
684
                        [% item.holding_branch.branchname | $raw %]
685
                        [% item.location | $raw %]
686
                        [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %]
687
                        [% item.barcode | $raw %]
688
                    </li>[% END %]
689
                </ul>
690
            </p>
691
        [% END %]
692
        <hr/>
693
    </li>
694
[% END %]
695
</ol>",'email','default');
(-)a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql (+219 lines)
Lines 493-495 INSERT IGNORE INTO letter (module, code, name, title, content, message_transport Link Here
493
    [% END %]
493
    [% END %]
494
[% END %]
494
[% END %]
495
", 'email');
495
", 'email');
496
497
INSERT IGNORE INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('catalog','LIST','','Send list',1,'Your list: [% listname | html %]',"[%- USE raw -%]
498
<p>Hi,</p>
499
<p>[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a list from our online catalog called: [% listname | $raw %].</p>
500
<p>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.</p>
501
<hr/>
502
<p>[% comment | $raw %]</p>
503
<hr/>
504
<ol>
505
[% FOREACH biblio IN biblios %]
506
    <li>
507
        <span>
508
            [% biblio.title | $raw %]
509
            [% IF ( biblio.subtitle ) %]
510
                [% FOREACH subtitle IN biblio.subtitle.split(' | ') %]
511
                    [% subtitle | $raw %]
512
                [% END %]
513
            [% END %]
514
            [% biblio.part_number | $raw %] [% biblio.part_name | $raw %]
515
        </span>
516
        <p>
517
            [% IF ( biblio.author || biblio.get_authors_from_MARC ) %]
518
                <span>Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %]
519
                [% IF ( biblio.get_authors_from_MARC ) %]
520
                    [% IF ( biblio.author ) %]; [% END %]
521
                    [% FOREACH author IN biblio.get_authors_from_MARC %]
522
                        [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %]
523
                            [% subfield.separator | $raw %][% subfield.value | $raw %]
524
                        [% END %]
525
                        [% UNLESS ( loop.last ) %];[% END %]
526
                    [% END %]
527
                [% END %]
528
                </span><br/>
529
            [% END %]
530
            [% SET biblioitem = biblio.biblioitem %]
531
            [% IF ( biblioitem.isbn ) %]
532
                <span>
533
                    ISBN: [% FOREACH isbn IN biblioitem.isbn %]
534
                        [% isbn | $raw %]
535
                        [% UNLESS ( loop.last ) %]; [% END %]
536
                    [% END %]
537
                </span><br/>
538
            [% END %]
539
            [% IF ( biblioitem.publishercode ) %]
540
                <span>
541
                    Published by: [% biblioitem.publishercode | $raw %]
542
                    [% IF ( biblioitem.publicationyear ) %]
543
                        in [% biblioitem.publicationyear | $raw %]
544
                    [% END %]
545
                    [% IF ( biblioitem.pages ) %]
546
                        , [% biblioitem.pages | $raw %]
547
                    [% END %]
548
                </span><br/>
549
            [% END %]
550
            [% IF ( biblio.seriestitle ) %]
551
                <span>
552
                    Collection: [% biblio.seriestitle | $raw %]
553
                </span><br/>
554
            [% END %]
555
            [% IF ( biblio.copyrightdate ) %]
556
                <span>
557
                    Copyright year: [% biblio.copyrightdate | $raw %]
558
                </span><br/>
559
            [% END %]
560
            [% IF ( biblio.notes ) %]
561
                <span>
562
                    Notes: [% biblio.notes | $raw %]
563
                </span><br/>
564
            [% END %]
565
            [% IF ( biblio.unititle ) %]
566
                <span>
567
                    Unified title: [% biblio.unititle | $raw %]
568
                </span><br/>
569
            [% END %]
570
            [% IF ( biblio.serial ) %]
571
                <span>
572
                    Serial: [% biblio.serial | $raw %]
573
                </span><br/>
574
            [% END %]
575
            [% IF ( biblioitem.lccn ) %]
576
                <span>
577
                    LCCN: [% biblioitem.lccn | $raw %]
578
                </span><br/>
579
            [% END %]
580
            [% IF ( biblioitem.url ) %]
581
                <span>
582
                    URL: [% biblioitem.url | html %]
583
                </span>
584
            [% END %]
585
        </p>
586
        [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %]
587
        [% IF ( OPACBaseURL ) %]
588
            <p>In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]</p>
589
        [% END %]
590
        [% IF ( biblio.items.count > 0 ) %]
591
            <p>Items:
592
                <ul>
593
                    [% FOREACH item IN biblio.items %]<li>
594
                        [% item.holding_branch.branchname | $raw %]
595
                        [% item.location | $raw %]
596
                        [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %]
597
                        [% item.barcode | $raw %]
598
                    </li>[% END %]
599
                </ul>
600
            </p>
601
        [% END %]
602
        <hr/>
603
    </li>
604
[% END %]
605
</ol>", 'email','default' ),
606
('catalog','CART','','Send cart',1,'Your cart',"[%- USE raw -%]
607
<p>Hi,</p>
608
<p>[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a cart from our online catalog.</p>
609
<p>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.</p>
610
<hr/>
611
<p>[% comment | $raw %]</p>
612
<hr/>
613
<ol>
614
[% FOREACH biblio IN biblios %]
615
    <li>
616
        <span>
617
            [% biblio.title | $raw %]
618
            [% IF ( biblio.subtitle ) %]
619
                [% FOREACH subtitle IN biblio.subtitle.split(' | ') %]
620
                    [% subtitle | $raw %]
621
                [% END %]
622
            [% END %]
623
            [% biblio.part_number | $raw %] [% biblio.part_name | $raw %]
624
        </span>
625
        <p>
626
            [% IF ( biblio.author || biblio.get_authors_from_MARC ) %]
627
                <span>Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %]
628
                [% IF ( biblio.get_authors_from_MARC ) %]
629
                    [% IF ( biblio.author ) %]; [% END %]
630
                    [% FOREACH author IN biblio.get_authors_from_MARC %]
631
                        [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %]
632
                            [% subfield.separator | $raw %][% subfield.value | $raw %]
633
                        [% END %]
634
                        [% UNLESS ( loop.last ) %];[% END %]
635
                    [% END %]
636
                [% END %]
637
                </span><br/>
638
            [% END %]
639
            [% SET biblioitem = biblio.biblioitem %]
640
            [% IF ( biblioitem.isbn ) %]
641
                <span>
642
                    ISBN: [% FOREACH isbn IN biblioitem.isbn %]
643
                        [% isbn | $raw %]
644
                        [% UNLESS ( loop.last ) %]; [% END %]
645
                    [% END %]
646
                </span><br/>
647
            [% END %]
648
            [% IF ( biblioitem.publishercode ) %]
649
                <span>
650
                    Published by: [% biblioitem.publishercode | $raw %]
651
                    [% IF ( biblioitem.publicationyear ) %]
652
                        in [% biblioitem.publicationyear | $raw %]
653
                    [% END %]
654
                    [% IF ( biblioitem.pages ) %]
655
                        , [% biblioitem.pages | $raw %]
656
                    [% END %]
657
                </span><br/>
658
            [% END %]
659
            [% IF ( biblio.seriestitle ) %]
660
                <span>
661
                    Collection: [% biblio.seriestitle | $raw %]
662
                </span><br/>
663
            [% END %]
664
            [% IF ( biblio.copyrightdate ) %]
665
                <span>
666
                    Copyright year: [% biblio.copyrightdate | $raw %]
667
                </span><br/>
668
            [% END %]
669
            [% IF ( biblio.notes ) %]
670
                <span>
671
                    Notes: [% biblio.notes | $raw %]
672
                </span><br/>
673
            [% END %]
674
            [% IF ( biblio.unititle ) %]
675
                <span>
676
                    Unified title: [% biblio.unititle | $raw %]
677
                </span><br/>
678
            [% END %]
679
            [% IF ( biblio.serial ) %]
680
                <span>
681
                    Serial: [% biblio.serial | $raw %]
682
                </span><br/>
683
            [% END %]
684
            [% IF ( biblioitem.lccn ) %]
685
                <span>
686
                    LCCN: [% biblioitem.lccn | $raw %]
687
                </span><br/>
688
            [% END %]
689
            [% IF ( biblioitem.url ) %]
690
                <span>
691
                    URL: [% biblioitem.url | html %]
692
                </span>
693
            [% END %]
694
        </p>
695
        [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %]
696
        [% IF ( OPACBaseURL ) %]
697
            <p>In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]</p>
698
        [% END %]
699
        [% IF ( biblio.items.count > 0 ) %]
700
            <p>Items:
701
                <ul>
702
                    [% FOREACH item IN biblio.items %]<li>
703
                        [% item.holding_branch.branchname | $raw %]
704
                        [% item.location | $raw %]
705
                        [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %]
706
                        [% item.barcode | $raw %]
707
                    </li>[% END %]
708
                </ul>
709
            </p>
710
        [% END %]
711
        <hr/>
712
    </li>
713
[% END %]
714
</ol>",'email','default');
(-)a/opac/opac-sendbasket.pl (-108 / +45 lines)
Lines 54-181 if ( $email_add ) { Link Here
54
        session_id => scalar $query->cookie('CGISESSID'),
54
        session_id => scalar $query->cookie('CGISESSID'),
55
        token  => scalar $query->param('csrf_token'),
55
        token  => scalar $query->param('csrf_token'),
56
    });
56
    });
57
    my $patron = Koha::Patrons->find( $borrowernumber );
58
    my $borcat = $patron ? $patron->categorycode : q{};
59
    my $user_email = $patron->first_valid_email_address
60
    || C4::Context->preference('KohaAdminEmailAddress');
61
57
62
    my $email_replyto = $patron->firstname . " " . $patron->surname . " <$user_email>";
58
    my $patron = Koha::Patrons->find( $borrowernumber );
63
    my $comment    = $query->param('comment');
64
59
65
    # Since we are already logged in, no need to check credentials again
60
    my $comment = $query->param('comment');
66
    # when loading a second template.
67
    my $template2 = C4::Templates::gettemplate(
68
        'opac-sendbasket.tt', 'opac', $query,
69
    );
70
61
71
    my @bibs = split( /\//, $bib_list );
62
    my @bibs = split( /\//, $bib_list );
72
    my @results;
73
    my $iso2709;
63
    my $iso2709;
74
    my $marcflavour = C4::Context->preference('marcflavour');
75
    foreach my $biblionumber (@bibs) {
76
        $template2->param( biblionumber => $biblionumber );
77
78
        my $dat              = GetBiblioData($biblionumber);
79
        next unless $dat;
80
        my $biblio           = Koha::Biblios->find( $biblionumber );
81
        my $record           = GetMarcBiblio({
82
            biblionumber => $biblionumber,
83
            embed_items  => 1,
84
            opac         => 1,
85
            borcat       => $borcat });
86
        my $marcauthorsarray = $biblio->get_authors_from_MARC;
87
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
88
89
        my @items = GetItemsInfo( $biblionumber );
90
91
        my $hasauthors = 0;
92
        if($dat->{'author'} || @$marcauthorsarray) {
93
          $hasauthors = 1;
94
        }
95
	
96
97
        $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
98
        $dat->{MARCAUTHORS}    = $marcauthorsarray;
99
        $dat->{HASAUTHORS}     = $hasauthors;
100
        $dat->{'biblionumber'} = $biblionumber;
101
        $dat->{ITEM_RESULTS}   = \@items;
102
103
        $iso2709 .= $record->as_usmarc();
104
105
        push( @results, $dat );
106
    }
107
108
    my $resultsarray = \@results;
109
    
110
    $template2->param(
111
        BIBLIO_RESULTS => $resultsarray,
112
        comment        => $comment,
113
        firstname      => $patron->firstname,
114
        surname        => $patron->surname,
115
    );
116
117
    # Getting template result
118
    my $template_res = $template2->output();
119
    my $body;
120
121
    # Analysing information and getting mail properties
122
    my $subject;
123
    if ( $template_res =~ /\<SUBJECT\>(?<subject>.*)\<END_SUBJECT\>/s ) {
124
        $subject = $+{subject};
125
        $subject =~ s|\n?(.*)\n?|$1|;
126
    }
127
    else {
128
        $subject = "no subject";
129
    }
130
131
    my $email_header = "";
132
    if ( $template_res =~ /<HEADER>(.*)<END_HEADER>/s ) {
133
        $email_header = $1;
134
        $email_header =~ s|\n?(.*)\n?|$1|;
135
    }
136
137
    if ( $template_res =~ /<MESSAGE>(.*)<END_MESSAGE>/s ) {
138
        $body = $1;
139
        $body =~ s|\n?(.*)\n?|$1|;
140
    }
141
64
142
    my $THE_body = <<END_OF_BODY;
65
    foreach my $bib ( @bibs ) {
143
$email_header
66
        my $biblio = Koha::Biblios->find($bib);
144
$body
67
        $iso2709 .= $biblio->metadata->record->as_usmarc();
145
END_OF_BODY
68
    };
146
69
147
    if ( !defined $iso2709 ) {
70
    if ( !defined $iso2709 ) {
148
        carp "Error sending mail: empty basket";
71
        carp "Error sending mail: empty basket";
149
        $template->param( error => 1 );
72
        $template->param( error => 1 );
150
    }
73
151
    else {
74
    } else {
152
        try {
75
        my %loops = (
153
            # if you want to use the KohaAdmin address as from, that is the default no need to set it
76
            biblio => \@bibs,
154
            my $email = Koha::Email->create({
77
        );
155
                to       => $email_add,
78
156
                reply_to => $email_replyto,
79
        my %substitute = (
157
                subject  => $subject,
80
            comment => $comment,
158
            });
81
        );
159
            $email->header( 'X-Abuse-Report' => C4::Context->preference('KohaAdminEmailAddress') );
82
160
            $email->text_body( $THE_body );
83
        my $letter = C4::Letters::GetPreparedLetter(
161
            $email->attach(
84
            module => 'catalog',
162
                Encode::encode( "UTF-8", $iso2709 ),
85
            letter_code => 'CART',
163
                content_type => 'application/octet-stream',
86
            lang => $patron->lang,
164
                name         => 'basket.iso2709',
87
            tables => {
165
                disposition  => 'attachment',
88
                borrowers => $borrowernumber,
166
            );
89
            },
167
            my $library = $patron->library;
90
            message_transport_type => 'email',
168
            $email->transport( $library->smtp_server->transport );
91
            loops => \%loops,
169
            $email->send_or_die;
92
            substitute => \%substitute,
170
            $template->param( SENT => "1" );
93
        );
171
        }
94
172
        catch {
95
        my $attachment = {
173
            carp "Error sending mail: $_";
96
            filename => 'basket.iso2709',
174
            $template->param( error => 1 );
97
            type => 'application/octet-stream',
98
            content => Encode::encode("UTF-8", $iso2709),
175
        };
99
        };
100
101
        my $user_email = $patron->first_valid_email_address || C4::Context->preference('KohaAdminEmailAddress');
102
        C4::Letters::EnqueueLetter({
103
            letter => $letter,
104
            message_transport_type => 'email',
105
            borrowernumber => $patron->borrowernumber,
106
            to_address => $email_add,
107
            reply_address => $user_email,
108
            attachments => [$attachment],
109
        });
110
111
        $template->param( SENT => 1 );
176
    }
112
    }
177
113
178
    $template->param( email_add => $email_add );
114
    $template->param( email_add => $email_add );
115
179
    output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
116
    output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
180
}
117
}
181
else {
118
else {
(-)a/opac/opac-sendshelf.pl (-89 / +46 lines)
Lines 58-64 my $shelf = Koha::Virtualshelves->find( $shelfid ); Link Here
58
if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) {
58
if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) {
59
59
60
if ( $email ) {
60
if ( $email ) {
61
    my $comment    = $query->param('comment');
61
    my $comment = $query->param('comment');
62
62
63
    my ( $template2, $borrowernumber, $cookie ) = get_template_and_user(
63
    my ( $template2, $borrowernumber, $cookie ) = get_template_and_user(
64
        {
64
        {
Lines 70-178 if ( $email ) { Link Here
70
    );
70
    );
71
71
72
    my $patron = Koha::Patrons->find( $borrowernumber );
72
    my $patron = Koha::Patrons->find( $borrowernumber );
73
    my $borcat = $patron ? $patron->categorycode : q{};
74
75
    my $shelf = Koha::Virtualshelves->find( $shelfid );
73
    my $shelf = Koha::Virtualshelves->find( $shelfid );
76
    my $contents = $shelf->get_contents;
74
    my $contents = $shelf->get_contents;
77
    my $marcflavour         = C4::Context->preference('marcflavour');
75
    my @biblionumbers;
78
    my $iso2709;
79
    my @results;
80
76
77
    my $iso2709;
81
    while ( my $content = $contents->next ) {
78
    while ( my $content = $contents->next ) {
82
        my $biblionumber = $content->biblionumber;
79
        push @biblionumbers, $content->biblionumber;
83
        my $record           = GetMarcBiblio({
80
        my $biblio = Koha::Biblios->find($content->biblionumber);
84
            biblionumber => $biblionumber,
81
        $iso2709 .= $biblio->metadata->record->as_usmarc();
85
            embed_items  => 1,
82
    };
86
            opac         => 1,
87
            borcat       => $borcat });
88
        next unless $record;
89
        my $biblio           = Koha::Biblios->find( $biblionumber );
90
        my $fw               = GetFrameworkCode($biblionumber);
91
        my $dat              = GetBiblioData($biblionumber);
92
93
        my $marcauthorsarray = $biblio->get_authors_from_MARC;
94
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
95
96
        my @items = GetItemsInfo( $biblionumber );
97
98
        $dat->{ISBN}           = GetMarcISBN($record, $marcflavour);
99
        $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
100
        $dat->{MARCAUTHORS}    = $marcauthorsarray;
101
        $dat->{'biblionumber'} = $biblionumber;
102
        $dat->{ITEM_RESULTS}   = \@items;
103
        $dat->{HASAUTHORS}     = $dat->{'author'} || @$marcauthorsarray;
104
105
        $iso2709 .= $record->as_usmarc();
106
107
        push( @results, $dat );
108
    }
109
110
    $template2->param(
111
        BIBLIO_RESULTS => \@results,
112
        comment        => $comment,
113
        shelfname      => $shelf->shelfname,
114
        firstname      => $patron->firstname,
115
        surname        => $patron->surname,
116
    );
117
118
    # Getting template result
119
    my $template_res = $template2->output();
120
    my $body;
121
122
    my $subject;
123
    # Analysing information and getting mail properties
124
    if ( $template_res =~ /<SUBJECT>(?<subject>.*)<END_SUBJECT>/s ) {
125
        $subject = $+{subject};
126
        $subject =~ s|\n?(.*)\n?|$1|;
127
    }
128
    else {
129
        $subject = "no subject";
130
    }
131
83
132
    my $email_header = "";
84
    if ( !defined $iso2709 ) {
133
    if ( $template_res =~ /<HEADER>(.*)<END_HEADER>/s ) {
85
        carp "Error sending mail: empty list";
134
        $email_header = $1;
86
        $template->param( error => 1 );
135
        $email_header =~ s|\n?(.*)\n?|$1|;
136
    }
137
87
138
    if ( $template_res =~ /<MESSAGE>(.*)<END_MESSAGE>/s ) {
88
    } else {
139
        $body = $1;
89
        my %loops = (
140
        $body =~ s|\n?(.*)\n?|$1|;
90
            biblio => \@biblionumbers,
141
    }
91
        );
142
92
143
    my $THE_body = <<END_OF_BODY;
93
        my %substitute = (
144
$email_header
94
            comment => $comment,
145
$body
95
            listname => $shelf->shelfname,
146
END_OF_BODY
147
148
    try {
149
        my $email = Koha::Email->create(
150
            {
151
                to      => $email,
152
                subject => $subject,
153
            }
154
        );
96
        );
155
        $email->text_body( $THE_body );
97
156
        $email->attach(
98
        my $letter = C4::Letters::GetPreparedLetter(
157
            Encode::encode( "UTF-8", $iso2709 ),
99
            module => 'catalog',
158
            content_type => 'application/octet-stream',
100
            letter_code => 'LIST',
159
            name         => 'list.iso2709',
101
            lang => $patron->lang,
160
            disposition  => 'attachment',
102
            tables => {
103
                borrowers => $borrowernumber,
104
            },
105
            message_transport_type => 'email',
106
            loops => \%loops,
107
            substitute => \%substitute,
161
        );
108
        );
162
        my $library = Koha::Patrons->find( $borrowernumber )->library;
109
163
        $email->transport( $library->smtp_server->transport );
110
        my $attachment = {
164
        $email->send_or_die;
111
            filename => 'list.iso2709',
165
        $template->param( SENT => "1" );
112
            type => 'application/octet-stream',
113
            content => Encode::encode("UTF-8", $iso2709),
114
        };
115
116
        C4::Letters::EnqueueLetter({
117
            letter => $letter,
118
            message_transport_type => 'email',
119
            borrowernumber => $patron->borrowernumber,
120
            to_address => $email,
121
            reply_address => $patron->first_valid_email_address,
122
            attachments => [$attachment],
123
        });
124
125
        $template->param( SENT => 1 );
166
    }
126
    }
167
    catch {
168
        carp "Error sending mail: $_";
169
        $template->param( error => 1 );
170
    };
171
127
172
    $template->param(
128
    $template->param(
173
        shelfid => $shelfid,
129
        shelfid => $shelfid,
174
        email   => $email,
130
        email   => $email,
175
    );
131
    );
132
176
    output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
133
    output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
177
134
178
135
(-)a/virtualshelves/sendshelf.pl (-80 / +45 lines)
Lines 59-157 if ($to_address) { Link Here
59
        }
59
        }
60
    );
60
    );
61
61
62
    my $patron = Koha::Patrons->find( $borrowernumber );
62
    my $shelf = Koha::Virtualshelves->find( $shelfid );
63
    my $shelf = Koha::Virtualshelves->find( $shelfid );
63
    my $contents = $shelf->get_contents;
64
    my $contents = $shelf->get_contents;
64
    my $marcflavour = C4::Context->preference('marcflavour');
65
    my @biblionumbers;
65
    my $iso2709;
66
    my @results;
67
66
67
    my $iso2709;
68
    while ( my $content = $contents->next ) {
68
    while ( my $content = $contents->next ) {
69
        my $biblionumber     = $content->biblionumber;
69
        push @biblionumbers, $content->biblionumber;
70
        my $biblio           = Koha::Biblios->find( $biblionumber );
70
        my $biblio = Koha::Biblios->find($content->biblionumber);
71
        my $dat              = GetBiblioData($biblionumber);
71
        $iso2709 .= $biblio->metadata->record->as_usmarc();
72
        my $record           = GetMarcBiblio({
72
    };
73
            biblionumber => $biblionumber,
74
            embed_items  => 1 });
75
        my $marcauthorsarray = $biblio->get_authors_from_MARC;
76
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
77
78
        my @items = GetItemsInfo($biblionumber);
79
80
        $dat->{ISBN}           = GetMarcISBN($record, $marcflavour);
81
        $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
82
        $dat->{MARCAUTHORS}    = $marcauthorsarray;
83
        $dat->{'biblionumber'} = $biblionumber;
84
        $dat->{ITEM_RESULTS}   = \@items;
85
        $dat->{HASAUTHORS}     = $dat->{'author'} || @$marcauthorsarray;
86
87
        $iso2709 .= $record->as_usmarc();
88
89
        push( @results, $dat );
90
    }
91
92
    $template2->param(
93
        BIBLIO_RESULTS => \@results,
94
        comment        => $comment,
95
        shelfname      => $shelf->shelfname,
96
    );
97
98
    # Getting template result
99
    my $template_res = $template2->output();
100
    my $body;
101
102
    my $subject;
103
    # Analysing information and getting mail properties
104
    if ( $template_res =~ /<SUBJECT>(?<subject>.*)<END_SUBJECT>/s ) {
105
        $subject = $+{subject};
106
        $subject =~ s|\n?(.*)\n?|$1|;
107
    }
108
    else {
109
        $subject = "no subject";
110
    }
111
73
112
    my $email_header = "";
74
    if ( !defined $iso2709 ) {
113
    if ( $template_res =~ /<HEADER>(.*)<END_HEADER>/s ) {
75
        carp "Error sending mail: empty list";
114
        $email_header = $1;
76
        $template->param( error => 1 );
115
        $email_header =~ s|\n?(.*)\n?|$1|;
116
    }
117
77
118
    if ( $template_res =~ /<MESSAGE>(.*)<END_MESSAGE>/s ) {
78
    } else {
119
        $body = $1;
79
        my %loops = (
120
        $body =~ s|\n?(.*)\n?|$1|;
80
            biblio => \@biblionumbers,
121
    }
81
        );
122
82
123
    my $THE_body = <<END_OF_BODY;
83
        my %substitute = (
124
$email_header
84
            comment => $comment,
125
$body
85
            listname => $shelf->shelfname,
126
END_OF_BODY
127
128
    try {
129
        my $email = Koha::Email->create(
130
            {
131
                to      => $to_address,
132
                subject => $subject,
133
            }
134
        );
86
        );
135
        $email->text_body( $THE_body );
87
136
        $email->attach(
88
        my $letter = C4::Letters::GetPreparedLetter(
137
            Encode::encode("UTF-8", $iso2709),
89
            module => 'catalog',
138
            content_type => 'application/octet-stream',
90
            letter_code => 'LIST',
139
            name         => 'shelf.iso2709',
91
            lang => $patron->lang,
140
            disposition  => 'attachment',
92
            tables => {
93
                borrowers => $borrowernumber,
94
            },
95
            message_transport_type => 'email',
96
            loops => \%loops,
97
            substitute => \%substitute,
141
        );
98
        );
142
99
143
        my $library = Koha::Patrons->find( $borrowernumber )->library;
100
        my $attachment = {
144
        $email->send_or_die({ transport => $library->smtp_server->transport });
101
            filename => 'shelf.iso2709',
145
        $template->param( SENT => "1" );
102
            type => 'application/octet-stream',
103
            content => Encode::encode("UTF-8", $iso2709),
104
        };
105
106
        C4::Letters::EnqueueLetter({
107
            letter => $letter,
108
            message_transport_type => 'email',
109
            borrowernumber => $patron->borrowernumber,
110
            to_address => $to_address,
111
            reply_address => $patron->first_valid_email_address,
112
            attachments => [$attachment],
113
        });
114
115
        $template->param( SENT => 1 );
146
    }
116
    }
147
    catch {
148
        carp "Error sending mail: $_";
149
        $template->param( error => 1 );
150
    };
151
117
152
    $template->param( email => $to_address );
118
    $template->param( email => $to_address );
153
    output_html_with_http_headers $query, $cookie, $template->output;
154
119
120
    output_html_with_http_headers $query, $cookie, $template->output;
155
}
121
}
156
else {
122
else {
157
    $template->param(
123
    $template->param(
158
- 

Return to bug 3150