@@ -, +, @@ subscription - Create or update a subscription - In the "Vendor" input try an empty string, a valid vendor's id, and --- .../intranet-tmpl/prog/en/modules/serials/subscription-add.tt | 3 +++ koha-tmpl/intranet-tmpl/prog/js/subscription-add.js | 9 ++++++++- serials/subscription-add.pl | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt @@ -1,4 +1,5 @@ [% USE raw %] +[% USE To %] [% USE Asset %] [% USE KohaDates %] [% USE Branches %] @@ -554,6 +555,8 @@ fieldset.rows table { clear: none; margin: 0; } var MSG_MANA_SHOW_DETAILS = _("Show Mana results"); var MSG_MANA_NO_SUBSCRIPTION_FOUND = _("No subscription found on Mana Knowledge Base"); var MSG_MANA_SHARE_PATTERN = _("Please feel free to share your pattern with all others librarians once you are done"); + + var BOOKSELLER_IDS = [% To.json( bookseller_ids ) || '[]' | $raw %]; [% Asset.js("js/subscription-add.js") | $raw %] [% Asset.js("js/showpredictionpattern.js") | $raw %] --- a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js +++ a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js @@ -46,11 +46,18 @@ function Clear(id) { } function Check_page1() { - if ( $("#aqbooksellerid").val().length == 0) { + var bookseller_id = $("#aqbooksellerid").val(); + if ( bookseller_id.length == 0) { input_box = confirm( MSG_LINK_TO_VENDOR ); if (input_box==false) { return false; } + } else { + var bookseller_ids = BOOKSELLER_IDS; + if ( $.inArray(Number(bookseller_id), bookseller_ids) == -1 ) { + alert ("The vendor does not exist"); + return false; + } } var biblionumber = $("#biblionumber").val() --- a/serials/subscription-add.pl +++ a/serials/subscription-add.pl @@ -244,6 +244,9 @@ if ($op eq 'addsubscription') { $template->param( locales => $languages ); + my @bookseller_ids = Koha::Acquisition::Booksellers->search->get_column('id'); + $template->param( bookseller_ids => \@bookseller_ids ); + output_html_with_http_headers $query, $cookie, $template->output; } --