Bugzilla – Attachment 34786 Details for
Bug 11023
Automatic item modification by age (Was "Toggle new status for items")
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11023: Use DBIx-Class to retrieve column names
Bug-11023-Use-DBIx-Class-to-retrieve-column-names.patch (text/plain), 2.29 KB, created by
Jonathan Druart
on 2014-12-29 10:22:28 UTC
(
hide
)
Description:
Bug 11023: Use DBIx-Class to retrieve column names
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-12-29 10:22:28 UTC
Size:
2.29 KB
patch
obsolete
>From 54d6ba448fd890be1f0bfabba1fa5c732ecef98e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 5 Mar 2014 11:06:41 +0100 >Subject: [PATCH] Bug 11023: Use DBIx-Class to retrieve column names > >--- > C4/Items.pm | 47 +++++------------------------------------------ > 1 file changed, 5 insertions(+), 42 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 962ea29..8e8cd16 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -35,6 +35,7 @@ use DateTime::Format::MySQL; > use Data::Dumper; # used as part of logging item record changes, not just for > # debugging; so please don't remove this > use Koha::DateUtils qw/dt_from_string/; >+use Koha::Database; > > use Koha::Database; > >@@ -3069,27 +3070,8 @@ and an empty array on failure. > =cut > > sub columns { >- # Pure ANSI SQL goodness. >- my $sql = 'SELECT * FROM items WHERE 1=0;'; >- >- # Get the database handle. >- my $dbh = C4::Context->dbh; >- >- # Run the SQL statement to load STH's readonly properties. >- my $sth = $dbh->prepare($sql); >- my $rv = $sth->execute(); >- >- # This only fails if the table doesn't exist. >- # This will always be called AFTER an install or upgrade, >- # so borrowers will exist! >- my @data; >- if ($sth->{NUM_OF_FIELDS}>0) { >- @data = @{$sth->{NAME}}; >- } >- else { >- @data = (); >- } >- return @data; >+ my $rs = Koha::Database->new->schema->resultset('Item'); >+ return $rs->result_source->columns; > } > > =head2 biblioitems_columns >@@ -3102,27 +3084,8 @@ and an empty array on failure. > =cut > > sub biblioitems_columns { >- # Pure ANSI SQL goodness. >- my $sql = 'SELECT * FROM biblioitems WHERE 1=0;'; >- >- # Get the database handle. >- my $dbh = C4::Context->dbh; >- >- # Run the SQL statement to load STH's readonly properties. >- my $sth = $dbh->prepare($sql); >- my $rv = $sth->execute(); >- >- # This only fails if the table doesn't exist. >- # This will always be called AFTER an install or upgrade, >- # so borrowers will exist! >- my @data; >- if ($sth->{NUM_OF_FIELDS}>0) { >- @data = @{$sth->{NAME}}; >- } >- else { >- @data = (); >- } >- return @data; >+ my $rs = Koha::Database->new->schema->resultset('Biblioitem'); >+ return $rs->result_source->columns; > } > > sub ToggleNewStatus { >-- >2.1.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 11023
:
21926
|
21932
|
21982
|
21983
|
22004
|
22386
|
22734
|
22735
|
24068
|
24069
|
24070
|
24146
|
24147
|
24148
|
25767
|
25833
|
26817
|
26818
|
26819
|
26820
|
26821
|
26822
|
26855
|
27810
|
29216
|
29217
|
29218
|
29219
|
29220
|
29221
|
29222
|
31820
|
31821
|
31822
|
33226
|
33227
|
33228
|
33229
|
33230
|
33231
|
33232
|
33233
|
33234
|
33235
|
34782
|
34783
|
34784
|
34785
|
34786
|
34787
|
34788
|
34789
|
34790
|
34791
|
34870
|
34871
|
34872
|
34873
|
34874
|
34875
|
34876
|
34877
|
34878
|
34879
|
34880
|
34881
|
34882
|
34883
|
35375
|
35376
|
41147
|
41148