Bug 30331: Rename RenewalPeriodBase as ManualRenewalPeriodBase and add AutomaticRenewalPeriodBase sys pref

Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Lucas Gass 2025-10-07 15:53:26 +00:00
parent e58d39671f
commit 15d83804b3
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
5 changed files with 48 additions and 7 deletions

View File

@ -3326,7 +3326,7 @@ sub CanBookBeRenewed {
# CHECK FOR BOOKINGS
if ( $item->bookings->count ) {
my $startdate =
( C4::Context->preference('RenewalPeriodBase') eq 'date_due' )
( C4::Context->preference('ManualRenewalPeriodBase') eq 'date_due' )
? dt_from_string( $issue->date_due, 'sql' )
: dt_from_string();
my $datedue = CalcDateDue( $startdate, $item->effective_itemtype, $branchcode, $patron, 'is a renewal' );
@ -3466,12 +3466,12 @@ sub AddRenewal {
# If the due date wasn't specified, calculate it by adding the
# book's loan length to today's date or the current due date
# based on the value of the RenewalPeriodBase syspref.
# based on the value of the ManualRenewalPeriodBase syspref.
my $itemtype = $item_object->effective_itemtype;
unless ($datedue) {
$datedue =
( C4::Context->preference('RenewalPeriodBase') eq 'date_due' )
( C4::Context->preference('ManualRenewalPeriodBase') eq 'date_due' )
? dt_from_string( $issue->date_due, 'sql' )
: dt_from_string();
$datedue = CalcDateDue( $datedue, $itemtype, $circ_library->branchcode, $patron, 'is a renewal' );

View File

@ -180,7 +180,8 @@ sub _shared_preferences {
IssueLostItem
IssuingInProcess
OverduesBlockCirc
RenewalPeriodBase
ManualRenewalPeriodBase
AutomaticRenewalPeriodBase
RenewalSendNotice
ReturnBeforeExpiry
TransfersMaxDaysWarning

View File

@ -0,0 +1,32 @@
use Modern::Perl;
use Koha::Installer::Output qw(say_warning say_success say_info);
return {
bug_number => "30331",
description =>
"Rename RenewalPeriodBase as ManualRenewalPeriodBase AND add new AutomaticRenewalPeriodBase system preference",
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
#Get the old value before changing anything
my $base_period = C4::Context->preference('RenewalPeriodBase');
$dbh->do(
q{
UPDATE systempreferences SET variable = 'ManualRenewalPeriodBase' WHERE variable = 'RenewalPeriodBase'
}
);
say_success( $out, "System preference RenewalPeriodBase updated to ManualRenewalPeriodBase" );
$dbh->do(
q{
INSERT IGNORE INTO systempreferences (`variable`,`value`,`options`,`explanation`,`type`)
VALUES ('AutomaticRenewalPeriodBase', ? ,'date_due|now','Set whether the renewal date should be counted from the date_due or from the moment the Patron asks for renewal, for automatic renewals','Choice')
}, undef, $base_period
);
say_success( $out, "System preference AutomaticRenewalPeriodBase added." );
},
};

View File

@ -101,6 +101,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('AutomaticConfirmTransfer','0',NULL,'Defines whether transfers should be automatically confirmed at checkin if modal dismissed','YesNo'),
('AutomaticEmailReceipts','0',NULL,'Send email receipts for payments and write-offs','YesNo'),
('AutomaticItemReturn','1',NULL,'If ON, Koha will automatically set up a transfer of this item to its homebranch','YesNo'),
('AutomaticRenewalPeriodBase','date_due','date_due|now','Set whether the renewal date should be counted from the date_due or from the moment the Patron asks for renewal, for automatic renewals ','Choice'),
('autoMemberNum','0',NULL,'If ON, patron number is auto-calculated','YesNo'),
('AutoRemoveOverduesRestrictions','no','no|when_no_overdue|when_no_overdue_causing_debarment', 'Defines if and on what conditions OVERDUES debarments should automatically be lifted when overdue items are returned by the patron.','Choice'),
('AutoRenewalNotices','preferences','cron|preferences|never','How should Koha determine whether to end autorenewal notices','Choice'),
@ -410,6 +411,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('makePreviousSerialAvailable','0',NULL,'make previous serial automatically available when collecting a new serial. Please note that the item-level_itypes syspref must be set to specific item.','YesNo'),
('Mana','2',NULL,'request to Mana Webservice. Mana centralize common information between other Koha to facilitate the creation of new subscriptions, vendors, report queries etc... You can search, share, import and comment the content of Mana.','Choice'),
('ManaToken','',NULL,'Security token used for authentication on Mana KB service (anti spam)','Textarea'),
('ManualRenewalPeriodBase','date_due','date_due|now','Set whether the renewal date should be counted from the date_due or from the moment the Patron asks for renewal, for manual renewals ','Choice'),
('MARCAuthorityControlField008','|| aca||aabn | a|a d',NULL,'Define the contents of MARC21 authority control field 008 position 06-39','Textarea'),
('MarcFieldDocURL', '', NULL, 'URL used for MARC field documentation. Following substitutions are available: {MARC} = marc flavour, eg. "MARC21" or "UNIMARC". {FIELD} = field number, eg. "000" or "048". {LANG} = user language, eg. "en" or "fi-FI"', 'Free'),
('MarcFieldForCreatorId','',NULL,'Where to store the borrowernumber of the record\'s creator','Free'),
@ -682,7 +684,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('RenewAccruingItemInOpac','0',NULL,'If enabled, when the fines on an item accruing is paid off in the OPAC via a payment plugin, attempt to renew that item. If the syspref "RenewalPeriodBase" is set to "due date", renewed items may still be overdue','YesNo'),
('RenewAccruingItemWhenPaid','0',NULL,'If enabled, when the fines on an item accruing is paid off, attempt to renew that item. If the syspref "RenewalPeriodBase" is set to "due date", renewed items may still be overdue','YesNo'),
('RenewalLog','0',NULL,'If ON, log information about renewals','YesNo'),
('RenewalPeriodBase','date_due','date_due|now','Set whether the renewal date should be counted from the date_due or from the moment the Patron asks for renewal ','Choice'),
('RenewalSendNotice','0',NULL,NULL,'YesNo'),
('RenewSerialAddsSuggestion','0',NULL,'If ON, adds a new suggestion at serial subscription renewal','YesNo'),
('RentalFeesCheckoutConfirmation', '0', NULL, 'Allow user to confirm when checking out an item with rental fees.', 'YesNo'),

View File

@ -345,8 +345,15 @@ Circulation:
exact_time: exact time
- . Only relevant for loans calculated in days, hourly loans are not affected.
-
- When renewing checkouts, base the new due date on
- pref: RenewalPeriodBase
- When renewing checkouts manually, base the new due date on
- pref: ManualRenewalPeriodBase
choices:
date_due: the old due date of the checkout
now: the current date
- .
-
- When renewing checkouts automaticaly, base the new due date on
- pref: AutomaticRenewalPeriodBase
choices:
date_due: the old due date of the checkout
now: the current date