@@ -, +, @@ you are placing. --- installer/data/mysql/updatedatabase.pl | 7 ++++ .../opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 13 +++++++ koha-tmpl/opac-tmpl/bootstrap/js/global.js | 14 +++++++- .../opac-tmpl/prog/en/modules/opac-reserve.tt | 15 ++++++++ opac/opac-reserve.pl | 38 ++++++++++++------- reserve/request.pl | 14 +++++--- 6 files changed, 81 insertions(+), 20 deletions(-) --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -8551,6 +8551,13 @@ if (CheckVersion($DBversion)) { SetVersion($DBversion); } +$DBversion = "3.15.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('maxreserves',50,'System-wide maximum number of holds a patron can place','','Integer')"); + print "Upgrade to $DBversion done (Re-add system preference maxreserves)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -105,6 +105,12 @@ [% END %] + [% IF ( new_reserves_allowed ) %] +
+ Sorry, you can only place [% new_reserves_allowed %] more holds. Please uncheck the checkboxes for the items you wish to not place holds on. +
+ [% END %] +
@@ -563,6 +569,13 @@ var biblionumbers = ""; var selections = ""; + [% IF new_reserves_allowed %] + if ($(".confirmjs:checked").size() > [% new_reserves_allowed %] ) { + alert(_("You cannot place this many new holds. Please reduce the number of selected holds to %s holds").format([% new_reserves_allowed %])); + return false; + } + [% END %] + if ($(".confirmjs:checked").size() == 0) { alert(MSG_NO_RECORD_SELECTED); return false; --- a/koha-tmpl/opac-tmpl/bootstrap/js/global.js +++ a/koha-tmpl/opac-tmpl/bootstrap/js/global.js @@ -1,3 +1,15 @@ +// http://stackoverflow.com/questions/1038746/equivalent-of-string-format-in-jquery/5341855#5341855 +String.prototype.format = function() { return formatstr(this, arguments) } +function formatstr(str, col) { + col = typeof col === 'object' ? col : Array.prototype.slice.call(arguments, 1); + var idx = 0; + return str.replace(/%%|%s|%(\d+)\$s/g, function (m, n) { + if (m == "%%") { return "%"; } + if (m == "%s") { return col[idx++]; } + return col[n]; + }); +}; + function confirmDelete(message) { return (confirm(message) ? true : false); } @@ -22,4 +34,4 @@ function prefixOf (s, tok) { function suffixOf (s, tok) { var index = s.indexOf(tok); return s.substring(index + 1); -} +} --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt +++ a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt @@ -7,10 +7,13 @@