Lines 2855-2860
sub columns {
Link Here
|
2855 |
return @data; |
2855 |
return @data; |
2856 |
} |
2856 |
} |
2857 |
|
2857 |
|
|
|
2858 |
=head2 biblioitems_columns |
2859 |
|
2860 |
my @columns = C4::Items::biblioitems_columns(); |
2861 |
|
2862 |
Returns an array of biblioitems' table columns on success, |
2863 |
and an empty array on failure. |
2864 |
|
2865 |
=cut |
2866 |
|
2867 |
sub biblioitems_columns { |
2868 |
# Pure ANSI SQL goodness. |
2869 |
my $sql = 'SELECT * FROM biblioitems WHERE 1=0;'; |
2870 |
|
2871 |
# Get the database handle. |
2872 |
my $dbh = C4::Context->dbh; |
2873 |
|
2874 |
# Run the SQL statement to load STH's readonly properties. |
2875 |
my $sth = $dbh->prepare($sql); |
2876 |
my $rv = $sth->execute(); |
2877 |
|
2878 |
# This only fails if the table doesn't exist. |
2879 |
# This will always be called AFTER an install or upgrade, |
2880 |
# so borrowers will exist! |
2881 |
my @data; |
2882 |
if ($sth->{NUM_OF_FIELDS}>0) { |
2883 |
@data = @{$sth->{NAME}}; |
2884 |
} |
2885 |
else { |
2886 |
@data = (); |
2887 |
} |
2888 |
return @data; |
2889 |
} |
2890 |
|
2858 |
sub ToggleNewStatus { |
2891 |
sub ToggleNewStatus { |
2859 |
my ( $params ) = @_; |
2892 |
my ( $params ) = @_; |
2860 |
my @rules = @{ $params->{rules} }; |
2893 |
my @rules = @{ $params->{rules} }; |
Lines 2862-2868
sub ToggleNewStatus {
Link Here
|
2862 |
|
2895 |
|
2863 |
my $dbh = C4::Context->dbh; |
2896 |
my $dbh = C4::Context->dbh; |
2864 |
my @errors; |
2897 |
my @errors; |
2865 |
my @items_columns = C4::Items::columns; |
2898 |
my @item_columns = map { "items.$_" } C4::Items::columns; |
|
|
2899 |
my @biblioitem_columns = map { "biblioitems.$_" } C4::Items::biblioitems_columns; |
2866 |
my $report; |
2900 |
my $report; |
2867 |
for my $rule ( @rules ) { |
2901 |
for my $rule ( @rules ) { |
2868 |
my $duration = $rule->{duration}; |
2902 |
my $duration = $rule->{duration}; |
Lines 2870-2878
sub ToggleNewStatus {
Link Here
|
2870 |
my $substitutions = $rule->{substitutions}; |
2904 |
my $substitutions = $rule->{substitutions}; |
2871 |
my @params; |
2905 |
my @params; |
2872 |
|
2906 |
|
2873 |
my $query = q|SELECT biblionumber, itemnumber FROM items WHERE 1 |; |
2907 |
my $query = q| |
|
|
2908 |
SELECT items.biblionumber, items.itemnumber |
2909 |
FROM items |
2910 |
LEFT JOIN biblioitems ON items.biblioitemnumber = items.itemnumber |
2911 |
WHERE 1 |
2912 |
|; |
2874 |
for my $condition ( @$conditions ) { |
2913 |
for my $condition ( @$conditions ) { |
2875 |
if ( grep {/^$condition->{field}$/} @items_columns ) { |
2914 |
if ( |
|
|
2915 |
grep {/^$condition->{field}$/} @item_columns |
2916 |
or grep {/^$condition->{field}$/} @biblioitem_columns |
2917 |
) { |
2876 |
if ( $condition->{value} =~ /\|/ ) { |
2918 |
if ( $condition->{value} =~ /\|/ ) { |
2877 |
my @values = split /\|/, $condition->{value}; |
2919 |
my @values = split /\|/, $condition->{value}; |
2878 |
$query .= qq| AND $condition->{field} IN (| |
2920 |
$query .= qq| AND $condition->{field} IN (| |