|
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 vars qw($VERSION @ISA @EXPORT); |
40 |
use vars qw($VERSION @ISA @EXPORT); |
| 40 |
|
41 |
|
|
Lines 2922-2948
and an empty array on failure.
Link Here
|
| 2922 |
=cut |
2923 |
=cut |
| 2923 |
|
2924 |
|
| 2924 |
sub columns { |
2925 |
sub columns { |
| 2925 |
# Pure ANSI SQL goodness. |
2926 |
my $rs = Koha::Database->new->schema->resultset('Item'); |
| 2926 |
my $sql = 'SELECT * FROM items WHERE 1=0;'; |
2927 |
return $rs->result_source->columns; |
| 2927 |
|
|
|
| 2928 |
# Get the database handle. |
| 2929 |
my $dbh = C4::Context->dbh; |
| 2930 |
|
| 2931 |
# Run the SQL statement to load STH's readonly properties. |
| 2932 |
my $sth = $dbh->prepare($sql); |
| 2933 |
my $rv = $sth->execute(); |
| 2934 |
|
| 2935 |
# This only fails if the table doesn't exist. |
| 2936 |
# This will always be called AFTER an install or upgrade, |
| 2937 |
# so borrowers will exist! |
| 2938 |
my @data; |
| 2939 |
if ($sth->{NUM_OF_FIELDS}>0) { |
| 2940 |
@data = @{$sth->{NAME}}; |
| 2941 |
} |
| 2942 |
else { |
| 2943 |
@data = (); |
| 2944 |
} |
| 2945 |
return @data; |
| 2946 |
} |
2928 |
} |
| 2947 |
|
2929 |
|
| 2948 |
=head2 biblioitems_columns |
2930 |
=head2 biblioitems_columns |
|
Lines 2955-2981
and an empty array on failure.
Link Here
|
| 2955 |
=cut |
2937 |
=cut |
| 2956 |
|
2938 |
|
| 2957 |
sub biblioitems_columns { |
2939 |
sub biblioitems_columns { |
| 2958 |
# Pure ANSI SQL goodness. |
2940 |
my $rs = Koha::Database->new->schema->resultset('Biblioitem'); |
| 2959 |
my $sql = 'SELECT * FROM biblioitems WHERE 1=0;'; |
2941 |
return $rs->result_source->columns; |
| 2960 |
|
|
|
| 2961 |
# Get the database handle. |
| 2962 |
my $dbh = C4::Context->dbh; |
| 2963 |
|
| 2964 |
# Run the SQL statement to load STH's readonly properties. |
| 2965 |
my $sth = $dbh->prepare($sql); |
| 2966 |
my $rv = $sth->execute(); |
| 2967 |
|
| 2968 |
# This only fails if the table doesn't exist. |
| 2969 |
# This will always be called AFTER an install or upgrade, |
| 2970 |
# so borrowers will exist! |
| 2971 |
my @data; |
| 2972 |
if ($sth->{NUM_OF_FIELDS}>0) { |
| 2973 |
@data = @{$sth->{NAME}}; |
| 2974 |
} |
| 2975 |
else { |
| 2976 |
@data = (); |
| 2977 |
} |
| 2978 |
return @data; |
| 2979 |
} |
2942 |
} |
| 2980 |
|
2943 |
|
| 2981 |
sub ToggleNewStatus { |
2944 |
sub ToggleNewStatus { |
| 2982 |
- |
|
|