Bug 35044: Update: Acquisition orders
Test plan, k-t-d: Preparation: Create additional fields for table 'aqorders': 2 text fields, one repeatable, one not-repeatable 2 AV fields, one repeatable, one not-repeatable 2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field 942$c Attempt to create a repeatable MARC field (get or set). Notice you're unable to. 1) Add a new order for an existing basket, with an existing record, visit: /cgi-bin/koha/acqui/neworderempty.pl?booksellerid=1&basketno=1&biblionumber=76 2) Set the mandatory "Koha item type" for the item. Click the 'Add item' button below. 3) Notice the accounting details now have quantity:1 4) Set the mandatory "Fund" input in accounting details. 5) At the bottom, fill in all additional fields, click the '+New' and 'Clear' links, hit 'Save' 6) In the orders table shown, click "Modify". Notice all the fields are presented correctly in the edit form. 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:
parent
891a1a0bde
commit
1c7c2a260c
3 changed files with 28 additions and 23 deletions
|
@ -117,17 +117,17 @@ if it is an order from an existing suggestion : the id of this suggestion.
|
|||
=cut
|
||||
|
||||
use Modern::Perl;
|
||||
use CGI qw ( -utf8 );
|
||||
use CGI qw ( -utf8 );
|
||||
use JSON qw ( to_json encode_json );
|
||||
|
||||
use C4::Acquisition qw( FillWithDefaultValues ModOrderUsers );
|
||||
use C4::Auth qw( get_template_and_user );
|
||||
use C4::Auth qw( get_template_and_user );
|
||||
use C4::Barcodes;
|
||||
use C4::Biblio qw( AddBiblio GetMarcFromKohaField TransformHtmlToXml TransformKohaToMarc );
|
||||
use C4::Budgets qw( GetBudget GetBudgetSpent GetBudgetOrdered FieldsForCalculatingFundValues );
|
||||
use C4::Items qw( AddItemFromMarc );
|
||||
use C4::Log qw( logaction );
|
||||
use C4::Output qw( output_html_with_http_headers );
|
||||
use C4::Biblio qw( AddBiblio GetMarcFromKohaField TransformHtmlToXml TransformKohaToMarc );
|
||||
use C4::Budgets qw( GetBudget GetBudgetSpent GetBudgetOrdered FieldsForCalculatingFundValues );
|
||||
use C4::Items qw( AddItemFromMarc );
|
||||
use C4::Log qw( logaction );
|
||||
use C4::Output qw( output_html_with_http_headers );
|
||||
use C4::Suggestions qw( ModSuggestion );
|
||||
use Koha::Acquisition::Baskets;
|
||||
use Koha::Acquisition::Currencies qw( get_active );
|
||||
|
@ -387,17 +387,19 @@ if ( $op eq 'cud-order' ) {
|
|||
ModOrderUsers( $order->ordernumber, @order_users );
|
||||
|
||||
# Retrieve and save additional fields values
|
||||
my @additional_fields = Koha::AdditionalFields->search( { tablename => 'aqorders' } )->as_list;
|
||||
my @additional_field_values;
|
||||
foreach my $af (@additional_fields) {
|
||||
my $id = $af->id;
|
||||
my $value = $input->param("additional_field_$id");
|
||||
push @additional_field_values, {
|
||||
id => $id,
|
||||
value => $value,
|
||||
my @additional_fields;
|
||||
my $order_fields = Koha::AdditionalFields->search( { tablename => 'aqorders' } );
|
||||
while ( my $field = $order_fields->next ) {
|
||||
my @field_values = $input->param( 'additional_field_' . $field->id );
|
||||
foreach my $value (@field_values){
|
||||
push @additional_fields,
|
||||
{
|
||||
id => $field->id,
|
||||
value => $value,
|
||||
} if $value;
|
||||
};
|
||||
}
|
||||
$order->set_additional_fields( \@additional_field_values );
|
||||
$order->set_additional_fields( \@additional_fields );
|
||||
|
||||
# now, add items if applicable
|
||||
if ( $basket->effective_create_items eq 'ordering' ) {
|
||||
|
@ -482,4 +484,3 @@ if ( $op eq 'cud-order' ) {
|
|||
print $input->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -424,26 +424,29 @@ $quantity //= 0;
|
|||
# Get additional fields
|
||||
my $record;
|
||||
my @additional_fields = Koha::AdditionalFields->search({ tablename => 'aqorders' })->as_list;
|
||||
my %additional_field_values;
|
||||
my $additional_field_values;
|
||||
my $items;
|
||||
if ($ordernumber) {
|
||||
my $order = Koha::Acquisition::Orders->find($ordernumber);
|
||||
foreach my $value ($order->additional_field_values->as_list) {
|
||||
$additional_field_values{$value->field_id} = $value->value;
|
||||
}
|
||||
$additional_field_values = $order->get_additional_field_values_for_template;
|
||||
$items = $order->items;
|
||||
} elsif ( $biblionumber ) {
|
||||
my %additional_field_values;
|
||||
foreach my $af (@additional_fields) {
|
||||
my @marc_field_values;
|
||||
if ($af->marcfield) {
|
||||
$record //= Koha::Biblios->find($biblionumber)->metadata->record;
|
||||
my ($field, $subfield) = split /\$/, $af->marcfield;
|
||||
$additional_field_values{$af->id} = $record->subfield($field, $subfield);
|
||||
push @marc_field_values, $record->subfield( $field, $subfield ) if $record->subfield( $field, $subfield );
|
||||
$additional_field_values{ $af->id } = \@marc_field_values;
|
||||
}
|
||||
}
|
||||
$additional_field_values = \%additional_field_values
|
||||
}
|
||||
|
||||
$template->param(
|
||||
additional_fields => \@additional_fields,
|
||||
additional_field_values => \%additional_field_values,
|
||||
additional_field_values => $additional_field_values,
|
||||
items => $items,
|
||||
);
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
[% Asset.js("js/acq.js") | $raw %]
|
||||
[% Asset.js("js/additem.js") | $raw %]
|
||||
[% Asset.js("js/cataloging.js") | $raw %]
|
||||
[% Asset.js("js/additional-fields-entry.js") | $raw %]
|
||||
[% INCLUDE 'calendar.inc' %]
|
||||
[% INCLUDE 'select2.inc' %]
|
||||
<script>
|
||||
|
|
Loading…
Reference in a new issue