Lines 2945-2950
sub columns {
Link Here
|
2945 |
return @data; |
2945 |
return @data; |
2946 |
} |
2946 |
} |
2947 |
|
2947 |
|
|
|
2948 |
=head2 biblioitems_columns |
2949 |
|
2950 |
my @columns = C4::Items::biblioitems_columns(); |
2951 |
|
2952 |
Returns an array of biblioitems' table columns on success, |
2953 |
and an empty array on failure. |
2954 |
|
2955 |
=cut |
2956 |
|
2957 |
sub biblioitems_columns { |
2958 |
# Pure ANSI SQL goodness. |
2959 |
my $sql = 'SELECT * FROM biblioitems WHERE 1=0;'; |
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 |
} |
2980 |
|
2948 |
sub ToggleNewStatus { |
2981 |
sub ToggleNewStatus { |
2949 |
my ( $params ) = @_; |
2982 |
my ( $params ) = @_; |
2950 |
my @rules = @{ $params->{rules} }; |
2983 |
my @rules = @{ $params->{rules} }; |
Lines 2952-2958
sub ToggleNewStatus {
Link Here
|
2952 |
|
2985 |
|
2953 |
my $dbh = C4::Context->dbh; |
2986 |
my $dbh = C4::Context->dbh; |
2954 |
my @errors; |
2987 |
my @errors; |
2955 |
my @items_columns = C4::Items::columns; |
2988 |
my @item_columns = map { "items.$_" } C4::Items::columns; |
|
|
2989 |
my @biblioitem_columns = map { "biblioitems.$_" } C4::Items::biblioitems_columns; |
2956 |
my $report; |
2990 |
my $report; |
2957 |
for my $rule ( @rules ) { |
2991 |
for my $rule ( @rules ) { |
2958 |
my $duration = $rule->{duration}; |
2992 |
my $duration = $rule->{duration}; |
Lines 2960-2968
sub ToggleNewStatus {
Link Here
|
2960 |
my $substitutions = $rule->{substitutions}; |
2994 |
my $substitutions = $rule->{substitutions}; |
2961 |
my @params; |
2995 |
my @params; |
2962 |
|
2996 |
|
2963 |
my $query = q|SELECT biblionumber, itemnumber FROM items WHERE 1 |; |
2997 |
my $query = q| |
|
|
2998 |
SELECT items.biblionumber, items.itemnumber |
2999 |
FROM items |
3000 |
LEFT JOIN biblioitems ON items.biblioitemnumber = items.itemnumber |
3001 |
WHERE 1 |
3002 |
|; |
2964 |
for my $condition ( @$conditions ) { |
3003 |
for my $condition ( @$conditions ) { |
2965 |
if ( grep {/^$condition->{field}$/} @items_columns ) { |
3004 |
if ( |
|
|
3005 |
grep {/^$condition->{field}$/} @item_columns |
3006 |
or grep {/^$condition->{field}$/} @biblioitem_columns |
3007 |
) { |
2966 |
if ( $condition->{value} =~ /\|/ ) { |
3008 |
if ( $condition->{value} =~ /\|/ ) { |
2967 |
my @values = split /\|/, $condition->{value}; |
3009 |
my @values = split /\|/, $condition->{value}; |
2968 |
$query .= qq| AND $condition->{field} IN (| |
3010 |
$query .= qq| AND $condition->{field} IN (| |