Lines 2908-2913
sub columns {
Link Here
|
2908 |
return @data; |
2908 |
return @data; |
2909 |
} |
2909 |
} |
2910 |
|
2910 |
|
|
|
2911 |
=head2 biblioitems_columns |
2912 |
|
2913 |
my @columns = C4::Items::biblioitems_columns(); |
2914 |
|
2915 |
Returns an array of biblioitems' table columns on success, |
2916 |
and an empty array on failure. |
2917 |
|
2918 |
=cut |
2919 |
|
2920 |
sub biblioitems_columns { |
2921 |
# Pure ANSI SQL goodness. |
2922 |
my $sql = 'SELECT * FROM biblioitems WHERE 1=0;'; |
2923 |
|
2924 |
# Get the database handle. |
2925 |
my $dbh = C4::Context->dbh; |
2926 |
|
2927 |
# Run the SQL statement to load STH's readonly properties. |
2928 |
my $sth = $dbh->prepare($sql); |
2929 |
my $rv = $sth->execute(); |
2930 |
|
2931 |
# This only fails if the table doesn't exist. |
2932 |
# This will always be called AFTER an install or upgrade, |
2933 |
# so borrowers will exist! |
2934 |
my @data; |
2935 |
if ($sth->{NUM_OF_FIELDS}>0) { |
2936 |
@data = @{$sth->{NAME}}; |
2937 |
} |
2938 |
else { |
2939 |
@data = (); |
2940 |
} |
2941 |
return @data; |
2942 |
} |
2943 |
|
2911 |
sub ToggleNewStatus { |
2944 |
sub ToggleNewStatus { |
2912 |
my ( $params ) = @_; |
2945 |
my ( $params ) = @_; |
2913 |
my @rules = @{ $params->{rules} }; |
2946 |
my @rules = @{ $params->{rules} }; |
Lines 2915-2921
sub ToggleNewStatus {
Link Here
|
2915 |
|
2948 |
|
2916 |
my $dbh = C4::Context->dbh; |
2949 |
my $dbh = C4::Context->dbh; |
2917 |
my @errors; |
2950 |
my @errors; |
2918 |
my @items_columns = C4::Items::columns; |
2951 |
my @item_columns = map { "items.$_" } C4::Items::columns; |
|
|
2952 |
my @biblioitem_columns = map { "biblioitems.$_" } C4::Items::biblioitems_columns; |
2919 |
my $report; |
2953 |
my $report; |
2920 |
for my $rule ( @rules ) { |
2954 |
for my $rule ( @rules ) { |
2921 |
my $duration = $rule->{duration}; |
2955 |
my $duration = $rule->{duration}; |
Lines 2923-2931
sub ToggleNewStatus {
Link Here
|
2923 |
my $substitutions = $rule->{substitutions}; |
2957 |
my $substitutions = $rule->{substitutions}; |
2924 |
my @params; |
2958 |
my @params; |
2925 |
|
2959 |
|
2926 |
my $query = q|SELECT biblionumber, itemnumber FROM items WHERE 1 |; |
2960 |
my $query = q| |
|
|
2961 |
SELECT items.biblionumber, items.itemnumber |
2962 |
FROM items |
2963 |
LEFT JOIN biblioitems ON items.biblioitemnumber = items.itemnumber |
2964 |
WHERE 1 |
2965 |
|; |
2927 |
for my $condition ( @$conditions ) { |
2966 |
for my $condition ( @$conditions ) { |
2928 |
if ( grep {/^$condition->{field}$/} @items_columns ) { |
2967 |
if ( |
|
|
2968 |
grep {/^$condition->{field}$/} @item_columns |
2969 |
or grep {/^$condition->{field}$/} @biblioitem_columns |
2970 |
) { |
2929 |
if ( $condition->{value} =~ /\|/ ) { |
2971 |
if ( $condition->{value} =~ /\|/ ) { |
2930 |
my @values = split /\|/, $condition->{value}; |
2972 |
my @values = split /\|/, $condition->{value}; |
2931 |
$query .= qq| AND $condition->{field} IN (| |
2973 |
$query .= qq| AND $condition->{field} IN (| |