Bug 35044: Update: Order baskets

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqbasket':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new basket, visit:
/cgi-bin/koha/acqui/basketheader.pl?booksellerid=1&op=add_form
2) Fill in name and all additional fields, click the '+New' and 'Clear'
   links,  hit 'Save'
3) Notice the basket screen shows repeated fields separated by comma.
4) Notice that only non-null additional fields labels are shown.
5) Edit the basket. Notice all fields are shown as expected.

Additional testing:

Having a repeatable field with multiple instances, go back to the
additional fields configuration and make the additional field
non-repeatable again. Edit the basket again. Notice the multiple text
instances are still shown, but the '+New' link no longer shows.
You're able to remove existing multiple instances, but unable to add new
ones, this is because the field is no longer repeatable.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Pedro Amorim 2023-10-16 09:32:44 +00:00 committed by Katrin Fischer
parent 410654387e
commit 891a1a0bde
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
3 changed files with 12 additions and 13 deletions

View file

@ -442,9 +442,8 @@ if ( $op eq 'list' ) {
duplinbatch => $duplinbatch,
csv_profiles => Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' }),
available_additional_fields => Koha::AdditionalFields->search( { tablename => 'aqbasket' } ),
additional_field_values => { map {
$_->field->name => $_->value
} Koha::Acquisition::Baskets->find($basketno)->additional_field_values->as_list },
additional_field_values =>
Koha::Acquisition::Baskets->find($basketno)->get_additional_field_values_for_template,
);
}

View file

@ -96,11 +96,8 @@ if ( $op eq 'add_form' ) {
}
}
$template->param( is_an_edit => 1);
$template->param(
additional_field_values => { map {
$_->field->id => $_->value
} Koha::Acquisition::Baskets->find($basketno)->additional_field_values->as_list },
);
$template->param( additional_field_values =>
Koha::Acquisition::Baskets->find($basketno)->get_additional_field_values_for_template );
} else {
#new basket
my $basket;
@ -168,11 +165,13 @@ if ( $op eq 'add_form' ) {
my @additional_fields;
my $basket_fields = Koha::AdditionalFields->search({ tablename => 'aqbasket' });
while ( my $field = $basket_fields->next ) {
my $value = $input->param('additional_field_' . $field->id);
push @additional_fields, {
id => $field->id,
value => $value,
};
my @field_values = $input->param( 'additional_field_' . $field->id );
foreach my $value (@field_values) {
push @additional_fields, {
id => $field->id,
value => $value,
} if $value;
}
}
Koha::Acquisition::Baskets->find($basketno)->set_additional_fields(\@additional_fields);

View file

@ -164,6 +164,7 @@
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/acquisitions-menu.js") | $raw %]
[% Asset.js("js/acq.js") | $raw %]
[% Asset.js("js/additional-fields-entry.js") | $raw %]
[% INCLUDE 'select2.inc' %]
<script>