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

(-)a/admin/koha2marclinks.pl (-3 / +8 lines)
Lines 48-59 my $cache = Koha::Caches->get_instance(); Link Here
48
# Update data before showing the form
48
# Update data before showing the form
49
my $no_upd;
49
my $no_upd;
50
50
51
if( $input->param('add_field') ) {
51
if( $input->param('add_field') && $input->request_method eq 'POST' ) {
52
    # add a mapping to all frameworks
52
    # add a mapping to all frameworks
53
    my ($kohafield, $tag, $sub) = split /,/, $input->param('add_field'), 3;
53
    my ($kohafield, $tag, $sub) = split /,/, $input->param('add_field'), 3;
54
    Koha::MarcSubfieldStructures->search({ tagfield => $tag, tagsubfield => $sub })->update({ kohafield => $kohafield });
54
    my $rs = Koha::MarcSubfieldStructures->search({ tagfield => $tag, tagsubfield => $sub });
55
    if( $rs->count ) {
56
        $rs->update({ kohafield => $kohafield });
57
    } else {
58
        $template->param( error_add => 1, error_info => "$tag, $sub" );
59
    }
55
60
56
} elsif( $input->param('remove_field') ) {
61
} elsif( $input->param('remove_field') && $input->request_method eq 'POST' ) {
57
    # remove a mapping from all frameworks
62
    # remove a mapping from all frameworks
58
    my ($tag, $sub) = split /,/, $input->param('remove_field'), 2;
63
    my ($tag, $sub) = split /,/, $input->param('remove_field'), 2;
59
    Koha::MarcSubfieldStructures->search({ tagfield => $tag, tagsubfield => $sub })->update({ kohafield => undef });
64
    Koha::MarcSubfieldStructures->search({ tagfield => $tag, tagsubfield => $sub })->update({ kohafield => undef });
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt (-1 / +6 lines)
Lines 13-18 function AddFld(kohafield) { Link Here
13
    if( temp.length == 2 ) {
13
    if( temp.length == 2 ) {
14
        $('#add_field').val( kohafield+','+fieldstr );
14
        $('#add_field').val( kohafield+','+fieldstr );
15
        $('#koha2marc').submit();
15
        $('#koha2marc').submit();
16
    } else {
17
        alert( "Invalid input. Enter something like: 245,a" );
16
    }
18
    }
17
}
19
}
18
20
Lines 42-47 function RemFld(tagfield, subfield ) { Link Here
42
<br/>
44
<br/>
43
<form action="/cgi-bin/koha/admin/koha2marclinks.pl" method="post" id="koha2marc">
45
<form action="/cgi-bin/koha/admin/koha2marclinks.pl" method="post" id="koha2marc">
44
46
47
[% IF error_add %]
48
    <div class="dialog alert">Failed to add mapping for [% error_info %]</div>
49
[% END %]
50
45
<table id="kohafields">
51
<table id="kohafields">
46
<thead><tr>
52
<thead><tr>
47
    <th>Koha field</th>
53
    <th>Koha field</th>
48
- 

Return to bug 10306