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 36-42 use Koha::Number::Price; Link Here
36
use Koha::Patrons;
36
use Koha::Patrons;
37
use Koha::Subscriptions;
37
use Koha::Subscriptions;
38
38
39
use base qw(Koha::Object);
39
use base qw(Koha::Object Koha::Object::Mixin::AdditionalFields);
40
40
41
=head1 NAME
41
=head1 NAME
42
42
(-)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 892-897 __PACKAGE__->belongs_to( Link Here
892
  },
892
  },
893
);
893
);
894
894
895
__PACKAGE__->has_many(
896
  "additional_field_values",
897
  "Koha::Schema::Result::AdditionalFieldValue",
898
  sub {
899
    my ($args) = @_;
900
901
    return {
902
        "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.ordernumber" },
903
904
        # TODO Add column additional_field_values.tablename to avoid subquery ?
905
        "$args->{foreign_alias}.field_id" =>
906
            { -in => \'(SELECT id FROM additional_fields WHERE tablename = "aqorders")' },
907
    };
908
  },
909
  { cascade_copy => 0, cascade_delete => 0 },
910
);
911
895
sub koha_objects_class {
912
sub koha_objects_class {
896
    'Koha::Acquisition::Orders';
913
    'Koha::Acquisition::Orders';
897
}
914
}
(-)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 100-105 use Koha::Patrons; Link Here
100
use Koha::RecordProcessor;
100
use Koha::RecordProcessor;
101
use Koha::Subscriptions;
101
use Koha::Subscriptions;
102
use Koha::UI::Form::Builder::Biblio;
102
use Koha::UI::Form::Builder::Biblio;
103
use Koha::AdditionalFields;
103
104
104
our $input           = CGI->new;
105
our $input           = CGI->new;
105
my $booksellerid    = $input->param('booksellerid');	# FIXME: else ERROR!
106
my $booksellerid    = $input->param('booksellerid');	# FIXME: else ERROR!
Lines 415-420 my $quantity = $input->param('rr_quantity_to_order') ? Link Here
415
      $data->{'quantity'};
416
      $data->{'quantity'};
416
$quantity //= 0;
417
$quantity //= 0;
417
418
419
# Get additional fields
420
my $record;
421
my @additional_fields = Koha::AdditionalFields->search({ tablename => 'aqorders' })->as_list;
422
my %additional_field_values;
423
if ($ordernumber) {
424
    my $order = Koha::Acquisition::Orders->find($ordernumber);
425
    foreach my $value ($order->additional_field_values->as_list) {
426
        $additional_field_values{$value->field_id} = $value->value;
427
    }
428
} elsif ( $biblionumber ) {
429
    foreach my $af (@additional_fields) {
430
        if ($af->marcfield) {
431
            $record //= Koha::Biblios->find($biblionumber)->metadata->record;
432
            my ($field, $subfield) = split /\$/, $af->marcfield;
433
            $additional_field_values{$af->id} = $record->subfield($field, $subfield);
434
        }
435
    }
436
}
437
$template->param(
438
    additional_fields => \@additional_fields,
439
    additional_field_values => \%additional_field_values,
440
);
441
418
# fill template
442
# fill template
419
$template->param(
443
$template->param(
420
    existing         => $biblionumber,
444
    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
[% INCLUDE 'doc-head-open.inc' %]
8
[% INCLUDE 'doc-head-open.inc' %]
8
<title>[% IF ( ordernumber ) %]Modify order details (line #[% ordernumber | html %])[% ELSE %]New order[% END %] &rsaquo; Basket [% basketno | html %] &rsaquo; Acquisitions &rsaquo; Koha</title>
9
<title>[% IF ( ordernumber ) %]Modify order details (line #[% ordernumber | html %])[% ELSE %]New order[% END %] &rsaquo; Basket [% basketno | html %] &rsaquo; Acquisitions &rsaquo; Koha</title>
9
[% INCLUDE 'doc-head-close.inc' %]
10
[% INCLUDE 'doc-head-close.inc' %]
Lines 697-702 Link Here
697
            </li>
698
            </li>
698
        </ol>
699
        </ol>
699
    </fieldset>
700
    </fieldset>
701
702
    [% INCLUDE 'additional-fields-entry.inc' available = additional_fields values = additional_field_values %]
703
700
    <fieldset class="action">
704
    <fieldset class="action">
701
        <input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
705
        <input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
702
        <input type="submit" class="btn btn-primary" value="Save" />
706
        <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 105-110 Link Here
105
            <ul>
105
            <ul>
106
                [% IF CAN_user_acquisition_order_manage %]
106
                [% IF CAN_user_acquisition_order_manage %]
107
                    [% WRAPPER table_option value="aqbasket" %]<span>Order baskets</span>[% END %]
107
                    [% WRAPPER table_option value="aqbasket" %]<span>Order baskets</span>[% END %]
108
                    [% WRAPPER table_option value="aqorders" %]<span>Order lines</span>[% END %]
108
                [% END %]
109
                [% END %]
109
                [% IF CAN_user_acquisition_edit_invoices %]
110
                [% IF CAN_user_acquisition_edit_invoices %]
110
                    [% WRAPPER table_option value="aqinvoices" %]<span>Invoices</span>[% END %]
111
                    [% WRAPPER table_option value="aqinvoices" %]<span>Invoices</span>[% END %]
Lines 132-137 Link Here
132
                            <th>Authorized value category</th>
133
                            <th>Authorized value category</th>
133
                            [% IF show_marcfield %]
134
                            [% IF show_marcfield %]
134
                                <th>MARC field</th>
135
                                <th>MARC field</th>
136
                                <th>MARC field mode</th>
135
                            [% END %]
137
                            [% END %]
136
                            [% IF show_searchable %]
138
                            [% IF show_searchable %]
137
                                <th>Searchable</th>
139
                                <th>Searchable</th>
Lines 146-151 Link Here
146
                                <td>[% field.authorised_value_category | html %]</td>
148
                                <td>[% field.authorised_value_category | html %]</td>
147
                                [% IF show_marcfield %]
149
                                [% IF show_marcfield %]
148
                                    <td>[% field.marcfield | html %]</td>
150
                                    <td>[% field.marcfield | html %]</td>
151
                                    <td>
152
                                        [% SWITCH field.marcfield_mode %]
153
                                            [% CASE 'get' %]Get value from MARC record
154
                                            [% CASE 'set' %]Save value to MARC record
155
                                        [% END %]
156
                                    </td>
149
                                [% END %]
157
                                [% END %]
150
                                [% IF show_searchable %]
158
                                [% IF show_searchable %]
151
                                    <td>
159
                                    <td>
Lines 190-195 Link Here
190
                            <label for="marcfield">MARC field: </label>
198
                            <label for="marcfield">MARC field: </label>
191
                            <input type="text" name="marcfield" id="marcfield" value="[% field.marcfield | html %]" />
199
                            <input type="text" name="marcfield" id="marcfield" value="[% field.marcfield | html %]" />
192
                        </li>
200
                        </li>
201
                        <li>
202
                            <label for="marcfield_mode">MARC field mode: </label>
203
                            <select id="marcfield_mode" name="marcfield_mode">
204
                                [% IF field.marcfield_mode == 'get' %]
205
                                    <option value="get" selected>Get value from MARC record (not modifiable)</option>
206
                                [% ELSE %]
207
                                    <option value="get">Get value from MARC record (not modifiable)</option>
208
                                [% END %]
209
210
                                [% IF field.marcfield_mode == 'set' %]
211
                                    <option value="set" selected>Save value to MARC record</option>
212
                                [% ELSE %]
213
                                    <option value="set">Save value to MARC record</option>
214
                                [% END %]
215
                            </select>
216
                        </li>
193
                    [% END %]
217
                    [% END %]
194
                    [% IF show_searchable %]
218
                    [% IF show_searchable %]
195
                        <li>
219
                        <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