Bugzilla – Attachment 11514 Details for
Bug 8612
CSV export profile to have custom fields in export csv basket
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch that adds new syspref and uses it
0001-CustomFieldsInBasketExport.patch (text/plain), 5.47 KB, created by
Maxime Pelletier
on 2012-08-09 21:36:48 UTC
(
hide
)
Description:
patch that adds new syspref and uses it
Filename:
MIME Type:
Creator:
Maxime Pelletier
Created:
2012-08-09 21:36:48 UTC
Size:
5.47 KB
patch
obsolete
>From 67d4ed2b5a1a333b7b3c551ae1a3120242537f5c Mon Sep 17 00:00:00 2001 >From: Maxime Pelletier <maxime.pelletier@libeo.com> >Date: Mon, 14 May 2012 14:07:24 -0400 >Subject: [PATCH] Bug 8612 New syspref to configure fields for the basket export >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >New syspref to configure fields for the basket export > >--- > C4/Acquisition.pm | 45 +++++++++---------- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 7 +++ > .../en/modules/admin/preferences/acquisitions.pref | 4 ++ > 4 files changed, 33 insertions(+), 24 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 2e3fb00..44e10e5 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -237,40 +237,37 @@ sub GetBasketAsCSV { > my $csv = Text::CSV->new(); > my $output; > >+ my $fields = C4::Context->preference("BasketExportFields"); >+ my @fields = split(/,/, $fields); >+ > # TODO: Translate headers >- my @headers = qw(contractname ordernumber entrydate isbn author title publishercode collectiontitle notes quantity rrp); >+ my @headers = 'contractname'; >+ push @headers, @fields; > >- $csv->combine(@headers); >- $output = $csv->string() . "\n"; >+ $csv->combine(@headers); >+ $output = $csv->string() . "\n"; > > my @rows; > foreach my $order (@orders) { >- my @cols; >- # newlines are not valid characters for Text::CSV combine() >+ my @cols; >+ # newlines are not valid characters for Text::CSV combine() > $order->{'notes'} =~ s/[\r\n]+//g; >- push(@cols, >- $contract->{'contractname'}, >- $order->{'ordernumber'}, >- $order->{'entrydate'}, >- $order->{'isbn'}, >- $order->{'author'}, >- $order->{'title'}, >- $order->{'publishercode'}, >- $order->{'collectiontitle'}, >- $order->{'notes'}, >- $order->{'quantity'}, >- $order->{'rrp'}, >- ); >- push (@rows, \@cols); >+ push(@cols, $contract->{'contractname'}); >+ foreach my $fieldName (@fields) { #Add value from orders for each fields set in the sysprefs >+ #Strip trailing and ending whitespaces >+ $fieldName =~ s/^\s+//; >+ $fieldName =~ s/\s+$//; >+ push @cols, $order->{$fieldName}; >+ } >+ push (@rows, \@cols); > } > > foreach my $row (@rows) { >- $csv->combine(@$row); >- $output .= $csv->string() . "\n"; >- >+ $csv->combine(@$row); >+ $output .= $csv->string() . "\n"; > } >- >- return $output; >+ >+ return $output; > > } > >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 05a3261..000391d 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -365,3 +365,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' > INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsIntranet', '1', NULL , 'Allow holds to be suspended from the intranet.', 'YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsOpac', '1', NULL , 'Allow holds to be suspended from the OPAC.', 'YesNo'); >+INSERT INTO systempreferences (variable, value) VALUES ('BasketExportFields', 'ordernumber,entrydate,isbn,author,title,publishercode,collectiontitle,notes,quantity,rrp'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 2d4d2ab..4850c2e 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5249,6 +5249,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = 'XXX'; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do("INSERT INTO systempreferences (variable, value) VALUES ('BasketExportFields', 'ordernumber,entrydate,isbn,author,title,publishercode,collectiontitle,notes,quantity,rrp');"); >+ print "Upgrade to $DBversion done (Add BasketExportFields syspref)\n"; >+ SetVersion ($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >index ebae997..a5a32a1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >@@ -19,6 +19,10 @@ Acquisitions: > 1: always ask for confirmation. > 2: do not ask for confirmation. > - >+ - Fields shown when exporting a basket. Fields from these tables are allowed : biblio, biblioitems, aqorders and aqbudgets >+ - pref: BasketExportFields >+ class: multi >+ - > - Show baskets > - pref: AcqViewBaskets > choices: >-- >1.7.2.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8612
:
11514
|
36860
|
37289
|
37293
|
41224
|
41225
|
41226
|
41227
|
42532
|
42533
|
42534
|
47591
|
47592
|
47593
|
56222
|
56223
|
56224
|
56225
|
57012
|
57013
|
57024
|
57025
|
57026
|
57027
|
57028
|
57029
|
57079
|
58073
|
58074
|
58075
|
58076
|
58077
|
58078
|
58079
|
58985
|
58986
|
58987
|
58988
|
58989
|
58990
|
58991
|
58992
|
59757
|
60480
|
61264
|
61265
|
61266
|
61267
|
61405
|
61520
|
63048
|
63049
|
63050
|
63051
|
63052
|
63053
|
63054
|
63055
|
63056
|
63104
|
63158
|
63279
|
63910
|
63911
|
63912
|
63913
|
63914
|
63915
|
63964
|
63966