From 0f577dee04b421a92c7d943080b7b3c797d6acbd Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 13 Feb 2023 14:16:43 +1300 Subject: [PATCH] Bug 3150: (follow-up) Use get_marc_contributors --- .../bug_3150_-_add_LIST_and_CART_notices.perl | 54 ------------------- .../bug_3150_-_add_LIST_and_CART_notices.pl | 62 ++++++++++++++++++++++ .../data/mysql/en/mandatory/sample_notices.yml | 4 +- 3 files changed, 64 insertions(+), 56 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_3150_-_add_LIST_and_CART_notices.perl create mode 100644 installer/data/mysql/atomicupdate/bug_3150_-_add_LIST_and_CART_notices.pl 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 deleted file mode 100644 index b376d6c6cda..00000000000 --- a/installer/data/mysql/atomicupdate/bug_3150_-_add_LIST_and_CART_notices.perl +++ /dev/null @@ -1,54 +0,0 @@ -$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 -('catalogue','LIST','','Send list',1,'Your list: [% listname | html %]',"Hi, -[% borrower.firstname | html %] [% borrower.surname | html %] sent you a list from our online catalog called: [% listname | html %]. -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 | html %]
-
    [% FOREACH biblio IN biblios %]
  1. - [% biblio.title | html %] - [% IF ( biblio.subtitle ) %][% FOREACH subtitle IN biblio.subtitle.split(' | ') %][% subtitle | html %][% END %][% END %] - [% biblio.part_number | html %] [% biblio.part_name | html %] - [% IF ( biblio.author || biblio.get_marc_authors ) %]Author(s): [% IF ( biblio.author ) %][% biblio.author | html %][% END %][% IF ( biblio.get_marc_authors ) %][% IF ( biblio.author ) %]; [% END %][% FOREACH author IN biblio.get_marc_authors %][% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %][% subfield.separator | html %][% subfield.value | html %][% END %][% UNLESS ( loop.last ) %];[% END %][% END %][% END %][% END %] - [% SET biblioitem = biblio.biblioitem %][% IF ( biblioitem.isbn ) %]ISBN: [% FOREACH isbn IN biblioitem.isbn %][% isbn | html %][% UNLESS ( loop.last ) %]; [% END %][% END %][% END %] - [% IF ( biblioitem.publishercode ) %]Published by: [% biblioitem.publishercode | html %][% IF ( biblioitem.publicationyear ) %] in [% biblioitem.publicationyear | html %][% END %][% IF ( biblioitem.pages ) %], [% biblioitem.pages | html %][% END %][% END %] - [% IF ( biblio.seriestitle ) %]Collection: [% biblio.seriestitle | html %][% END %] - [% IF ( biblio.copyrightdate ) %]Copyright year: [% biblio.copyrightdate | html %][% END %] - [% IF ( biblio.notes ) %]Notes: [% biblio.notes | html %][% END %] - [% IF ( biblio.unititle ) %]Unified title: [% biblio.unititle | html %][% END %] - [% IF ( biblio.serial ) %]Serial: [% biblio.serial | html %][% END %] - [% IF ( biblioitem.lccn ) %]LCCN: [% biblioitem.lccn | html %][% END %] - [% IF ( biblioitem.url ) %]URL: [% biblioitem.url | html %][% END %] - [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %][% IF ( OPACBaseURL ) %]In online catalog: [% OPACBaseURL | html %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %][% END %] - [% IF ( biblio.items.count > 0 ) %]Items:
      [% FOREACH item IN biblio.items %]
    • [% Branches.GetName( item.holdingbranch ) | html %] - [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %] - [% IF item.itemcallnumber %]([% item.itemcallnumber | html %])[% END %] - [% item.barcode | html %]
    • [% END %]
    [% END %] -
  2. [% END %]
", 'email','default' ), - ('catalogue','CART','','Send cart',1,'Your cart',"Hi, -[% borrower.firstname | html %] [% borrower.surname | html %] 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 | html %]
-
    [% FOREACH biblio IN biblios %]
  1. - [% biblio.title | html %] - [% IF ( biblio.subtitle ) %][% FOREACH subtitle IN biblio.subtitle.split(' | ') %][% subtitle | html %][% END %][% END %] - [% biblio.part_number | html %] [% biblio.part_name | html %] - [% IF ( biblio.author || biblio.get_marc_authors ) %]Author(s): [% IF ( biblio.author ) %][% biblio.author | html %][% END %][% IF ( biblio.get_marc_authors ) %][% IF ( biblio.author ) %]; [% END %][% FOREACH author IN biblio.get_marc_authors %][% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %][% subfield.separator | html %][% subfield.value | html %][% END %][% UNLESS ( loop.last ) %];[% END %][% END %][% END %][% END %] - [% SET biblioitem = biblio.biblioitem %][% IF ( biblioitem.isbn ) %]ISBN: [% FOREACH isbn IN biblioitem.isbn %][% isbn | html %][% UNLESS ( loop.last ) %]; [% END %][% END %][% END %] - [% IF ( biblioitem.publishercode ) %]Published by: [% biblioitem.publishercode | html %][% IF ( biblioitem.publicationyear ) %] in [% biblioitem.publicationyear | html %][% END %][% IF ( biblioitem.pages ) %], [% biblioitem.pages | html %][% END %][% END %] - [% IF ( biblio.seriestitle ) %]Collection: [% biblio.seriestitle | html %][% END %] - [% IF ( biblio.copyrightdate ) %]Copyright year: [% biblio.copyrightdate | html %][% END %] - [% IF ( biblio.notes ) %]Notes: [% biblio.notes | html %][% END %] - [% IF ( biblio.unititle ) %]Unified title: [% biblio.unititle | html %][% END %] - [% IF ( biblio.serial ) %]Serial: [% biblio.serial | html %][% END %] - [% IF ( biblioitem.lccn ) %]LCCN: [% biblioitem.lccn | html %][% END %] - [% IF ( biblioitem.url ) %]URL: [% biblioitem.url | html %][% END %] - [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %][% IF ( OPACBaseURL ) %]In online catalog: [% OPACBaseURL | html %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %][% END %] - [% IF ( biblio.items.count > 0 ) %]Items:
      [% FOREACH item IN biblio.items %]
    • [% Branches.GetName( item.holdingbranch ) | html %] - [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %] - [% IF item.itemcallnumber %]([% item.itemcallnumber | html %])[% END %] - [% item.barcode | html %]
    • [% END %]
    [% END %] -
  2. [% END %]
",'email','default') }); - - NewVersion( $DBversion, 3150, 'Add LIST and CART notices' ); -} diff --git a/installer/data/mysql/atomicupdate/bug_3150_-_add_LIST_and_CART_notices.pl b/installer/data/mysql/atomicupdate/bug_3150_-_add_LIST_and_CART_notices.pl new file mode 100644 index 00000000000..bb74efe2b85 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_3150_-_add_LIST_and_CART_notices.pl @@ -0,0 +1,62 @@ +use Modern::Perl; + +return { + bug_number => "3150", + description => "Add LIST and CART notices", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + $dbh->do(q{ INSERT IGNORE INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES + ('catalogue','LIST','','Send list',1,'Your list: [% listname | html %]',"Hi, + [% borrower.firstname | html %] [% borrower.surname | html %] sent you a list from our online catalog called: [% listname | html %]. + 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 | html %]
+
    [% FOREACH biblio IN biblios %]
  1. + [% biblio.title | html %] + [% IF ( biblio.subtitle ) %][% FOREACH subtitle IN biblio.subtitle.split(' | ') %][% subtitle | html %][% END %][% END %] + [% biblio.part_number | html %] [% biblio.part_name | html %] + [% IF ( biblio.author || biblio.get_marc_contributors ) %]Author(s): [% IF ( biblio.author ) %][% biblio.author | html %][% END %][% IF ( biblio.get_marc_contributors ) %][% IF ( biblio.author ) %]; [% END %][% FOREACH author IN biblio.get_marc_contributors %][% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %][% subfield.separator | html %][% subfield.value | html %][% END %][% UNLESS ( loop.last ) %];[% END %][% END %][% END %][% END %] + [% SET biblioitem = biblio.biblioitem %][% IF ( biblioitem.isbn ) %]ISBN: [% FOREACH isbn IN biblioitem.isbn %][% isbn | html %][% UNLESS ( loop.last ) %]; [% END %][% END %][% END %] + [% IF ( biblioitem.publishercode ) %]Published by: [% biblioitem.publishercode | html %][% IF ( biblioitem.publicationyear ) %] in [% biblioitem.publicationyear | html %][% END %][% IF ( biblioitem.pages ) %], [% biblioitem.pages | html %][% END %][% END %] + [% IF ( biblio.seriestitle ) %]Collection: [% biblio.seriestitle | html %][% END %] + [% IF ( biblio.copyrightdate ) %]Copyright year: [% biblio.copyrightdate | html %][% END %] + [% IF ( biblio.notes ) %]Notes: [% biblio.notes | html %][% END %] + [% IF ( biblio.unititle ) %]Unified title: [% biblio.unititle | html %][% END %] + [% IF ( biblio.serial ) %]Serial: [% biblio.serial | html %][% END %] + [% IF ( biblioitem.lccn ) %]LCCN: [% biblioitem.lccn | html %][% END %] + [% IF ( biblioitem.url ) %]URL: [% biblioitem.url | html %][% END %] + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %][% IF ( OPACBaseURL ) %]In online catalog: [% OPACBaseURL | html %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %][% END %] + [% IF ( biblio.items.count > 0 ) %]Items:
      [% FOREACH item IN biblio.items %]
    • [% Branches.GetName( item.holdingbranch ) | html %] + [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | html %])[% END %] + [% item.barcode | html %]
    • [% END %]
    [% END %] +
  2. [% END %]
", 'email','default' ), + ('catalogue','CART','','Send cart',1,'Your cart',"Hi, + [% borrower.firstname | html %] [% borrower.surname | html %] 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 | html %]
+
    [% FOREACH biblio IN biblios %]
  1. + [% biblio.title | html %] + [% IF ( biblio.subtitle ) %][% FOREACH subtitle IN biblio.subtitle.split(' | ') %][% subtitle | html %][% END %][% END %] + [% biblio.part_number | html %] [% biblio.part_name | html %] + [% IF ( biblio.author || biblio.get_marc_contributors ) %]Author(s): [% IF ( biblio.author ) %][% biblio.author | html %][% END %][% IF ( biblio.get_marc_contributors ) %][% IF ( biblio.author ) %]; [% END %][% FOREACH author IN biblio.get_marc_contributors %][% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %][% subfield.separator | html %][% subfield.value | html %][% END %][% UNLESS ( loop.last ) %];[% END %][% END %][% END %][% END %] + [% SET biblioitem = biblio.biblioitem %][% IF ( biblioitem.isbn ) %]ISBN: [% FOREACH isbn IN biblioitem.isbn %][% isbn | html %][% UNLESS ( loop.last ) %]; [% END %][% END %][% END %] + [% IF ( biblioitem.publishercode ) %]Published by: [% biblioitem.publishercode | html %][% IF ( biblioitem.publicationyear ) %] in [% biblioitem.publicationyear | html %][% END %][% IF ( biblioitem.pages ) %], [% biblioitem.pages | html %][% END %][% END %] + [% IF ( biblio.seriestitle ) %]Collection: [% biblio.seriestitle | html %][% END %] + [% IF ( biblio.copyrightdate ) %]Copyright year: [% biblio.copyrightdate | html %][% END %] + [% IF ( biblio.notes ) %]Notes: [% biblio.notes | html %][% END %] + [% IF ( biblio.unititle ) %]Unified title: [% biblio.unititle | html %][% END %] + [% IF ( biblio.serial ) %]Serial: [% biblio.serial | html %][% END %] + [% IF ( biblioitem.lccn ) %]LCCN: [% biblioitem.lccn | html %][% END %] + [% IF ( biblioitem.url ) %]URL: [% biblioitem.url | html %][% END %] + [% SET OPACBaseURL = Koha.Preference('OPACBaseURL') %][% IF ( OPACBaseURL ) %]In online catalog: [% OPACBaseURL | html %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %][% END %] + [% IF ( biblio.items.count > 0 ) %]Items:
      [% FOREACH item IN biblio.items %]
    • [% Branches.GetName( item.holdingbranch ) | html %] + [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %] + [% IF item.itemcallnumber %]([% item.itemcallnumber | html %])[% END %] + [% item.barcode | html %]
    • [% END %]
    [% END %] +
  2. [% END %]
",'email','default') }); + + say $out "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 665d5306e74..a7e47c3719e 100644 --- a/installer/data/mysql/en/mandatory/sample_notices.yml +++ b/installer/data/mysql/en/mandatory/sample_notices.yml @@ -2128,7 +2128,7 @@ tables: - "
    [% FOREACH biblio IN biblios %]
  1. " - "[% biblio.title | html %]" - "[% IF ( biblio.subtitle ) %][% FOREACH subtitle IN biblio.subtitle.split(' | ') %][% subtitle | html %][% END %][% END %][% biblio.part_number | html %] [% biblio.part_name | html %]" - - "[% IF ( biblio.author || biblio.get_marc_authors ) %]Author(s): [% IF ( biblio.author ) %][% biblio.author | html %][% END %][% IF ( biblio.get_marc_authors ) %][% IF ( biblio.author ) %]; [% END %][% FOREACH author IN biblio.get_marc_authors %][% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %][% subfield.separator | html %][% subfield.value | html %][% END %][% UNLESS ( loop.last ) %];[% END %][% END %][% END %][% END %]" + - "[% IF ( biblio.author || biblio.get_marc_contributors ) %]Author(s): [% IF ( biblio.author ) %][% biblio.author | html %][% END %][% IF ( biblio.get_marc_contributors ) %][% IF ( biblio.author ) %]; [% END %][% FOREACH author IN biblio.get_marc_contributors %][% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %][% subfield.separator | html %][% subfield.value | html %][% END %][% UNLESS ( loop.last ) %];[% END %][% END %][% END %][% END %]" - "[% SET biblioitem = biblio.biblioitem %][% IF ( biblioitem.isbn ) %]ISBN: [% FOREACH isbn IN biblioitem.isbn %][% isbn | html %][% UNLESS ( loop.last ) %]; [% END %][% END %][% END %]" - "[% IF ( biblioitem.publishercode ) %]Published by: [% biblioitem.publishercode | html %][% IF ( biblioitem.publicationyear ) %] in [% biblioitem.publicationyear | html %][% END %][% IF ( biblioitem.pages ) %], [% biblioitem.pages | html %][% END %][% END %]" - "[% IF ( biblio.seriestitle ) %]Collection: [% biblio.seriestitle | html %][% END %]" @@ -2159,7 +2159,7 @@ tables: - "
      [% FOREACH biblio IN biblios %]
    1. " - "[% biblio.title | html %]" - "[% IF ( biblio.subtitle ) %][% FOREACH subtitle IN biblio.subtitle.split(' | ') %][% subtitle | html %][% END %][% END %][% biblio.part_number | html %] [% biblio.part_name | html %]" - - "[% IF ( biblio.author || biblio.get_marc_authors ) %]Author(s): [% IF ( biblio.author ) %][% biblio.author | html %][% END %][% IF ( biblio.get_marc_authors ) %][% IF ( biblio.author ) %]; [% END %][% FOREACH author IN biblio.get_marc_authors %][% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %][% subfield.separator | html %][% subfield.value | html %][% END %][% UNLESS ( loop.last ) %];[% END %][% END %][% END %][% END %]" + - "[% IF ( biblio.author || biblio.get_marc_contributors ) %]Author(s): [% IF ( biblio.author ) %][% biblio.author | html %][% END %][% IF ( biblio.get_marc_contributors ) %][% IF ( biblio.author ) %]; [% END %][% FOREACH author IN biblio.get_marc_contributors %][% FOREACH subfield IN author.MARCAUTHOR_SUBFIELDS_LOOP %][% subfield.separator | html %][% subfield.value | html %][% END %][% UNLESS ( loop.last ) %];[% END %][% END %][% END %][% END %]" - "[% SET biblioitem = biblio.biblioitem %][% IF ( biblioitem.isbn ) %]ISBN: [% FOREACH isbn IN biblioitem.isbn %][% isbn | html %][% UNLESS ( loop.last ) %]; [% END %][% END %][% END %]" - "[% IF ( biblioitem.publishercode ) %]Published by: [% biblioitem.publishercode | html %][% IF ( biblioitem.publicationyear ) %] in [% biblioitem.publicationyear | html %][% END %][% IF ( biblioitem.pages ) %], [% biblioitem.pages | html %][% END %][% END %]" - "[% IF ( biblio.seriestitle ) %]Collection: [% biblio.seriestitle | html %][% END %]" -- 2.11.0