From: Nahuel ANGELINETTI <[email protected]> This patch modify the database to have a grace period which can be set. And is used to create automatically new waited issues with a cronjob(which is in this patch), and set old issues to "late" status.
Signed-off-by: Galen Charlton <[email protected]> --- C4/Serials.pm | 17 +++++---- installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 ++++ .../prog/en/modules/serials/subscription-add.tmpl | 3 ++ .../en/modules/serials/subscription-detail.tmpl | 1 + kohaversion.pl | 2 +- serials/subscription-add.pl | 36 ++++++++++--------- 7 files changed, 42 insertions(+), 25 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index aedc9c5..1357432 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1345,7 +1345,7 @@ $subscriptionid = &NewSubscription($auser,branchcode,$aqbooksellerid,$cost,$aqbu $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1, $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2, $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3, - $numberingmethod, $status, $notes, $serialsadditems) + $numberingmethod, $status, $notes, $serialsadditems, graceperiod) Create a new subscription with value given on input args. @@ -1368,7 +1368,8 @@ sub NewSubscription { $lastvalue3, $innerloop3, $numberingmethod, $status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, $callnumber, $hemisphere, $manualhistory, - $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount + $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, + $graceperiod ) = @_; my $dbh = C4::Context->dbh; @@ -1381,8 +1382,9 @@ sub NewSubscription { add2,every2,whenmorethan2,setto2,lastvalue2,innerloop2, add3,every3,whenmorethan3,setto3,lastvalue3,innerloop3, numberingmethod, status, notes, letter,firstacquidate,irregularity, - numberpattern, callnumber, hemisphere,manualhistory,internalnotes,serialsadditems,staffdisplaycount,opacdisplaycount) - VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) + numberpattern, callnumber, hemisphere,manualhistory,internalnotes,serialsadditems, + staffdisplaycount,opacdisplaycount,graceperiod) + VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |; my $sth = $dbh->prepare($query); $sth->execute( @@ -1407,7 +1409,8 @@ sub NewSubscription { $numberpattern, $callnumber, $hemisphere, $manualhistory, $internalnotes, $serialsadditems, - $staffdisplaycount, $opacdisplaycount + $staffdisplaycount, $opacdisplaycount, + $graceperiod, ); #then create the 1st waited number @@ -2368,9 +2371,9 @@ sub abouttoexpire { $sth->execute($subscriptionid); my ($res) = $sth->fetchrow ; # warn "date expiration : ".$expirationdate." date courante ".$res; - my @res=split /-/,$res; + my @res=split (/-/,$res); @res=Date::Calc::Today if ($res[0]*$res[1]==0); - my @endofsubscriptiondate=split/-/,$expirationdate; + my @endofsubscriptiondate=split(/-/,$expirationdate); my $x; if ( $per == 1 ) {$x=7;} if ( $per == 2 ) {$x=7; } diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 72ff5e3..c17c4ba 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1898,6 +1898,7 @@ CREATE TABLE `subscription` ( `serialsadditems` tinyint(1) NOT NULL default '0', `staffdisplaycount` VARCHAR(10) NULL, `opacdisplaycount` VARCHAR(10) NULL, + `graceperiod` int(11) NOT NULL default '0', PRIMARY KEY (`subscriptionid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 8225b86..71340c1 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -2430,6 +2430,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.01.00.034"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("ALTER TABLE `subscription` ADD COLUMN `graceperiod` INT(11) NOT NULL default '0';"); + print "Upgrade to $DBversion done (Adding a field in issuingrules table)\n"; + SetVersion ($DBversion); +} + =item DropAllForeignKeys($table) Drop all foreign keys of the table $table diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl index b3b6395..c2c4400 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl @@ -1002,6 +1002,9 @@ $(document).ready(function() { </li> <li> + <label for="graceperiod">Grace period:</label> <input type="text" name="graceperiod" id="graceperiod" value="<!-- TMPL_VAR name="graceperiod" -->" /> day(s) + </li> + <li> <label for="notes">Public note:</label> <textarea name="notes" id="notes" cols="30" rows="2"><!-- TMPL_VAR name="notes" --></textarea> </li> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tmpl index 0e6b4c1..93e92cc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tmpl @@ -66,6 +66,7 @@ function popup(subscriptionid) { <!-- TMPL_ELSE --> <li>Serial receipt does not create an item record.</li> <!-- /TMPL_IF --> + <li><span class="label">Grace period:</span> <!-- TMPL_VAR name="graceperiod" --> </li> <!-- TMPL_IF name="callnumber" --><li><span class="label">Call Number:</span> <!-- TMPL_VAR name="callnumber" --> </li><!-- /TMPL_IF --> <!-- TMPL_IF NAME="staffdisplaycount" --><li><span class="label">Number of issues to display to staff</span>: <!-- TMPL_VAR NAME="staffdisplaycount" --> </li><!-- /TMPL_IF --> <!-- TMPL_IF NAME="opacdisplaycount" --><li><span class="label">Number of issues to display to the public</span>: <!-- TMPL_VAR NAME="opacdisplaycount" --> </li><!-- /TMPL_IF --> diff --git a/kohaversion.pl b/kohaversion.pl index a0248ea..6d838d3 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -10,7 +10,7 @@ use strict; sub kohaversion { - our $VERSION = '3.01.00.033'; + our $VERSION = '3.01.00.034'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl index aeac684..dba37ad 100755 --- a/serials/subscription-add.pl +++ b/serials/subscription-add.pl @@ -161,22 +161,24 @@ $template->param( 'dateformat_' . C4::Context->preference('dateformat') => 1 , ); if ($op eq 'addsubscription') { - my $auser = $query->param('user'); - my $branchcode = $query->param('branchcode'); - my $aqbooksellerid = $query->param('aqbooksellerid'); - my $cost = $query->param('cost'); - my $aqbudgetid = $query->param('aqbudgetid'); - my $startdate = $query->param('startdate'); - my $firstacquidate = $query->param('firstacquidate'); - my $periodicity = $query->param('periodicity'); - my $dow = $query->param('dow'); - my @irregularity = $query->param('irregularity_select'); - my $numberlength = 0; - my $weeklength = 0; - my $monthlength = 0; - my $numberpattern = $query->param('numbering_pattern'); - my $sublength = $query->param('sublength'); - my $subtype = $query->param('subtype'); + my $auser = $query->param('user'); + my $branchcode = $query->param('branchcode'); + my $aqbooksellerid = $query->param('aqbooksellerid'); + my $cost = $query->param('cost'); + my $aqbudgetid = $query->param('aqbudgetid'); + my $startdate = $query->param('startdate'); + my $firstacquidate = $query->param('firstacquidate'); + my $periodicity = $query->param('periodicity'); + my $dow = $query->param('dow'); + my @irregularity = $query->param('irregularity_select'); + my $numberlength = 0; + my $weeklength = 0; + my $monthlength = 0; + my $numberpattern = $query->param('numbering_pattern'); + my $sublength = $query->param('sublength'); + my $subtype = $query->param('subtype'); + my $graceperiod = $query->param('graceperiod') || 0; + if ($subtype eq 'months'){ $monthlength = $sublength; } elsif ($subtype eq 'weeks'){ @@ -222,7 +224,7 @@ if ($op eq 'addsubscription') { $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3, $numberingmethod, $status, $notes,$letter,$firstacquidate,join(",",@irregularity), $numberpattern, $callnumber, $hemisphere,($manualhistory?$manualhistory:0),$internalnotes, - $serialsadditems,$staffdisplaycount,$opacdisplaycount + $serialsadditems,$staffdisplaycount,$opacdisplaycount,$graceperiod ); print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); -- 1.5.6.5 _______________________________________________ Koha-patches mailing list [email protected] http://lists.koha.org/mailman/listinfo/koha-patches
