Lines 59-72
sub get_fields {
Link Here
|
59 |
if ( $syspref ) { |
59 |
if ( $syspref ) { |
60 |
my @ret; |
60 |
my @ret; |
61 |
my @spfields = split ('\|', $syspref); |
61 |
my @spfields = split ('\|', $syspref); |
62 |
my $dbh=C4::Context->dbh; |
62 |
my $schema = Koha::Database->new()->schema(); |
63 |
my $sth = $dbh->prepare('SHOW COLUMNS FROM items'); |
63 |
my @columns = $schema->source('Item')->columns; |
64 |
$sth->execute; |
|
|
65 |
my $dbfields = $sth->fetchall_hashref('Field'); |
66 |
$sth->finish(); |
67 |
|
64 |
|
68 |
foreach my $fn ( @spfields ) { |
65 |
foreach my $fn ( @spfields ) { |
69 |
push ( @ret, $fn ) if ( $dbfields->{ $fn } ); |
66 |
push ( @ret, $fn ) if ( grep(/^$fn$/, @columns) ); |
70 |
} |
67 |
} |
71 |
$ret = join( '|', @ret); |
68 |
$ret = join( '|', @ret); |
72 |
} |
69 |
} |
73 |
- |
|
|