From ab8c6d632e9a2a0fa2849e56f61bbab1b2614c14 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Thu, 27 Oct 2022 21:59:26 -1000 Subject: [PATCH] Bug 32029: Automatic item modifications by age add biblio table In automatic item modifications by age missing, conditions can be on columns of tables items or biblioitems. Table biblio is missing. Test plan : 1) Create an automatic item modifications by age with a condition on a column of biblio table 2) Create a record and item matching the rule 3) Run misc/cronjobs/automatic_item_modification_by_age.pl -c -v => Check only matching items are impacted Signed-off-by: Philip Orr --- C4/Items.pm | 3 +++ tools/automatic_item_modification_by_age.pl | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/C4/Items.pm b/C4/Items.pm index de776d5dfe..8c31fcb849 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1568,6 +1568,7 @@ sub ToggleNewStatus { my @errors; my @item_columns = map { "items.$_" } Koha::Items->columns; my @biblioitem_columns = map { "biblioitems.$_" } Koha::Biblioitems->columns; + my @biblio_columns = map { "biblio.$_" } Koha::Biblios->columns; my $report; for my $rule ( @rules ) { my $age = $rule->{age}; @@ -1585,6 +1586,7 @@ sub ToggleNewStatus { SELECT items.* FROM items LEFT JOIN biblioitems ON biblioitems.biblionumber = items.biblionumber + LEFT JOIN biblio ON biblio.biblionumber = biblioitems.biblionumber WHERE 1 |; for my $condition ( @$conditions ) { @@ -1592,6 +1594,7 @@ sub ToggleNewStatus { if ( grep { $_ eq $condition->{field} } @item_columns or grep { $_ eq $condition->{field} } @biblioitem_columns + or grep { $_ eq $condition->{field} } @biblio_columns ) { if ( $condition->{value} =~ /\|/ ) { my @values = split /\|/, $condition->{value}; diff --git a/tools/automatic_item_modification_by_age.pl b/tools/automatic_item_modification_by_age.pl index a3138091d3..2f4428b61e 100755 --- a/tools/automatic_item_modification_by_age.pl +++ b/tools/automatic_item_modification_by_age.pl @@ -42,6 +42,7 @@ use C4::Koha; use Koha::Items; use Koha::Biblioitems; +use Koha::Biblios; my $cgi = CGI->new; @@ -115,12 +116,13 @@ if ( $@ ) { my @item_fields = map { "items.$_" } Koha::Items->columns; my @biblioitem_fields = map { "biblioitems.$_" } Koha::Biblioitems->columns; +my @biblio_fields = map { "biblio.$_" } Koha::Biblios->columns; my @age_fields = ('items.dateaccessioned', 'items.replacementpricedate', 'items.datelastborrowed', 'items.datelastseen', 'items.damaged_on', 'items.itemlost_on', 'items.withdrawn_on'); $template->param( op => $op, messages => \@messages, agefields => [ @age_fields ], - condition_fields => [ @item_fields, @biblioitem_fields ], + condition_fields => [ @item_fields, @biblioitem_fields, @biblio_fields ], substitution_fields => \@item_fields, rules => $rules, ); -- 2.30.2