@@ -, +, @@ - Delete selected items: redirect to batch items deletion - Modify selected items: redirect to batch items modification --- catalogue/detail.pl | 21 +++++++- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 11 ++++ .../intranet-tmpl/prog/en/includes/cat-toolbar.inc | 2 - .../en/modules/admin/preferences/staff_client.pref | 6 ++ .../prog/en/modules/catalogue/detail.tt | 60 ++++++++++++++++++++ .../prog/en/modules/tools/batchMod-del.tt | 4 +- .../prog/en/modules/tools/batchMod-edit.tt | 4 +- 8 files changed, 102 insertions(+), 7 deletions(-) --- a/catalogue/detail.pl +++ a/catalogue/detail.pl @@ -47,7 +47,7 @@ my $query = CGI->new(); my $analyze = $query->param('analyze'); -my ( $template, $borrowernumber, $cookie ) = get_template_and_user( +my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( { template_name => 'catalogue/detail.tmpl', query => $query, @@ -377,4 +377,23 @@ if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->pref 'sort'=>'-weight', limit=>$tag_quantity})); } +my $StaffDetailItemSelection = C4::Context->preference('StaffDetailItemSelection'); +if ($StaffDetailItemSelection) { + # Only enable item selection if user can execute at least one action + if ( + $flags->{superlibrarian} + || ( + ref $flags->{tools} eq 'HASH' && ( + $flags->{tools}->{items_batchmod} # Modify selected items + || $flags->{tools}->{items_batchdel} # Delete selected items + ) + ) + || ( ref $flags->{tools} eq '' && $flags->{tools} ) + ) + { + $template->param( + StaffDetailItemSelection => $StaffDetailItemSelection ); + } +} + output_html_with_http_headers $query, $cookie, $template->output; --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -386,3 +386,4 @@ INSERT INTO systempreferences (variable,value,explanation,type) VALUES('OPACdidy INSERT INTO systempreferences (variable,value,explanation,type) VALUES('INTRAdidyoumean',NULL,'Did you mean? configuration for the Intranet. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'); INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer'); +INSERT INTO systempreferences (variable, value, explanation, options, type) VALUES ('StaffDetailItemSelection', '0', 'Enable item selection in record detail page', NULL, 'YesNo'); --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -6055,6 +6055,17 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "XXX"; +if (C4::Context->preference('Version') < TransformToNum($DBversion)) { + $dbh->do(qq{ + INSERT INTO systempreferences (variable, value, explanation, options, type) + VALUES ('StaffDetailItemSelection', '0', 'Enable item selection in record detail page', NULL, 'YesNo') + }); + print "Upgrade to $DBversion done (Add system preference StaffDetailItemSelection)\n"; + SetVersion($DBversion); +} + + =head1 FUNCTIONS =head2 TableExists($table) --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -110,8 +110,6 @@ function confirm_items_deletion() { var editmenu = [ [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]{ text: _("Edit record"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]&frameworkcode=&op=" },[% END %] [% IF ( CAN_user_editcatalogue_edit_items ) %]{ text: _("Edit items"), url: "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber %]" },[% END %] - [% IF ( CAN_user_tools_items_batchmod ) %]{ text: _("Edit items in batch"), url: "/cgi-bin/koha/tools/batchMod.pl?op=show&biblionumber=[% biblionumber %]&src=CATALOGUING" },[% END %] - [% IF ( CAN_user_tools_items_batchdel ) %]{ text: _("Delete items in batch"), url: "/cgi-bin/koha/tools/batchMod.pl?del=1&op=show&biblionumber=[% biblionumber %]&src=CATALOGUING" },[% END %] [% IF ( CAN_user_editcatalogue_edit_items ) %]{ text: _("Attach item"), url: "/cgi-bin/koha/cataloguing/moveitem.pl?biblionumber=[% biblionumber %]" },[% END %] [% IF ( EasyAnalyticalRecords ) %][% IF ( CAN_user_editcatalogue_edit_items ) %]{ text: _("Link to host item"), url: "/cgi-bin/koha/cataloguing/linkitem.pl?biblionumber=[% biblionumber %]" },[% END %][% END %] [% IF ( LocalCoverImages || OPACLocalCoverImages) %][% IF ( CAN_user_tools_upload_local_cover_images ) %]{ text: _("Upload image"), url: "/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=[% biblionumber %]&filetype=image" },[% END %][% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref @@ -122,3 +122,9 @@ Staff Client: yes: Show no: "Don't show" - the cart option in the staff client. + - + - pref: StaffDetailItemSelection + choices: + yes: Enable + no: Disable + - item selection in record detail page. --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -35,6 +35,42 @@ function verify_images() { } }); } + + [% IF StaffDetailItemSelection %] + function selectAllItems(div) { + $("input[name='itemnumber'][type='checkbox']", div).attr('checked', 'checked'); + } + + function deselectAllItems(div) { + $("input[name='itemnumber'][type='checkbox']", div).removeAttr('checked'); + } + + function itemSelectionExecuteAction(div) { + var itemnumbers = new Array(); + $("input[name='itemnumber'][type='checkbox']:checked", div).each(function() { + itemnumbers.push($(this).val()); + }); + if (itemnumbers.length > 0) { + var action = $('select[name="itemselection_action"]', div).val(); + var del = (action == 'delete') ? 1 : 0; + var url = '/cgi-bin/koha/tools/batchMod.pl?op=show'; + if (action == 'delete') { + url += '&del=1'; + } + url += '&itemnumber=' + itemnumbers.join('&itemnumber='); + url += '&src=' + '[% "/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber" |uri %]'; + new_window = $("input[name='new_window']", div).attr('checked'); + if (new_window) { + window.open(url); + } else { + window.location.href = url; + } + } else { + alert(_("Please select at least one item.")); + } + } + [% END %] + $(document).ready(function() { $('#bibliodetails').tabs(); $('#search-form').focus(); @@ -266,8 +302,27 @@ function verify_images() {
[% IF ( count ) %] [% IF ( showncount ) %] + [% IF (StaffDetailItemSelection) %] + Select all | + Deselect all | +
+ + + + + +
+ [% END %] + [% IF (StaffDetailItemSelection) %][% END %] [% IF ( item_level_itypes ) %][% END %] @@ -287,6 +342,11 @@ function verify_images() { [% FOREACH itemloo IN itemloop %] + [% IF (StaffDetailItemSelection) %] + + [% END %] [% IF ( item_level_itypes ) %]
Item typeCurrent location Home Library
+ + [% IF !noItemTypeImages && itemloo.imageurl %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt @@ -178,8 +178,8 @@ for( x=0; x - [% IF ( src == 'CATALOGUING') %] - Done + [% IF src %] + Done [% ELSE %] Return to batch item deletion [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt @@ -184,8 +184,8 @@ $(document).ready(function(){ [% ELSE %]
-[% IF ( src == 'CATALOGUING') %] - Done +[% IF src %] + Done [% ELSE %] Done [% END %] --