Bug 42746: Sanitize age_field
Signed-off-by: Sanjar Tulkinov Anvar o'g'li <sanjarbiy11@gmail.com> Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
This commit is contained in:
parent
5e3741d0e5
commit
2b52eb2bcb
|
|
@ -56,7 +56,14 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
|||
}
|
||||
);
|
||||
|
||||
my $op = $cgi->param('op') // 'show';
|
||||
my $op = $cgi->param('op') // 'show';
|
||||
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 @allowed_age_fields = (
|
||||
'items.dateaccessioned', 'items.replacementpricedate', 'items.datelastborrowed', 'items.datelastseen',
|
||||
'items.damaged_on', 'items.itemlost_on', 'items.withdrawn_on'
|
||||
);
|
||||
|
||||
my $syspref_name = q|automatic_item_modification_by_age_configuration|;
|
||||
if ( $op eq 'cud-update' ) {
|
||||
|
|
@ -89,6 +96,7 @@ if ( $op eq 'cud-update' ) {
|
|||
$rule->{age} = $cgi->param("age_$unique_id");
|
||||
|
||||
for my $age_field (@age_fields) {
|
||||
next unless grep { $_ eq $age_field } @allowed_age_fields;
|
||||
$rule->{agefield} = $age_field ? $age_field : "items.dateaccessioned";
|
||||
}
|
||||
push @rules, $rule;
|
||||
|
|
@ -114,17 +122,10 @@ if ($@) {
|
|||
exit;
|
||||
}
|
||||
|
||||
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],
|
||||
agefields => [@allowed_age_fields],
|
||||
condition_fields => [ @item_fields, @biblioitem_fields, @biblio_fields ],
|
||||
substitution_fields => \@item_fields,
|
||||
rules => $rules,
|
||||
|
|
|
|||
Loading…
Reference in New Issue