Bugzilla – Attachment 63911 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]
Bug 8612: [Follow-up] Make usage and type different columns in table
Bug-8612-Follow-up-Make-usage-and-type-different-c.patch (text/plain), 13.95 KB, created by
Marcel de Rooy
on 2017-06-02 06:53:48 UTC
(
hide
)
Description:
Bug 8612: [Follow-up] Make usage and type different columns in table
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-06-02 06:53:48 UTC
Size:
13.95 KB
patch
obsolete
>From 45afa19c2213da97a2c246d592ab64561758c068 Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Mon, 20 Mar 2017 11:12:54 +0000 >Subject: [PATCH] Bug 8612: [Follow-up] Make usage and type different columns > in table >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > acqui/basket.pl | 2 +- > basket/basket.pl | 2 +- > basket/downloadcart.pl | 2 +- > installer/data/mysql/atomicupdate/bug_8612.sql | 5 ++- > installer/data/mysql/kohastructure.sql | 1 + > .../prog/en/modules/tools/csv-profiles.tt | 45 +++++++++++++++++++--- > opac/opac-downloadcart.pl | 2 +- > opac/opac-downloadshelf.pl | 2 +- > serials/claims.pl | 2 +- > t/db_dependent/Koha/CsvProfiles.t | 5 ++- > tools/csv-profiles.pl | 6 +++ > tools/export.pl | 2 +- > virtualshelves/downloadshelf.pl | 2 +- > virtualshelves/shelves.pl | 2 +- > 14 files changed, 62 insertions(+), 18 deletions(-) > >diff --git a/acqui/basket.pl b/acqui/basket.pl >index 779d64b..244e471 100755 >--- a/acqui/basket.pl >+++ b/acqui/basket.pl >@@ -431,7 +431,7 @@ if ( $op eq 'list' ) { > unclosable => @orders ? $basket->{is_standing} : 1, > has_budgets => $has_budgets, > duplinbatch => $duplinbatch, >- csv_profiles => [ Koha::CsvProfiles->search({ type => 'export_basket' }) ], >+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' }) ], > ); > } > >diff --git a/basket/basket.pl b/basket/basket.pl >index 62a37ab..14f661f 100755 >--- a/basket/basket.pl >+++ b/basket/basket.pl >@@ -122,7 +122,7 @@ my $resultsarray = \@results; > > $template->param( > BIBLIO_RESULTS => $resultsarray, >- csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ], >+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ], > bib_list => $bib_list, > ); > >diff --git a/basket/downloadcart.pl b/basket/downloadcart.pl >index f5cec95..278b2c7 100755 >--- a/basket/downloadcart.pl >+++ b/basket/downloadcart.pl >@@ -90,7 +90,7 @@ if ($bib_list && $format) { > print $output; > > } else { >- $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]); >+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]); > $template->param(bib_list => $bib_list); > output_html_with_http_headers $query, $cookie, $template->output; > } >diff --git a/installer/data/mysql/atomicupdate/bug_8612.sql b/installer/data/mysql/atomicupdate/bug_8612.sql >index 37a643b..4e0ea01 100644 >--- a/installer/data/mysql/atomicupdate/bug_8612.sql >+++ b/installer/data/mysql/atomicupdate/bug_8612.sql >@@ -1 +1,4 @@ >-UPDATE export_format SET type = 'late_issues' WHERE type ='sql'; >+ALTER TABLE export_format ADD used_for varchar(255) DEFAULT 'export_records' AFTER type; >+ >+UPDATE export_format SET used_for = 'late_issues' WHERE type = 'sql'; >+UPDATE export_format SET used_for = 'export_records' WHERE type = 'marc'; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index c293b79..85b286d 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -718,6 +718,7 @@ CREATE TABLE `export_format` ( > `subfield_separator` varchar(2) NOT NULL, > `encoding` varchar(255) NOT NULL, > `type` varchar(255) DEFAULT 'marc', >+ `used_for` varchar(255) DEFAULT 'export_records', > PRIMARY KEY (`export_format_id`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Used for CSV export'; > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt >index 38d8269..d6d2d4c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt >@@ -102,10 +102,17 @@ function reloadPage(p) { > [% END %] > > [% BLOCK type_description %] >- [% IF type_code == 'marc' %] MARC for export records >- [% ELSIF type_code == 'late_issues' %] SQL for late serial issues claims >- [% ELSIF type_code == 'export_basket' %] SQL for basket export in acquisition >- [% ELSE %] Uknown type >+ [% IF type_code == 'marc' %] MARC >+ [% ELSIF type_code == 'sql' %] SQL >+ [% ELSE %] Unknown type >+ [% END %] >+[% END %] >+ >+[% BLOCK used_for_description %] >+ [% IF used_for_code == 'export_records' %] Export records >+ [% ELSIF used_for_code == 'late_issues' %] Late serial issues claims >+ [% ELSIF used_for_code == 'export_basket' %] Basket export in acquisition >+ [% ELSE %] Unknown usage > [% END %] > [% END %] > >@@ -132,7 +139,7 @@ function reloadPage(p) { > <li> > <label for="type" class="required">Profile type: </label> > <select id="type" name="type"> >- [% FOREACH type IN [ 'marc' 'late_issues' 'export_basket'] %] >+ [% FOREACH type IN [ 'marc' 'sql'] %] > [% IF csv_profile.type == type %] > <option value="[% type %]" selected="selected">[% PROCESS type_description type_code = type %]</option> > [% ELSE %] >@@ -142,6 +149,30 @@ function reloadPage(p) { > </select> > <span class="required">Required</span> > </li> >+ <li class="sql_specific"> >+ <label for="used_for_sql">Usage: </label> >+ <select id="used_for_sql" name="used_for_sql"> >+ [% FOREACH used_for IN [ 'late_issues' 'export_basket' ] %] >+ [% IF csv_profile.used_for == used_for %] >+ <option value="[% used_for %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option> >+ [% ELSE %] >+ <option value="[% used_for %]">[% PROCESS used_for_description used_for_code = used_for %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ <li class="marc_specific"> >+ <label for="used_for_marc">Usage: </label> >+ <select id="used_for_marc" name="used_for_marc"> >+ [% FOREACH used_for IN [ 'export_records' ] %] >+ [% IF csv_profile.used_for == used_for %] >+ <option value="[% used_for %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option> >+ [% ELSE %] >+ <option value="[% used_for %]">[% PROCESS used_for_description used_for_code = used_for %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> > <li> > <label for="description">Profile description: </label> > <textarea cols="50" rows="2" name="description" id="description">[% csv_profile.description %]</textarea> >@@ -233,7 +264,7 @@ function reloadPage(p) { > > <h2>CSV profiles</h2> > >- [% IF csv_profiles%] >+ [% IF csv_profiles %] > <table id="table_csv_profiles"> > <thead> > <th>CSV profile ID</th> >@@ -242,6 +273,7 @@ function reloadPage(p) { > <th>Content</th> > <th>CSV separator</th> > <th>CSV type</th> >+ <th>Usage</th> > <th> </th> > <th> </th> > </thead> >@@ -254,6 +286,7 @@ function reloadPage(p) { > <td>[% csv_profile.content %]</td> > <td>[% csv_profile.csv_separator %]</td> > <td>[% PROCESS type_description type_code = csv_profile.type %]</td> >+ <td>[% PROCESS used_for_description used_for_code = csv_profile.used_for %]</td> > <td><a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=[% csv_profile.export_format_id %]">Edit</a></td> > <td><a href="/cgi-bin/koha/tools/csv-profiles.pl?op=delete_confirm&export_format_id=[% csv_profile.export_format_id %]">Delete</a></td> > </tr> >diff --git a/opac/opac-downloadcart.pl b/opac/opac-downloadcart.pl >index 75ab4a1..d20000e 100755 >--- a/opac/opac-downloadcart.pl >+++ b/opac/opac-downloadcart.pl >@@ -111,7 +111,7 @@ if ($bib_list && $format) { > print $output; > > } else { >- $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]); >+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]); > $template->param(bib_list => $bib_list); > output_html_with_http_headers $query, $cookie, $template->output; > } >diff --git a/opac/opac-downloadshelf.pl b/opac/opac-downloadshelf.pl >index 51769c4..b91f3a3 100755 >--- a/opac/opac-downloadshelf.pl >+++ b/opac/opac-downloadshelf.pl >@@ -129,7 +129,7 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { > } else { > $template->param(fullpage => 1); > } >- $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]); >+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]); > $template->param( shelf => $shelf ); > output_html_with_http_headers $query, $cookie, $template->output; > } >diff --git a/serials/claims.pl b/serials/claims.pl >index fbf7743..44cff74 100755 >--- a/serials/claims.pl >+++ b/serials/claims.pl >@@ -104,7 +104,7 @@ $template->param( > supplierid => $supplierid, > claimletter => $claimletter, > additional_fields_for_subscription => $additional_fields, >- csv_profiles => [ Koha::CsvProfiles->search({ type => 'late_issues' }) ], >+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_issues' }) ], > letters => $letters, > (uc(C4::Context->preference("marcflavour"))) => 1 > ); >diff --git a/t/db_dependent/Koha/CsvProfiles.t b/t/db_dependent/Koha/CsvProfiles.t >index aee3152..8b021b1 100644 >--- a/t/db_dependent/Koha/CsvProfiles.t >+++ b/t/db_dependent/Koha/CsvProfiles.t >@@ -35,12 +35,13 @@ my $nb_of_csv_profiles = Koha::CsvProfiles->search->count; > my $new_csv_profile_1 = Koha::CsvProfile->new({ > profile => 'my_csv_profile_name_for_test_1', > description => 'my_csv_profile_description_for_test_1', >- type => 'late_issues' >+ type => 'sql', >+ used_for => 'late_issues' > })->store; > my $new_csv_profile_2 = Koha::CsvProfile->new({ > profile => 'my_csv_profile_name_for_test_2', > description => 'my_csv_profile_description_for_test_2', >- type => 'marc', >+ type => 'marc' > })->store; > > like( $new_csv_profile_1->export_format_id, qr|^\d+$|, 'Adding a new csv_profile should have set the export_format_id'); >diff --git a/tools/csv-profiles.pl b/tools/csv-profiles.pl >index a9b8525..dd09677 100755 >--- a/tools/csv-profiles.pl >+++ b/tools/csv-profiles.pl >@@ -72,6 +72,10 @@ if ( $op eq 'add_form' ) { > my $profile = $input->param("profile"); > my $description = $input->param("description"); > my $type = $input->param("type"); >+ my $used_for = >+ $type eq "marc" >+ ? $input->param("used_for_marc") >+ : $input->param("used_for_sql"); > my $content = > $type eq "marc" > ? $input->param("marc_content") >@@ -92,6 +96,7 @@ if ( $op eq 'add_form' ) { > $csv_profile->subfield_separator($subfield_separator); > $csv_profile->encoding($encoding); > $csv_profile->type($type); >+ $csv_profile->used_for($used_for); > eval { $csv_profile->store; }; > > if ($@) { >@@ -109,6 +114,7 @@ if ( $op eq 'add_form' ) { > subfield_separator => $subfield_separator, > encoding => $encoding, > type => $type, >+ used_for => $used_for, > } > ); > eval { $csv_profile->store; }; >diff --git a/tools/export.pl b/tools/export.pl >index 0165cf1..4c9605b 100755 >--- a/tools/export.pl >+++ b/tools/export.pl >@@ -300,7 +300,7 @@ else { > itemtypes => $itemtypes, > authority_types => $authority_types, > export_remove_fields => C4::Context->preference("ExportRemoveFields"), >- csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ], >+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ], > messages => \@messages, > ); > >diff --git a/virtualshelves/downloadshelf.pl b/virtualshelves/downloadshelf.pl >index 5a9f440..9faf4ad 100755 >--- a/virtualshelves/downloadshelf.pl >+++ b/virtualshelves/downloadshelf.pl >@@ -101,7 +101,7 @@ if ($shelfid && $format) { > } > } > else { >- $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]); >+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]); > $template->param(shelfid => $shelfid); > } > $template->param( messages => \@messages ); >diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl >index c328869..06d93d2 100755 >--- a/virtualshelves/shelves.pl >+++ b/virtualshelves/shelves.pl >@@ -324,7 +324,7 @@ $template->param( > messages => \@messages, > category => $category, > print => scalar $query->param('print') || 0, >- csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ], >+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ], > ); > > output_html_with_http_headers $query, $cookie, $template->output; >-- >2.1.4
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