View | Details | Raw Unified | Return to bug 8587
Collapse All | Expand All

(-)a/C4/Serials.pm (-7 / +9 lines)
Lines 1156-1162 sub ModSubscription { Link Here
1156
        $whenmorethan1,   $setto1,          $lastvalue1,        $innerloop1,       $add2,          $every2,      $whenmorethan2, $setto2,
1156
        $whenmorethan1,   $setto1,          $lastvalue1,        $innerloop1,       $add2,          $every2,      $whenmorethan2, $setto2,
1157
        $lastvalue2,      $innerloop2,      $add3,              $every3,           $whenmorethan3, $setto3,      $lastvalue3,    $innerloop3,
1157
        $lastvalue2,      $innerloop2,      $add3,              $every3,           $whenmorethan3, $setto3,      $lastvalue3,    $innerloop3,
1158
        $numberingmethod, $status,          $biblionumber,      $callnumber,       $notes,         $letter,      $hemisphere,    $manualhistory,
1158
        $numberingmethod, $status,          $biblionumber,      $callnumber,       $notes,         $letter,      $hemisphere,    $manualhistory,
1159
        $internalnotes,   $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,    $enddate,       $subscriptionid
1159
        $internalnotes,   $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,    $enddate,       $subscriptionid,
1160
        $seriallifespan
1160
    ) = @_;
1161
    ) = @_;
1161
1162
1162
    #     warn $irregularity;
1163
    #     warn $irregularity;
Lines 1170-1176 sub ModSubscription { Link Here
1170
                        numberingmethod=?, status=?, biblionumber=?, callnumber=?, notes=?, 
1171
                        numberingmethod=?, status=?, biblionumber=?, callnumber=?, notes=?, 
1171
						letter=?, hemisphere=?,manualhistory=?,internalnotes=?,serialsadditems=?,
1172
						letter=?, hemisphere=?,manualhistory=?,internalnotes=?,serialsadditems=?,
1172
						staffdisplaycount = ?,opacdisplaycount = ?, graceperiod = ?, location = ?
1173
						staffdisplaycount = ?,opacdisplaycount = ?, graceperiod = ?, location = ?
1173
						,enddate=?
1174
						,enddate=?, seriallifespan=?
1174
                    WHERE subscriptionid = ?";
1175
                    WHERE subscriptionid = ?";
1175
1176
1176
    #warn "query :".$query;
1177
    #warn "query :".$query;
Lines 1187-1193 sub ModSubscription { Link Here
1187
        $numberingmethod, $status,         $biblionumber,   $callnumber,
1188
        $numberingmethod, $status,         $biblionumber,   $callnumber,
1188
        $notes, $letter, $hemisphere, ( $manualhistory ? $manualhistory : 0 ),
1189
        $notes, $letter, $hemisphere, ( $manualhistory ? $manualhistory : 0 ),
1189
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1190
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1190
        $graceperiod,   $location,        $enddate,           $subscriptionid
1191
        $graceperiod,   $location,        $enddate,  $seriallifespan, $subscriptionid
1191
    );
1192
    );
1192
    my $rows = $sth->rows;
1193
    my $rows = $sth->rows;
1193
1194
Lines 1213-1224 the id of this new subscription Link Here
1213
=cut
1214
=cut
1214
1215
1215
sub NewSubscription {
1216
sub NewSubscription {
1217
1216
    my ($auser,         $branchcode,      $aqbooksellerid,    $cost,             $aqbudgetid,    $biblionumber, $startdate,       $periodicity,
1218
    my ($auser,         $branchcode,      $aqbooksellerid,    $cost,             $aqbudgetid,    $biblionumber, $startdate,       $periodicity,
1217
        $dow,           $numberlength,    $weeklength,        $monthlength,      $add1,          $every1,       $whenmorethan1,   $setto1,
1219
        $dow,           $numberlength,    $weeklength,        $monthlength,      $add1,          $every1,       $whenmorethan1,   $setto1,
1218
        $lastvalue1,    $innerloop1,      $add2,              $every2,           $whenmorethan2, $setto2,       $lastvalue2,      $innerloop2,
1220
        $lastvalue1,    $innerloop1,      $add2,              $every2,           $whenmorethan2, $setto2,       $lastvalue2,      $innerloop2,
1219
        $add3,          $every3,          $whenmorethan3,     $setto3,           $lastvalue3,    $innerloop3,   $numberingmethod, $status,
1221
        $add3,          $every3,          $whenmorethan3,     $setto3,           $lastvalue3,    $innerloop3,   $numberingmethod, $status,
1220
        $notes,         $letter,          $firstacquidate,    $irregularity,     $numberpattern, $callnumber,   $hemisphere,      $manualhistory,
1222
        $notes,         $letter,          $firstacquidate,    $irregularity,     $numberpattern, $callnumber,   $hemisphere,      $manualhistory,
1221
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,     $enddate
1223
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,     $enddate,         $seriallifespan
1222
    ) = @_;
1224
    ) = @_;
1223
    my $dbh = C4::Context->dbh;
1225
    my $dbh = C4::Context->dbh;
1224
1226
Lines 1232-1239 sub NewSubscription { Link Here
1232
            add3,every3,whenmorethan3,setto3,lastvalue3,innerloop3,
1234
            add3,every3,whenmorethan3,setto3,lastvalue3,innerloop3,
1233
            numberingmethod, status, notes, letter,firstacquidate,irregularity,
1235
            numberingmethod, status, notes, letter,firstacquidate,irregularity,
1234
            numberpattern, callnumber, hemisphere,manualhistory,internalnotes,serialsadditems,
1236
            numberpattern, callnumber, hemisphere,manualhistory,internalnotes,serialsadditems,
1235
            staffdisplaycount,opacdisplaycount,graceperiod,location,enddate)
1237
            staffdisplaycount,opacdisplaycount,graceperiod,location,enddate,seriallifespan)
1236
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
1238
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
1237
        |;
1239
        |;
1238
    my $sth = $dbh->prepare($query);
1240
    my $sth = $dbh->prepare($query);
1239
    $sth->execute(
1241
    $sth->execute(
Lines 1242-1248 sub NewSubscription { Link Here
1242
        $lastvalue1,    $innerloop1,      $add2,              $every2,           $whenmorethan2, $setto2,       $lastvalue2,      $innerloop2,
1244
        $lastvalue1,    $innerloop1,      $add2,              $every2,           $whenmorethan2, $setto2,       $lastvalue2,      $innerloop2,
1243
        $add3,          $every3,          $whenmorethan3,     $setto3,           $lastvalue3,    $innerloop3,   $numberingmethod, "$status",
1245
        $add3,          $every3,          $whenmorethan3,     $setto3,           $lastvalue3,    $innerloop3,   $numberingmethod, "$status",
1244
        $notes,         $letter,          $firstacquidate,    $irregularity,     $numberpattern, $callnumber,   $hemisphere,      $manualhistory,
1246
        $notes,         $letter,          $firstacquidate,    $irregularity,     $numberpattern, $callnumber,   $hemisphere,      $manualhistory,
1245
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,     $enddate
1247
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,     $enddate,         $seriallifespan
1246
    );
1248
    );
1247
1249
1248
    my $subscriptionid = $dbh->{'mysql_insertid'};
1250
    my $subscriptionid = $dbh->{'mysql_insertid'};
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 1884-1889 CREATE TABLE `subscription` ( Link Here
1884
  `opacdisplaycount` VARCHAR(10) NULL,
1884
  `opacdisplaycount` VARCHAR(10) NULL,
1885
  `graceperiod` int(11) NOT NULL default '0',
1885
  `graceperiod` int(11) NOT NULL default '0',
1886
  `enddate` date default NULL,
1886
  `enddate` date default NULL,
1887
  `seriallifespan` TINYINT(1) DEFAULT -1,
1887
  PRIMARY KEY  (`subscriptionid`)
1888
  PRIMARY KEY  (`subscriptionid`)
1888
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1889
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1889
1890
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +69 lines)
Lines 5249-5254 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5249
    SetVersion($DBversion);
5249
    SetVersion($DBversion);
5250
}
5250
}
5251
5251
5252
$DBversion = 'XXX';
5253
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
5254
   $dbh->do("ALTER TABLE subscription ADD `seriallifespan` TINYINT(1) DEFAULT -1");
5255
   print "Upgrade to $DBversion done (Add seriallifespan to subscription)\n";
5256
   SetVersion ($DBversion);
5257
}
5258
5252
=head1 FUNCTIONS
5259
=head1 FUNCTIONS
5253
5260
5254
=head2 TableExists($table)
5261
=head2 TableExists($table)
5255
-- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
5262
++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
Lines 1017-1022 $(document).ready(function() { Link Here
1017
            [% END %]
1017
            [% END %]
1018
        </li>
1018
        </li>
1019
        <li>
1019
        <li>
1020
            <label for="seriallifespan">Serial lifespan:</label>
1021
            <select name="seriallifespan" id="seriallifespan">
1022
            [% IF ( seriallifespan == -1 ) %]
1023
                <option value="-1" selected="selected">Immortal</option>
1024
            [% ELSE %]
1025
                <option value="-1">Immortal</option>
1026
            [% END %]
1027
            [% IF ( seriallifespan == 1 ) %]
1028
                <option value="1" selected="selected">1 year</option>
1029
            [% ELSE %]
1030
                <option value="1">1 year</option>
1031
            [% END %]
1032
            [% IF ( seriallifespan == 2 ) %]
1033
                <option value="2" selected="selected">2 years</option>
1034
            [% ELSE %]
1035
                <option value="2">2 years</option>
1036
            [% END %]
1037
            [% IF ( seriallifespan == 3 ) %]
1038
                <option value="3" selected="selected">3 years</option>
1039
            [% ELSE %]
1040
                <option value="3">3 years</option>
1041
            [% END %]
1042
            [% IF ( seriallifespan == 4 ) %]
1043
                <option value="4" selected="selected">4 years</option>
1044
            [% ELSE %]
1045
                <option value="4">4 years</option>
1046
            [% END %]
1047
            [% IF ( seriallifespan == 5 ) %]
1048
                <option value="5" selected="selected">5 years</option>
1049
            [% ELSE %]
1050
                <option value="5">5 years</option>
1051
            [% END %]
1052
            [% IF ( seriallifespan == 6 ) %]
1053
                <option value="6" selected="selected">6 years</option>
1054
            [% ELSE %]
1055
                <option value="6">6 years</option>
1056
            [% END %]
1057
            [% IF ( seriallifespan == 7 ) %]
1058
                <option value="7" selected="selected">7 years</option>
1059
            [% ELSE %]
1060
                <option value="7">7 years</option>
1061
            [% END %]
1062
            [% IF ( seriallifespan == 8 ) %]
1063
                <option value="8" selected="selected">8 years</option>
1064
            [% ELSE %]
1065
                <option value="8">8 years</option>
1066
            [% END %]
1067
            [% IF ( seriallifespan == 9 ) %]
1068
                <option value="9" selected="selected">9 years</option>
1069
            [% ELSE %]
1070
                <option value="9">9 years</option>
1071
            [% END %]
1072
            [% IF ( seriallifespan == 10 ) %]
1073
                <option value="10" selected="selected">10 years</option>
1074
            [% ELSE %]
1075
                <option value="10">10 years</option>
1076
            [% END %]
1077
            </select>
1078
            <div class="hint">Set the subscription's serial lifespan. A serial will be considered "out of date" after the chosen time period.</div>
1079
        </li>
1080
        <li>
1020
            <label for="branchcode">Library:</label>
1081
            <label for="branchcode">Library:</label>
1021
            
1082
            
1022
                <select name="branchcode" id="branchcode" style="width: 20em;">
1083
                <select name="branchcode" id="branchcode" style="width: 20em;">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (+52 lines)
Lines 251-256 $(document).ready(function() { Link Here
251
        [% IF ( numberlength ) %]<li><span class="label">Number of issues:</span> [% numberlength %]</li>[% END %]
251
        [% IF ( numberlength ) %]<li><span class="label">Number of issues:</span> [% numberlength %]</li>[% END %]
252
        [% IF ( weeklength ) %]<li><span class="label">Number of weeks:</span> [% weeklength %]</li>[% END %]
252
        [% IF ( weeklength ) %]<li><span class="label">Number of weeks:</span> [% weeklength %]</li>[% END %]
253
        [% IF ( monthlength ) %]<li><span class="label">Number of months:</span> [% monthlength %]</li>[% END %]
253
        [% IF ( monthlength ) %]<li><span class="label">Number of months:</span> [% monthlength %]</li>[% END %]
254
                <li><span class="label">Serial lifespan:</span>
255
                [% IF seriallifespan == -1 %]
256
                    <span>Immortal</span>
257
                [% ELSIF ( seriallifespan == 1 ) %]
258
                    <span>1 year</span>
259
                [% ELSIF ( seriallifespan == 2 ) %]
260
                    <span>2 years</span>
261
                [% ELSIF ( seriallifespan == 3 ) %]
262
                    <span>3 years</span>
263
                [% ELSIF ( seriallifespan == 4 ) %]
264
                    <span>4 years</span>
265
                [% ELSIF ( seriallifespan == 5 ) %]
266
                    <span>5 years</span>
267
                [% ELSIF ( seriallifespan == 6 ) %]
268
                    <span>6 years</span>
269
                [% ELSIF ( seriallifespan == 7 ) %]
270
                    <span>7 years</span>
271
                [% ELSIF ( seriallifespan == 8 ) %]
272
                    <span>8 years</span>
273
                [% ELSIF ( seriallifespan == 9 ) %]
274
                    <span>9 years</span>
275
                [% ELSIF ( seriallifespan == 10 ) %]
276
                    <span>10 years</span>
277
                [% END %]
278
            </li>
254
        </ol>
279
        </ol>
255
    </div>
280
    </div>
256
    </div>
281
    </div>
Lines 317-322 $(document).ready(function() { Link Here
317
            </table>
342
            </table>
318
    </div>
343
    </div>
319
    <div id="subscription_issues">
344
    <div id="subscription_issues">
345
        <h2>Serial issues</h2>
346
        <p>
347
            <label>Serial lifespan :</label>
348
            [% IF seriallifespan == -1 %]
349
                <span>Immortal</span>
350
            [% ELSIF ( seriallifespan == 1 ) %]
351
                <span>1 year</span>
352
            [% ELSIF ( seriallifespan == 2 ) %]
353
                <span>2 years</span>
354
            [% ELSIF ( seriallifespan == 3 ) %]
355
                <span>3 years</span>
356
            [% ELSIF ( seriallifespan == 4 ) %]
357
                <span>4 years</span>
358
            [% ELSIF ( seriallifespan == 5 ) %]
359
                <span>5 years</span>
360
            [% ELSIF ( seriallifespan == 6 ) %]
361
                <span>6 years</span>
362
            [% ELSIF ( seriallifespan == 7 ) %]
363
                <span>7 years</span>
364
            [% ELSIF ( seriallifespan == 8 ) %]
365
                <span>8 years</span>
366
            [% ELSIF ( seriallifespan == 9 ) %]
367
                <span>9 years</span>
368
            [% ELSIF ( seriallifespan == 10 ) %]
369
                <span>10 years</span>
370
            [% END %]
371
        </p>
320
        <table>
372
        <table>
321
        <tr>
373
        <tr>
322
            <th>Issue number</th>
374
            <th>Issue number</th>
(-)a/serials/subscription-add.pl (-10 / +14 lines)
Lines 109-114 if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { Link Here
109
                    history => ($op eq 'modify'),
109
                    history => ($op eq 'modify'),
110
                    "periodicity".$subs->{'periodicity'} => 1,
110
                    "periodicity".$subs->{'periodicity'} => 1,
111
                    "numberpattern".$subs->{'numberpattern'} => 1,
111
                    "numberpattern".$subs->{'numberpattern'} => 1,
112
                    "seriallifespan" => $subs->{'seriallifespan'},
112
                    firstacquiyear => substr($firstissuedate,0,4),
113
                    firstacquiyear => substr($firstissuedate,0,4),
113
                    );
114
                    );
114
    }
115
    }
Lines 257-271 sub redirect_add_subscription { Link Here
257
    my $missinglist = $query->param('missinglist');
258
    my $missinglist = $query->param('missinglist');
258
    my $opacnote = $query->param('opacnote');
259
    my $opacnote = $query->param('opacnote');
259
    my $librariannote = $query->param('librariannote');
260
    my $librariannote = $query->param('librariannote');
261
    my $seriallifespan = $query->param('seriallifespan');
260
	my $subscriptionid = NewSubscription($auser,$branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
262
	my $subscriptionid = NewSubscription($auser,$branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
261
					$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
263
        $startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
262
					$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
264
        $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
263
					$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
265
        $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
264
					$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
266
        $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
265
					$numberingmethod, $status, $notes,$letter,$firstacquidate,join(",",@irregularity),
267
        $numberingmethod, $status, $notes,$letter,$firstacquidate,join(",",@irregularity),
266
                    $numberpattern, $callnumber, $hemisphere,($manualhistory?$manualhistory:0),$internalnotes,
268
        $numberpattern, $callnumber, $hemisphere,($manualhistory?$manualhistory:0),$internalnotes,
267
                    $serialsadditems,$staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate
269
        $serialsadditems,$staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate,$seriallifespan
268
				);
270
    );
271
269
    ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
272
    ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
270
273
271
    print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
274
    print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
Lines 332-344 sub redirect_mod_subscription { Link Here
332
    my $graceperiod     = $query->param('graceperiod') || 0;
335
    my $graceperiod     = $query->param('graceperiod') || 0;
333
    my $location = $query->param('location');
336
    my $location = $query->param('location');
334
    my $nextexpected = GetNextExpected($subscriptionid);
337
    my $nextexpected = GetNextExpected($subscriptionid);
338
    my $seriallifespan = $query->param('seriallifespan');
335
	#  If it's  a mod, we need to check the current 'expected' issue, and mod it in the serials table if necessary.
339
	#  If it's  a mod, we need to check the current 'expected' issue, and mod it in the serials table if necessary.
336
    if ( $nextacquidate ne $nextexpected->{planneddate}->output('iso') ) {
340
    if ( $nextacquidate ne $nextexpected->{planneddate}->output('iso') ) {
337
        ModNextExpected($subscriptionid,C4::Dates->new($nextacquidate,'iso'));
341
        ModNextExpected($subscriptionid,C4::Dates->new($nextacquidate,'iso'));
338
        # if we have not received any issues yet, then we also must change the firstacquidate for the subs.
342
        # if we have not received any issues yet, then we also must change the firstacquidate for the subs.
339
        $firstissuedate = $nextacquidate if($nextexpected->{isfirstissue});
343
        $firstissuedate = $nextacquidate if($nextexpected->{isfirstissue});
340
    }
344
    }
341
342
        ModSubscription(
345
        ModSubscription(
343
            $auser,           $branchcode,   $aqbooksellerid, $cost,
346
            $auser,           $branchcode,   $aqbooksellerid, $cost,
344
            $aqbudgetid,      $startdate,    $periodicity,    $firstissuedate,
347
            $aqbudgetid,      $startdate,    $periodicity,    $firstissuedate,
Lines 350-357 sub redirect_mod_subscription { Link Here
350
            $whenmorethan3,   $setto3,       $lastvalue3,     $innerloop3,
353
            $whenmorethan3,   $setto3,       $lastvalue3,     $innerloop3,
351
            $numberingmethod, $status,       $biblionumber,   $callnumber,
354
            $numberingmethod, $status,       $biblionumber,   $callnumber,
352
            $notes,           $letter,       $hemisphere,     $manualhistory,$internalnotes,
355
            $notes,           $letter,       $hemisphere,     $manualhistory,$internalnotes,
353
            $serialsadditems, $staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate,$subscriptionid
356
            $serialsadditems, $staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate,$subscriptionid,$seriallifespan
354
        );
357
        );
358
355
        ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
359
        ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
356
    print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
360
    print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
357
    return;
361
    return;
(-)a/serials/subscription-detail.pl (-1 / +1 lines)
Lines 138-143 $template->param( Link Here
138
    intranetcolorstylesheet => C4::Context->preference('intranetcolorstylesheet'),
138
    intranetcolorstylesheet => C4::Context->preference('intranetcolorstylesheet'),
139
    irregular_issues => scalar @irregular_issues,
139
    irregular_issues => scalar @irregular_issues,
140
    default_bib_view => $default_bib_view,
140
    default_bib_view => $default_bib_view,
141
    "seriallifespan" => $subs->{'seriallifespan'},
141
    );
142
    );
142
143
143
output_html_with_http_headers $query, $cookie, $template->output;
144
output_html_with_http_headers $query, $cookie, $template->output;
144
- 

Return to bug 8587