From 9f3e217f99a05774d405aa85dc51a8d8591599ce Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 9 Nov 2012 15:16:52 +0100 Subject: [PATCH] Bug 9044: Provide item selection in record detail page (staff client) This patch add a column in the items table of catalogue/detail.pl that contains checkboxes for item selection and a drop-down list of actions that can be executed for the selection of items. Currently available actions are: - Delete selected items: redirect to batch items deletion - Modify selected items: redirect to batch items modification These actions replace the two menu entries corresponding to the same action. Item selection is only enabled if the new syspref StaffDetailItemSelection is ON. Actions are not displayed if user doesn't have the right permissions. Signed-off-by: Kyle M Hall --- 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(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 6b313b2..e3ce9a0 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -48,7 +48,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, @@ -399,4 +399,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; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index d5d15d7..de1816c 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -406,3 +406,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('NotesBlacklist','','List of notes fields that should not appear in the title notes/description separator of details',NULL,'free'); INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserCSS', '', NULL, 'Add CSS to be included in the SCO module in an embedded