Bugzilla – Attachment 50185 Details for
Bug 15451
Move the CSV related code to Koha::CsvProfile[s]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15451: Do not considered a Resultset as a Result
Bug-15451-Do-not-considered-a-Resultset-as-a-Resul.patch (text/plain), 3.24 KB, created by
Jonathan Druart
on 2016-04-13 08:37:35 UTC
(
hide
)
Description:
Bug 15451: Do not considered a Resultset as a Result
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-04-13 08:37:35 UTC
Size:
3.24 KB
patch
obsolete
>From 33a598df2e10de9ec88ece61f57da3755fb42776 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 6 Jan 2016 08:58:13 +0000 >Subject: [PATCH] Bug 15451: Do not considered a Resultset as a Result > >The previous calls were wrong, but there is something bad with the DB >structure: export_format.profile should be a unique key. >This patch fixes the previous calls and add a FIXME not to forget to fix >the DB structure. >--- > Koha/Exporter/Record.pm | 7 ++++++- > misc/export_records.pl | 5 +++-- > tools/export.pl | 5 +++-- > 3 files changed, 12 insertions(+), 5 deletions(-) > >diff --git a/Koha/Exporter/Record.pm b/Koha/Exporter/Record.pm >index b043411..ef2a37d 100644 >--- a/Koha/Exporter/Record.pm >+++ b/Koha/Exporter/Record.pm >@@ -134,7 +134,12 @@ sub export { > print MARC::File::XML::footer(); > print "\n"; > } elsif ( $format eq 'csv' ) { >- $csv_profile_id ||= Koha::CsvProfiles->search({ profile => C4::Context->preference('ExportWithCsvProfile') })->export_format_id; >+ unless ( $csv_profile_id ) { >+ # FIXME export_format.profile should be a unique key >+ my $csv_profiles = Koha::CsvProfiles->search({ profile => C4::Context->preference('ExportWithCsvProfile') }); >+ die "The ExportWithCsvProfile system preference is not defined or does not match a valid csv profile" unless $csv_profiles->count; >+ $csv_profile_id = $csv_profiles->next->export_format_id; >+ } > print marc2csv( $record_ids, $csv_profile_id, $itemnumbers ); > } > >diff --git a/misc/export_records.pl b/misc/export_records.pl >index 3236a4f..59d0dfe 100755 >--- a/misc/export_records.pl >+++ b/misc/export_records.pl >@@ -196,8 +196,9 @@ if ($deleted_barcodes) { > } > else { > unless ( $csv_profile_id ) { >- my $default_csv_profile = Koha::CsvProfiles->search({ profile => C4::Context->preference('ExportWithCsvProfile') }); >- $csv_profile_id = $default_csv_profile ? $default_csv_profile->export_format_id : undef; >+ # FIXME export_format.profile should be a unique key >+ my $default_csv_profiles = Koha::CsvProfiles->search({ profile => C4::Context->preference('ExportWithCsvProfile') }); >+ $csv_profile_id = $default_csv_profiles->count ? $default_csv_profiles->next->export_format_id : undef; > } > Koha::Exporter::Record::export( > { record_type => $record_type, >diff --git a/tools/export.pl b/tools/export.pl >index a23eeb0..becc72d 100755 >--- a/tools/export.pl >+++ b/tools/export.pl >@@ -192,8 +192,9 @@ if ( $op eq "export" ) { > > my $csv_profile_id = $query->param('csv_profile_id'); > unless ( $csv_profile_id ) { >- my $default_csv_profile = Koha::CsvProfiles->search({ profile => C4::Context->preference('ExportWithCsvProfile') }); >- $csv_profile_id = $default_csv_profile ? $default_csv_profile->export_format_id : undef; >+ # FIXME export_format.profile should be a unique key >+ my $default_csv_profiles = Koha::CsvProfiles->search({ profile => C4::Context->preference('ExportWithCsvProfile') }); >+ $csv_profile_id = $default_csv_profiles->count ? $default_csv_profiles->next->export_format_id : undef; > } > > Koha::Exporter::Record::export( >-- >2.7.0
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 15451
:
46108
|
46109
|
46110
|
46111
|
46112
|
46113
|
46114
|
46306
|
50178
|
50179
|
50180
|
50181
|
50182
|
50183
|
50184
|
50185
|
50860
|
50861
|
50862
|
50863
|
50864
|
50865
|
50866
|
50867
|
50868
|
50985
|
53623
|
53624
|
53625
|
53626
|
53627
|
53628
|
53629
|
53630
|
53631
|
53641