@@ -, +, @@ by pickup library and/or itemtype --- C4/Reserves.pm | 25 +- .../data/mysql/atomicupdate/split_holds_queue.sql | 4 + installer/data/mysql/sysprefs.sql | 1 + koha-tmpl/intranet-tmpl/prog/css/staff-global.css | 8 + .../intranet-tmpl/prog/en/includes/holds_table.inc | 200 ++++++++++++++++ .../en/modules/admin/preferences/circulation.pref | 14 ++ .../prog/en/modules/reserve/request.tt | 257 +++++++-------------- reserve/request.pl | 10 +- t/db_dependent/Holds.t | 8 +- 9 files changed, 334 insertions(+), 193 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/split_holds_queue.sql create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc --- a/C4/Reserves.pm +++ a/C4/Reserves.pm @@ -1229,7 +1229,7 @@ sub _OnShelfHoldsAllowed { =head2 AlterPriority - AlterPriority( $where, $reserve_id ); + AlterPriority( $where, $reserve_id, $prev_priority, $next_priority, $first_priority, $last_priority ); This function changes a reserve's priority up, down, to the top, or to the bottom. Input: $where is 'up', 'down', 'top' or 'bottom'. Biblionumber, Date reserve was placed @@ -1237,7 +1237,7 @@ Input: $where is 'up', 'down', 'top' or 'bottom'. Biblionumber, Date reserve was =cut sub AlterPriority { - my ( $where, $reserve_id ) = @_; + my ( $where, $reserve_id, $prev_priority, $next_priority, $first_priority, $last_priority ) = @_; my $hold = Koha::Holds->find( $reserve_id ); return unless $hold; @@ -1247,21 +1247,18 @@ sub AlterPriority { return; } - if ( $where eq 'up' || $where eq 'down' ) { - - my $priority = $hold->priority; - $priority = $where eq 'up' ? $priority - 1 : $priority + 1; - _FixPriority({ reserve_id => $reserve_id, rank => $priority }) - + if ( $where eq 'up' ) { + return unless $prev_priority; + _FixPriority({ reserve_id => $reserve_id, rank => $prev_priority }) + } elsif ( $where eq 'down' ) { + return unless $next_priority; + _FixPriority({ reserve_id => $reserve_id, rank => $next_priority }) } elsif ( $where eq 'top' ) { - - _FixPriority({ reserve_id => $reserve_id, rank => '1' }) - + _FixPriority({ reserve_id => $reserve_id, rank => $first_priority }) } elsif ( $where eq 'bottom' ) { - - _FixPriority({ reserve_id => $reserve_id, rank => '999999' }); - + _FixPriority({ reserve_id => $reserve_id, rank => $last_priority }); } + # FIXME Should return the new priority } --- a/installer/data/mysql/atomicupdate/split_holds_queue.sql +++ a/installer/data/mysql/atomicupdate/split_holds_queue.sql @@ -0,0 +1,4 @@ +INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES +('HoldsSplitQueue','nothing','nothing|branch|itemtype|branch_itemtype','In the staff client, split the holds view by the given criteria','Choice'), +('HoldsSplitQueueNumbering', 'actual', 'actual|virtual', 'If the holds queue is split, decide if the acual priorities should be displayed', 'Choice'); + --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -189,6 +189,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('HoldFeeMode','not_always','any_time_is_placed|not_always|any_time_is_collected','Set the hold fee mode','Choice'), ('HoldsLog','0',NULL,'If ON, log create/cancel/suspend/resume actions on holds.','YesNo'), ('HoldsQueueSkipClosed', '0', NULL, 'If enabled, any libraries that are closed when the holds queue is built will be ignored for the purpose of filling holds.', 'YesNo'), +('HoldsSplitQueue','nothing','nothing|branch|itemtype|branch_itemtype','In the staff client, split the holds view by the given criteria','Choice'), ('HoldsToPullStartDate','2',NULL,'Set the default start date for the Holds to pull list to this many days ago','Integer'), ('HomeOrHoldingBranch','holdingbranch','holdingbranch|homebranch','Used by Circulation to determine which branch of an item to check with independent branches on, and by search to determine which branch to choose for availability ','Choice'), ('HouseboundModule',0,'','If ON, enable housebound module functionality.','YesNo'), --- a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css +++ a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css @@ -360,6 +360,14 @@ fieldset { border-radius:5px; } +fieldset.standard { + background-color:#f4f8f9 !important; +} + +fieldset.contrast { + background-color:#F3F3F3 !important; +} + fieldset.lastchecked { margin-bottom : 0; border-bottom-width: 0; --- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc @@ -0,0 +1,200 @@ + + + [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] + + + [% ELSE %] + + [% END %] + + + + + + + [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] + + [% END %] + + [% IF SuspendHoldsIntranet %][% END %] + + + [% FOREACH hold IN holds %] + + + + [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] + [% SET first_priority = holds.first.priority %] + [% SET last_priority = holds.last.priority %] + [% SET prev_priority = loop.prev.priority %] + [% SET next_priority = loop.next.priority %] + [% holds.index %] + + + [% END %] + + + + + + + + + + + + [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] + + [% END %] + + + + [% IF SuspendHoldsIntranet %] + + [% END # IF SuspendHoldsIntranet %] + + + + [% END %] +
Priority Delete?PatronNotesDateExpirationPickup libraryDetailsToggle set to lowest priority  
+ + + + + + + Go up + + + + Go top + + + + Go bottom + + + + Go down + + + + [% IF ( hold.hidename ) %] + [% hold.cardnumber (hold.borrowernumber) %] + [% ELSE %] + [% hold.firstname %] [% hold.surname %] + [% END %] + + [% hold.notes %][% hold.date %][% hold.expirationdate %] + [% IF ( hold.found ) %] + [% IF ( hold.atdestination ) %] + [% IF ( hold.found ) %] + Item waiting at [% hold.wbrname %] since [% hold.waiting_date | $KohaDates %] + [% ELSE %] + Waiting to be pulled + [% END %] + [% ELSE %] + Item being transferred to [% hold.wbrname %] + [% END %] + [% ELSE %] + [% IF Koha.Preference('IndependentBranches') && Branches.all().size == 1 %] + [% Branches.GetName(hold.branchcode) %] + [% ELSE %] + + [% END %] + [% END %] + + [% IF ( hold.found ) %] + + [% IF ( hold.barcodenumber ) %] + [% hold.barcodenumber %] + + [% ELSE %] + No barcode + [% END %] + + [% ELSE %] + [% IF ( hold.item_level_hold ) %] + + Only item + + [% IF ( hold.barcodenumber ) %] + [% hold.barcodenumber %] + + [% ELSE %] + No barcode + [% END %] + + + [% ELSE %] + [% IF hold.itemtype %] + Next available [% ItemTypes.GetDescription( hold.itemtype ) %] item + [% ELSE %] + Next available + [% END %] + + + [% END %] + [% END %] + + + [% IF ( hold.lowestPriority ) %] + Unset lowest priority + [% ELSE %] + Set to lowest priority + [% END %] + + + + Cancel + + + [% UNLESS ( hold.found ) %] + + + [% IF AutoResumeSuspendedHolds %] + + + Clear date + [% ELSE %] + + [% END %] + + [% ELSE %] + + [% END %] +
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -488,6 +488,20 @@ Circulation: - the restriction periods. Holds Policy: - + - In the staff client, split the holds queue into separate tables by + - pref: HoldsSplitQueue + choices: + nothing: nothing + branch: "pickup library" + itemtype: "hold itemtype" + branch_itemtype: "pickup library & itemtype" + - + - If the holds queue is split, show librarians + - pref: HoldsSplitQueueNumbering + choices: + actual: "the actual priority, which may be out of order" + virtual: "'virtual' priorities, where each group is numbered separately" + - - pref: AllowHoldItemTypeSelection choices: yes: Allow --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -1,3 +1,4 @@ +[% USE Dumper %] [% USE Koha %] [% USE KohaDates %] [% USE Branches %] @@ -700,194 +701,106 @@ function checkMultiHold() { [% FOREACH biblioloo IN biblioloop %] [% IF ( biblioloo.reserveloop ) %] - - [% IF ( multi_hold ) %] - - [% END %] - - - [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] - - - [% ELSE %] - - [% END %] - - - - - - - [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] - - [% END %] - - [% IF SuspendHoldsIntranet %][% END %] - - - [% FOREACH reserveloo IN biblioloo.reserveloop %] - - + [% IF Koha.Preference('HoldsSplitQueue') == 'branch' %] + [% SET branchcodes = [] %] - [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] - + [% FOREACH i IN itemtypes.sort %] + [% SET holds_by_itemtype = [] %] + [% FOREACH h IN biblioloo.reserveloop %] + [% IF h.itemtype == i %] + [% holds_by_itemtype.push( h ) %] [% END %] + [% END %] - - - - - - - - - - - [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] - [% END %] - - - [% IF SuspendHoldsIntranet %] - - [% END # IF SuspendHoldsIntranet %] - + [% SET holds_by_itemtype = [] %] + [% FOREACH h IN holds_by_branch %] + [% IF h.itemtype == i %] + [% holds_by_itemtype.push( h ) %] + [% END %] + [% END %] + [% INCLUDE holds_table.inc holds=holds_by_itemtype %] + + [% END %] + + [% END %] + [% ELSE %] + [% INCLUDE holds_table.inc holds=biblioloo.reserveloop %] + [% END %] - [% END %] -
[% biblioloo.title |html %]
Priority Delete?PatronNotesDateExpirationPickup libraryDetailsToggle set to lowest priority  
- - - - - - - Go up - + [% FOREACH h IN biblioloo.reserveloop %] + [% branchcodes.push( h.branchcode ) %] + [% END %] + [% branchcodes = branchcodes.unique %] - - Go top - + [% FOREACH b IN branchcodes.sort %] + [% SET holds_by_branch = [] %] + [% FOREACH h IN biblioloo.reserveloop %] + [% IF h.branchcode == b %] + [% holds_by_branch.push( h ) %] + [% END %] + [% END %] +
+ [% Branches.GetName( b ) %] + [% INCLUDE holds_table.inc holds=holds_by_branch %] +
+ [% END %] + [% ELSIF Koha.Preference('HoldsSplitQueue') == 'itemtype' %] + [% SET itemtypes = [] %] - - Go bottom - + [% FOREACH h IN biblioloo.reserveloop %] + [% itemtypes.push( h.itemtype ) %] + [% END %] + [% itemtypes = itemtypes.unique %] - - Go down - -
- - [% IF ( reserveloo.hidename ) %] - [% reserveloo.cardnumber (reserveloo.borrowernumber) %] - [% ELSE %] - [% reserveloo.firstname %] [% reserveloo.surname %] - [% END %] - - [% reserveloo.notes %][% reserveloo.date %][% reserveloo.expirationdate %] - [% IF ( reserveloo.found ) %] - [% IF ( reserveloo.atdestination ) %] - [% IF ( reserveloo.found ) %] - Item waiting at [% reserveloo.wbrname %] since [% reserveloo.waiting_date | $KohaDates %] - [% ELSE %] - Waiting to be pulled - [% END %] - [% ELSE %] - Item being transferred to [% reserveloo.wbrname %] - [% END %] - [% ELSE %] - [% IF Koha.Preference('IndependentBranches') && Branches.all().size == 1 %] - [% Branches.GetName(reserveloo.branchcode) %] - [% ELSE %] - - [% END %] - [% END %] - - [% IF ( reserveloo.found ) %] - - [% IF ( reserveloo.barcodenumber ) %] - [% reserveloo.barcodenumber %] - - [% ELSE %] - No barcode - [% END %] - - [% ELSE %] - [% IF ( reserveloo.item_level_hold ) %] - - Only item - - [% IF ( reserveloo.barcodenumber ) %] - [% reserveloo.barcodenumber %] - - [% ELSE %] - No barcode - [% END %] - - - [% ELSE %] - [% IF reserveloo.itemtype %] - Next available [% ItemTypes.GetDescription( reserveloo.itemtype ) %] item - [% ELSE %] - Next available - [% END %] +
+ [% IF i %] + [% ItemTypes.GetDescription( i ) %] + [% ELSE %] + Any item type + [% END %] + [% INCLUDE holds_table.inc holds=holds_by_itemtype %] +
+ [% END %] + [% ELSIF Koha.Preference('HoldsSplitQueue') == 'branch_itemtype' %] + [% SET branchcodes = [] %] - - [% END %] + [% FOREACH h IN biblioloo.reserveloop %] + [% branchcodes.push( h.branchcode ) %] + [% END %] + [% branchcodes = branchcodes.unique %] + + [% FOREACH b IN branchcodes.sort %] +
+ [% Branches.GetName( b ) %] + [% SET holds_by_branch = [] %] + [% FOREACH h IN biblioloo.reserveloop %] + [% IF h.branchcode == b %] + [% holds_by_branch.push( h ) %] [% END %] -
- - [% IF ( reserveloo.lowestPriority ) %] - Unset lowest priority - [% ELSE %] - Set to lowest priority - [% END %] - - - - Cancel - - - [% UNLESS ( reserveloo.found ) %] - - - [% IF AutoResumeSuspendedHolds %] - - - Clear date - [% ELSE %] - - [% END %] + [% SET itemtypes = [] %] + [% FOREACH h IN holds_by_branch %] + [% itemtypes.push( h.itemtype ) %] + [% END %] + [% itemtypes = itemtypes.unique %] + [% FOREACH i IN itemtypes.sort %] +
+ [% IF i %] + [% ItemTypes.GetDescription( i ) %] [% ELSE %] - + Any item type [% END %] -
[% END %] [% END %] --- a/reserve/request.pl +++ a/reserve/request.pl @@ -86,9 +86,13 @@ my $action = $input->param('action'); $action ||= q{}; if ( $action eq 'move' ) { - my $where = $input->param('where'); - my $reserve_id = $input->param('reserve_id'); - AlterPriority( $where, $reserve_id ); + my $where = $input->param('where'); + my $reserve_id = $input->param('reserve_id'); + my $prev_priority = $input->param('prev_priority'); + my $next_priority = $input->param('next_priority'); + my $first_priority = $input->param('first_priority'); + my $last_priority = $input->param('last_priority'); + AlterPriority( $where, $reserve_id, $prev_priority, $next_priority, $first_priority, $last_priority ); } elsif ( $action eq 'cancel' ) { my $reserve_id = $input->param('reserve_id'); my $hold = Koha::Holds->find( $reserve_id ); --- a/t/db_dependent/Holds.t +++ a/t/db_dependent/Holds.t @@ -200,19 +200,19 @@ is( $holds->next->itemnumber, $itemnumber, "Test ModReserveMinusPriority()" ); $holds = $biblio->holds; $hold = $holds->next; -AlterPriority( 'top', $hold->reserve_id ); +AlterPriority( 'top', $hold->reserve_id, undef, 2, 1, 6 ); $hold = Koha::Holds->find( $reserveid ); is( $hold->priority, '1', "Test AlterPriority(), move to top" ); -AlterPriority( 'down', $hold->reserve_id ); +AlterPriority( 'down', $hold->reserve_id, undef, 2, 1, 6 ); $hold = Koha::Holds->find( $reserveid ); is( $hold->priority, '2', "Test AlterPriority(), move down" ); -AlterPriority( 'up', $hold->reserve_id ); +AlterPriority( 'up', $hold->reserve_id, 1, 3, 1, 6 ); $hold = Koha::Holds->find( $reserveid ); is( $hold->priority, '1', "Test AlterPriority(), move up" ); -AlterPriority( 'bottom', $hold->reserve_id ); +AlterPriority( 'bottom', $hold->reserve_id, undef, 2, 1, 6 ); $hold = Koha::Holds->find( $reserveid ); is( $hold->priority, '6', "Test AlterPriority(), move to bottom" ); --