View | Details | Raw Unified | Return to bug 11844
Collapse All | Expand All

(-)a/C4/Acquisition.pm (-5 / +16 lines)
Lines 32-37 use Koha::Acquisition::Baskets; Link Here
32
use Koha::Acquisition::Booksellers;
32
use Koha::Acquisition::Booksellers;
33
use Koha::Acquisition::Invoices;
33
use Koha::Acquisition::Invoices;
34
use Koha::Acquisition::Orders;
34
use Koha::Acquisition::Orders;
35
use Koha::AdditionalFieldValue;
35
use Koha::Biblios;
36
use Koha::Biblios;
36
use Koha::Exceptions;
37
use Koha::Exceptions;
37
use Koha::Items;
38
use Koha::Items;
Lines 1880-1886 sub TransferOrder { Link Here
1880
    my $order = Koha::Acquisition::Orders->find( $ordernumber ) or return;
1881
    my $order = Koha::Acquisition::Orders->find( $ordernumber ) or return;
1881
    return if $order->datereceived;
1882
    return if $order->datereceived;
1882
1883
1883
    $order = $order->unblessed;
1884
    my $orderhash = $order->unblessed;
1884
1885
1885
    my $basket = GetBasket($basketno);
1886
    my $basket = GetBasket($basketno);
1886
    return unless $basket;
1887
    return unless $basket;
Lines 1896-1906 sub TransferOrder { Link Here
1896
    $sth = $dbh->prepare($query);
1897
    $sth = $dbh->prepare($query);
1897
    $rv = $sth->execute('cancelled', $ordernumber);
1898
    $rv = $sth->execute('cancelled', $ordernumber);
1898
1899
1899
    delete $order->{'ordernumber'};
1900
    delete $orderhash->{ordernumber};
1900
    delete $order->{parent_ordernumber};
1901
    delete $orderhash->{parent_ordernumber};
1901
    $order->{'basketno'} = $basketno;
1902
    $orderhash->{basketno} = $basketno;
1902
1903
1903
    my $newordernumber = Koha::Acquisition::Order->new($order)->store->ordernumber;
1904
    my $neworder = Koha::Acquisition::Order->new($orderhash);
1905
    my $newordernumber = $neworder->store->ordernumber;
1904
1906
1905
    $query = q{
1907
    $query = q{
1906
        UPDATE aqorders_items
1908
        UPDATE aqorders_items
Lines 1917-1922 sub TransferOrder { Link Here
1917
    $sth = $dbh->prepare($query);
1919
    $sth = $dbh->prepare($query);
1918
    $sth->execute($ordernumber, $newordernumber);
1920
    $sth->execute($ordernumber, $newordernumber);
1919
1921
1922
    # Copy additional fields values
1923
    foreach my $afv ($order->additional_field_values->as_list) {
1924
        Koha::AdditionalFieldValue->new({
1925
            field_id => $afv->field_id,
1926
            record_id => $newordernumber,
1927
            value => $afv->value,
1928
        })->store;
1929
    }
1930
1920
    return $newordernumber;
1931
    return $newordernumber;
1921
}
1932
}
1922
1933
(-)a/Koha/Acquisition/Order.pm (-1 / +1 lines)
Lines 35-41 use Koha::Items; Link Here
35
use Koha::Number::Price;
35
use Koha::Number::Price;
36
use Koha::Subscriptions;
36
use Koha::Subscriptions;
37
37
38
use base qw(Koha::Object);
38
use base qw(Koha::Object Koha::Object::Mixin::AdditionalFields);
39
39
40
=head1 NAME
40
=head1 NAME
41
41
(-)a/Koha/AdditionalField.pm (+19 lines)
Lines 11-16 use Modern::Perl; Link Here
11
use base qw(Koha::Object);
11
use base qw(Koha::Object);
12
12
13
use C4::Context;
13
use C4::Context;
14
use Koha::MarcSubfieldStructures;
15
16
sub effective_authorised_value_category {
17
    my ($self) = @_;
18
19
    my $category = $self->authorised_value_category;
20
    unless ($category) {
21
        if ($self->marcfield) {
22
            my ($tag, $subfield) = split /\$/, $self->marcfield;
23
24
            my $mss = Koha::MarcSubfieldStructures->find('', $tag, $subfield);
25
            if ($mss) {
26
                $category = $mss->authorised_value;
27
            }
28
        }
29
    }
30
31
    return $category;
32
}
14
33
15
sub _type { 'AdditionalField' }
34
sub _type { 'AdditionalField' }
16
35
(-)a/Koha/Object/Mixin/AdditionalFields.pm (+32 lines)
Lines 46-53 sub set_additional_fields { Link Here
46
46
47
    $self->additional_field_values->delete;
47
    $self->additional_field_values->delete;
48
48
49
    my $biblionumber;
50
    my $record;
51
    my $record_updated;
52
    if ($self->_result->has_column('biblionumber')) {
53
        $biblionumber = $self->biblionumber;
54
    }
55
49
    foreach my $additional_field (@$additional_fields) {
56
    foreach my $additional_field (@$additional_fields) {
57
        my $field = Koha::AdditionalFields->find($additional_field->{id});
50
        my $value = $additional_field->{value};
58
        my $value = $additional_field->{value};
59
60
        if ($biblionumber and $field->marcfield) {
61
            require Koha::Biblios;
62
            $record //= Koha::Biblios->find($biblionumber)->metadata->record;
63
64
            my ($tag, $subfield) = split /\$/, $field->marcfield;
65
            my $marc_field = $record->field($tag);
66
            if ($field->marcfield_mode eq 'get') {
67
                $value = $marc_field ? $marc_field->subfield($subfield) : '';
68
            } elsif ($field->marcfield_mode eq 'set') {
69
                if ($marc_field) {
70
                    $marc_field->update($subfield => $value);
71
                } else {
72
                    $marc_field = MARC::Field->new($tag, '', '', $subfield => $value);
73
                    $record->append_fields($marc_field);
74
                }
75
                $record_updated = 1;
76
            }
77
        }
78
51
        if (defined $value) {
79
        if (defined $value) {
52
            my $field_value = Koha::AdditionalFieldValue->new({
80
            my $field_value = Koha::AdditionalFieldValue->new({
53
                field_id => $additional_field->{id},
81
                field_id => $additional_field->{id},
Lines 56-61 sub set_additional_fields { Link Here
56
            })->store;
84
            })->store;
57
        }
85
        }
58
    }
86
    }
87
88
    if ($record_updated) {
89
        C4::Biblio::ModBiblio($record, $biblionumber);
90
    }
59
}
91
}
60
92
61
=head3 additional_field_values
93
=head3 additional_field_values
(-)a/Koha/Schema/Result/Aqorder.pm (+17 lines)
Lines 863-868 __PACKAGE__->belongs_to( Link Here
863
  },
863
  },
864
);
864
);
865
865
866
__PACKAGE__->has_many(
867
  "additional_field_values",
868
  "Koha::Schema::Result::AdditionalFieldValue",
869
  sub {
870
    my ($args) = @_;
871
872
    return {
873
        "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.ordernumber" },
874
875
        # TODO Add column additional_field_values.tablename to avoid subquery ?
876
        "$args->{foreign_alias}.field_id" =>
877
            { -in => \'(SELECT id FROM additional_fields WHERE tablename = "aqorders")' },
878
    };
879
  },
880
  { cascade_copy => 0, cascade_delete => 0 },
881
);
882
866
sub koha_objects_class {
883
sub koha_objects_class {
867
    'Koha::Acquisition::Orders';
884
    'Koha::Acquisition::Orders';
868
}
885
}
(-)a/acqui/addorder.pl (+15 lines)
Lines 139-144 use Koha::Acquisition::Baskets; Link Here
139
use C4::Barcodes;
139
use C4::Barcodes;
140
use Koha::DateUtils qw( dt_from_string );
140
use Koha::DateUtils qw( dt_from_string );
141
141
142
use Koha::AdditionalFields;
143
142
### "-------------------- addorder.pl ----------"
144
### "-------------------- addorder.pl ----------"
143
145
144
# FIXME: This needs to do actual error checking and possibly return user to the same form,
146
# FIXME: This needs to do actual error checking and possibly return user to the same form,
Lines 368-373 if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { Link Here
368
    my @order_users = split( /:/, $order_users_ids );
370
    my @order_users = split( /:/, $order_users_ids );
369
    ModOrderUsers( $order->ordernumber, @order_users );
371
    ModOrderUsers( $order->ordernumber, @order_users );
370
372
373
    # Retrieve and save additional fields values
374
    my @additional_fields = Koha::AdditionalFields->search({ tablename => 'aqorders' })->as_list;
375
    my @additional_field_values;
376
    foreach my $af (@additional_fields) {
377
        my $id = $af->id;
378
        my $value = $input->param("additional_field_$id");
379
        push @additional_field_values, {
380
            id => $id,
381
            value => $value,
382
        };
383
    }
384
    $order->set_additional_fields(\@additional_field_values);
385
371
    # now, add items if applicable
386
    # now, add items if applicable
372
    if ($basket->effective_create_items eq 'ordering') {
387
    if ($basket->effective_create_items eq 'ordering') {
373
388
(-)a/acqui/neworderempty.pl (+24 lines)
Lines 99-104 use Koha::ItemTypes; Link Here
99
use Koha::Patrons;
99
use Koha::Patrons;
100
use Koha::RecordProcessor;
100
use Koha::RecordProcessor;
101
use Koha::Subscriptions;
101
use Koha::Subscriptions;
102
use Koha::AdditionalFields;
102
103
103
our $input           = CGI->new;
104
our $input           = CGI->new;
104
my $booksellerid    = $input->param('booksellerid');	# FIXME: else ERROR!
105
my $booksellerid    = $input->param('booksellerid');	# FIXME: else ERROR!
Lines 419-424 my $quantity = $input->param('rr_quantity_to_order') ? Link Here
419
      $data->{'quantity'};
420
      $data->{'quantity'};
420
$quantity //= 0;
421
$quantity //= 0;
421
422
423
# Get additional fields
424
my $record;
425
my @additional_fields = Koha::AdditionalFields->search({ tablename => 'aqorders' })->as_list;
426
my %additional_field_values;
427
if ($ordernumber) {
428
    my $order = Koha::Acquisition::Orders->find($ordernumber);
429
    foreach my $value ($order->additional_field_values->as_list) {
430
        $additional_field_values{$value->field_id} = $value->value;
431
    }
432
} elsif ( $biblionumber ) {
433
    foreach my $af (@additional_fields) {
434
        if ($af->marcfield) {
435
            $record //= Koha::Biblios->find($biblionumber)->metadata->record;
436
            my ($field, $subfield) = split /\$/, $af->marcfield;
437
            $additional_field_values{$af->id} = $record->subfield($field, $subfield);
438
        }
439
    }
440
}
441
$template->param(
442
    additional_fields => \@additional_fields,
443
    additional_field_values => \%additional_field_values,
444
);
445
422
# fill template
446
# fill template
423
$template->param(
447
$template->param(
424
    existing         => $biblionumber,
448
    existing         => $biblionumber,
(-)a/admin/additional-fields.pl (+3 lines)
Lines 51-56 if ( $op eq 'add' ) { Link Here
51
    my $name = $input->param('name') // q{};
51
    my $name = $input->param('name') // q{};
52
    my $authorised_value_category = $input->param('authorised_value_category') // q{};
52
    my $authorised_value_category = $input->param('authorised_value_category') // q{};
53
    my $marcfield = $input->param('marcfield') // q{};
53
    my $marcfield = $input->param('marcfield') // q{};
54
    my $marcfield_mode = $input->param('marcfield_mode') // 'get';
54
    my $searchable = $input->param('searchable') ? 1 : 0;
55
    my $searchable = $input->param('searchable') ? 1 : 0;
55
    if ( $field_id and $name ) {
56
    if ( $field_id and $name ) {
56
        my $updated = 0;
57
        my $updated = 0;
Lines 60-65 if ( $op eq 'add' ) { Link Here
60
                name => $name,
61
                name => $name,
61
                authorised_value_category => $authorised_value_category,
62
                authorised_value_category => $authorised_value_category,
62
                marcfield => $marcfield,
63
                marcfield => $marcfield,
64
                marcfield_mode => $marcfield_mode,
63
                searchable => $searchable,
65
                searchable => $searchable,
64
            });
66
            });
65
            $updated = $af->store ? 1 : 0;
67
            $updated = $af->store ? 1 : 0;
Lines 76-81 if ( $op eq 'add' ) { Link Here
76
                name => $name,
78
                name => $name,
77
                authorised_value_category => $authorised_value_category,
79
                authorised_value_category => $authorised_value_category,
78
                marcfield => $marcfield,
80
                marcfield => $marcfield,
81
                marcfield_mode => $marcfield_mode,
79
                searchable => $searchable,
82
                searchable => $searchable,
80
            });
83
            });
81
            $inserted = $af->store ? 1 : 0;
84
            $inserted = $af->store ? 1 : 0;
(-)a/installer/data/mysql/atomicupdate/bug-11844.pl (+17 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => '11844',
5
    description => 'Add column additional_fields.marcfield_mode',
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        unless ( column_exists( 'additional_fields', 'marcfield_mode' ) ) {
11
            $dbh->do(q{
12
                ALTER TABLE additional_fields
13
                ADD COLUMN marcfield_mode ENUM('get', 'set') NOT NULL DEFAULT 'get' COMMENT 'mode of operation (get or set) for marcfield' AFTER marcfield
14
            });
15
        }
16
    },
17
};
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 244-249 CREATE TABLE `additional_fields` ( Link Here
244
  `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the field',
244
  `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the field',
245
  `authorised_value_category` varchar(32) NOT NULL DEFAULT '' COMMENT 'is an authorised value category',
245
  `authorised_value_category` varchar(32) NOT NULL DEFAULT '' COMMENT 'is an authorised value category',
246
  `marcfield` varchar(16) NOT NULL DEFAULT '' COMMENT 'contains the marc field to copied into the record',
246
  `marcfield` varchar(16) NOT NULL DEFAULT '' COMMENT 'contains the marc field to copied into the record',
247
  `marcfield_mode` ENUM('get', 'set') NOT NULL DEFAULT 'get' COMMENT 'mode of operation (get or set) for marcfield',
247
  `searchable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the field searchable?',
248
  `searchable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the field searchable?',
248
  PRIMARY KEY (`id`),
249
  PRIMARY KEY (`id`),
249
  UNIQUE KEY `fields_uniq` (`tablename`(191),`name`(191))
250
  UNIQUE KEY `fields_uniq` (`tablename`(191),`name`(191))
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/additional-fields-entry.inc (-10 / +18 lines)
Lines 5-30 Link Here
5
    <ol>
5
    <ol>
6
[% END %]
6
[% END %]
7
        [% FOR field IN available %]
7
        [% FOR field IN available %]
8
        [% authorised_value_category = field.effective_authorised_value_category %]
8
            <li>
9
            <li>
9
                <label for="additional_field_[% field.id | html %]"> [% field.name | html %]: </label>
10
                <label for="additional_field_[% field.id | html %]"> [% field.name | html %]: </label>
10
                [% IF field.authorised_value_category %]
11
                [% IF authorised_value_category %]
11
                    <select name="additional_field_[% field.id | html %]" id="additional_field_[% field.id | html %]">
12
                    [% IF field.marcfield && field.marcfield_mode == 'get' %]
13
                        <select name="additional_field_[% field.id | html %]" id="additional_field_[% field.id | html %]" disabled>
14
                    [% ELSE %]
15
                        <select name="additional_field_[% field.id | html %]" id="additional_field_[% field.id | html %]">
16
                    [% END %]
12
                        <option value=""></option>
17
                        <option value=""></option>
13
                        [% FOREACH av IN AuthorisedValues.GetAuthValueDropbox( field.authorised_value_category ) %]
18
                        [% FOREACH av IN AuthorisedValues.GetAuthValueDropbox( authorised_value_category ) %]
14
                            [% IF av.authorised_value == values.${field.id} %]
19
                            [% IF av.authorised_value == values.${field.id} %]
15
                                <option value="[% av.authorised_value | html %]" selected="selected">[% av.lib | html %]</option>
20
                                <option value="[% av.authorised_value | html %]" selected="selected">[% av.lib | html %]</option>
16
                            [% ELSE %]
21
                            [% ELSE %]
17
                                <option value="[% av.authorised_value | html %]">[% av.lib | html %]</option>
22
                                <option value="[% av.authorised_value | html %]">[% av.lib | html %]</option>
18
                            [% END %]
23
                            [% END %]
19
                        [% END %]
24
                        [% END %]
20
                    </select> <span>(Authorised values for [% field.authorised_value_category | html %])</span>
25
                    </select> <span>(Authorised values for [% authorised_value_category | html %])</span>
26
                [% ELSIF field.marcfield && field.marcfield_mode == 'get' %]
27
                    <input type="text" value="[% values.${field.id} | html %]" id="additional_field_[% field.id | html %]" name="additional_field_[% field.id | html %]" readonly="readonly" />
21
                [% ELSE %]
28
                [% ELSE %]
22
                    [% IF field.marcfield %]
29
                    <input type="text" value="[% values.${field.id} | html %]" id="additional_field_[% field.id | html %]" name="additional_field_[% field.id | html %]" />
23
                        <input type="text" value="[% values.${field.id} | html %]" id="additional_field_[% field.id | html %]" name="additional_field_[% field.id | html %]" readonly="readonly" />
30
                [% END %]
24
                        This value will be filled with the [% field.marcfield | html %] subfield of the selected biblio.
31
25
                    [% ELSE %]
32
                [% IF field.marcfield && field.marcfield_mode == 'get' %]
26
                        <input type="text" value="[% values.${field.id} | html %]" id="additional_field_[% field.id | html %]" name="additional_field_[% field.id | html %]" />
33
                    This value will be filled with the [% field.marcfield | html %] subfield of the selected biblio.
27
                    [% END %]
34
                [% ELSIF field.marcfield && field.marcfield_mode == 'set' %]
35
                    This value will be saved to the [% field.marcfield %] subfield of the selected biblio.
28
                [% END %]
36
                [% END %]
29
            </li>
37
            </li>
30
        [% END %]
38
        [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (+4 lines)
Lines 4-9 Link Here
4
[% USE KohaDates %]
4
[% USE KohaDates %]
5
[% USE Price %]
5
[% USE Price %]
6
[% USE ItemTypes %]
6
[% USE ItemTypes %]
7
[% USE AuthorisedValues %]
7
[% SET footerjs = 1 %]
8
[% SET footerjs = 1 %]
8
[% INCLUDE 'doc-head-open.inc' %]
9
[% INCLUDE 'doc-head-open.inc' %]
9
<title>[% IF ( ordernumber ) %]Modify order details (line #[% ordernumber | html %])[% ELSE %]New order[% END %] &rsaquo; Basket [% basketno | html %] &rsaquo; Acquisitions &rsaquo; Koha</title>
10
<title>[% IF ( ordernumber ) %]Modify order details (line #[% ordernumber | html %])[% ELSE %]New order[% END %] &rsaquo; Basket [% basketno | html %] &rsaquo; Acquisitions &rsaquo; Koha</title>
Lines 529-534 Link Here
529
            </li>
530
            </li>
530
        </ol>
531
        </ol>
531
    </fieldset>
532
    </fieldset>
533
534
    [% INCLUDE 'additional-fields-entry.inc' available = additional_fields values = additional_field_values %]
535
532
    <fieldset class="action">
536
    <fieldset class="action">
533
        <input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
537
        <input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
534
        <input type="submit" class="btn btn-primary" value="Save" />
538
        <input type="submit" class="btn btn-primary" value="Save" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt (-1 / +25 lines)
Lines 11-17 Link Here
11
[% INCLUDE 'doc-head-close.inc' %]
11
[% INCLUDE 'doc-head-close.inc' %]
12
</head>
12
</head>
13
13
14
[% marcfield_tables = ['subscription'] %]
14
[% marcfield_tables = ['subscription', 'aqorders'] %]
15
[% searchable_tables = ['subscription', 'aqbasket', 'aqinvoices'] %]
15
[% searchable_tables = ['subscription', 'aqbasket', 'aqinvoices'] %]
16
[% show_marcfield = marcfield_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
16
[% show_marcfield = marcfield_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
17
[% show_searchable = searchable_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
17
[% show_searchable = searchable_tables.grep('^' _ tablename _ '$').size ? 1 : 0 %]
Lines 118-123 Link Here
118
            <ul>
118
            <ul>
119
                [% IF CAN_user_acquisition_order_manage %]
119
                [% IF CAN_user_acquisition_order_manage %]
120
                    [% WRAPPER table_option value="aqbasket" %]<span>Order baskets</span>[% END %]
120
                    [% WRAPPER table_option value="aqbasket" %]<span>Order baskets</span>[% END %]
121
                    [% WRAPPER table_option value="aqorders" %]<span>Order lines</span>[% END %]
121
                [% END %]
122
                [% END %]
122
                [% IF CAN_user_acquisition_edit_invoices %]
123
                [% IF CAN_user_acquisition_edit_invoices %]
123
                    [% WRAPPER table_option value="aqinvoices" %]<span>Invoices</span>[% END %]
124
                    [% WRAPPER table_option value="aqinvoices" %]<span>Invoices</span>[% END %]
Lines 145-150 Link Here
145
                            <th>Authorized value category</th>
146
                            <th>Authorized value category</th>
146
                            [% IF show_marcfield %]
147
                            [% IF show_marcfield %]
147
                                <th>MARC field</th>
148
                                <th>MARC field</th>
149
                                <th>MARC field mode</th>
148
                            [% END %]
150
                            [% END %]
149
                            [% IF show_searchable %]
151
                            [% IF show_searchable %]
150
                                <th>Searchable</th>
152
                                <th>Searchable</th>
Lines 159-164 Link Here
159
                                <td>[% field.authorised_value_category | html %]</td>
161
                                <td>[% field.authorised_value_category | html %]</td>
160
                                [% IF show_marcfield %]
162
                                [% IF show_marcfield %]
161
                                    <td>[% field.marcfield | html %]</td>
163
                                    <td>[% field.marcfield | html %]</td>
164
                                    <td>
165
                                        [% SWITCH field.marcfield_mode %]
166
                                            [% CASE 'get' %]Get value from MARC record
167
                                            [% CASE 'set' %]Save value to MARC record
168
                                        [% END %]
169
                                    </td>
162
                                [% END %]
170
                                [% END %]
163
                                [% IF show_searchable %]
171
                                [% IF show_searchable %]
164
                                    <td>
172
                                    <td>
Lines 203-208 Link Here
203
                            <label for="marcfield">MARC field: </label>
211
                            <label for="marcfield">MARC field: </label>
204
                            <input type="text" name="marcfield" id="marcfield" value="[% field.marcfield | html %]" />
212
                            <input type="text" name="marcfield" id="marcfield" value="[% field.marcfield | html %]" />
205
                        </li>
213
                        </li>
214
                        <li>
215
                            <label for="marcfield_mode">MARC field mode: </label>
216
                            <select id="marcfield_mode" name="marcfield_mode">
217
                                [% IF field.marcfield_mode == 'get' %]
218
                                    <option value="get" selected>Get value from MARC record (not modifiable)</option>
219
                                [% ELSE %]
220
                                    <option value="get">Get value from MARC record (not modifiable)</option>
221
                                [% END %]
222
223
                                [% IF field.marcfield_mode == 'set' %]
224
                                    <option value="set" selected>Save value to MARC record</option>
225
                                [% ELSE %]
226
                                    <option value="set">Save value to MARC record</option>
227
                                [% END %]
228
                            </select>
229
                        </li>
206
                    [% END %]
230
                    [% END %]
207
                    [% IF show_searchable %]
231
                    [% IF show_searchable %]
208
                        <li>
232
                        <li>
(-)a/serials/subscription-add.pl (-15 lines)
Lines 365-380 sub redirect_add_subscription { Link Here
365
365
366
    my @additional_fields;
366
    my @additional_fields;
367
    my $biblio = Koha::Biblios->find($biblionumber);
367
    my $biblio = Koha::Biblios->find($biblionumber);
368
    my $record = $biblio->metadata->record({ embed_items => 1 });
369
    my $subscription_fields = Koha::AdditionalFields->search({ tablename => 'subscription' });
368
    my $subscription_fields = Koha::AdditionalFields->search({ tablename => 'subscription' });
370
    while ( my $field = $subscription_fields->next ) {
369
    while ( my $field = $subscription_fields->next ) {
371
        my $value = $query->param('additional_field_' . $field->id);
370
        my $value = $query->param('additional_field_' . $field->id);
372
        if ($field->marcfield) {
373
            my ($field, $subfield) = split /\$/, $field->marcfield;
374
            if ( $record and $field and $subfield ) {
375
                $value = $record->subfield( $field, $subfield );
376
            }
377
        }
378
        push @additional_fields, {
371
        push @additional_fields, {
379
            id => $field->id,
372
            id => $field->id,
380
            value => $value,
373
            value => $value,
Lines 485-500 sub redirect_mod_subscription { Link Here
485
478
486
    my @additional_fields;
479
    my @additional_fields;
487
    my $biblio = Koha::Biblios->find($biblionumber);
480
    my $biblio = Koha::Biblios->find($biblionumber);
488
    my $record = $biblio->metadata->record({ embed_items => 1 });
489
    my $subscription_fields = Koha::AdditionalFields->search({ tablename => 'subscription' });
481
    my $subscription_fields = Koha::AdditionalFields->search({ tablename => 'subscription' });
490
    while ( my $field = $subscription_fields->next ) {
482
    while ( my $field = $subscription_fields->next ) {
491
        my $value = $query->param('additional_field_' . $field->id);
483
        my $value = $query->param('additional_field_' . $field->id);
492
        if ($field->marcfield) {
493
            my ($field, $subfield) = split /\$/, $field->marcfield;
494
            if ( $record and $field and $subfield ) {
495
                $value = $record->subfield( $field, $subfield );
496
            }
497
        }
498
        push @additional_fields, {
484
        push @additional_fields, {
499
            id => $field->id,
485
            id => $field->id,
500
            value => $value,
486
            value => $value,
501
- 

Return to bug 11844