Bugzilla – Attachment 50180 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: Koha::CsvProfiles - Remove GetCsvProfilesLoop
Bug-15451-KohaCsvProfiles---Remove-GetCsvProfilesL.patch (text/plain), 6.63 KB, created by
Jonathan Druart
on 2016-04-13 08:37:19 UTC
(
hide
)
Description:
Bug 15451: Koha::CsvProfiles - Remove GetCsvProfilesLoop
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-04-13 08:37:19 UTC
Size:
6.63 KB
patch
obsolete
>From b412935006c894dcbffe078c5bc83a3e1697d122 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 31 Dec 2015 10:32:35 +0000 >Subject: [PATCH] Bug 15451: Koha::CsvProfiles - Remove GetCsvProfilesLoop > >This subroutine returned the csv profiles for a given type. >This could be done easily with the new Koha::CsvProfiles->search method. > >Test plan: >To do at the OPAC and staff interface! >1/ Export a list using a CSV profile >2/ Export your CART using a CSV profile >Note that only MARC profiles should be available. >--- > C4/Csv.pm | 19 ------------------- > basket/basket.pl | 8 ++++---- > basket/downloadcart.pl | 8 +++++--- > opac/opac-downloadcart.pl | 8 +++++--- > opac/opac-downloadshelf.pl | 6 +++--- > virtualshelves/downloadshelf.pl | 6 +++--- > virtualshelves/shelves.pl | 4 +++- > 7 files changed, 23 insertions(+), 36 deletions(-) > >diff --git a/C4/Csv.pm b/C4/Csv.pm >index ce4693a..275fb49 100644 >--- a/C4/Csv.pm >+++ b/C4/Csv.pm >@@ -34,7 +34,6 @@ use vars qw(@ISA @EXPORT); > &GetCsvProfiles > &GetCsvProfile > &GetCsvProfileId >- &GetCsvProfilesLoop > &GetMarcFieldsForCsv > ); > >@@ -94,23 +93,5 @@ sub GetMarcFieldsForCsv { > > } > >-# Returns informations aboout csv profiles suitable for html templates >-sub GetCsvProfilesLoop { >- my ( $type ) = @_; >- # List of existing profiles >- my $dbh = C4::Context->dbh; >- my $sth; >- my $query = "SELECT export_format_id, profile FROM export_format"; >- if ( $type ) { >- $query .= " WHERE type = ?"; >- } >- >- $sth = $dbh->prepare($query); >- $sth->execute( $type ? $type : () ); >- return $sth->fetchall_arrayref({}); >- >-} >- >- > > 1; >diff --git a/basket/basket.pl b/basket/basket.pl >index 1dfbdb8..ec5e485 100755 >--- a/basket/basket.pl >+++ b/basket/basket.pl >@@ -16,15 +16,15 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > >-use strict; >-use warnings; >+use Modern::Perl; > use CGI qw ( -utf8 ); > use C4::Koha; > use C4::Biblio; > use C4::Items; > use C4::Auth; > use C4::Output; >-use C4::Csv; >+ >+use Koha::CsvProfiles; > > my $query = new CGI; > >@@ -121,7 +121,7 @@ my $resultsarray = \@results; > > $template->param( > BIBLIO_RESULTS => $resultsarray, >- csv_profiles => GetCsvProfilesLoop('marc'), >+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ], > bib_list => $bib_list, > ); > >diff --git a/basket/downloadcart.pl b/basket/downloadcart.pl >index 17e5617..0690da5 100755 >--- a/basket/downloadcart.pl >+++ b/basket/downloadcart.pl >@@ -17,8 +17,7 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-use warnings; >+use Modern::Perl; > > use CGI qw ( -utf8 ); > use Encode qw(encode); >@@ -30,6 +29,9 @@ use C4::Output; > use C4::Record; > use C4::Ris; > use C4::Csv; >+ >+use Koha::CsvProfiles; >+ > use utf8; > my $query = new CGI; > >@@ -89,7 +91,7 @@ if ($bib_list && $format) { > print $output; > > } else { >- $template->param(csv_profiles => GetCsvProfilesLoop('marc')); >+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]); > $template->param(bib_list => $bib_list); > output_html_with_http_headers $query, $cookie, $template->output; > } >diff --git a/opac/opac-downloadcart.pl b/opac/opac-downloadcart.pl >index c5574e3..ba4d4b2 100755 >--- a/opac/opac-downloadcart.pl >+++ b/opac/opac-downloadcart.pl >@@ -17,8 +17,7 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-use warnings; >+use Modern::Perl; > > use CGI qw ( -utf8 ); > use Encode qw(encode); >@@ -30,6 +29,9 @@ use C4::Output; > use C4::Record; > use C4::Ris; > use C4::Csv; >+ >+use Koha::CsvProfiles; >+ > use utf8; > my $query = new CGI; > >@@ -95,7 +97,7 @@ if ($bib_list && $format) { > print $output; > > } else { >- $template->param(csv_profiles => GetCsvProfilesLoop('marc')); >+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]); > $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 6102082..8413e75 100755 >--- a/opac/opac-downloadshelf.pl >+++ b/opac/opac-downloadshelf.pl >@@ -17,8 +17,7 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-use warnings; >+use Modern::Perl; > > use CGI qw ( -utf8 ); > use Encode qw(encode); >@@ -31,6 +30,7 @@ use C4::Record; > use C4::Ris; > use C4::Csv; > >+use Koha::CsvProfiles; > use Koha::Virtualshelves; > > use utf8; >@@ -118,7 +118,7 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { > } else { > $template->param(fullpage => 1); > } >- $template->param(csv_profiles => GetCsvProfilesLoop('marc')); >+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]); > $template->param( shelf => $shelf ); > output_html_with_http_headers $query, $cookie, $template->output; > } >diff --git a/virtualshelves/downloadshelf.pl b/virtualshelves/downloadshelf.pl >index 5a00694..3db362a 100755 >--- a/virtualshelves/downloadshelf.pl >+++ b/virtualshelves/downloadshelf.pl >@@ -17,8 +17,7 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-use warnings; >+use Modern::Perl; > > use CGI qw ( -utf8 ); > use Encode qw(encode); >@@ -31,6 +30,7 @@ use C4::Record; > use C4::Ris; > use C4::Csv; > >+use Koha::CsvProfiles; > use Koha::Virtualshelves; > > use utf8; >@@ -101,7 +101,7 @@ if ($shelfid && $format) { > $format = "csv" if ($format =~ m/^\d+$/); > } > else { >- $template->param(csv_profiles => GetCsvProfilesLoop('marc')); >+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]); > $template->param(shelfid => $shelfid); > } > $template->param( messages => \@messages ); >diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl >index eab6c17..06c40a3 100755 >--- a/virtualshelves/shelves.pl >+++ b/virtualshelves/shelves.pl >@@ -27,6 +27,8 @@ use C4::Items; > use C4::Members; > use C4::Output; > use C4::XSLT; >+ >+use Koha::CsvProfiles; > use Koha::Virtualshelves; > > my $query = new CGI; >@@ -303,7 +305,7 @@ $template->param( > messages => \@messages, > category => $category, > print => $query->param('print') || 0, >- csv_profiles => GetCsvProfilesLoop('marc'), >+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ], > ); > > output_html_with_http_headers $query, $cookie, $template->output; >-- >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