Bug 34478: Changes for admin/koha2marclinks

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Marcel de Rooy 2024-02-02 10:47:17 +00:00 committed by Jonathan Druart
parent abfbf5f4e9
commit 700ff3508b
No known key found for this signature in database
GPG Key ID: A085E712BEF0E0F0
2 changed files with 5 additions and 3 deletions

View File

@ -28,7 +28,8 @@ use Koha::BiblioFrameworks;
use Koha::Caches;
use Koha::MarcSubfieldStructures;
my $input = CGI->new;
my $input = CGI->new;
my $op = $input->param('op') // q{};
my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
{
@ -45,7 +46,7 @@ my $cache = Koha::Caches->get_instance();
# Update data before showing the form
my $no_upd;
if( $input->param('add_field') && $input->request_method eq 'POST' ) {
if( $input->param('add_field') && $op eq 'cud-save' ) {
# add a mapping to all frameworks
my ($kohafield, $tag, $sub) = split /,/, $input->param('add_field'), 3;
my $rs = Koha::MarcSubfieldStructures->search({ tagfield => $tag, tagsubfield => $sub });
@ -55,7 +56,7 @@ if( $input->param('add_field') && $input->request_method eq 'POST' ) {
$template->param( error_add => 1, error_info => "$tag, $sub" );
}
} elsif( $input->param('remove_field') && $input->request_method eq 'POST' ) {
} elsif( $input->param('remove_field') && $op eq 'cud-save' ) {
# remove a mapping from all frameworks
my ($tag, $sub) = split /,/, $input->param('remove_field'), 2;
Koha::MarcSubfieldStructures->search({ tagfield => $tag, tagsubfield => $sub })->update({ kohafield => undef });

View File

@ -75,6 +75,7 @@
</div> <!-- /.page-section -->
<input id="remove_field" name="remove_field" type="hidden" value=""/>
<input id="add_field" name="add_field" type="hidden" value=""/>
<input type="hidden" name="op" value="cud-save" />
</form>