Lines 35-40
use DateTime::Format::MySQL;
Link Here
|
35 |
use Data::Dumper; # used as part of logging item record changes, not just for |
35 |
use Data::Dumper; # used as part of logging item record changes, not just for |
36 |
# debugging; so please don't remove this |
36 |
# debugging; so please don't remove this |
37 |
use Koha::DateUtils qw/dt_from_string/; |
37 |
use Koha::DateUtils qw/dt_from_string/; |
|
|
38 |
use Koha::Database; |
38 |
|
39 |
|
39 |
use Koha::Database; |
40 |
use Koha::Database; |
40 |
|
41 |
|
Lines 3069-3095
and an empty array on failure.
Link Here
|
3069 |
=cut |
3070 |
=cut |
3070 |
|
3071 |
|
3071 |
sub columns { |
3072 |
sub columns { |
3072 |
# Pure ANSI SQL goodness. |
3073 |
my $rs = Koha::Database->new->schema->resultset('Item'); |
3073 |
my $sql = 'SELECT * FROM items WHERE 1=0;'; |
3074 |
return $rs->result_source->columns; |
3074 |
|
|
|
3075 |
# Get the database handle. |
3076 |
my $dbh = C4::Context->dbh; |
3077 |
|
3078 |
# Run the SQL statement to load STH's readonly properties. |
3079 |
my $sth = $dbh->prepare($sql); |
3080 |
my $rv = $sth->execute(); |
3081 |
|
3082 |
# This only fails if the table doesn't exist. |
3083 |
# This will always be called AFTER an install or upgrade, |
3084 |
# so borrowers will exist! |
3085 |
my @data; |
3086 |
if ($sth->{NUM_OF_FIELDS}>0) { |
3087 |
@data = @{$sth->{NAME}}; |
3088 |
} |
3089 |
else { |
3090 |
@data = (); |
3091 |
} |
3092 |
return @data; |
3093 |
} |
3075 |
} |
3094 |
|
3076 |
|
3095 |
=head2 biblioitems_columns |
3077 |
=head2 biblioitems_columns |
Lines 3102-3128
and an empty array on failure.
Link Here
|
3102 |
=cut |
3084 |
=cut |
3103 |
|
3085 |
|
3104 |
sub biblioitems_columns { |
3086 |
sub biblioitems_columns { |
3105 |
# Pure ANSI SQL goodness. |
3087 |
my $rs = Koha::Database->new->schema->resultset('Biblioitem'); |
3106 |
my $sql = 'SELECT * FROM biblioitems WHERE 1=0;'; |
3088 |
return $rs->result_source->columns; |
3107 |
|
|
|
3108 |
# Get the database handle. |
3109 |
my $dbh = C4::Context->dbh; |
3110 |
|
3111 |
# Run the SQL statement to load STH's readonly properties. |
3112 |
my $sth = $dbh->prepare($sql); |
3113 |
my $rv = $sth->execute(); |
3114 |
|
3115 |
# This only fails if the table doesn't exist. |
3116 |
# This will always be called AFTER an install or upgrade, |
3117 |
# so borrowers will exist! |
3118 |
my @data; |
3119 |
if ($sth->{NUM_OF_FIELDS}>0) { |
3120 |
@data = @{$sth->{NAME}}; |
3121 |
} |
3122 |
else { |
3123 |
@data = (); |
3124 |
} |
3125 |
return @data; |
3126 |
} |
3089 |
} |
3127 |
|
3090 |
|
3128 |
sub ToggleNewStatus { |
3091 |
sub ToggleNewStatus { |
3129 |
- |
|
|