Bugzilla – Attachment 13933 Details for
Bug 9044
Allow to select items on catalogue/detail.pl and trigger actions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9044: Provide item selection in record detail page (staff client)
Bug-9044-Provide-item-selection-in-record-detail-p.patch (text/plain), 12.40 KB, created by
Kyle M Hall (khall)
on 2012-12-07 15:36:20 UTC
(
hide
)
Description:
Bug 9044: Provide item selection in record detail page (staff client)
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2012-12-07 15:36:20 UTC
Size:
12.40 KB
patch
obsolete
>From a5f189ed983cb77baa3a660bb8f6cc4f7f38728d Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Mon, 19 Nov 2012 14:23:45 +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 <kyle@bywatersolutions.com> >--- > catalogue/detail.pl | 21 +++++++- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 10 +++ > .../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, 101 insertions(+), 7 deletions(-) > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 162530f..6c0bada 100755 >--- a/catalogue/detail.pl >+++ b/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, >@@ -379,4 +379,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 0cc5a54..e4fd521 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -388,3 +388,4 @@ INSERT INTO systempreferences (variable, value, options, explanation, type) VALU > 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('alphabet','A B C D E F G H I J K L M N O P Q R S T U V W X Y Z','Alphabet than can be expanded into browse links, e.g. on Home > Patrons',NULL,'free'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RefundLostItemFeeOnReturn', '1', 'If enabled, the lost item fee charged to a borrower will be refunded when the lost item is returned.', NULL, 'YesNo'); >+INSERT INTO systempreferences (variable, value, explanation, options, type) VALUES ('StaffDetailItemSelection', '0', 'Enable item selection in record detail page', NULL, 'YesNo'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 676bb3e..2f296c6 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6134,6 +6134,16 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > SetVersion ($DBversion); > } > >+$DBversion = "3.11.00.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) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >index f8e6b4a..80bf80a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >@@ -109,8 +109,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 %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref >index d9fc21a..65746f0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref >+++ b/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. >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index bf7ec07..86bb1c6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -36,6 +36,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(); >@@ -272,8 +308,27 @@ function verify_images() { > <div id="holdings"> > [% IF ( count ) %] > [% IF ( showncount ) %] >+ [% IF (StaffDetailItemSelection) %] >+ <a href="#" onclick="selectAllItems($(this).parent()); return false;">Select all</a> | >+ <a href="#" onclick="deselectAllItems($(this).parent()); return false;">Deselect all</a> | >+ <form onsubmit="itemSelectionExecuteAction($(this).parent()); return false;"> >+ <label>Action:</label> >+ <select name="itemselection_action"> >+ [% IF CAN_user_tools_items_batchdel %] >+ <option value="delete">Delete selected items</option> >+ [% END %] >+ [% IF CAN_user_tools_items_batchmod %] >+ <option value="modify">Modify selected items</option> >+ [% END %] >+ </select> >+ <input type="submit" value="Go" /> >+ <input type="checkbox" name="new_window" /> >+ <label>Open in new window</label> >+ </form> >+ [% END %] > <table> > <tr> >+ [% IF (StaffDetailItemSelection) %]<th></th>[% END %] > [% IF ( item_level_itypes ) %]<th>Item type</th>[% END %] > <th>Current location</th> > <th>Home Library</th> >@@ -293,6 +348,11 @@ function verify_images() { > </tr> > [% FOREACH itemloo IN itemloop %] > <tr> >+ [% IF (StaffDetailItemSelection) %] >+ <td style="text-align:center;vertical-align:middle"> >+ <input type="checkbox" value="[% itemloo.itemnumber %]" name="itemnumber" /> >+ </td> >+ [% END %] > [% IF ( item_level_itypes ) %] > <td class="itype"> > [% IF !noItemTypeImages && itemloo.imageurl %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt >index e3f6b29..89db154 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt >@@ -178,8 +178,8 @@ for( x=0; x<allColumns.length; x++ ){ > [% END %] > > <p> >- [% IF ( src == 'CATALOGUING') %] >- <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]">Done</a> >+ [% IF src %] >+ <a href="[% src %]">Done</a> > [% ELSE %] > <a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Return to batch item deletion</a> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt >index c65277a..141092d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt >@@ -190,8 +190,8 @@ $(document).ready(function(){ > [% END %] > [% ELSE %] <!-- // show --> > <fieldset class="action"> >-[% IF ( src == 'CATALOGUING') %] >- <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber %]">Done</a> >+[% IF src %] >+ <a href="[% src %]">Done</a> > [% ELSE %] > <a href="/cgi-bin/koha/tools/batchMod.pl">Done</a> > [% END %] >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9044
:
13344
|
13513
|
13933
|
14737
|
16612
|
16707
|
16708
|
16711
|
19060
|
19344
|
19913
|
19914
|
19915
|
19916
|
21324
|
21325
|
21326
|
21327
|
21561
|
21562
|
21563
|
21564
|
21591
|
21634
|
21683
|
21745
|
21746
|
21747
|
21748
|
21749