From ecd10c14f583d53a6be9fba3a2aafa576171aead 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 --- installer/data/mysql/atomicupdate/bug_24163.perl | 18 ++++++++++++++++++ installer/data/mysql/en/optional/csv_profiles.sql | 14 ++++++++++++-- 2 files changed, 30 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.sql b/installer/data/mysql/en/optional/csv_profiles.sql index 86c2394d76..0758ebe13e 100644 --- a/installer/data/mysql/en/optional/csv_profiles.sql +++ b/installer/data/mysql/en/optional/csv_profiles.sql @@ -1,2 +1,12 @@ -INSERT IGNORE INTO export_format( profile, description, content, csv_separator, type, used_for ) -VALUES ( "issues to claim", "default CSV export for serial issue claims", "SUPPLIER=aqbooksellers.name|TITLE=subscription.title|ISSUE NUMBER=serial.serialseq|LATE SINCE=serial.planneddate", ",", "sql", "late_issues" ); +INSERT IGNORE INTO export_format( profile, description, content, csv_separator, type, used_for ) VALUES +( "issues to claim", "default CSV export for serial issue claims", "SUPPLIER=aqbooksellers.name|TITLE=subscription.title|ISSUE NUMBER=serial.serialseq|LATE SINCE=serial.planneddate", ",", "sql", "late_issues" ), +("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"); -- 2.11.0