Bugzilla – Attachment 68773 Details for
Bug 10306
Koha to MARC mappings (Part 1): Allow multiple mappings per kohafield (for say 260/RDA 264)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10306: (QA follow-up) More feedback for admins in koha2marclinks
Bug-10306-QA-follow-up-More-feedback-for-admins-in.patch (text/plain), 2.92 KB, created by
Kyle M Hall (khall)
on 2017-10-27 16:50:38 UTC
(
hide
)
Description:
Bug 10306: (QA follow-up) More feedback for admins in koha2marclinks
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2017-10-27 16:50:38 UTC
Size:
2.92 KB
patch
obsolete
>From bc5da8a6ea996eef36bcfef2025caf36c228975e Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 23 Oct 2017 12:07:04 +0200 >Subject: [PATCH] Bug 10306: (QA follow-up) More feedback for admins in > koha2marclinks > >As requested by Tomas, this patch does: > >[1] Add a js alert when you did not type field,subfield >[2] Print a yellow alert div when the field,subfield is not found. >[3] Bonus: Make it little bit more secure by demanding a POST. (Leaving > CSRF etc. for another report.) > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > admin/koha2marclinks.pl | 11 ++++++++--- > .../intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt | 6 ++++++ > 2 files changed, 14 insertions(+), 3 deletions(-) > >diff --git a/admin/koha2marclinks.pl b/admin/koha2marclinks.pl >index d6f2b5f..b337a3c 100755 >--- a/admin/koha2marclinks.pl >+++ b/admin/koha2marclinks.pl >@@ -48,12 +48,17 @@ my $cache = Koha::Caches->get_instance(); > # Update data before showing the form > my $no_upd; > >-if( $input->param('add_field') ) { >+if( $input->param('add_field') && $input->request_method eq 'POST' ) { > # add a mapping to all frameworks > my ($kohafield, $tag, $sub) = split /,/, $input->param('add_field'), 3; >- Koha::MarcSubfieldStructures->search({ tagfield => $tag, tagsubfield => $sub })->update({ kohafield => $kohafield }); >+ my $rs = Koha::MarcSubfieldStructures->search({ tagfield => $tag, tagsubfield => $sub }); >+ if( $rs->count ) { >+ $rs->update({ kohafield => $kohafield }); >+ } else { >+ $template->param( error_add => 1, error_info => "$tag, $sub" ); >+ } > >-} elsif( $input->param('remove_field') ) { >+} elsif( $input->param('remove_field') && $input->request_method eq 'POST' ) { > # 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 }); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt >index 32061a0..afddb9b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt >@@ -13,6 +13,8 @@ function AddFld(kohafield) { > if( temp.length == 2 ) { > $('#add_field').val( kohafield+','+fieldstr ); > $('#koha2marc').submit(); >+ } else { >+ alert( "Invalid input. Enter something like: 245,a" ); > } > } > >@@ -42,6 +44,10 @@ function RemFld(tagfield, subfield ) { > <br/> > <form action="/cgi-bin/koha/admin/koha2marclinks.pl" method="post" id="koha2marc"> > >+[% IF error_add %] >+ <div class="dialog alert">Failed to add mapping for [% error_info %]</div> >+[% END %] >+ > <table id="kohafields"> > <thead><tr> > <th>Koha field</th> >-- >2.10.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10306
:
65539
|
65540
|
65541
|
65542
|
65543
|
65544
|
65545
|
65948
|
65949
|
65950
|
65951
|
65952
|
65953
|
66134
|
66135
|
66137
|
66138
|
66139
|
66140
|
66141
|
66142
|
66327
|
66328
|
66329
|
66330
|
66331
|
66332
|
66405
|
66547
|
66548
|
67501
|
67502
|
67503
|
67504
|
67505
|
67506
|
67507
|
68382
|
68766
|
68767
|
68768
|
68769
|
68770
|
68771
|
68772
| 68773