Bugzilla – Attachment 96576 Details for
Bug 21232
Problems when linking a subscription to a non-existing biblionumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21232: Add a client-side check on biblionumber when creating a subscription
Bug-21232-Add-a-client-side-check-on-biblionumber-.patch (text/plain), 4.01 KB, created by
Katrin Fischer
on 2019-12-22 17:11:51 UTC
(
hide
)
Description:
Bug 21232: Add a client-side check on biblionumber when creating a subscription
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2019-12-22 17:11:51 UTC
Size:
4.01 KB
patch
obsolete
>From 8d32f9ebf1d1d63dc750879f85a81461f803314c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 13 Dec 2019 12:41:20 +0100 >Subject: [PATCH] Bug 21232: Add a client-side check on biblionumber when > creating a subscription > >This patch adds an AJAX call to the REST API (/api/v1/biblios/) to >retrieve and display the biblio's title. >On clicking the "next" button a check is done to make sure the title >exists, which means the biblionumber we manually entered is valid (can >we assume a title is mandatory?) > >Test plan: >- Create or edit a new subscription >- Enter an invalid biblionumber in the input >=> A friendly note is telling you that the biblio does not exist >- Try to switch to the next screen >=> You get an alert >- Enter a valid biblionumber in the input >=> The title is displayed >=> Try to switch to the next screen >=> It works! > >Signed-off-by: hc <hc@interleaf.ie> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../prog/en/modules/serials/subscription-add.tt | 1 + > .../intranet-tmpl/prog/js/subscription-add.js | 30 ++++++++++++++++++++-- > 2 files changed, 29 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >index e59c3258a7..c5dd38639c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >@@ -61,6 +61,7 @@ fieldset.rows table { clear: none; margin: 0; } > <label for="biblionumber" class="required">Record:</label> > <input type="text" name="biblionumber" id="biblionumber" value="[% bibnum | html %]" size="8" /> > (<input type="text" name="title" value="[% bibliotitle | html %]" disabled="disabled" readonly="readonly" />) <span class="required" title="Subscriptions must be associated with a bibliographic record">Required</span> >+ <span id="error_bib_not_exist"></span> > <div class="hint">Subscriptions must be associated with a bibliographic record</div> > <div class="inputnote"> <a href="#" id="record_search"><i class="fa fa-search"></i> Search for record</a> > [% IF ( CAN_user_editcatalogue ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js >index 63104717bd..8f14fba505 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js >@@ -52,12 +52,17 @@ function Check_page1() { > return false; > } > } >- if ($("#biblionumber").val().length == 0) { >+ >+ var biblionumber = $("#biblionumber").val() >+ if ( biblionumber.length == 0 ) { > alert( MSG_LINK_BIBLIO ); > return false; > } > >- return true; >+ var bib_exists = $("input[name='title']").val().length; >+ >+ if (!bib_exists) alert(_("Bibliographic record does not exist!")); >+ return bib_exists; > } > > function Check_page2(){ >@@ -694,4 +699,25 @@ $(document).ready(function() { > e.preventDefault(); > hidePredcitionPatternTest(); > }); >+ >+ $("#biblionumber").on("change", function(){ >+ var biblionumber = $(this).val(); >+ $.ajax({ >+ url: "/api/v1/biblios/" + biblionumber, >+ type: "GET", >+ headers: { >+ Accept: "application/json", >+ }, >+ contentType: "application/json", >+ success: function (biblio) { >+ $("input[name='title']").val(biblio['title']); >+ $("#error_bib_not_exist").html(""); >+ }, >+ error: function (x) { >+ $("input[name='title']").val(''); >+ $("#error_bib_not_exist").html("This bibliographic record does not exist"); >+ } >+ }); >+ }); >+ > }); >-- >2.11.0
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 21232
:
89357
|
96245
|
96489
| 96576