Bug 34440: Add lead and trail time to circulation rules

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Martin Renvoize 2024-02-26 13:50:11 +00:00 committed by Katrin Fischer
parent 23d98a4a8a
commit f053ca032b
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
4 changed files with 106 additions and 44 deletions

View file

@ -216,6 +216,12 @@ our $RULE_KINDS = {
holds_pickup_period => {
scope => [ 'branchcode', 'categorycode', 'itemtype' ],
},
bookings_lead_period => {
scope => [ 'branchcode', 'itemtype' ],
},
bookings_trail_period => {
scope => [ 'branchcode', 'itemtype' ],
},
# Not included (deprecated?):
# * accountsent
# * reservecharge

View file

@ -138,11 +138,13 @@ elsif ($op eq 'cud-delete-branch-cat') {
);
Koha::CirculationRules->set_rules(
{
branchcode => undef,
itemtype => undef,
rules => {
branchcode => undef,
itemtype => undef,
rules => {
holdallowed => undef,
hold_fulfillment_policy => undef,
bookings_lead_period => undef,
bookings_trail_period => undef,
returnbranch => undef,
}
}
@ -174,11 +176,13 @@ elsif ($op eq 'cud-delete-branch-cat') {
);
Koha::CirculationRules->set_rules(
{
branchcode => $branch,
itemtype => undef,
rules => {
branchcode => $branch,
itemtype => undef,
rules => {
holdallowed => undef,
hold_fulfillment_policy => undef,
bookings_lead_period => undef,
bookings_trail_period => undef,
returnbranch => undef,
}
}
@ -203,11 +207,13 @@ elsif ($op eq 'cud-delete-branch-item') {
if ($itemtype eq "*") {
Koha::CirculationRules->set_rules(
{
branchcode => undef,
itemtype => undef,
rules => {
branchcode => undef,
itemtype => undef,
rules => {
holdallowed => undef,
hold_fulfillment_policy => undef,
bookings_lead_period => undef,
bookings_trail_period => undef,
returnbranch => undef,
}
}
@ -215,11 +221,13 @@ elsif ($op eq 'cud-delete-branch-item') {
} else {
Koha::CirculationRules->set_rules(
{
branchcode => undef,
itemtype => $itemtype,
rules => {
branchcode => undef,
itemtype => $itemtype,
rules => {
holdallowed => undef,
hold_fulfillment_policy => undef,
bookings_lead_period => undef,
bookings_trail_period => undef,
returnbranch => undef,
}
}
@ -228,11 +236,13 @@ elsif ($op eq 'cud-delete-branch-item') {
} elsif ($itemtype eq "*") {
Koha::CirculationRules->set_rules(
{
branchcode => $branch,
itemtype => undef,
rules => {
branchcode => $branch,
itemtype => undef,
rules => {
holdallowed => undef,
hold_fulfillment_policy => undef,
bookings_lead_period => undef,
bookings_trail_period => undef,
returnbranch => undef,
}
}
@ -240,11 +250,13 @@ elsif ($op eq 'cud-delete-branch-item') {
} else {
Koha::CirculationRules->set_rules(
{
branchcode => $branch,
itemtype => $itemtype,
rules => {
branchcode => $branch,
itemtype => $itemtype,
rules => {
holdallowed => undef,
hold_fulfillment_policy => undef,
bookings_lead_period => undef,
bookings_trail_period => undef,
returnbranch => undef,
}
}
@ -357,23 +369,27 @@ elsif ( $op eq 'cud-add' ) {
}
elsif ($op eq "cud-set-branch-defaults") {
my $categorycode = $input->param('categorycode');
my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') );
my $categorycode = $input->param('categorycode');
my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') );
my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
$patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty);
my $holdallowed = $input->param('holdallowed');
my $holdallowed = $input->param('holdallowed');
my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
my $returnbranch = $input->param('returnbranch');
my $max_holds = strip_non_numeric( scalar $input->param('max_holds') );
my $bookings_lead_period = $input->param('bookings_lead_period');
my $bookings_trail_period = $input->param('bookings_trail_period');
my $returnbranch = $input->param('returnbranch');
my $max_holds = strip_non_numeric( scalar $input->param('max_holds') );
if ($branch eq "*") {
Koha::CirculationRules->set_rules(
{
itemtype => undef,
branchcode => undef,
rules => {
itemtype => undef,
branchcode => undef,
rules => {
holdallowed => $holdallowed,
hold_fulfillment_policy => $hold_fulfillment_policy,
bookings_lead_period => $bookings_lead_period,
bookings_trail_period => $bookings_trail_period,
returnbranch => $returnbranch,
}
}
@ -391,11 +407,13 @@ elsif ($op eq "cud-set-branch-defaults") {
} else {
Koha::CirculationRules->set_rules(
{
itemtype => undef,
branchcode => $branch,
rules => {
itemtype => undef,
branchcode => $branch,
rules => {
holdallowed => $holdallowed,
hold_fulfillment_policy => $hold_fulfillment_policy,
bookings_lead_period => $bookings_lead_period,
bookings_trail_period => $bookings_trail_period,
returnbranch => $returnbranch,
}
}
@ -584,17 +602,21 @@ elsif ($op eq "cud-add-branch-item") {
my $itemtype = $input->param('itemtype');
my $holdallowed = $input->param('holdallowed');
my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
my $bookings_lead_period = $input->param('bookings_lead_period');
my $bookings_trail_period = $input->param('bookings_trail_period');
my $returnbranch = $input->param('returnbranch');
if ($branch eq "*") {
if ($itemtype eq "*") {
Koha::CirculationRules->set_rules(
{
itemtype => undef,
branchcode => undef,
rules => {
itemtype => undef,
branchcode => undef,
rules => {
holdallowed => $holdallowed,
hold_fulfillment_policy => $hold_fulfillment_policy,
bookings_lead_period => $bookings_lead_period,
bookings_trail_period => $bookings_trail_period,
returnbranch => $returnbranch,
}
}
@ -602,11 +624,13 @@ elsif ($op eq "cud-add-branch-item") {
} else {
Koha::CirculationRules->set_rules(
{
itemtype => $itemtype,
branchcode => undef,
rules => {
itemtype => $itemtype,
branchcode => undef,
rules => {
holdallowed => $holdallowed,
hold_fulfillment_policy => $hold_fulfillment_policy,
bookings_lead_period => $bookings_lead_period,
bookings_trail_period => $bookings_trail_period,
returnbranch => $returnbranch,
}
}
@ -615,11 +639,13 @@ elsif ($op eq "cud-add-branch-item") {
} elsif ($itemtype eq "*") {
Koha::CirculationRules->set_rules(
{
itemtype => undef,
branchcode => $branch,
rules => {
itemtype => undef,
branchcode => $branch,
rules => {
holdallowed => $holdallowed,
hold_fulfillment_policy => $hold_fulfillment_policy,
bookings_lead_period => $bookings_lead_period,
bookings_trail_period => $bookings_trail_period,
returnbranch => $returnbranch,
}
}
@ -627,11 +653,13 @@ elsif ($op eq "cud-add-branch-item") {
} else {
Koha::CirculationRules->set_rules(
{
itemtype => $itemtype,
branchcode => $branch,
rules => {
itemtype => $itemtype,
branchcode => $branch,
rules => {
holdallowed => $holdallowed,
hold_fulfillment_policy => $hold_fulfillment_policy,
bookings_lead_period => $bookings_lead_period,
bookings_trail_period => $bookings_trail_period,
returnbranch => $returnbranch,
}
}

View file

@ -288,6 +288,8 @@ if ( $step == 5 ) {
recall_overdue_fine => undef,
recall_shelf_time => undef,
holds_pickup_period => undef,
bookings_lead_period => undef,
bookings_trail_period => undef,
}
};

View file

@ -633,6 +633,8 @@
<th>Maximum total holds allowed (count)</th>
<th>Hold policy</th>
<th>Hold pickup library match</th>
<th>Booking preparation period</th>
<th>Booking precaution period</th>
<th>Return policy</th>
<th class="noExport">Actions</th>
</tr>
@ -641,6 +643,8 @@
[% SET rule_value = CirculationRules.Search( current_branch, undef , undef, 'max_holds', { want_rule => 1 } ) %]
[% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed', { want_rule => 1 } ) %]
[% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy', { want_rule => 1 }) %]
[% SET bookings_lead_period = CirculationRules.Search( current_branch, undef, undef, 'bookings_lead_period', { want_rule => 1 }) %]
[% SET bookings_trail_period = CirculationRules.Search( current_branch, undef, undef, 'bookings_trail_period', { want_rule => 1 }) %]
[% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch', { want_rule => 1 }) %]
[% SET default_checkout_hold_and_return_policy = ( patron_maxissueqty || patron_maxonsiteissueqty || rule_value || holdallowed || hold_fulfillment_policy || returnbranch ) %]
<tr>
@ -759,6 +763,12 @@
[% END %]
</select>
</td>
<td>
<input type="text" name="bookings_lead_period" class="bookinglead" size="3" value="[% bookings_lead_period | html %]">
</td>
<td>
<input type="text" name="bookings_trail_period" class="bookingtrail" size="3" value="[% bookings_trail_period | html %]">
</td>
<td>
<select name="returnbranch">
@ -1275,12 +1285,12 @@
</div>
<div id="holds-policy-by-item-type" class="page-section">
<h2>[% IF humanbranch %]Holds policy by item type for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default holds policy by item type[% END %]</h2>
<h2>[% IF humanbranch %]Holds and bookings policies by item type for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default holds and bookings policies by item type[% END %]</h2>
<p>
For this library, you can edit rules for given itemtypes, regardless of the patron's category.
</p>
<p>
Currently, this means hold policies. The various policies have the following effects:
Currently, this means holds and bookings policies. The various policies have the following effects:
</p>
<ul>
<li><strong>From any library:</strong> Patrons from any library may put this item on hold. <cite>(default if none is defined)</cite></li>
@ -1307,6 +1317,8 @@
<th>Item type</th>
<th>Hold policy</th>
<th>Hold pickup library match</th>
<th>Booking preparation period</th>
<th>Booking precaution period</th>
<th>Return policy</th>
<th>&nbsp;</th>
</tr>
@ -1315,9 +1327,11 @@
[% SET c = undef %]
[% SET holdallowed = all_rules.$c.$it.holdallowed %]
[% SET hold_fulfillment_policy = all_rules.$c.$it.hold_fulfillment_policy %]
[% SET bookings_lead_period = all_rules.$c.$it.bookings_lead_period %]
[% SET bookings_trail_period = all_rules.$c.$it.bookings_trail_period %]
[% SET returnbranch = all_rules.$c.$it.returnbranch %]
[% IF holdallowed || hold_fulfillment_policy || returnbranch %]
[% IF holdallowed || hold_fulfillment_policy || returnbranch || bookings_lead_period || bookings_trail_period %]
<tr>
<td>
[% i.translated_description | html %]
@ -1346,6 +1360,12 @@
<span>item's holding library</span>
[% END %]
</td>
<td>
<span>[% bookings_lead_period | html %]</span>
</td>
<td>
<span>[% bookings_trail_period | html %]</span>
</td>
<td>
[% IF returnbranch == 'homebranch' %]
<span>Item returns home</span>
@ -1402,6 +1422,12 @@
</option>
</select>
</td>
<td>
<input type="text" name="bookings_lead_period" class="bookinglead" size="3" value="[% bookings_lead_period | html %]">
</td>
<td>
<input type="text" name="bookings_trail_period" class="bookingtrail" size="3" value="[% bookings_trail_period | html %]">
</td>
<td>
<select name="returnbranch">
<option value="homebranch">Item returns home</option>