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