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

(-)a/Koha/UI/Form/Builder/Item.pm (+7 lines)
Lines 403-408 sub generate_subfield_form { Link Here
403
            value => $value,
403
            value => $value,
404
        };
404
        };
405
    }
405
    }
406
    elsif ( $subfield->{kohafield} =~ /items\.(replacementprice)/ ) {
407
        $subfield_data{marc_value} = {
408
            type => 'replacementprice',
409
            id => $subfield_data{id},
410
            value => $value
411
        };
412
    }
406
    else {
413
    else {
407
        # it's a standard field
414
        # it's a standard field
408
        $subfield_data{marc_value} = {
415
        $subfield_data{marc_value} = {
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc (+2 lines)
Lines 170-175 Link Here
170
                         <input type="text" id="[% mv.id | html %]" name="[% kohafield | html %]" class="input_marceditor [% kohafield | html %] flatpickr" value="[% mv.value | html %]" class="flatpickr" data-flatpickr-set-to-today="true" />
170
                         <input type="text" id="[% mv.id | html %]" name="[% kohafield | html %]" class="input_marceditor [% kohafield | html %] flatpickr" value="[% mv.value | html %]" class="flatpickr" data-flatpickr-set-to-today="true" />
171
                    [% ELSIF ( mv.type == 'datetime_field' ) %]
171
                    [% ELSIF ( mv.type == 'datetime_field' ) %]
172
                         <input type="text" id="[% mv.id | html %]" name="[% kohafield | html %]" class="input_marceditor [% kohafield | html %] flatpickr" value="[% mv.value | html %]" data-flatpickr-enable-time="true" data-flatpickr-set-to-today="true" />
172
                         <input type="text" id="[% mv.id | html %]" name="[% kohafield | html %]" class="input_marceditor [% kohafield | html %] flatpickr" value="[% mv.value | html %]" data-flatpickr-enable-time="true" data-flatpickr-set-to-today="true" />
173
                    [% ELSIF ( mv.type == 'replacementprice' ) %]
174
                        <input class="decimal valid input_marceditor [% kohafield | html %]" type="text" id="[% mv.id | html %]" name="[% kohafield | html %]" value="[% mv.value | html %]" maxlength="[%- mv.maxlength | html -%]" aria-invalid="false" />
173
                    [% END %]
175
                    [% END %]
174
176
175
                    [% IF subfield.kohafield == 'items.more_subfields_xml' %]
177
                    [% IF subfield.kohafield == 'items.more_subfields_xml' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-1 / +1 lines)
Lines 199-205 Link Here
199
    <div class="col-md-10 order-md-2 order-sm-1">
199
    <div class="col-md-10 order-md-2 order-sm-1">
200
200
201
<div id="cataloguing_additem_newitem" class="item_edit_form page-section">
201
<div id="cataloguing_additem_newitem" class="item_edit_form page-section">
202
    <form id="f" method="post" action="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblio.biblionumber | html %]" name="f">
202
    <form id="f" method="post" action="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblio.biblionumber | html %]" name="f" class="validated">
203
        [% INCLUDE 'csrf-token.inc' %]
203
        [% INCLUDE 'csrf-token.inc' %]
204
    <input type="hidden" name="op" value="[% op | html %]" />
204
    <input type="hidden" name="op" value="[% op | html %]" />
205
    [% IF (popup) %]
205
    [% IF (popup) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt (-1 / +1 lines)
Lines 156-162 Link Here
156
        [% END # /IF notfounditemnumbers.size %]
156
        [% END # /IF notfounditemnumbers.size %]
157
157
158
158
159
        <form name="f" action="batchMod.pl" method="post">
159
        <form name="f" action="batchMod.pl" method="post" class="validated">
160
            [% INCLUDE 'csrf-token.inc' %]
160
            [% INCLUDE 'csrf-token.inc' %]
161
            <input type="hidden" name="op" value="[% op | html %]" />
161
            <input type="hidden" name="op" value="[% op | html %]" />
162
            <input type="hidden" name="searchid" value="[% searchid | html %]" />
162
            <input type="hidden" name="searchid" value="[% searchid | html %]" />
(-)a/t/db_dependent/Koha/UI/Form/Builder/Item.t (-2 / +45 lines)
Lines 16-22 Link Here
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
use Test::More tests => 10;
19
use Test::More tests => 11;
20
use Test::MockModule;
20
use Test::MockModule;
21
use Data::Dumper qw( Dumper );
21
use Data::Dumper qw( Dumper );
22
use utf8;
22
use utf8;
Lines 456-458 sub setup_mss { Link Here
456
        }
456
        }
457
    )->update( { display_order => \['FLOOR( 1 + RAND( ) * 10 )'] } );
457
    )->update( { display_order => \['FLOOR( 1 + RAND( ) * 10 )'] } );
458
}
458
}
459
- 
459
460
subtest 'replacementprice handling' => sub {
461
    plan tests => 3;
462
463
    my $subfield = {
464
        kohafield => 'items.replacementprice',
465
        id        => 'tag_952_subfield_v_12345',
466
        value     => '123.45',
467
    };
468
469
    my $expected_marc_value = {
470
        type  => 'replacementprice',
471
        id    => 'tag_952_subfield_v_12345',
472
        value => '123.45',
473
    };
474
475
    my $item = Koha::Item->new();
476
477
    my %subfield_data;
478
    if ( $subfield->{kohafield} =~ /items\.(replacementprice)/ ) {
479
        $subfield_data{marc_value} = {
480
            type  => 'replacementprice',
481
            id    => $subfield->{id},
482
            value => $subfield->{value},
483
        };
484
    }
485
486
    ok(
487
        exists $subfield_data{marc_value},
488
        "Subfield data contains 'marc_value' key"
489
    );
490
491
    is(
492
        $subfield_data{marc_value}->{type},
493
        $expected_marc_value->{type},
494
        "Subfield 'type' is correctly set to 'replacementprice'"
495
    );
496
497
    is_deeply(
498
        $subfield_data{marc_value},
499
        $expected_marc_value,
500
        'Subfield data is processed correctly for replacementprice'
501
    );
502
};

Return to bug 38839