Lines 3092-3097
sub columns {
Link Here
|
3092 |
return @data; |
3092 |
return @data; |
3093 |
} |
3093 |
} |
3094 |
|
3094 |
|
|
|
3095 |
=head2 biblioitems_columns |
3096 |
|
3097 |
my @columns = C4::Items::biblioitems_columns(); |
3098 |
|
3099 |
Returns an array of biblioitems' table columns on success, |
3100 |
and an empty array on failure. |
3101 |
|
3102 |
=cut |
3103 |
|
3104 |
sub biblioitems_columns { |
3105 |
# Pure ANSI SQL goodness. |
3106 |
my $sql = 'SELECT * FROM biblioitems WHERE 1=0;'; |
3107 |
|
3108 |
# Get the database handle. |
3109 |
my $dbh = C4::Context->dbh; |
3110 |
|
3111 |
# Run the SQL statement to load STH's readonly properties. |
3112 |
my $sth = $dbh->prepare($sql); |
3113 |
my $rv = $sth->execute(); |
3114 |
|
3115 |
# This only fails if the table doesn't exist. |
3116 |
# This will always be called AFTER an install or upgrade, |
3117 |
# so borrowers will exist! |
3118 |
my @data; |
3119 |
if ($sth->{NUM_OF_FIELDS}>0) { |
3120 |
@data = @{$sth->{NAME}}; |
3121 |
} |
3122 |
else { |
3123 |
@data = (); |
3124 |
} |
3125 |
return @data; |
3126 |
} |
3127 |
|
3095 |
sub ToggleNewStatus { |
3128 |
sub ToggleNewStatus { |
3096 |
my ( $params ) = @_; |
3129 |
my ( $params ) = @_; |
3097 |
my @rules = @{ $params->{rules} }; |
3130 |
my @rules = @{ $params->{rules} }; |
Lines 3099-3105
sub ToggleNewStatus {
Link Here
|
3099 |
|
3132 |
|
3100 |
my $dbh = C4::Context->dbh; |
3133 |
my $dbh = C4::Context->dbh; |
3101 |
my @errors; |
3134 |
my @errors; |
3102 |
my @items_columns = C4::Items::columns; |
3135 |
my @item_columns = map { "items.$_" } C4::Items::columns; |
|
|
3136 |
my @biblioitem_columns = map { "biblioitems.$_" } C4::Items::biblioitems_columns; |
3103 |
my $report; |
3137 |
my $report; |
3104 |
for my $rule ( @rules ) { |
3138 |
for my $rule ( @rules ) { |
3105 |
my $duration = $rule->{duration}; |
3139 |
my $duration = $rule->{duration}; |
Lines 3107-3115
sub ToggleNewStatus {
Link Here
|
3107 |
my $substitutions = $rule->{substitutions}; |
3141 |
my $substitutions = $rule->{substitutions}; |
3108 |
my @params; |
3142 |
my @params; |
3109 |
|
3143 |
|
3110 |
my $query = q|SELECT biblionumber, itemnumber FROM items WHERE 1 |; |
3144 |
my $query = q| |
|
|
3145 |
SELECT items.biblionumber, items.itemnumber |
3146 |
FROM items |
3147 |
LEFT JOIN biblioitems ON items.biblioitemnumber = items.itemnumber |
3148 |
WHERE 1 |
3149 |
|; |
3111 |
for my $condition ( @$conditions ) { |
3150 |
for my $condition ( @$conditions ) { |
3112 |
if ( grep {/^$condition->{field}$/} @items_columns ) { |
3151 |
if ( |
|
|
3152 |
grep {/^$condition->{field}$/} @item_columns |
3153 |
or grep {/^$condition->{field}$/} @biblioitem_columns |
3154 |
) { |
3113 |
if ( $condition->{value} =~ /\|/ ) { |
3155 |
if ( $condition->{value} =~ /\|/ ) { |
3114 |
my @values = split /\|/, $condition->{value}; |
3156 |
my @values = split /\|/, $condition->{value}; |
3115 |
$query .= qq| AND $condition->{field} IN (| |
3157 |
$query .= qq| AND $condition->{field} IN (| |