@@ -, +, @@ record --- installer/data/mysql/atomicupdate/bug_17378.sql | 2 + installer/data/mysql/sysprefs.sql | 1 + .../intranet-tmpl/prog/en/includes/cat-toolbar.inc | 11 +++- .../en/modules/admin/preferences/cataloguing.pref | 3 ++ .../prog/en/modules/cataloguing/additem.tt | 58 +++++++++++++++------- koha-tmpl/intranet-tmpl/prog/js/catalog.js | 2 +- 6 files changed, 56 insertions(+), 21 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_17378.sql --- a/installer/data/mysql/atomicupdate/bug_17378.sql +++ a/installer/data/mysql/atomicupdate/bug_17378.sql @@ -0,0 +1,2 @@ +INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES +('RecordItemLimit',NULL,NULL,'If this number is exceeded, a librarian will be unable to manually add more items to a record','Integer'); --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -451,6 +451,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('QueryWeightFields','1',NULL,'If ON, enables field weighting','YesNo'), ('QuoteOfTheDay','0',NULL,'Enable or disable display of Quote of the Day on the OPAC home page','YesNo'), ('RandomizeHoldsQueueWeight','0',NULL,'if ON, the holds queue in circulation will be randomized, either based on all location codes, or by the location codes specified in StaticHoldsQueueWeight','YesNo'), +('RecordItemLimit',NULL,NULL,'If this number is exceeded, a librarian will be unable to manually add more items to a record','Integer'), ('RecordLocalUseOnReturn','0',NULL,'If ON, statistically record returns of unissued items as local use, instead of return','YesNo'), ('RefundLostOnReturnControl','CheckinLibrary','CheckinLibrary|ItemHomeBranch|ItemHoldingBranch','If a lost item is returned, choose which branch to pick rules for refunding.','Choice'), ('RenewalLog','0','','If ON, log information about renewals','YesNo'), --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -1,3 +1,4 @@ +[% USE Koha %] [% INCLUDE 'blocking_errors.inc' %]
@@ -55,7 +56,15 @@ CAN_user_serials_create_subscription ) %] [% END %] [% END %] - [% IF ( CAN_user_editcatalogue_edit_items ) %]
  • Attach item
  • [% END %] + [% IF ( CAN_user_editcatalogue_edit_items ) %] + [% IF Koha.Preference('RecordItemLimit') && count > Koha.Preference('RecordItemLimit') %] +
  • + Attach item +
  • + [% ELSE %] +
  • Attach item
  • + [% END %] + [% END %] [% IF ( EasyAnalyticalRecords ) %][% IF ( CAN_user_editcatalogue_edit_items ) %]
  • Link to host item[% END %][% END %] [% IF ( LocalCoverImages || OPACLocalCoverImages) %][% IF ( CAN_user_tools_upload_local_cover_images ) %]
  • Upload image[% END %][% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -47,6 +47,9 @@ Cataloging: no: "Don't display" - buttons on the bib details page to print item spine labels. - + - If a record has more than + - pref: RecordItemLimit + - items, don't allow a librarian to add more manually. Record Structure: - - Fill in the default language for field 008 Range 35-37 of MARC21 records (e.g. eng, nor, ger, see MARC Code List for Languages) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -17,6 +17,9 @@ browser.show(); $(document).ready(function(){ + [% IF opisadd && Koha.Preference('RecordItemLimit') && item_loop.size > Koha.Preference('RecordItemLimit') %] + $("#f fieldset.rows").hide(); + [% END %] // Remove the onclick event defined in browser.js, // otherwise the deletion confirmation will not work correctly @@ -118,6 +121,13 @@ function CheckMultipleAdd(f) { if (f>99) { return confirm(_("You are about to add %s items. Continue?").format(f)); } + [% IF Koha.Preference('RecordItemLimit') %] + [% SET max_new_items = Koha.Preference('RecordItemLimit') - item_loop.size %] + if (f > [% max_new_items %]) { + alert(_("You are exceeding the [% Koha.Preference('RecordItemLimit') %] limit of items per record. You can only add [% max_new_items %] new item(s).")); + return false; + } + [% END %] } function Dopop(link,i) { defaultvalue=document.forms[0].field_value[i].value; @@ -336,31 +346,41 @@ function confirm_deletion() {
    [% IF ( opisadd ) %] - - - - - - - - - -
    - - - Cancel -

    The barcode you enter will be incremented for each additional item.

    -
    + [% IF Koha.Preference('RecordItemLimit') && item_loop.size > Koha.Preference('RecordItemLimit') %] +
    + [% item_loop.size %] items are attached to this record exceeding the threshold of [% Koha.Preference('RecordItemLimit') %] items. You cannot add more items. +
    + [% ELSE %] + + + + + + + + + +
    + + + Cancel +

    The barcode you enter will be incremented for each additional item.

    +
    + [% END %] [% ELSE %] - + [% IF Koha.Preference('RecordItemLimit') && item_loop.size > Koha.Preference('RecordItemLimit') %] + + [% ELSE %] + + [% END %] Cancel [% END %]
    --- a/koha-tmpl/intranet-tmpl/prog/js/catalog.js +++ a/koha-tmpl/intranet-tmpl/prog/js/catalog.js @@ -102,7 +102,7 @@ $(document).ready(function() { return false; }); $("#export").remove(); // Hide embedded export form if JS menus available - $("#deletebiblio").tooltip(); + $("#deletebiblio,#attachitem").tooltip(); $("#batchedit-disabled,#batchdelete-disabled,#deleteallitems-disabled") .on("click",function(e){ e.preventDefault(); --