From dfb1f55a90ab7c105218caadc5e0af80c79aef39 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 18 Dec 2019 17:32:46 +0100 Subject: [PATCH] Bug 24163: Add the csv into the DB - as an example Sponsored-by: Institute of Technology Tralee Signed-off-by: David Nind Signed-off-by: Angela O'Connor Desmond --- installer/data/mysql/atomicupdate/bug_24163.perl | 18 ++++++++++++++++++ installer/data/mysql/en/optional/csv_profiles.yml | 21 +++++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_24163.perl diff --git a/installer/data/mysql/atomicupdate/bug_24163.perl b/installer/data/mysql/atomicupdate/bug_24163.perl new file mode 100644 index 0000000000..f595db9102 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_24163.perl @@ -0,0 +1,18 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + INSERT IGNORE INTO export_format( profile, description, content, csv_separator, type, used_for ) VALUES + ("Late orders (csv profile)", "default CSV export for late orders", 'Title[% separator %]Author[% separator %]Publication year[% separator %]ISBN[% separator %]Quantity[% separator %]Number of claims + [% FOR order IN orders ~%] + [%~ SET biblio = order.biblio ~%] + "[% biblio.title %]"[% separator ~%] + "[% biblio.author %]"[% separator ~%] + "[% bibio.biblioitem.publicationyear %]"[% separator ~%] + "[% biblio.biblioitem.isbn %]"[% separator ~%] + "[% order.quantity%]"[% separator ~%] + "[% order.claims.count%][% IF order.claims.count %]([% FOR c IN order.claims %][% c.claimed_on | $KohaDates %][% UNLESS loop.last %], [% END %][% END %])[% END %]" + [% END %]', ",", "sql", "late_orders") + }); + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 24163 - Define a default CSV profile for late orders)\n"; +} diff --git a/installer/data/mysql/en/optional/csv_profiles.yml b/installer/data/mysql/en/optional/csv_profiles.yml index 2ef57b129b..a4862ac2c5 100644 --- a/installer/data/mysql/en/optional/csv_profiles.yml +++ b/installer/data/mysql/en/optional/csv_profiles.yml @@ -25,11 +25,28 @@ description: tables: - export_format: translatable: [ profile, description ] - multiline: [] + multiline: [ content ] rows: - profile: "issues to claim" description: "default CSV export for serial issue claims" - content: "SUPPLIER=aqbooksellers.name|TITLE=subscription.title|ISSUE NUMBER=serial.serialseq|LATE SINCE=serial.planneddate" + content: + - "SUPPLIER=aqbooksellers.name|TITLE=subscription.title|ISSUE NUMBER=serial.serialseq|LATE SINCE=serial.planneddate" csv_separator: "," type: sql used_for: late_issues + - profile: "Late orders (csv profile)" + description: "default CSV export for late orders" + content: + - 'Title[% separator %]Author[% separator %]Publication year[% separator %]ISBN[% separator %]Quantity[% separator %]Number of claims' + - '[% FOR order IN orders ~%]' + - '[%~ SET biblio = order.biblio ~%]' + - '"[% biblio.title %]"[% separator ~%]' + - '"[% biblio.author %]"[% separator ~%]' + - '"[% bibio.biblioitem.publicationyear %]"[% separator ~%]' + - '"[% biblio.biblioitem.isbn %]"[% separator ~%]' + - '"[% order.quantity%]"[% separator ~%]' + - '"[% order.claims.count%][% IF order.claims.count %]([% FOR c IN order.claims %][% c.claimed_on | $KohaDates %][% UNLESS loop.last %], [% END %][% END %])[% END %]"' + - '[% END %]' + csv_separator: "," + type: sql + used_for: late_orders -- 2.11.0