From c5c72f517187b079c373900328d524e79505cde5 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 22 Sep 2020 09:30:32 +1200 Subject: [PATCH] Bug 3150: Move emails for sending cart and list contents to notices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch creates notices using Template Toolkit syntax for sending emails containing cart and list contents. To test: 1. Apply Bug 27266 2. Run update database and restart services 3. In the staff client, add multiple items to your cart and to a list 4. Go to your cart and click Send to email the contents 5. Add an email and a comment and click Send 6. Confirm the information shown in the success message is correct 7. In your terminal, log into the database. View the message queue ( i.e. select * from message_queue; ). Confirm that your email has been queued and the content is all correct. Confirm the cart contents has been included as an attachment. 8. Go to your list and click Send list to email the contents 9. Repeat steps 5-7 10. Log into the OPAC 11. Add multiple items to your cart and to a list 12. Repeat steps 4-9 13. By the end, you should have four emails in your message queue. All of the data about the items should be correct, they should all have attachments, and be addressed to the correct email address. Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ) Signed-off-by: David Nind Signed-off-by: Martin Renvoize --- basket/sendbasket.pl | 135 ++++------ .../bug_3150_-_add_LIST_and_CART_notices.perl | 224 +++++++++++++++++ .../mysql/en/mandatory/sample_notices.yml | 238 ++++++++++++++++++ .../fr-CA/obligatoire/sample_notices.sql | 219 ++++++++++++++++ .../fr-FR/1-Obligatoire/sample_notices.sql | 219 ++++++++++++++++ .../data/mysql/it-IT/necessari/notices.sql | 219 ++++++++++++++++ .../nb-NO/1-Obligatorisk/sample_notices.sql | 219 ++++++++++++++++ .../mysql/pl-PL/mandatory/sample_notices.sql | 219 ++++++++++++++++ .../mysql/ru-RU/mandatory/sample_notices.sql | 219 ++++++++++++++++ .../mysql/uk-UA/mandatory/sample_notices.sql | 219 ++++++++++++++++ opac/opac-sendbasket.pl | 153 ++++------- opac/opac-sendshelf.pl | 135 ++++------ virtualshelves/sendshelf.pl | 124 ++++----- 13 files changed, 2175 insertions(+), 367 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_3150_-_add_LIST_and_CART_notices.perl diff --git a/basket/sendbasket.pl b/basket/sendbasket.pl index b0497ae51a..557dc462ef 100755 --- a/basket/sendbasket.pl +++ b/basket/sendbasket.pl @@ -52,112 +52,65 @@ if ( $email_add ) { session_id => scalar $query->cookie('CGISESSID'), token => scalar $query->param('csrf_token'), }); - my $comment = $query->param('comment'); - # Since we are already logged in, no need to check credentials again - # when loading a second template. - my $template2 = C4::Templates::gettemplate( - 'basket/sendbasket.tt', 'intranet', $query, - ); + my $patron = Koha::Patrons->find( $borrowernumber ); + + my $comment = $query->param('comment'); my @bibs = split( /\//, $bib_list ); - my @results; my $iso2709; - my $marcflavour = C4::Context->preference('marcflavour'); - foreach my $biblionumber (@bibs) { - $template2->param( biblionumber => $biblionumber ); - - my $dat = GetBiblioData($biblionumber); - next unless $dat; - my $biblio = Koha::Biblios->find( $biblionumber ); - my $record = GetMarcBiblio({ - biblionumber => $biblionumber, - embed_items => 1 }); - my $marcauthorsarray = $biblio->get_authors_from_MARC; - my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); - - my @items = GetItemsInfo( $biblionumber ); - - my $hasauthors = 0; - if($dat->{'author'} || @$marcauthorsarray) { - $hasauthors = 1; - } - - - $dat->{MARCSUBJCTS} = $marcsubjctsarray; - $dat->{MARCAUTHORS} = $marcauthorsarray; - $dat->{HASAUTHORS} = $hasauthors; - $dat->{'biblionumber'} = $biblionumber; - $dat->{ITEM_RESULTS} = \@items; - - $iso2709 .= $record->as_usmarc(); - - push( @results, $dat ); - } - - my $resultsarray = \@results; - $template2->param( - BIBLIO_RESULTS => $resultsarray, - comment => $comment - ); - - # Getting template result - my $template_res = $template2->output(); - my $body; - - my $subject; - # Analysing information and getting mail properties - if ( $template_res =~ /(?.*)/s ) { - $subject = $+{subject}; - $subject =~ s|\n?(.*)\n?|$1|; - } - else { - $subject = "no subject"; - } - my $email_header = ""; - if ( $template_res =~ /
(.*)/s ) { - $email_header = $1; - $email_header =~ s|\n?(.*)\n?|$1|; - } - - if ( $template_res =~ /(.*)/s ) { - $body = $1; - $body =~ s|\n?(.*)\n?|$1|; - } + foreach my $bib ( @bibs ) { + my $biblio = Koha::Biblios->find($bib); + $iso2709 .= $biblio->metadata->record->as_usmarc(); + }; - my $THE_body = <param( error => 1 ); - try { + } else { + my %loops = ( + biblio => \@bibs, + ); - my $email = Koha::Email->create( - { - to => $email_add, - subject => $subject, - } + my %substitute = ( + comment => $comment, ); - $email->text_body( $THE_body ); - $email->attach( - Encode::encode( "UTF-8", $iso2709 ), - content_type => 'application/octet-stream', - name => 'basket.iso2709', - disposition => 'attachment', + my $letter = C4::Letters::GetPreparedLetter( + module => 'catalog', + letter_code => 'CART', + lang => $patron->lang, + tables => { + borrowers => $borrowernumber, + }, + message_transport_type => 'email', + loops => \%loops, + substitute => \%substitute, ); - my $library = Koha::Patrons->find( $borrowernumber )->library; - $email->send_or_die({ transport => $library->smtp_server->transport }); - $template->param( SENT => "1" ); + my $attachment = { + filename => 'basket.iso2709', + type => 'application/octet-stream', + content => Encode::encode("UTF-8", $iso2709), + }; + + my $user_email = $patron->first_valid_email_address || C4::Context->preference('KohaAdminEmailAddress'); + C4::Letters::EnqueueLetter({ + letter => $letter, + message_transport_type => 'email', + borrowernumber => $patron->borrowernumber, + to_address => $email_add, + reply_address => $user_email, + attachments => [$attachment], + }); + + $template->param( SENT => 1 ); } - catch { - carp "Error sending mail: $_"; - $template->param( error => 1 ); - }; $template->param( email_add => $email_add ); + output_html_with_http_headers $query, $cookie, $template->output; } else { diff --git a/installer/data/mysql/atomicupdate/bug_3150_-_add_LIST_and_CART_notices.perl b/installer/data/mysql/atomicupdate/bug_3150_-_add_LIST_and_CART_notices.perl new file mode 100644 index 0000000000..610a58ac12 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_3150_-_add_LIST_and_CART_notices.perl @@ -0,0 +1,224 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ 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 -%] +

Hi,

+

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a list from our online catalog called: [% listname | $raw %].

+

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.

+
+

[% comment | $raw %]

+
+
    +[% FOREACH biblio IN biblios %] +
  1. + + [% biblio.title | $raw %] + [% IF ( biblio.subtitle ) %] + [% FOREACH subtitle IN biblio.subtitle.split(' | ') %] + [% subtitle | $raw %] + [% END %] + [% END %] + [% biblio.part_number | $raw %] [% biblio.part_name | $raw %] + +

    + [% IF ( biblio.author || biblio.get_authors_from_MARC ) %] + Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %] + [% IF ( biblio.get_authors_from_MARC ) %] + [% IF ( biblio.author ) %]; [% END %] + [% FOREACH author IN biblio.get_authors_from_MARC %] + [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %] + [% subfield.separator | $raw %][% subfield.value | $raw %] + [% END %] + [% UNLESS ( loop.last ) %];[% END %] + [% END %] + [% END %] +
    + [% END %] + [% SET biblioitem = biblio.biblioitem %] + [% IF ( biblioitem.isbn ) %] + + ISBN: [% FOREACH isbn IN biblioitem.isbn %] + [% isbn | $raw %] + [% UNLESS ( loop.last ) %]; [% END %] + [% END %] +
    + [% END %] + [% IF ( biblioitem.publishercode ) %] + + Published by: [% biblioitem.publishercode | $raw %] + [% IF ( biblioitem.publicationyear ) %] + in [% biblioitem.publicationyear | $raw %] + [% END %] + [% IF ( biblioitem.pages ) %] + , [% biblioitem.pages | $raw %] + [% END %] +
    + [% END %] + [% IF ( biblio.seriestitle ) %] + + Collection: [% biblio.seriestitle | $raw %] +
    + [% END %] + [% IF ( biblio.copyrightdate ) %] + + Copyright year: [% biblio.copyrightdate | $raw %] +
    + [% END %] + [% IF ( biblio.notes ) %] + + Notes: [% biblio.notes | $raw %] +
    + [% END %] + [% IF ( biblio.unititle ) %] + + Unified title: [% biblio.unititle | $raw %] +
    + [% END %] + [% IF ( biblio.serial ) %] + + Serial: [% biblio.serial | $raw %] +
    + [% END %] + [% IF ( biblioitem.lccn ) %] + + LCCN: [% biblioitem.lccn | $raw %] +
    + [% END %] + [% IF ( biblioitem.url ) %] + + URL: [% biblioitem.url | html %] + + [% END %] +

    + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %] + [% IF ( OPACBaseURL ) %] +

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    + [% END %] + [% IF ( biblio.items.count > 0 ) %] +

    Items: +

      + [% FOREACH item IN biblio.items %]
    • + [% item.holding_branch.branchname | $raw %] + [% item.location | $raw %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %] + [% item.barcode | $raw %] +
    • [% END %] +
    +

    + [% END %] +
    +
  2. +[% END %] +
", 'email','default' ), + ('catalog','CART','','Send cart',1,'Your cart',"[%- USE raw -%] +

Hi,

+

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a cart from our online catalog.

+

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.

+
+

[% comment | $raw %]

+
+
    +[% FOREACH biblio IN biblios %] +
  1. + + [% biblio.title | $raw %] + [% IF ( biblio.subtitle ) %] + [% FOREACH subtitle IN biblio.subtitle.split(' | ') %] + [% subtitle | $raw %] + [% END %] + [% END %] + [% biblio.part_number | $raw %] [% biblio.part_name | $raw %] + +

    + [% IF ( biblio.author || biblio.get_authors_from_MARC ) %] + Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %] + [% IF ( biblio.get_authors_from_MARC ) %] + [% IF ( biblio.author ) %]; [% END %] + [% FOREACH author IN biblio.get_authors_from_MARC %] + [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %] + [% subfield.separator | $raw %][% subfield.value | $raw %] + [% END %] + [% UNLESS ( loop.last ) %];[% END %] + [% END %] + [% END %] +
    + [% END %] + [% SET biblioitem = biblio.biblioitem %] + [% IF ( biblioitem.isbn ) %] + + ISBN: [% FOREACH isbn IN biblioitem.isbn %] + [% isbn | $raw %] + [% UNLESS ( loop.last ) %]; [% END %] + [% END %] +
    + [% END %] + [% IF ( biblioitem.publishercode ) %] + + Published by: [% biblioitem.publishercode | $raw %] + [% IF ( biblioitem.publicationyear ) %] + in [% biblioitem.publicationyear | $raw %] + [% END %] + [% IF ( biblioitem.pages ) %] + , [% biblioitem.pages | $raw %] + [% END %] +
    + [% END %] + [% IF ( biblio.seriestitle ) %] + + Collection: [% biblio.seriestitle | $raw %] +
    + [% END %] + [% IF ( biblio.copyrightdate ) %] + + Copyright year: [% biblio.copyrightdate | $raw %] +
    + [% END %] + [% IF ( biblio.notes ) %] + + Notes: [% biblio.notes | $raw %] +
    + [% END %] + [% IF ( biblio.unititle ) %] + + Unified title: [% biblio.unititle | $raw %] +
    + [% END %] + [% IF ( biblio.serial ) %] + + Serial: [% biblio.serial | $raw %] +
    + [% END %] + [% IF ( biblioitem.lccn ) %] + + LCCN: [% biblioitem.lccn | $raw %] +
    + [% END %] + [% IF ( biblioitem.url ) %] + + URL: [% biblioitem.url | html %] + + [% END %] +

    + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %] + [% IF ( OPACBaseURL ) %] +

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    + [% END %] + [% IF ( biblio.items.count > 0 ) %] +

    Items: +

      + [% FOREACH item IN biblio.items %]
    • + [% item.holding_branch.branchname | $raw %] + [% item.location | $raw %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %] + [% item.barcode | $raw %] +
    • [% END %] +
    +

    + [% END %] +
    +
  2. +[% END %] +
",'email','default') }); + + NewVersion( $DBversion, 3150, 'Add LIST and CART notices' ); +} diff --git a/installer/data/mysql/en/mandatory/sample_notices.yml b/installer/data/mysql/en/mandatory/sample_notices.yml index e58c0075af..b48e091566 100644 --- a/installer/data/mysql/en/mandatory/sample_notices.yml +++ b/installer/data/mysql/en/mandatory/sample_notices.yml @@ -1478,3 +1478,241 @@ tables: - "Barcode: [% item.barcode %]
" - "

" - "[% END %]" + + - module: catalog + code: LIST + branchcode: "" + name: "Send list" + is_html: 1 + title: "Your list: [% listname | html %]" + message_transport_type: email + lang: default + content: + - "[%- USE raw -%]" + - "

Hi,

" + - "

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a list from our online catalog called: [% listname | $raw %].

" + - "

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.

" + - "
" + - "

[% comment | $raw %]

" + - "
" + - "
    " + - "[% FOREACH biblio IN biblios %]" + - "
  1. " + - "" + - "[% biblio.title | $raw %]" + - "[% IF ( biblio.subtitle ) %]" + - "[% FOREACH subtitle IN biblio.subtitle.split(' | ') %]" + - "[% subtitle | $raw %]" + - "[% END %]" + - "[% END %]" + - "[% biblio.part_number | $raw %] [% biblio.part_name | $raw %]" + - "" + - "

    " + - "[% IF ( biblio.author || biblio.get_authors_from_MARC ) %]" + - "Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %]" + - "[% IF ( biblio.get_authors_from_MARC ) %]" + - "[% IF ( biblio.author ) %]; [% END %]" + - "[% FOREACH author IN biblio.get_authors_from_MARC %]" + - "[% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %]" + - "[% subfield.separator | $raw %][% subfield.value | $raw %]" + - "[% END %]" + - "[% UNLESS ( loop.last ) %];[% END %]" + - "[% END %]" + - "[% END %]" + - "
    " + - "[% END %]" + - "[% SET biblioitem = biblio.biblioitem %]" + - "[% IF ( biblioitem.isbn ) %]" + - "" + - "ISBN: [% FOREACH isbn IN biblioitem.isbn %]" + - "[% isbn | $raw %]" + - "[% UNLESS ( loop.last ) %]; [% END %]" + - "[% END %]" + - "
    " + - "[% END %]" + - "[% IF ( biblioitem.publishercode ) %]" + - "" + - "Published by: [% biblioitem.publishercode | $raw %]" + - "[% IF ( biblioitem.publicationyear ) %]" + - "in [% biblioitem.publicationyear | $raw %]" + - "[% END %]" + - "[% IF ( biblioitem.pages ) %]" + - ", [% biblioitem.pages | $raw %]" + - "[% END %]" + - "
    " + - "[% END %]" + - "[% IF ( biblio.seriestitle ) %]" + - "" + - "Collection: [% biblio.seriestitle | $raw %]" + - "
    " + - "[% END %]" + - "[% IF ( biblio.copyrightdate ) %]" + - "" + - "Copyright year: [% biblio.copyrightdate | $raw %]" + - "
    " + - "[% END %]" + - "[% IF ( biblio.notes ) %]" + - "" + - "Notes: [% biblio.notes | $raw %]" + - "
    " + - "[% END %]" + - "[% IF ( biblio.unititle ) %]" + - "" + - "Unified title: [% biblio.unititle | $raw %]" + - "
    " + - "[% END %]" + - "[% IF ( biblio.serial ) %]" + - "" + - "Serial: [% biblio.serial | $raw %]" + - "
    " + - "[% END %]" + - "[% IF ( biblioitem.lccn ) %]" + - "" + - "LCCN: [% biblioitem.lccn | $raw %]" + - "
    " + - "[% END %]" + - "[% IF ( biblioitem.url ) %]" + - "" + - "URL: [% biblioitem.url | html %]" + - "" + - "[% END %]" + - "

    " + - "[% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %]" + - "[% IF ( OPACBaseURL ) %]" + - "

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    " + - "[% END %]" + - "[% IF ( biblio.items.count > 0 ) %]" + - "

    Items:" + - "

      " + - "[% FOREACH item IN biblio.items %]
    • " + - "[% item.holding_branch.branchname | $raw %]" + - "[% item.location | $raw %]" + - "[% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %]" + - "[% item.barcode | $raw %]" + - "
    • [% END %]" + - "
    " + - "

    " + - "[% END %]" + - "
    " + - "
  2. " + - "[% END %]" + - "
" + + - module: catalog + code: CART + branchcode: "" + name: "Send cart" + is_html: 1 + title: "Your cart" + message_transport_type: email + lang: default + content: + - "[%- USE raw -%]" + - "

Hi,

" + - "

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a cart from our online catalog.

" + - "

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.

" + - "
" + - "

[% comment | $raw %]

" + - "
" + - "
    " + - "[% FOREACH biblio IN biblios %]" + - "
  1. " + - "" + - "[% biblio.title | $raw %]" + - "[% IF ( biblio.subtitle ) %]" + - "[% FOREACH subtitle IN biblio.subtitle.split(' | ') %]" + - "[% subtitle | $raw %]" + - "[% END %]" + - "[% END %]" + - "[% biblio.part_number | $raw %] [% biblio.part_name | $raw %]" + - "" + - "

    " + - "[% IF ( biblio.author || biblio.get_authors_from_MARC ) %]" + - "Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %]" + - "[% IF ( biblio.get_authors_from_MARC ) %]" + - "[% IF ( biblio.author ) %]; [% END %]" + - "[% FOREACH author IN biblio.get_authors_from_MARC %]" + - "[% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %]" + - "[% subfield.separator | $raw %][% subfield.value | $raw %]" + - "[% END %]" + - "[% UNLESS ( loop.last ) %];[% END %]" + - "[% END %]" + - "[% END %]" + - "
    " + - "[% END %]" + - "[% SET biblioitem = biblio.biblioitem %]" + - "[% IF ( biblioitem.isbn ) %]" + - "" + - "ISBN: [% FOREACH isbn IN biblioitem.isbn %]" + - "[% isbn | $raw %]" + - "[% UNLESS ( loop.last ) %]; [% END %]" + - "[% END %]" + - "
    " + - "[% END %]" + - "[% IF ( biblioitem.publishercode ) %]" + - "" + - "Published by: [% biblioitem.publishercode | $raw %]" + - "[% IF ( biblioitem.publicationyear ) %]" + - "in [% biblioitem.publicationyear | $raw %]" + - "[% END %]" + - "[% IF ( biblioitem.pages ) %]" + - ", [% biblioitem.pages | $raw %]" + - "[% END %]" + - "
    " + - "[% END %]" + - "[% IF ( biblio.seriestitle ) %]" + - "" + - "Collection: [% biblio.seriestitle | $raw %]" + - "
    " + - "[% END %]" + - "[% IF ( biblio.copyrightdate ) %]" + - "" + - "Copyright year: [% biblio.copyrightdate | $raw %]" + - "
    " + - "[% END %]" + - "[% IF ( biblio.notes ) %]" + - "" + - "Notes: [% biblio.notes | $raw %]" + - "
    " + - "[% END %]" + - "[% IF ( biblio.unititle ) %]" + - "" + - "Unified title: [% biblio.unititle | $raw %]" + - "
    " + - "[% END %]" + - "[% IF ( biblio.serial ) %]" + - "" + - "Serial: [% biblio.serial | $raw %]" + - "
    " + - "[% END %]" + - "[% IF ( biblioitem.lccn ) %]" + - "" + - "LCCN: [% biblioitem.lccn | $raw %]" + - "
    " + - "[% END %]" + - "[% IF ( biblioitem.url ) %]" + - "" + - "URL: [% biblioitem.url | html %]" + - "" + - "[% END %]" + - "

    " + - "[% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %]" + - "[% IF ( OPACBaseURL ) %]" + - "

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    " + - "[% END %]" + - "[% IF ( biblio.items.count > 0 ) %]" + - "

    Items:" + - "

      " + - "[% FOREACH item IN biblio.items %]
    • " + - "[% item.holding_branch.branchname | $raw %]" + - "[% item.location | $raw %]" + - "[% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %]" + - "[% item.barcode | $raw %]" + - "
    • [% END %]" + - "
    " + - "

    " + - "[% END %]" + - "
    " + - "
  2. " + - "[% END %]" + - "
" diff --git a/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql b/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql index 2317e98575..bb13f25d9a 100644 --- a/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql +++ b/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql @@ -316,3 +316,222 @@ INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, conten INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_CANCEL', '', 'ILL request cancelled', 0, "Interlibrary loan request cancelled", "The patron for interlibrary loans request [% illrequest.illrequest_id %], with the following details, has requested cancellation of this ILL request:\n\n[% ill_full_metadata %]", 'sms', 'default'); INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_MODIFIED', '', 'ILL request modified', 0, "Interlibrary loan request modified", "The patron for interlibrary loans request [% illrequest.illrequest_id %], with the following details, has modified this ILL request:\n\n[% ill_full_metadata %]", 'sms', 'default'); INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_PARTNER_REQ', '', 'ILL request to partners', 0, "Interlibrary loan request to partners", "Dear Sir/Madam,\n\nWe would like to request an interlibrary loan for a title matching the following description:\n\n[% ill_full_metadata %]\n\nPlease let us know if you are able to supply this to us.\n\nKind Regards\n\n[% branch.branchname %]\n[% branch.branchaddress1 %]\n[% branch.branchaddress2 %]\n[% branch.branchaddress3 %]\n[% branch.branchcity %]\n[% branch.branchstate %]\n[% branch.branchzip %]\n[% branch.branchphone %]\n[% branch.branchillemail %]\n[% branch.branchemail %]", 'sms', 'default'); + +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 -%] +

Hi,

+

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a list from our online catalog called: [% listname | $raw %].

+

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.

+
+

[% comment | $raw %]

+
+
    +[% FOREACH biblio IN biblios %] +
  1. + + [% biblio.title | $raw %] + [% IF ( biblio.subtitle ) %] + [% FOREACH subtitle IN biblio.subtitle.split(' | ') %] + [% subtitle | $raw %] + [% END %] + [% END %] + [% biblio.part_number | $raw %] [% biblio.part_name | $raw %] + +

    + [% IF ( biblio.author || biblio.get_authors_from_MARC ) %] + Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %] + [% IF ( biblio.get_authors_from_MARC ) %] + [% IF ( biblio.author ) %]; [% END %] + [% FOREACH author IN biblio.get_authors_from_MARC %] + [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %] + [% subfield.separator | $raw %][% subfield.value | $raw %] + [% END %] + [% UNLESS ( loop.last ) %];[% END %] + [% END %] + [% END %] +
    + [% END %] + [% SET biblioitem = biblio.biblioitem %] + [% IF ( biblioitem.isbn ) %] + + ISBN: [% FOREACH isbn IN biblioitem.isbn %] + [% isbn | $raw %] + [% UNLESS ( loop.last ) %]; [% END %] + [% END %] +
    + [% END %] + [% IF ( biblioitem.publishercode ) %] + + Published by: [% biblioitem.publishercode | $raw %] + [% IF ( biblioitem.publicationyear ) %] + in [% biblioitem.publicationyear | $raw %] + [% END %] + [% IF ( biblioitem.pages ) %] + , [% biblioitem.pages | $raw %] + [% END %] +
    + [% END %] + [% IF ( biblio.seriestitle ) %] + + Collection: [% biblio.seriestitle | $raw %] +
    + [% END %] + [% IF ( biblio.copyrightdate ) %] + + Copyright year: [% biblio.copyrightdate | $raw %] +
    + [% END %] + [% IF ( biblio.notes ) %] + + Notes: [% biblio.notes | $raw %] +
    + [% END %] + [% IF ( biblio.unititle ) %] + + Unified title: [% biblio.unititle | $raw %] +
    + [% END %] + [% IF ( biblio.serial ) %] + + Serial: [% biblio.serial | $raw %] +
    + [% END %] + [% IF ( biblioitem.lccn ) %] + + LCCN: [% biblioitem.lccn | $raw %] +
    + [% END %] + [% IF ( biblioitem.url ) %] + + URL: [% biblioitem.url | html %] + + [% END %] +

    + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %] + [% IF ( OPACBaseURL ) %] +

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    + [% END %] + [% IF ( biblio.items.count > 0 ) %] +

    Items: +

      + [% FOREACH item IN biblio.items %]
    • + [% item.holding_branch.branchname | $raw %] + [% item.location | $raw %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %] + [% item.barcode | $raw %] +
    • [% END %] +
    +

    + [% END %] +
    +
  2. +[% END %] +
", 'email','default' ), +('catalog','CART','','Send cart',1,'Your cart',"[%- USE raw -%] +

Hi,

+

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a cart from our online catalog.

+

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.

+
+

[% comment | $raw %]

+
+
    +[% FOREACH biblio IN biblios %] +
  1. + + [% biblio.title | $raw %] + [% IF ( biblio.subtitle ) %] + [% FOREACH subtitle IN biblio.subtitle.split(' | ') %] + [% subtitle | $raw %] + [% END %] + [% END %] + [% biblio.part_number | $raw %] [% biblio.part_name | $raw %] + +

    + [% IF ( biblio.author || biblio.get_authors_from_MARC ) %] + Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %] + [% IF ( biblio.get_authors_from_MARC ) %] + [% IF ( biblio.author ) %]; [% END %] + [% FOREACH author IN biblio.get_authors_from_MARC %] + [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %] + [% subfield.separator | $raw %][% subfield.value | $raw %] + [% END %] + [% UNLESS ( loop.last ) %];[% END %] + [% END %] + [% END %] +
    + [% END %] + [% SET biblioitem = biblio.biblioitem %] + [% IF ( biblioitem.isbn ) %] + + ISBN: [% FOREACH isbn IN biblioitem.isbn %] + [% isbn | $raw %] + [% UNLESS ( loop.last ) %]; [% END %] + [% END %] +
    + [% END %] + [% IF ( biblioitem.publishercode ) %] + + Published by: [% biblioitem.publishercode | $raw %] + [% IF ( biblioitem.publicationyear ) %] + in [% biblioitem.publicationyear | $raw %] + [% END %] + [% IF ( biblioitem.pages ) %] + , [% biblioitem.pages | $raw %] + [% END %] +
    + [% END %] + [% IF ( biblio.seriestitle ) %] + + Collection: [% biblio.seriestitle | $raw %] +
    + [% END %] + [% IF ( biblio.copyrightdate ) %] + + Copyright year: [% biblio.copyrightdate | $raw %] +
    + [% END %] + [% IF ( biblio.notes ) %] + + Notes: [% biblio.notes | $raw %] +
    + [% END %] + [% IF ( biblio.unititle ) %] + + Unified title: [% biblio.unititle | $raw %] +
    + [% END %] + [% IF ( biblio.serial ) %] + + Serial: [% biblio.serial | $raw %] +
    + [% END %] + [% IF ( biblioitem.lccn ) %] + + LCCN: [% biblioitem.lccn | $raw %] +
    + [% END %] + [% IF ( biblioitem.url ) %] + + URL: [% biblioitem.url | html %] + + [% END %] +

    + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %] + [% IF ( OPACBaseURL ) %] +

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    + [% END %] + [% IF ( biblio.items.count > 0 ) %] +

    Items: +

      + [% FOREACH item IN biblio.items %]
    • + [% item.holding_branch.branchname | $raw %] + [% item.location | $raw %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %] + [% item.barcode | $raw %] +
    • [% END %] +
    +

    + [% END %] +
    +
  2. +[% END %] +
",'email','default'); diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql index 7bc86d3ec2..6ac7eb7cb6 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql @@ -429,3 +429,222 @@ INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, conten INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_CANCEL', '', 'ILL request cancelled', 0, "Interlibrary loan request cancelled", "The patron for interlibrary loans request [% illrequest.illrequest_id %], with the following details, has requested cancellation of this ILL request:\n\n[% ill_full_metadata %]", 'sms', 'default'); INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_MODIFIED', '', 'ILL request modified', 0, "Interlibrary loan request modified", "The patron for interlibrary loans request [% illrequest.illrequest_id %], with the following details, has modified this ILL request:\n\n[% ill_full_metadata %]", 'sms', 'default'); INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_PARTNER_REQ', '', 'ILL request to partners', 0, "Interlibrary loan request to partners", "Dear Sir/Madam,\n\nWe would like to request an interlibrary loan for a title matching the following description:\n\n[% ill_full_metadata %]\n\nPlease let us know if you are able to supply this to us.\n\nKind Regards\n\n[% branch.branchname %]\n[% branch.branchaddress1 %]\n[% branch.branchaddress2 %]\n[% branch.branchaddress3 %]\n[% branch.branchcity %]\n[% branch.branchstate %]\n[% branch.branchzip %]\n[% branch.branchphone %]\n[% branch.branchillemail %]\n[% branch.branchemail %]", 'sms', 'default'); + +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 -%] +

Hi,

+

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a list from our online catalog called: [% listname | $raw %].

+

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.

+
+

[% comment | $raw %]

+
+
    +[% FOREACH biblio IN biblios %] +
  1. + + [% biblio.title | $raw %] + [% IF ( biblio.subtitle ) %] + [% FOREACH subtitle IN biblio.subtitle.split(' | ') %] + [% subtitle | $raw %] + [% END %] + [% END %] + [% biblio.part_number | $raw %] [% biblio.part_name | $raw %] + +

    + [% IF ( biblio.author || biblio.get_authors_from_MARC ) %] + Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %] + [% IF ( biblio.get_authors_from_MARC ) %] + [% IF ( biblio.author ) %]; [% END %] + [% FOREACH author IN biblio.get_authors_from_MARC %] + [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %] + [% subfield.separator | $raw %][% subfield.value | $raw %] + [% END %] + [% UNLESS ( loop.last ) %];[% END %] + [% END %] + [% END %] +
    + [% END %] + [% SET biblioitem = biblio.biblioitem %] + [% IF ( biblioitem.isbn ) %] + + ISBN: [% FOREACH isbn IN biblioitem.isbn %] + [% isbn | $raw %] + [% UNLESS ( loop.last ) %]; [% END %] + [% END %] +
    + [% END %] + [% IF ( biblioitem.publishercode ) %] + + Published by: [% biblioitem.publishercode | $raw %] + [% IF ( biblioitem.publicationyear ) %] + in [% biblioitem.publicationyear | $raw %] + [% END %] + [% IF ( biblioitem.pages ) %] + , [% biblioitem.pages | $raw %] + [% END %] +
    + [% END %] + [% IF ( biblio.seriestitle ) %] + + Collection: [% biblio.seriestitle | $raw %] +
    + [% END %] + [% IF ( biblio.copyrightdate ) %] + + Copyright year: [% biblio.copyrightdate | $raw %] +
    + [% END %] + [% IF ( biblio.notes ) %] + + Notes: [% biblio.notes | $raw %] +
    + [% END %] + [% IF ( biblio.unititle ) %] + + Unified title: [% biblio.unititle | $raw %] +
    + [% END %] + [% IF ( biblio.serial ) %] + + Serial: [% biblio.serial | $raw %] +
    + [% END %] + [% IF ( biblioitem.lccn ) %] + + LCCN: [% biblioitem.lccn | $raw %] +
    + [% END %] + [% IF ( biblioitem.url ) %] + + URL: [% biblioitem.url | html %] + + [% END %] +

    + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %] + [% IF ( OPACBaseURL ) %] +

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    + [% END %] + [% IF ( biblio.items.count > 0 ) %] +

    Items: +

      + [% FOREACH item IN biblio.items %]
    • + [% item.holding_branch.branchname | $raw %] + [% item.location | $raw %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %] + [% item.barcode | $raw %] +
    • [% END %] +
    +

    + [% END %] +
    +
  2. +[% END %] +
", 'email','default' ), +('catalog','CART','','Send cart',1,'Your cart',"[%- USE raw -%] +

Hi,

+

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a cart from our online catalog.

+

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.

+
+

[% comment | $raw %]

+
+
    +[% FOREACH biblio IN biblios %] +
  1. + + [% biblio.title | $raw %] + [% IF ( biblio.subtitle ) %] + [% FOREACH subtitle IN biblio.subtitle.split(' | ') %] + [% subtitle | $raw %] + [% END %] + [% END %] + [% biblio.part_number | $raw %] [% biblio.part_name | $raw %] + +

    + [% IF ( biblio.author || biblio.get_authors_from_MARC ) %] + Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %] + [% IF ( biblio.get_authors_from_MARC ) %] + [% IF ( biblio.author ) %]; [% END %] + [% FOREACH author IN biblio.get_authors_from_MARC %] + [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %] + [% subfield.separator | $raw %][% subfield.value | $raw %] + [% END %] + [% UNLESS ( loop.last ) %];[% END %] + [% END %] + [% END %] +
    + [% END %] + [% SET biblioitem = biblio.biblioitem %] + [% IF ( biblioitem.isbn ) %] + + ISBN: [% FOREACH isbn IN biblioitem.isbn %] + [% isbn | $raw %] + [% UNLESS ( loop.last ) %]; [% END %] + [% END %] +
    + [% END %] + [% IF ( biblioitem.publishercode ) %] + + Published by: [% biblioitem.publishercode | $raw %] + [% IF ( biblioitem.publicationyear ) %] + in [% biblioitem.publicationyear | $raw %] + [% END %] + [% IF ( biblioitem.pages ) %] + , [% biblioitem.pages | $raw %] + [% END %] +
    + [% END %] + [% IF ( biblio.seriestitle ) %] + + Collection: [% biblio.seriestitle | $raw %] +
    + [% END %] + [% IF ( biblio.copyrightdate ) %] + + Copyright year: [% biblio.copyrightdate | $raw %] +
    + [% END %] + [% IF ( biblio.notes ) %] + + Notes: [% biblio.notes | $raw %] +
    + [% END %] + [% IF ( biblio.unititle ) %] + + Unified title: [% biblio.unititle | $raw %] +
    + [% END %] + [% IF ( biblio.serial ) %] + + Serial: [% biblio.serial | $raw %] +
    + [% END %] + [% IF ( biblioitem.lccn ) %] + + LCCN: [% biblioitem.lccn | $raw %] +
    + [% END %] + [% IF ( biblioitem.url ) %] + + URL: [% biblioitem.url | html %] + + [% END %] +

    + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %] + [% IF ( OPACBaseURL ) %] +

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    + [% END %] + [% IF ( biblio.items.count > 0 ) %] +

    Items: +

      + [% FOREACH item IN biblio.items %]
    • + [% item.holding_branch.branchname | $raw %] + [% item.location | $raw %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %] + [% item.barcode | $raw %] +
    • [% END %] +
    +

    + [% END %] +
    +
  2. +[% END %] +
",'email','default'); diff --git a/installer/data/mysql/it-IT/necessari/notices.sql b/installer/data/mysql/it-IT/necessari/notices.sql index c2c2a9cfc0..bbf495f2f6 100644 --- a/installer/data/mysql/it-IT/necessari/notices.sql +++ b/installer/data/mysql/it-IT/necessari/notices.sql @@ -432,3 +432,222 @@ INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, conten INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_CANCEL', '', 'ILL request cancelled', 0, "Interlibrary loan request cancelled", "The patron for interlibrary loans request [% illrequest.illrequest_id %], with the following details, has requested cancellation of this ILL request:\n\n[% ill_full_metadata %]", 'sms', 'default'); INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_MODIFIED', '', 'ILL request modified', 0, "Interlibrary loan request modified", "The patron for interlibrary loans request [% illrequest.illrequest_id %], with the following details, has modified this ILL request:\n\n[% ill_full_metadata %]", 'sms', 'default'); INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_PARTNER_REQ', '', 'ILL request to partners', 0, "Interlibrary loan request to partners", "Dear Sir/Madam,\n\nWe would like to request an interlibrary loan for a title matching the following description:\n\n[% ill_full_metadata %]\n\nPlease let us know if you are able to supply this to us.\n\nKind Regards\n\n[% branch.branchname %]\n[% branch.branchaddress1 %]\n[% branch.branchaddress2 %]\n[% branch.branchaddress3 %]\n[% branch.branchcity %]\n[% branch.branchstate %]\n[% branch.branchzip %]\n[% branch.branchphone %]\n[% branch.branchillemail %]\n[% branch.branchemail %]", 'sms', 'default'); + +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 -%] +

Hi,

+

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a list from our online catalog called: [% listname | $raw %].

+

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.

+
+

[% comment | $raw %]

+
+
    +[% FOREACH biblio IN biblios %] +
  1. + + [% biblio.title | $raw %] + [% IF ( biblio.subtitle ) %] + [% FOREACH subtitle IN biblio.subtitle.split(' | ') %] + [% subtitle | $raw %] + [% END %] + [% END %] + [% biblio.part_number | $raw %] [% biblio.part_name | $raw %] + +

    + [% IF ( biblio.author || biblio.get_authors_from_MARC ) %] + Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %] + [% IF ( biblio.get_authors_from_MARC ) %] + [% IF ( biblio.author ) %]; [% END %] + [% FOREACH author IN biblio.get_authors_from_MARC %] + [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %] + [% subfield.separator | $raw %][% subfield.value | $raw %] + [% END %] + [% UNLESS ( loop.last ) %];[% END %] + [% END %] + [% END %] +
    + [% END %] + [% SET biblioitem = biblio.biblioitem %] + [% IF ( biblioitem.isbn ) %] + + ISBN: [% FOREACH isbn IN biblioitem.isbn %] + [% isbn | $raw %] + [% UNLESS ( loop.last ) %]; [% END %] + [% END %] +
    + [% END %] + [% IF ( biblioitem.publishercode ) %] + + Published by: [% biblioitem.publishercode | $raw %] + [% IF ( biblioitem.publicationyear ) %] + in [% biblioitem.publicationyear | $raw %] + [% END %] + [% IF ( biblioitem.pages ) %] + , [% biblioitem.pages | $raw %] + [% END %] +
    + [% END %] + [% IF ( biblio.seriestitle ) %] + + Collection: [% biblio.seriestitle | $raw %] +
    + [% END %] + [% IF ( biblio.copyrightdate ) %] + + Copyright year: [% biblio.copyrightdate | $raw %] +
    + [% END %] + [% IF ( biblio.notes ) %] + + Notes: [% biblio.notes | $raw %] +
    + [% END %] + [% IF ( biblio.unititle ) %] + + Unified title: [% biblio.unititle | $raw %] +
    + [% END %] + [% IF ( biblio.serial ) %] + + Serial: [% biblio.serial | $raw %] +
    + [% END %] + [% IF ( biblioitem.lccn ) %] + + LCCN: [% biblioitem.lccn | $raw %] +
    + [% END %] + [% IF ( biblioitem.url ) %] + + URL: [% biblioitem.url | html %] + + [% END %] +

    + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %] + [% IF ( OPACBaseURL ) %] +

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    + [% END %] + [% IF ( biblio.items.count > 0 ) %] +

    Items: +

      + [% FOREACH item IN biblio.items %]
    • + [% item.holding_branch.branchname | $raw %] + [% item.location | $raw %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %] + [% item.barcode | $raw %] +
    • [% END %] +
    +

    + [% END %] +
    +
  2. +[% END %] +
", 'email','default' ), +('catalog','CART','','Send cart',1,'Your cart',"[%- USE raw -%] +

Hi,

+

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a cart from our online catalog.

+

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.

+
+

[% comment | $raw %]

+
+
    +[% FOREACH biblio IN biblios %] +
  1. + + [% biblio.title | $raw %] + [% IF ( biblio.subtitle ) %] + [% FOREACH subtitle IN biblio.subtitle.split(' | ') %] + [% subtitle | $raw %] + [% END %] + [% END %] + [% biblio.part_number | $raw %] [% biblio.part_name | $raw %] + +

    + [% IF ( biblio.author || biblio.get_authors_from_MARC ) %] + Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %] + [% IF ( biblio.get_authors_from_MARC ) %] + [% IF ( biblio.author ) %]; [% END %] + [% FOREACH author IN biblio.get_authors_from_MARC %] + [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %] + [% subfield.separator | $raw %][% subfield.value | $raw %] + [% END %] + [% UNLESS ( loop.last ) %];[% END %] + [% END %] + [% END %] +
    + [% END %] + [% SET biblioitem = biblio.biblioitem %] + [% IF ( biblioitem.isbn ) %] + + ISBN: [% FOREACH isbn IN biblioitem.isbn %] + [% isbn | $raw %] + [% UNLESS ( loop.last ) %]; [% END %] + [% END %] +
    + [% END %] + [% IF ( biblioitem.publishercode ) %] + + Published by: [% biblioitem.publishercode | $raw %] + [% IF ( biblioitem.publicationyear ) %] + in [% biblioitem.publicationyear | $raw %] + [% END %] + [% IF ( biblioitem.pages ) %] + , [% biblioitem.pages | $raw %] + [% END %] +
    + [% END %] + [% IF ( biblio.seriestitle ) %] + + Collection: [% biblio.seriestitle | $raw %] +
    + [% END %] + [% IF ( biblio.copyrightdate ) %] + + Copyright year: [% biblio.copyrightdate | $raw %] +
    + [% END %] + [% IF ( biblio.notes ) %] + + Notes: [% biblio.notes | $raw %] +
    + [% END %] + [% IF ( biblio.unititle ) %] + + Unified title: [% biblio.unititle | $raw %] +
    + [% END %] + [% IF ( biblio.serial ) %] + + Serial: [% biblio.serial | $raw %] +
    + [% END %] + [% IF ( biblioitem.lccn ) %] + + LCCN: [% biblioitem.lccn | $raw %] +
    + [% END %] + [% IF ( biblioitem.url ) %] + + URL: [% biblioitem.url | html %] + + [% END %] +

    + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %] + [% IF ( OPACBaseURL ) %] +

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    + [% END %] + [% IF ( biblio.items.count > 0 ) %] +

    Items: +

      + [% FOREACH item IN biblio.items %]
    • + [% item.holding_branch.branchname | $raw %] + [% item.location | $raw %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %] + [% item.barcode | $raw %] +
    • [% END %] +
    +

    + [% END %] +
    +
  2. +[% END %] +
",'email','default'); diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql b/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql index 19821cb794..56dfd08242 100644 --- a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql +++ b/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql @@ -447,3 +447,222 @@ INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, conten INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_CANCEL', '', 'ILL request cancelled', 0, "Interlibrary loan request cancelled", "The patron for interlibrary loans request [% illrequest.illrequest_id %], with the following details, has requested cancellation of this ILL request:\n\n[% ill_full_metadata %]", 'sms', 'default'); INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_MODIFIED', '', 'ILL request modified', 0, "Interlibrary loan request modified", "The patron for interlibrary loans request [% illrequest.illrequest_id %], with the following details, has modified this ILL request:\n\n[% ill_full_metadata %]", 'sms', 'default'); INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_PARTNER_REQ', '', 'ILL request to partners', 0, "Interlibrary loan request to partners", "Dear Sir/Madam,\n\nWe would like to request an interlibrary loan for a title matching the following description:\n\n[% ill_full_metadata %]\n\nPlease let us know if you are able to supply this to us.\n\nKind Regards\n\n[% branch.branchname %]\n[% branch.branchaddress1 %]\n[% branch.branchaddress2 %]\n[% branch.branchaddress3 %]\n[% branch.branchcity %]\n[% branch.branchstate %]\n[% branch.branchzip %]\n[% branch.branchphone %]\n[% branch.branchillemail %]\n[% branch.branchemail %]", 'sms', 'default'); + +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 -%] +

Hi,

+

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a list from our online catalog called: [% listname | $raw %].

+

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.

+
+

[% comment | $raw %]

+
+
    +[% FOREACH biblio IN biblios %] +
  1. + + [% biblio.title | $raw %] + [% IF ( biblio.subtitle ) %] + [% FOREACH subtitle IN biblio.subtitle.split(' | ') %] + [% subtitle | $raw %] + [% END %] + [% END %] + [% biblio.part_number | $raw %] [% biblio.part_name | $raw %] + +

    + [% IF ( biblio.author || biblio.get_authors_from_MARC ) %] + Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %] + [% IF ( biblio.get_authors_from_MARC ) %] + [% IF ( biblio.author ) %]; [% END %] + [% FOREACH author IN biblio.get_authors_from_MARC %] + [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %] + [% subfield.separator | $raw %][% subfield.value | $raw %] + [% END %] + [% UNLESS ( loop.last ) %];[% END %] + [% END %] + [% END %] +
    + [% END %] + [% SET biblioitem = biblio.biblioitem %] + [% IF ( biblioitem.isbn ) %] + + ISBN: [% FOREACH isbn IN biblioitem.isbn %] + [% isbn | $raw %] + [% UNLESS ( loop.last ) %]; [% END %] + [% END %] +
    + [% END %] + [% IF ( biblioitem.publishercode ) %] + + Published by: [% biblioitem.publishercode | $raw %] + [% IF ( biblioitem.publicationyear ) %] + in [% biblioitem.publicationyear | $raw %] + [% END %] + [% IF ( biblioitem.pages ) %] + , [% biblioitem.pages | $raw %] + [% END %] +
    + [% END %] + [% IF ( biblio.seriestitle ) %] + + Collection: [% biblio.seriestitle | $raw %] +
    + [% END %] + [% IF ( biblio.copyrightdate ) %] + + Copyright year: [% biblio.copyrightdate | $raw %] +
    + [% END %] + [% IF ( biblio.notes ) %] + + Notes: [% biblio.notes | $raw %] +
    + [% END %] + [% IF ( biblio.unititle ) %] + + Unified title: [% biblio.unititle | $raw %] +
    + [% END %] + [% IF ( biblio.serial ) %] + + Serial: [% biblio.serial | $raw %] +
    + [% END %] + [% IF ( biblioitem.lccn ) %] + + LCCN: [% biblioitem.lccn | $raw %] +
    + [% END %] + [% IF ( biblioitem.url ) %] + + URL: [% biblioitem.url | html %] + + [% END %] +

    + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %] + [% IF ( OPACBaseURL ) %] +

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    + [% END %] + [% IF ( biblio.items.count > 0 ) %] +

    Items: +

      + [% FOREACH item IN biblio.items %]
    • + [% item.holding_branch.branchname | $raw %] + [% item.location | $raw %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %] + [% item.barcode | $raw %] +
    • [% END %] +
    +

    + [% END %] +
    +
  2. +[% END %] +
", 'email','default' ), +('catalog','CART','','Send cart',1,'Your cart',"[%- USE raw -%] +

Hi,

+

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a cart from our online catalog.

+

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.

+
+

[% comment | $raw %]

+
+
    +[% FOREACH biblio IN biblios %] +
  1. + + [% biblio.title | $raw %] + [% IF ( biblio.subtitle ) %] + [% FOREACH subtitle IN biblio.subtitle.split(' | ') %] + [% subtitle | $raw %] + [% END %] + [% END %] + [% biblio.part_number | $raw %] [% biblio.part_name | $raw %] + +

    + [% IF ( biblio.author || biblio.get_authors_from_MARC ) %] + Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %] + [% IF ( biblio.get_authors_from_MARC ) %] + [% IF ( biblio.author ) %]; [% END %] + [% FOREACH author IN biblio.get_authors_from_MARC %] + [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %] + [% subfield.separator | $raw %][% subfield.value | $raw %] + [% END %] + [% UNLESS ( loop.last ) %];[% END %] + [% END %] + [% END %] +
    + [% END %] + [% SET biblioitem = biblio.biblioitem %] + [% IF ( biblioitem.isbn ) %] + + ISBN: [% FOREACH isbn IN biblioitem.isbn %] + [% isbn | $raw %] + [% UNLESS ( loop.last ) %]; [% END %] + [% END %] +
    + [% END %] + [% IF ( biblioitem.publishercode ) %] + + Published by: [% biblioitem.publishercode | $raw %] + [% IF ( biblioitem.publicationyear ) %] + in [% biblioitem.publicationyear | $raw %] + [% END %] + [% IF ( biblioitem.pages ) %] + , [% biblioitem.pages | $raw %] + [% END %] +
    + [% END %] + [% IF ( biblio.seriestitle ) %] + + Collection: [% biblio.seriestitle | $raw %] +
    + [% END %] + [% IF ( biblio.copyrightdate ) %] + + Copyright year: [% biblio.copyrightdate | $raw %] +
    + [% END %] + [% IF ( biblio.notes ) %] + + Notes: [% biblio.notes | $raw %] +
    + [% END %] + [% IF ( biblio.unititle ) %] + + Unified title: [% biblio.unititle | $raw %] +
    + [% END %] + [% IF ( biblio.serial ) %] + + Serial: [% biblio.serial | $raw %] +
    + [% END %] + [% IF ( biblioitem.lccn ) %] + + LCCN: [% biblioitem.lccn | $raw %] +
    + [% END %] + [% IF ( biblioitem.url ) %] + + URL: [% biblioitem.url | html %] + + [% END %] +

    + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %] + [% IF ( OPACBaseURL ) %] +

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    + [% END %] + [% IF ( biblio.items.count > 0 ) %] +

    Items: +

      + [% FOREACH item IN biblio.items %]
    • + [% item.holding_branch.branchname | $raw %] + [% item.location | $raw %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %] + [% item.barcode | $raw %] +
    • [% END %] +
    +

    + [% END %] +
    +
  2. +[% END %] +
",'email','default'); diff --git a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql b/installer/data/mysql/pl-PL/mandatory/sample_notices.sql index 6a6da3c021..daa9e79e86 100644 --- a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql +++ b/installer/data/mysql/pl-PL/mandatory/sample_notices.sql @@ -426,3 +426,222 @@ INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, conten INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_CANCEL', '', 'ILL request cancelled', 0, "Interlibrary loan request cancelled", "The patron for interlibrary loans request [% illrequest.illrequest_id %], with the following details, has requested cancellation of this ILL request:\n\n[% ill_full_metadata %]", 'sms', 'default'); INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_MODIFIED', '', 'ILL request modified', 0, "Interlibrary loan request modified", "The patron for interlibrary loans request [% illrequest.illrequest_id %], with the following details, has modified this ILL request:\n\n[% ill_full_metadata %]", 'sms', 'default'); INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_PARTNER_REQ', '', 'ILL request to partners', 0, "Interlibrary loan request to partners", "Dear Sir/Madam,\n\nWe would like to request an interlibrary loan for a title matching the following description:\n\n[% ill_full_metadata %]\n\nPlease let us know if you are able to supply this to us.\n\nKind Regards\n\n[% branch.branchname %]\n[% branch.branchaddress1 %]\n[% branch.branchaddress2 %]\n[% branch.branchaddress3 %]\n[% branch.branchcity %]\n[% branch.branchstate %]\n[% branch.branchzip %]\n[% branch.branchphone %]\n[% branch.branchillemail %]\n[% branch.branchemail %]", 'sms', 'default'); + +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 -%] +

Hi,

+

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a list from our online catalog called: [% listname | $raw %].

+

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.

+
+

[% comment | $raw %]

+
+
    +[% FOREACH biblio IN biblios %] +
  1. + + [% biblio.title | $raw %] + [% IF ( biblio.subtitle ) %] + [% FOREACH subtitle IN biblio.subtitle.split(' | ') %] + [% subtitle | $raw %] + [% END %] + [% END %] + [% biblio.part_number | $raw %] [% biblio.part_name | $raw %] + +

    + [% IF ( biblio.author || biblio.get_authors_from_MARC ) %] + Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %] + [% IF ( biblio.get_authors_from_MARC ) %] + [% IF ( biblio.author ) %]; [% END %] + [% FOREACH author IN biblio.get_authors_from_MARC %] + [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %] + [% subfield.separator | $raw %][% subfield.value | $raw %] + [% END %] + [% UNLESS ( loop.last ) %];[% END %] + [% END %] + [% END %] +
    + [% END %] + [% SET biblioitem = biblio.biblioitem %] + [% IF ( biblioitem.isbn ) %] + + ISBN: [% FOREACH isbn IN biblioitem.isbn %] + [% isbn | $raw %] + [% UNLESS ( loop.last ) %]; [% END %] + [% END %] +
    + [% END %] + [% IF ( biblioitem.publishercode ) %] + + Published by: [% biblioitem.publishercode | $raw %] + [% IF ( biblioitem.publicationyear ) %] + in [% biblioitem.publicationyear | $raw %] + [% END %] + [% IF ( biblioitem.pages ) %] + , [% biblioitem.pages | $raw %] + [% END %] +
    + [% END %] + [% IF ( biblio.seriestitle ) %] + + Collection: [% biblio.seriestitle | $raw %] +
    + [% END %] + [% IF ( biblio.copyrightdate ) %] + + Copyright year: [% biblio.copyrightdate | $raw %] +
    + [% END %] + [% IF ( biblio.notes ) %] + + Notes: [% biblio.notes | $raw %] +
    + [% END %] + [% IF ( biblio.unititle ) %] + + Unified title: [% biblio.unititle | $raw %] +
    + [% END %] + [% IF ( biblio.serial ) %] + + Serial: [% biblio.serial | $raw %] +
    + [% END %] + [% IF ( biblioitem.lccn ) %] + + LCCN: [% biblioitem.lccn | $raw %] +
    + [% END %] + [% IF ( biblioitem.url ) %] + + URL: [% biblioitem.url | html %] + + [% END %] +

    + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %] + [% IF ( OPACBaseURL ) %] +

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    + [% END %] + [% IF ( biblio.items.count > 0 ) %] +

    Items: +

      + [% FOREACH item IN biblio.items %]
    • + [% item.holding_branch.branchname | $raw %] + [% item.location | $raw %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %] + [% item.barcode | $raw %] +
    • [% END %] +
    +

    + [% END %] +
    +
  2. +[% END %] +
", 'email','default' ), +('catalog','CART','','Send cart',1,'Your cart',"[%- USE raw -%] +

Hi,

+

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a cart from our online catalog.

+

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.

+
+

[% comment | $raw %]

+
+
    +[% FOREACH biblio IN biblios %] +
  1. + + [% biblio.title | $raw %] + [% IF ( biblio.subtitle ) %] + [% FOREACH subtitle IN biblio.subtitle.split(' | ') %] + [% subtitle | $raw %] + [% END %] + [% END %] + [% biblio.part_number | $raw %] [% biblio.part_name | $raw %] + +

    + [% IF ( biblio.author || biblio.get_authors_from_MARC ) %] + Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %] + [% IF ( biblio.get_authors_from_MARC ) %] + [% IF ( biblio.author ) %]; [% END %] + [% FOREACH author IN biblio.get_authors_from_MARC %] + [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %] + [% subfield.separator | $raw %][% subfield.value | $raw %] + [% END %] + [% UNLESS ( loop.last ) %];[% END %] + [% END %] + [% END %] +
    + [% END %] + [% SET biblioitem = biblio.biblioitem %] + [% IF ( biblioitem.isbn ) %] + + ISBN: [% FOREACH isbn IN biblioitem.isbn %] + [% isbn | $raw %] + [% UNLESS ( loop.last ) %]; [% END %] + [% END %] +
    + [% END %] + [% IF ( biblioitem.publishercode ) %] + + Published by: [% biblioitem.publishercode | $raw %] + [% IF ( biblioitem.publicationyear ) %] + in [% biblioitem.publicationyear | $raw %] + [% END %] + [% IF ( biblioitem.pages ) %] + , [% biblioitem.pages | $raw %] + [% END %] +
    + [% END %] + [% IF ( biblio.seriestitle ) %] + + Collection: [% biblio.seriestitle | $raw %] +
    + [% END %] + [% IF ( biblio.copyrightdate ) %] + + Copyright year: [% biblio.copyrightdate | $raw %] +
    + [% END %] + [% IF ( biblio.notes ) %] + + Notes: [% biblio.notes | $raw %] +
    + [% END %] + [% IF ( biblio.unititle ) %] + + Unified title: [% biblio.unititle | $raw %] +
    + [% END %] + [% IF ( biblio.serial ) %] + + Serial: [% biblio.serial | $raw %] +
    + [% END %] + [% IF ( biblioitem.lccn ) %] + + LCCN: [% biblioitem.lccn | $raw %] +
    + [% END %] + [% IF ( biblioitem.url ) %] + + URL: [% biblioitem.url | html %] + + [% END %] +

    + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %] + [% IF ( OPACBaseURL ) %] +

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    + [% END %] + [% IF ( biblio.items.count > 0 ) %] +

    Items: +

      + [% FOREACH item IN biblio.items %]
    • + [% item.holding_branch.branchname | $raw %] + [% item.location | $raw %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %] + [% item.barcode | $raw %] +
    • [% END %] +
    +

    + [% END %] +
    +
  2. +[% END %] +
",'email','default'); diff --git a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql b/installer/data/mysql/ru-RU/mandatory/sample_notices.sql index e9b0006f91..aa615430b1 100644 --- a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql +++ b/installer/data/mysql/ru-RU/mandatory/sample_notices.sql @@ -428,3 +428,222 @@ INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, conten INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_CANCEL', '', 'ILL request cancelled', 0, "Interlibrary loan request cancelled", "The patron for interlibrary loans request [% illrequest.illrequest_id %], with the following details, has requested cancellation of this ILL request:\n\n[% ill_full_metadata %]", 'sms', 'default'); INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_MODIFIED', '', 'ILL request modified', 0, "Interlibrary loan request modified", "The patron for interlibrary loans request [% illrequest.illrequest_id %], with the following details, has modified this ILL request:\n\n[% ill_full_metadata %]", 'sms', 'default'); INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_PARTNER_REQ', '', 'ILL request to partners', 0, "Interlibrary loan request to partners", "Dear Sir/Madam,\n\nWe would like to request an interlibrary loan for a title matching the following description:\n\n[% ill_full_metadata %]\n\nPlease let us know if you are able to supply this to us.\n\nKind Regards\n\n[% branch.branchname %]\n[% branch.branchaddress1 %]\n[% branch.branchaddress2 %]\n[% branch.branchaddress3 %]\n[% branch.branchcity %]\n[% branch.branchstate %]\n[% branch.branchzip %]\n[% branch.branchphone %]\n[% branch.branchillemail %]\n[% branch.branchemail %]", 'sms', 'default'); + +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 -%] +

Hi,

+

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a list from our online catalog called: [% listname | $raw %].

+

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.

+
+

[% comment | $raw %]

+
+
    +[% FOREACH biblio IN biblios %] +
  1. + + [% biblio.title | $raw %] + [% IF ( biblio.subtitle ) %] + [% FOREACH subtitle IN biblio.subtitle.split(' | ') %] + [% subtitle | $raw %] + [% END %] + [% END %] + [% biblio.part_number | $raw %] [% biblio.part_name | $raw %] + +

    + [% IF ( biblio.author || biblio.get_authors_from_MARC ) %] + Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %] + [% IF ( biblio.get_authors_from_MARC ) %] + [% IF ( biblio.author ) %]; [% END %] + [% FOREACH author IN biblio.get_authors_from_MARC %] + [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %] + [% subfield.separator | $raw %][% subfield.value | $raw %] + [% END %] + [% UNLESS ( loop.last ) %];[% END %] + [% END %] + [% END %] +
    + [% END %] + [% SET biblioitem = biblio.biblioitem %] + [% IF ( biblioitem.isbn ) %] + + ISBN: [% FOREACH isbn IN biblioitem.isbn %] + [% isbn | $raw %] + [% UNLESS ( loop.last ) %]; [% END %] + [% END %] +
    + [% END %] + [% IF ( biblioitem.publishercode ) %] + + Published by: [% biblioitem.publishercode | $raw %] + [% IF ( biblioitem.publicationyear ) %] + in [% biblioitem.publicationyear | $raw %] + [% END %] + [% IF ( biblioitem.pages ) %] + , [% biblioitem.pages | $raw %] + [% END %] +
    + [% END %] + [% IF ( biblio.seriestitle ) %] + + Collection: [% biblio.seriestitle | $raw %] +
    + [% END %] + [% IF ( biblio.copyrightdate ) %] + + Copyright year: [% biblio.copyrightdate | $raw %] +
    + [% END %] + [% IF ( biblio.notes ) %] + + Notes: [% biblio.notes | $raw %] +
    + [% END %] + [% IF ( biblio.unititle ) %] + + Unified title: [% biblio.unititle | $raw %] +
    + [% END %] + [% IF ( biblio.serial ) %] + + Serial: [% biblio.serial | $raw %] +
    + [% END %] + [% IF ( biblioitem.lccn ) %] + + LCCN: [% biblioitem.lccn | $raw %] +
    + [% END %] + [% IF ( biblioitem.url ) %] + + URL: [% biblioitem.url | html %] + + [% END %] +

    + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %] + [% IF ( OPACBaseURL ) %] +

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    + [% END %] + [% IF ( biblio.items.count > 0 ) %] +

    Items: +

      + [% FOREACH item IN biblio.items %]
    • + [% item.holding_branch.branchname | $raw %] + [% item.location | $raw %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %] + [% item.barcode | $raw %] +
    • [% END %] +
    +

    + [% END %] +
    +
  2. +[% END %] +
", 'email','default' ), +('catalog','CART','','Send cart',1,'Your cart',"[%- USE raw -%] +

Hi,

+

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a cart from our online catalog.

+

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.

+
+

[% comment | $raw %]

+
+
    +[% FOREACH biblio IN biblios %] +
  1. + + [% biblio.title | $raw %] + [% IF ( biblio.subtitle ) %] + [% FOREACH subtitle IN biblio.subtitle.split(' | ') %] + [% subtitle | $raw %] + [% END %] + [% END %] + [% biblio.part_number | $raw %] [% biblio.part_name | $raw %] + +

    + [% IF ( biblio.author || biblio.get_authors_from_MARC ) %] + Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %] + [% IF ( biblio.get_authors_from_MARC ) %] + [% IF ( biblio.author ) %]; [% END %] + [% FOREACH author IN biblio.get_authors_from_MARC %] + [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %] + [% subfield.separator | $raw %][% subfield.value | $raw %] + [% END %] + [% UNLESS ( loop.last ) %];[% END %] + [% END %] + [% END %] +
    + [% END %] + [% SET biblioitem = biblio.biblioitem %] + [% IF ( biblioitem.isbn ) %] + + ISBN: [% FOREACH isbn IN biblioitem.isbn %] + [% isbn | $raw %] + [% UNLESS ( loop.last ) %]; [% END %] + [% END %] +
    + [% END %] + [% IF ( biblioitem.publishercode ) %] + + Published by: [% biblioitem.publishercode | $raw %] + [% IF ( biblioitem.publicationyear ) %] + in [% biblioitem.publicationyear | $raw %] + [% END %] + [% IF ( biblioitem.pages ) %] + , [% biblioitem.pages | $raw %] + [% END %] +
    + [% END %] + [% IF ( biblio.seriestitle ) %] + + Collection: [% biblio.seriestitle | $raw %] +
    + [% END %] + [% IF ( biblio.copyrightdate ) %] + + Copyright year: [% biblio.copyrightdate | $raw %] +
    + [% END %] + [% IF ( biblio.notes ) %] + + Notes: [% biblio.notes | $raw %] +
    + [% END %] + [% IF ( biblio.unititle ) %] + + Unified title: [% biblio.unititle | $raw %] +
    + [% END %] + [% IF ( biblio.serial ) %] + + Serial: [% biblio.serial | $raw %] +
    + [% END %] + [% IF ( biblioitem.lccn ) %] + + LCCN: [% biblioitem.lccn | $raw %] +
    + [% END %] + [% IF ( biblioitem.url ) %] + + URL: [% biblioitem.url | html %] + + [% END %] +

    + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %] + [% IF ( OPACBaseURL ) %] +

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    + [% END %] + [% IF ( biblio.items.count > 0 ) %] +

    Items: +

      + [% FOREACH item IN biblio.items %]
    • + [% item.holding_branch.branchname | $raw %] + [% item.location | $raw %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %] + [% item.barcode | $raw %] +
    • [% END %] +
    +

    + [% END %] +
    +
  2. +[% END %] +
",'email','default'); diff --git a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql b/installer/data/mysql/uk-UA/mandatory/sample_notices.sql index 1c8b70eda7..6fc47883fd 100644 --- a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql +++ b/installer/data/mysql/uk-UA/mandatory/sample_notices.sql @@ -519,3 +519,222 @@ INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, conten INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_CANCEL', '', 'ILL request cancelled', 0, "Interlibrary loan request cancelled", "The patron for interlibrary loans request [% illrequest.illrequest_id %], with the following details, has requested cancellation of this ILL request:\n\n[% ill_full_metadata %]", 'sms', 'default'); INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_MODIFIED', '', 'ILL request modified', 0, "Interlibrary loan request modified", "The patron for interlibrary loans request [% illrequest.illrequest_id %], with the following details, has modified this ILL request:\n\n[% ill_full_metadata %]", 'sms', 'default'); INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_PARTNER_REQ', '', 'ILL request to partners', 0, "Interlibrary loan request to partners", "Dear Sir/Madam,\n\nWe would like to request an interlibrary loan for a title matching the following description:\n\n[% ill_full_metadata %]\n\nPlease let us know if you are able to supply this to us.\n\nKind Regards\n\n[% branch.branchname %]\n[% branch.branchaddress1 %]\n[% branch.branchaddress2 %]\n[% branch.branchaddress3 %]\n[% branch.branchcity %]\n[% branch.branchstate %]\n[% branch.branchzip %]\n[% branch.branchphone %]\n[% branch.branchillemail %]\n[% branch.branchemail %]", 'sms', 'default'); + +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 -%] +

Hi,

+

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a list from our online catalog called: [% listname | $raw %].

+

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.

+
+

[% comment | $raw %]

+
+
    +[% FOREACH biblio IN biblios %] +
  1. + + [% biblio.title | $raw %] + [% IF ( biblio.subtitle ) %] + [% FOREACH subtitle IN biblio.subtitle.split(' | ') %] + [% subtitle | $raw %] + [% END %] + [% END %] + [% biblio.part_number | $raw %] [% biblio.part_name | $raw %] + +

    + [% IF ( biblio.author || biblio.get_authors_from_MARC ) %] + Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %] + [% IF ( biblio.get_authors_from_MARC ) %] + [% IF ( biblio.author ) %]; [% END %] + [% FOREACH author IN biblio.get_authors_from_MARC %] + [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %] + [% subfield.separator | $raw %][% subfield.value | $raw %] + [% END %] + [% UNLESS ( loop.last ) %];[% END %] + [% END %] + [% END %] +
    + [% END %] + [% SET biblioitem = biblio.biblioitem %] + [% IF ( biblioitem.isbn ) %] + + ISBN: [% FOREACH isbn IN biblioitem.isbn %] + [% isbn | $raw %] + [% UNLESS ( loop.last ) %]; [% END %] + [% END %] +
    + [% END %] + [% IF ( biblioitem.publishercode ) %] + + Published by: [% biblioitem.publishercode | $raw %] + [% IF ( biblioitem.publicationyear ) %] + in [% biblioitem.publicationyear | $raw %] + [% END %] + [% IF ( biblioitem.pages ) %] + , [% biblioitem.pages | $raw %] + [% END %] +
    + [% END %] + [% IF ( biblio.seriestitle ) %] + + Collection: [% biblio.seriestitle | $raw %] +
    + [% END %] + [% IF ( biblio.copyrightdate ) %] + + Copyright year: [% biblio.copyrightdate | $raw %] +
    + [% END %] + [% IF ( biblio.notes ) %] + + Notes: [% biblio.notes | $raw %] +
    + [% END %] + [% IF ( biblio.unititle ) %] + + Unified title: [% biblio.unititle | $raw %] +
    + [% END %] + [% IF ( biblio.serial ) %] + + Serial: [% biblio.serial | $raw %] +
    + [% END %] + [% IF ( biblioitem.lccn ) %] + + LCCN: [% biblioitem.lccn | $raw %] +
    + [% END %] + [% IF ( biblioitem.url ) %] + + URL: [% biblioitem.url | html %] + + [% END %] +

    + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %] + [% IF ( OPACBaseURL ) %] +

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    + [% END %] + [% IF ( biblio.items.count > 0 ) %] +

    Items: +

      + [% FOREACH item IN biblio.items %]
    • + [% item.holding_branch.branchname | $raw %] + [% item.location | $raw %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %] + [% item.barcode | $raw %] +
    • [% END %] +
    +

    + [% END %] +
    +
  2. +[% END %] +
", 'email','default' ), +('catalog','CART','','Send cart',1,'Your cart',"[%- USE raw -%] +

Hi,

+

[% borrower.firstname | $raw %] [% borrower.surname | $raw %] sent you a cart from our online catalog.

+

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.

+
+

[% comment | $raw %]

+
+
    +[% FOREACH biblio IN biblios %] +
  1. + + [% biblio.title | $raw %] + [% IF ( biblio.subtitle ) %] + [% FOREACH subtitle IN biblio.subtitle.split(' | ') %] + [% subtitle | $raw %] + [% END %] + [% END %] + [% biblio.part_number | $raw %] [% biblio.part_name | $raw %] + +

    + [% IF ( biblio.author || biblio.get_authors_from_MARC ) %] + Author(s): [% IF ( biblio.author ) %][% biblio.author | $raw %][% END %] + [% IF ( biblio.get_authors_from_MARC ) %] + [% IF ( biblio.author ) %]; [% END %] + [% FOREACH author IN biblio.get_authors_from_MARC %] + [% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %] + [% subfield.separator | $raw %][% subfield.value | $raw %] + [% END %] + [% UNLESS ( loop.last ) %];[% END %] + [% END %] + [% END %] +
    + [% END %] + [% SET biblioitem = biblio.biblioitem %] + [% IF ( biblioitem.isbn ) %] + + ISBN: [% FOREACH isbn IN biblioitem.isbn %] + [% isbn | $raw %] + [% UNLESS ( loop.last ) %]; [% END %] + [% END %] +
    + [% END %] + [% IF ( biblioitem.publishercode ) %] + + Published by: [% biblioitem.publishercode | $raw %] + [% IF ( biblioitem.publicationyear ) %] + in [% biblioitem.publicationyear | $raw %] + [% END %] + [% IF ( biblioitem.pages ) %] + , [% biblioitem.pages | $raw %] + [% END %] +
    + [% END %] + [% IF ( biblio.seriestitle ) %] + + Collection: [% biblio.seriestitle | $raw %] +
    + [% END %] + [% IF ( biblio.copyrightdate ) %] + + Copyright year: [% biblio.copyrightdate | $raw %] +
    + [% END %] + [% IF ( biblio.notes ) %] + + Notes: [% biblio.notes | $raw %] +
    + [% END %] + [% IF ( biblio.unititle ) %] + + Unified title: [% biblio.unititle | $raw %] +
    + [% END %] + [% IF ( biblio.serial ) %] + + Serial: [% biblio.serial | $raw %] +
    + [% END %] + [% IF ( biblioitem.lccn ) %] + + LCCN: [% biblioitem.lccn | $raw %] +
    + [% END %] + [% IF ( biblioitem.url ) %] + + URL: [% biblioitem.url | html %] + + [% END %] +

    + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %] + [% IF ( OPACBaseURL ) %] +

    In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]

    + [% END %] + [% IF ( biblio.items.count > 0 ) %] +

    Items: +

      + [% FOREACH item IN biblio.items %]
    • + [% item.holding_branch.branchname | $raw %] + [% item.location | $raw %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | $raw %])[% END %] + [% item.barcode | $raw %] +
    • [% END %] +
    +

    + [% END %] +
    +
  2. +[% END %] +
",'email','default'); diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl index 0278c683f8..c69c2ed9a9 100755 --- a/opac/opac-sendbasket.pl +++ b/opac/opac-sendbasket.pl @@ -54,128 +54,65 @@ if ( $email_add ) { session_id => scalar $query->cookie('CGISESSID'), token => scalar $query->param('csrf_token'), }); - my $patron = Koha::Patrons->find( $borrowernumber ); - my $borcat = $patron ? $patron->categorycode : q{}; - my $user_email = $patron->first_valid_email_address - || C4::Context->preference('KohaAdminEmailAddress'); - my $email_replyto = $patron->firstname . " " . $patron->surname . " <$user_email>"; - my $comment = $query->param('comment'); + my $patron = Koha::Patrons->find( $borrowernumber ); - # Since we are already logged in, no need to check credentials again - # when loading a second template. - my $template2 = C4::Templates::gettemplate( - 'opac-sendbasket.tt', 'opac', $query, - ); + my $comment = $query->param('comment'); my @bibs = split( /\//, $bib_list ); - my @results; my $iso2709; - my $marcflavour = C4::Context->preference('marcflavour'); - foreach my $biblionumber (@bibs) { - $template2->param( biblionumber => $biblionumber ); - - my $dat = GetBiblioData($biblionumber); - next unless $dat; - my $biblio = Koha::Biblios->find( $biblionumber ); - my $record = GetMarcBiblio({ - biblionumber => $biblionumber, - embed_items => 1, - opac => 1, - borcat => $borcat }); - my $marcauthorsarray = $biblio->get_authors_from_MARC; - my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); - - my @items = GetItemsInfo( $biblionumber ); - - my $hasauthors = 0; - if($dat->{'author'} || @$marcauthorsarray) { - $hasauthors = 1; - } - - - $dat->{MARCSUBJCTS} = $marcsubjctsarray; - $dat->{MARCAUTHORS} = $marcauthorsarray; - $dat->{HASAUTHORS} = $hasauthors; - $dat->{'biblionumber'} = $biblionumber; - $dat->{ITEM_RESULTS} = \@items; - - $iso2709 .= $record->as_usmarc(); - - push( @results, $dat ); - } - - my $resultsarray = \@results; - - $template2->param( - BIBLIO_RESULTS => $resultsarray, - comment => $comment, - firstname => $patron->firstname, - surname => $patron->surname, - ); - - # Getting template result - my $template_res = $template2->output(); - my $body; - - # Analysing information and getting mail properties - my $subject; - if ( $template_res =~ /\(?.*)\/s ) { - $subject = $+{subject}; - $subject =~ s|\n?(.*)\n?|$1|; - } - else { - $subject = "no subject"; - } - - my $email_header = ""; - if ( $template_res =~ /
(.*)/s ) { - $email_header = $1; - $email_header =~ s|\n?(.*)\n?|$1|; - } - - if ( $template_res =~ /(.*)/s ) { - $body = $1; - $body =~ s|\n?(.*)\n?|$1|; - } - my $THE_body = <find($bib); + $iso2709 .= $biblio->metadata->record->as_usmarc(); + }; if ( !defined $iso2709 ) { carp "Error sending mail: empty basket"; $template->param( error => 1 ); - } - else { - try { - # if you want to use the KohaAdmin address as from, that is the default no need to set it - my $email = Koha::Email->create({ - to => $email_add, - reply_to => $email_replyto, - subject => $subject, - }); - $email->header( 'X-Abuse-Report' => C4::Context->preference('KohaAdminEmailAddress') ); - $email->text_body( $THE_body ); - $email->attach( - Encode::encode( "UTF-8", $iso2709 ), - content_type => 'application/octet-stream', - name => 'basket.iso2709', - disposition => 'attachment', - ); - my $library = $patron->library; - $email->transport( $library->smtp_server->transport ); - $email->send_or_die; - $template->param( SENT => "1" ); - } - catch { - carp "Error sending mail: $_"; - $template->param( error => 1 ); + + } else { + my %loops = ( + biblio => \@bibs, + ); + + my %substitute = ( + comment => $comment, + ); + + my $letter = C4::Letters::GetPreparedLetter( + module => 'catalog', + letter_code => 'CART', + lang => $patron->lang, + tables => { + borrowers => $borrowernumber, + }, + message_transport_type => 'email', + loops => \%loops, + substitute => \%substitute, + ); + + my $attachment = { + filename => 'basket.iso2709', + type => 'application/octet-stream', + content => Encode::encode("UTF-8", $iso2709), }; + + my $user_email = $patron->first_valid_email_address || C4::Context->preference('KohaAdminEmailAddress'); + C4::Letters::EnqueueLetter({ + letter => $letter, + message_transport_type => 'email', + borrowernumber => $patron->borrowernumber, + to_address => $email_add, + reply_address => $user_email, + attachments => [$attachment], + }); + + $template->param( SENT => 1 ); } $template->param( email_add => $email_add ); + output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; } else { diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl index cf3dbc886f..c2642b711e 100755 --- a/opac/opac-sendshelf.pl +++ b/opac/opac-sendshelf.pl @@ -58,7 +58,7 @@ my $shelf = Koha::Virtualshelves->find( $shelfid ); if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { if ( $email ) { - my $comment = $query->param('comment'); + my $comment = $query->param('comment'); my ( $template2, $borrowernumber, $cookie ) = get_template_and_user( { @@ -70,109 +70,66 @@ if ( $email ) { ); my $patron = Koha::Patrons->find( $borrowernumber ); - my $borcat = $patron ? $patron->categorycode : q{}; - my $shelf = Koha::Virtualshelves->find( $shelfid ); my $contents = $shelf->get_contents; - my $marcflavour = C4::Context->preference('marcflavour'); - my $iso2709; - my @results; + my @biblionumbers; + my $iso2709; while ( my $content = $contents->next ) { - my $biblionumber = $content->biblionumber; - my $record = GetMarcBiblio({ - biblionumber => $biblionumber, - embed_items => 1, - opac => 1, - borcat => $borcat }); - next unless $record; - my $biblio = Koha::Biblios->find( $biblionumber ); - my $fw = GetFrameworkCode($biblionumber); - my $dat = GetBiblioData($biblionumber); - - my $marcauthorsarray = $biblio->get_authors_from_MARC; - my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); - - my @items = GetItemsInfo( $biblionumber ); - - $dat->{ISBN} = GetMarcISBN($record, $marcflavour); - $dat->{MARCSUBJCTS} = $marcsubjctsarray; - $dat->{MARCAUTHORS} = $marcauthorsarray; - $dat->{'biblionumber'} = $biblionumber; - $dat->{ITEM_RESULTS} = \@items; - $dat->{HASAUTHORS} = $dat->{'author'} || @$marcauthorsarray; - - $iso2709 .= $record->as_usmarc(); - - push( @results, $dat ); - } - - $template2->param( - BIBLIO_RESULTS => \@results, - comment => $comment, - shelfname => $shelf->shelfname, - firstname => $patron->firstname, - surname => $patron->surname, - ); - - # Getting template result - my $template_res = $template2->output(); - my $body; - - my $subject; - # Analysing information and getting mail properties - if ( $template_res =~ /(?.*)/s ) { - $subject = $+{subject}; - $subject =~ s|\n?(.*)\n?|$1|; - } - else { - $subject = "no subject"; - } + push @biblionumbers, $content->biblionumber; + my $biblio = Koha::Biblios->find($content->biblionumber); + $iso2709 .= $biblio->metadata->record->as_usmarc(); + }; - my $email_header = ""; - if ( $template_res =~ /
(.*)/s ) { - $email_header = $1; - $email_header =~ s|\n?(.*)\n?|$1|; - } + if ( !defined $iso2709 ) { + carp "Error sending mail: empty list"; + $template->param( error => 1 ); - if ( $template_res =~ /(.*)/s ) { - $body = $1; - $body =~ s|\n?(.*)\n?|$1|; - } + } else { + my %loops = ( + biblio => \@biblionumbers, + ); - my $THE_body = <create( - { - to => $email, - subject => $subject, - } + my %substitute = ( + comment => $comment, + listname => $shelf->shelfname, ); - $email->text_body( $THE_body ); - $email->attach( - Encode::encode( "UTF-8", $iso2709 ), - content_type => 'application/octet-stream', - name => 'list.iso2709', - disposition => 'attachment', + + my $letter = C4::Letters::GetPreparedLetter( + module => 'catalog', + letter_code => 'LIST', + lang => $patron->lang, + tables => { + borrowers => $borrowernumber, + }, + message_transport_type => 'email', + loops => \%loops, + substitute => \%substitute, ); - my $library = Koha::Patrons->find( $borrowernumber )->library; - $email->transport( $library->smtp_server->transport ); - $email->send_or_die; - $template->param( SENT => "1" ); + + my $attachment = { + filename => 'list.iso2709', + type => 'application/octet-stream', + content => Encode::encode("UTF-8", $iso2709), + }; + + C4::Letters::EnqueueLetter({ + letter => $letter, + message_transport_type => 'email', + borrowernumber => $patron->borrowernumber, + to_address => $email, + reply_address => $patron->first_valid_email_address, + attachments => [$attachment], + }); + + $template->param( SENT => 1 ); } - catch { - carp "Error sending mail: $_"; - $template->param( error => 1 ); - }; $template->param( shelfid => $shelfid, email => $email, ); + output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; diff --git a/virtualshelves/sendshelf.pl b/virtualshelves/sendshelf.pl index 09e2a4e43f..c5f24e1e83 100755 --- a/virtualshelves/sendshelf.pl +++ b/virtualshelves/sendshelf.pl @@ -59,99 +59,65 @@ if ($to_address) { } ); + my $patron = Koha::Patrons->find( $borrowernumber ); my $shelf = Koha::Virtualshelves->find( $shelfid ); my $contents = $shelf->get_contents; - my $marcflavour = C4::Context->preference('marcflavour'); - my $iso2709; - my @results; + my @biblionumbers; + my $iso2709; while ( my $content = $contents->next ) { - my $biblionumber = $content->biblionumber; - my $biblio = Koha::Biblios->find( $biblionumber ); - my $dat = GetBiblioData($biblionumber); - my $record = GetMarcBiblio({ - biblionumber => $biblionumber, - embed_items => 1 }); - my $marcauthorsarray = $biblio->get_authors_from_MARC; - my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); - - my @items = GetItemsInfo($biblionumber); - - $dat->{ISBN} = GetMarcISBN($record, $marcflavour); - $dat->{MARCSUBJCTS} = $marcsubjctsarray; - $dat->{MARCAUTHORS} = $marcauthorsarray; - $dat->{'biblionumber'} = $biblionumber; - $dat->{ITEM_RESULTS} = \@items; - $dat->{HASAUTHORS} = $dat->{'author'} || @$marcauthorsarray; - - $iso2709 .= $record->as_usmarc(); - - push( @results, $dat ); - } - - $template2->param( - BIBLIO_RESULTS => \@results, - comment => $comment, - shelfname => $shelf->shelfname, - ); - - # Getting template result - my $template_res = $template2->output(); - my $body; - - my $subject; - # Analysing information and getting mail properties - if ( $template_res =~ /(?.*)/s ) { - $subject = $+{subject}; - $subject =~ s|\n?(.*)\n?|$1|; - } - else { - $subject = "no subject"; - } + push @biblionumbers, $content->biblionumber; + my $biblio = Koha::Biblios->find($content->biblionumber); + $iso2709 .= $biblio->metadata->record->as_usmarc(); + }; - my $email_header = ""; - if ( $template_res =~ /
(.*)/s ) { - $email_header = $1; - $email_header =~ s|\n?(.*)\n?|$1|; - } + if ( !defined $iso2709 ) { + carp "Error sending mail: empty list"; + $template->param( error => 1 ); - if ( $template_res =~ /(.*)/s ) { - $body = $1; - $body =~ s|\n?(.*)\n?|$1|; - } + } else { + my %loops = ( + biblio => \@biblionumbers, + ); - my $THE_body = <create( - { - to => $to_address, - subject => $subject, - } + my %substitute = ( + comment => $comment, + listname => $shelf->shelfname, ); - $email->text_body( $THE_body ); - $email->attach( - Encode::encode("UTF-8", $iso2709), - content_type => 'application/octet-stream', - name => 'shelf.iso2709', - disposition => 'attachment', + + my $letter = C4::Letters::GetPreparedLetter( + module => 'catalog', + letter_code => 'LIST', + lang => $patron->lang, + tables => { + borrowers => $borrowernumber, + }, + message_transport_type => 'email', + loops => \%loops, + substitute => \%substitute, ); - my $library = Koha::Patrons->find( $borrowernumber )->library; - $email->send_or_die({ transport => $library->smtp_server->transport }); - $template->param( SENT => "1" ); + my $attachment = { + filename => 'shelf.iso2709', + type => 'application/octet-stream', + content => Encode::encode("UTF-8", $iso2709), + }; + + C4::Letters::EnqueueLetter({ + letter => $letter, + message_transport_type => 'email', + borrowernumber => $patron->borrowernumber, + to_address => $to_address, + reply_address => $patron->first_valid_email_address, + attachments => [$attachment], + }); + + $template->param( SENT => 1 ); } - catch { - carp "Error sending mail: $_"; - $template->param( error => 1 ); - }; $template->param( email => $to_address ); - output_html_with_http_headers $query, $cookie, $template->output; + output_html_with_http_headers $query, $cookie, $template->output; } else { $template->param( -- 2.20.1