Bug 8585 : Add System Preference to specify Holds to Pull List Start Date
authorDavid Cook <dcook@prosentient.com.au>
Fri, 10 Aug 2012 02:31:30 +0000 (12:31 +1000)
committerPaul Poulain <paul.poulain@biblibre.com>
Wed, 3 Oct 2012 13:18:40 +0000 (15:18 +0200)
Currently, Koha creates a default value of 2 days ago (-2) for the start date of the Holds to pull List. This system preference allows users to specify their own default start date for this list, since users might not want to have to manually change the date all the time when they already know the set date period they want to view.

The system preference value is specified as a positive integer, which is then passed as a negative integer in the handler script. This saves users from having to include a qualifer to the sys pref value.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
circ/pendingreserves.pl
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref

index 61bace9..a9c317d 100755 (executable)
@@ -68,8 +68,9 @@ my ( $year, $month, $day ) = Today();
 my $todaysdate     = sprintf("%-04.4d-%-02.2d-%02.2d", $year, $month, $day);
 my $yesterdaysdate = sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day,   0, 0, -1));
 # changed from delivered range of 10 years-yesterday to 2 days ago-today
-# Find two days ago for the default shelf pull start and end dates
-my $pastdate       = sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day, 0, 0, -2));
+# Find two days ago for the default shelf pull start and end dates, unless HoldsToPullStartDate sys pref is set.
+my $defaultstartdate = ( C4::Context->preference('HoldsToPullStartDate') ) ? "-".C4::Context->preference('HoldsToPullStartDate') : -2;
+my $pastdate       = sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day, 0, 0, $defaultstartdate));
 
 # Predefine the start and end dates if they are not already defined
 $startdate =~ s/^\s+//;
index db35f3a..63b8803 100755 (executable)
@@ -5995,6 +5995,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = "XXX";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("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')");
+    print "Upgrade to $DBversion done (Added HoldsToPullStartDate syspref)\n";
+    SetVersion($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)
index ec5ff1e..91eb1ac 100644 (file)
@@ -51,6 +51,11 @@ Circulation:
                   yes: Allow
                   no: "Don't allow"
             - staff to specify a due date for a checkout.
+        -
+            - Set the default start date for the Holds to pull list to
+            - pref: HoldsToPullStartDate
+              class: integer
+            - ago.
         -
             - pref: AllowAllMessageDeletion
               choices: