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

(-)a/C4/Serials.pm (-7 / +9 lines)
Lines 1171-1177 sub ModSubscription { Link Here
1171
        $whenmorethan1,   $setto1,          $lastvalue1,        $innerloop1,       $add2,          $every2,      $whenmorethan2, $setto2,
1171
        $whenmorethan1,   $setto1,          $lastvalue1,        $innerloop1,       $add2,          $every2,      $whenmorethan2, $setto2,
1172
        $lastvalue2,      $innerloop2,      $add3,              $every3,           $whenmorethan3, $setto3,      $lastvalue3,    $innerloop3,
1172
        $lastvalue2,      $innerloop2,      $add3,              $every3,           $whenmorethan3, $setto3,      $lastvalue3,    $innerloop3,
1173
        $numberingmethod, $status,          $biblionumber,      $callnumber,       $notes,         $letter,      $hemisphere,    $manualhistory,
1173
        $numberingmethod, $status,          $biblionumber,      $callnumber,       $notes,         $letter,      $hemisphere,    $manualhistory,
1174
        $internalnotes,   $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,    $enddate,       $subscriptionid
1174
        $internalnotes,   $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,    $enddate,       $subscriptionid,
1175
        $seriallifespan
1175
    ) = @_;
1176
    ) = @_;
1176
1177
1177
    #     warn $irregularity;
1178
    #     warn $irregularity;
Lines 1185-1191 sub ModSubscription { Link Here
1185
                        numberingmethod=?, status=?, biblionumber=?, callnumber=?, notes=?, 
1186
                        numberingmethod=?, status=?, biblionumber=?, callnumber=?, notes=?, 
1186
						letter=?, hemisphere=?,manualhistory=?,internalnotes=?,serialsadditems=?,
1187
						letter=?, hemisphere=?,manualhistory=?,internalnotes=?,serialsadditems=?,
1187
						staffdisplaycount = ?,opacdisplaycount = ?, graceperiod = ?, location = ?
1188
						staffdisplaycount = ?,opacdisplaycount = ?, graceperiod = ?, location = ?
1188
						,enddate=?
1189
						,enddate=?, seriallifespan=?
1189
                    WHERE subscriptionid = ?";
1190
                    WHERE subscriptionid = ?";
1190
1191
1191
    #warn "query :".$query;
1192
    #warn "query :".$query;
Lines 1202-1208 sub ModSubscription { Link Here
1202
        $numberingmethod, $status,         $biblionumber,   $callnumber,
1203
        $numberingmethod, $status,         $biblionumber,   $callnumber,
1203
        $notes, $letter, $hemisphere, ( $manualhistory ? $manualhistory : 0 ),
1204
        $notes, $letter, $hemisphere, ( $manualhistory ? $manualhistory : 0 ),
1204
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1205
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1205
        $graceperiod,   $location,        $enddate,           $subscriptionid
1206
        $graceperiod,   $location,        $enddate,  $seriallifespan, $subscriptionid
1206
    );
1207
    );
1207
    my $rows = $sth->rows;
1208
    my $rows = $sth->rows;
1208
1209
Lines 1228-1239 the id of this new subscription Link Here
1228
=cut
1229
=cut
1229
1230
1230
sub NewSubscription {
1231
sub NewSubscription {
1232
1231
    my ($auser,         $branchcode,      $aqbooksellerid,    $cost,             $aqbudgetid,    $biblionumber, $startdate,       $periodicity,
1233
    my ($auser,         $branchcode,      $aqbooksellerid,    $cost,             $aqbudgetid,    $biblionumber, $startdate,       $periodicity,
1232
        $dow,           $numberlength,    $weeklength,        $monthlength,      $add1,          $every1,       $whenmorethan1,   $setto1,
1234
        $dow,           $numberlength,    $weeklength,        $monthlength,      $add1,          $every1,       $whenmorethan1,   $setto1,
1233
        $lastvalue1,    $innerloop1,      $add2,              $every2,           $whenmorethan2, $setto2,       $lastvalue2,      $innerloop2,
1235
        $lastvalue1,    $innerloop1,      $add2,              $every2,           $whenmorethan2, $setto2,       $lastvalue2,      $innerloop2,
1234
        $add3,          $every3,          $whenmorethan3,     $setto3,           $lastvalue3,    $innerloop3,   $numberingmethod, $status,
1236
        $add3,          $every3,          $whenmorethan3,     $setto3,           $lastvalue3,    $innerloop3,   $numberingmethod, $status,
1235
        $notes,         $letter,          $firstacquidate,    $irregularity,     $numberpattern, $callnumber,   $hemisphere,      $manualhistory,
1237
        $notes,         $letter,          $firstacquidate,    $irregularity,     $numberpattern, $callnumber,   $hemisphere,      $manualhistory,
1236
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,     $enddate
1238
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,     $enddate,         $seriallifespan
1237
    ) = @_;
1239
    ) = @_;
1238
    my $dbh = C4::Context->dbh;
1240
    my $dbh = C4::Context->dbh;
1239
1241
Lines 1247-1254 sub NewSubscription { Link Here
1247
            add3,every3,whenmorethan3,setto3,lastvalue3,innerloop3,
1249
            add3,every3,whenmorethan3,setto3,lastvalue3,innerloop3,
1248
            numberingmethod, status, notes, letter,firstacquidate,irregularity,
1250
            numberingmethod, status, notes, letter,firstacquidate,irregularity,
1249
            numberpattern, callnumber, hemisphere,manualhistory,internalnotes,serialsadditems,
1251
            numberpattern, callnumber, hemisphere,manualhistory,internalnotes,serialsadditems,
1250
            staffdisplaycount,opacdisplaycount,graceperiod,location,enddate)
1252
            staffdisplaycount,opacdisplaycount,graceperiod,location,enddate,seriallifespan)
1251
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
1253
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
1252
        |;
1254
        |;
1253
    my $sth = $dbh->prepare($query);
1255
    my $sth = $dbh->prepare($query);
1254
    $sth->execute(
1256
    $sth->execute(
Lines 1257-1263 sub NewSubscription { Link Here
1257
        $lastvalue1,    $innerloop1,      $add2,              $every2,           $whenmorethan2, $setto2,       $lastvalue2,      $innerloop2,
1259
        $lastvalue1,    $innerloop1,      $add2,              $every2,           $whenmorethan2, $setto2,       $lastvalue2,      $innerloop2,
1258
        $add3,          $every3,          $whenmorethan3,     $setto3,           $lastvalue3,    $innerloop3,   $numberingmethod, "$status",
1260
        $add3,          $every3,          $whenmorethan3,     $setto3,           $lastvalue3,    $innerloop3,   $numberingmethod, "$status",
1259
        $notes,         $letter,          $firstacquidate,    $irregularity,     $numberpattern, $callnumber,   $hemisphere,      $manualhistory,
1261
        $notes,         $letter,          $firstacquidate,    $irregularity,     $numberpattern, $callnumber,   $hemisphere,      $manualhistory,
1260
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,     $enddate
1262
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,     $enddate,         $seriallifespan
1261
    );
1263
    );
1262
1264
1263
    my $subscriptionid = $dbh->{'mysql_insertid'};
1265
    my $subscriptionid = $dbh->{'mysql_insertid'};
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 1893-1898 CREATE TABLE `subscription` ( Link Here
1893
  `opacdisplaycount` VARCHAR(10) NULL,
1893
  `opacdisplaycount` VARCHAR(10) NULL,
1894
  `graceperiod` int(11) NOT NULL default '0',
1894
  `graceperiod` int(11) NOT NULL default '0',
1895
  `enddate` date default NULL,
1895
  `enddate` date default NULL,
1896
  `seriallifespan` TINYINT(1) DEFAULT -1,
1896
  PRIMARY KEY  (`subscriptionid`)
1897
  PRIMARY KEY  (`subscriptionid`)
1897
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1898
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1898
1899
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 5635-5640 if(C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5635
    SetVersion($DBversion);
5635
    SetVersion($DBversion);
5636
}
5636
}
5637
5637
5638
$DBversion = 'XXX';
5639
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
5640
   $dbh->do("ALTER TABLE subscription ADD `seriallifespan` TINYINT(1) DEFAULT -1");
5641
   print "Upgrade to $DBversion done (Add seriallifespan to subscription)\n";
5642
   SetVersion ($DBversion);
5643
}
5644
5638
=head1 FUNCTIONS
5645
=head1 FUNCTIONS
5639
5646
5640
=head2 TableExists($table)
5647
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (+17 lines)
Lines 1030-1035 $(document).ready(function() { Link Here
1030
            [% END %]
1030
            [% END %]
1031
        </li>
1031
        </li>
1032
        <li>
1032
        <li>
1033
            <label for="seriallifespan">Serial lifespan:</label>
1034
            <select name="seriallifespan" id="seriallifespan">
1035
                <option value="-1" [% IF ( seriallifespan == -1 ) %]selected="selected"[% END %]>Immortal</option>
1036
                <option value="1" [% IF ( seriallifespan == 1 ) %]selected="selected"[% END %]>1 year</option>
1037
                <option value="2" [% IF ( seriallifespan == 2 ) %]selected="selected"[% END %]>2 years</option>
1038
                <option value="3" [% IF ( seriallifespan == 3 ) %]selected="selected"[% END %]>3 years</option>
1039
                <option value="4" [% IF ( seriallifespan == 4 ) %]selected="selected"[% END %]>4 years</option>
1040
                <option value="5" [% IF ( seriallifespan == 5 ) %]selected="selected"[% END %]>5 years</option>
1041
                <option value="6" [% IF ( seriallifespan == 6 ) %]selected="selected"[% END %]>6 years</option>
1042
                <option value="7" [% IF ( seriallifespan == 7 ) %]selected="selected"[% END %]>7 years</option>
1043
                <option value="8" [% IF ( seriallifespan == 8 ) %]selected="selected"[% END %]>8 years</option>
1044
                <option value="9" [% IF ( seriallifespan == 9 ) %]selected="selected"[% END %]>9 years</option>
1045
                <option value="10" [% IF ( seriallifespan == 10 ) %]selected="selected"[% END %]>10 years</option>
1046
            </select>
1047
            <div class="hint">Set the subscription's serial lifespan. A serial will be considered "out of date" after the chosen time period.</div>
1048
        </li>
1049
        <li>
1033
            <label for="branchcode">Library:</label>
1050
            <label for="branchcode">Library:</label>
1034
            
1051
            
1035
                <select name="branchcode" id="branchcode" style="width: 20em;">
1052
                <select name="branchcode" id="branchcode" style="width: 20em;">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (+52 lines)
Lines 255-260 $(document).ready(function() { Link Here
255
        [% IF ( numberlength ) %]<li><span class="label">Number of issues:</span> [% numberlength %]</li>[% END %]
255
        [% IF ( numberlength ) %]<li><span class="label">Number of issues:</span> [% numberlength %]</li>[% END %]
256
        [% IF ( weeklength ) %]<li><span class="label">Number of weeks:</span> [% weeklength %]</li>[% END %]
256
        [% IF ( weeklength ) %]<li><span class="label">Number of weeks:</span> [% weeklength %]</li>[% END %]
257
        [% IF ( monthlength ) %]<li><span class="label">Number of months:</span> [% monthlength %]</li>[% END %]
257
        [% IF ( monthlength ) %]<li><span class="label">Number of months:</span> [% monthlength %]</li>[% END %]
258
                <li><span class="label">Serial lifespan:</span>
259
                [% IF seriallifespan == -1 %]
260
                    <span>Immortal</span>
261
                [% ELSIF ( seriallifespan == 1 ) %]
262
                    <span>1 year</span>
263
                [% ELSIF ( seriallifespan == 2 ) %]
264
                    <span>2 years</span>
265
                [% ELSIF ( seriallifespan == 3 ) %]
266
                    <span>3 years</span>
267
                [% ELSIF ( seriallifespan == 4 ) %]
268
                    <span>4 years</span>
269
                [% ELSIF ( seriallifespan == 5 ) %]
270
                    <span>5 years</span>
271
                [% ELSIF ( seriallifespan == 6 ) %]
272
                    <span>6 years</span>
273
                [% ELSIF ( seriallifespan == 7 ) %]
274
                    <span>7 years</span>
275
                [% ELSIF ( seriallifespan == 8 ) %]
276
                    <span>8 years</span>
277
                [% ELSIF ( seriallifespan == 9 ) %]
278
                    <span>9 years</span>
279
                [% ELSIF ( seriallifespan == 10 ) %]
280
                    <span>10 years</span>
281
                [% END %]
282
            </li>
258
        </ol>
283
        </ol>
259
    </div>
284
    </div>
260
    </div>
285
    </div>
Lines 321-326 $(document).ready(function() { Link Here
321
            </table>
346
            </table>
322
    </div>
347
    </div>
323
    <div id="subscription_issues">
348
    <div id="subscription_issues">
349
        <h2>Serial issues</h2>
350
        <p>
351
            <label>Serial lifespan :</label>
352
            [% IF seriallifespan == -1 %]
353
                <span>Immortal</span>
354
            [% ELSIF ( seriallifespan == 1 ) %]
355
                <span>1 year</span>
356
            [% ELSIF ( seriallifespan == 2 ) %]
357
                <span>2 years</span>
358
            [% ELSIF ( seriallifespan == 3 ) %]
359
                <span>3 years</span>
360
            [% ELSIF ( seriallifespan == 4 ) %]
361
                <span>4 years</span>
362
            [% ELSIF ( seriallifespan == 5 ) %]
363
                <span>5 years</span>
364
            [% ELSIF ( seriallifespan == 6 ) %]
365
                <span>6 years</span>
366
            [% ELSIF ( seriallifespan == 7 ) %]
367
                <span>7 years</span>
368
            [% ELSIF ( seriallifespan == 8 ) %]
369
                <span>8 years</span>
370
            [% ELSIF ( seriallifespan == 9 ) %]
371
                <span>9 years</span>
372
            [% ELSIF ( seriallifespan == 10 ) %]
373
                <span>10 years</span>
374
            [% END %]
375
        </p>
324
        <table>
376
        <table>
325
        <tr>
377
        <tr>
326
            <th>Issue number</th>
378
            <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 258-272 sub redirect_add_subscription { Link Here
258
    my $missinglist = $query->param('missinglist');
259
    my $missinglist = $query->param('missinglist');
259
    my $opacnote = $query->param('opacnote');
260
    my $opacnote = $query->param('opacnote');
260
    my $librariannote = $query->param('librariannote');
261
    my $librariannote = $query->param('librariannote');
262
    my $seriallifespan = $query->param('seriallifespan');
261
	my $subscriptionid = NewSubscription($auser,$branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
263
	my $subscriptionid = NewSubscription($auser,$branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
262
					$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
264
        $startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
263
					$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
265
        $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
264
					$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
266
        $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
265
					$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
267
        $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
266
					$numberingmethod, $status, $notes,$letter,$firstacquidate,join(",",@irregularity),
268
        $numberingmethod, $status, $notes,$letter,$firstacquidate,join(",",@irregularity),
267
                    $numberpattern, $callnumber, $hemisphere,($manualhistory?$manualhistory:0),$internalnotes,
269
        $numberpattern, $callnumber, $hemisphere,($manualhistory?$manualhistory:0),$internalnotes,
268
                    $serialsadditems,$staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate
270
        $serialsadditems,$staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate,$seriallifespan
269
				);
271
    );
272
270
    ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
273
    ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
271
274
272
    print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
275
    print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
Lines 333-345 sub redirect_mod_subscription { Link Here
333
    my $graceperiod     = $query->param('graceperiod') || 0;
336
    my $graceperiod     = $query->param('graceperiod') || 0;
334
    my $location = $query->param('location');
337
    my $location = $query->param('location');
335
    my $nextexpected = GetNextExpected($subscriptionid);
338
    my $nextexpected = GetNextExpected($subscriptionid);
339
    my $seriallifespan = $query->param('seriallifespan');
336
	#  If it's  a mod, we need to check the current 'expected' issue, and mod it in the serials table if necessary.
340
	#  If it's  a mod, we need to check the current 'expected' issue, and mod it in the serials table if necessary.
337
    if ( $nextacquidate ne $nextexpected->{planneddate}->output('iso') ) {
341
    if ( $nextacquidate ne $nextexpected->{planneddate}->output('iso') ) {
338
        ModNextExpected($subscriptionid,C4::Dates->new($nextacquidate,'iso'));
342
        ModNextExpected($subscriptionid,C4::Dates->new($nextacquidate,'iso'));
339
        # if we have not received any issues yet, then we also must change the firstacquidate for the subs.
343
        # if we have not received any issues yet, then we also must change the firstacquidate for the subs.
340
        $firstissuedate = $nextacquidate if($nextexpected->{isfirstissue});
344
        $firstissuedate = $nextacquidate if($nextexpected->{isfirstissue});
341
    }
345
    }
342
343
        ModSubscription(
346
        ModSubscription(
344
            $auser,           $branchcode,   $aqbooksellerid, $cost,
347
            $auser,           $branchcode,   $aqbooksellerid, $cost,
345
            $aqbudgetid,      $startdate,    $periodicity,    $firstissuedate,
348
            $aqbudgetid,      $startdate,    $periodicity,    $firstissuedate,
Lines 351-358 sub redirect_mod_subscription { Link Here
351
            $whenmorethan3,   $setto3,       $lastvalue3,     $innerloop3,
354
            $whenmorethan3,   $setto3,       $lastvalue3,     $innerloop3,
352
            $numberingmethod, $status,       $biblionumber,   $callnumber,
355
            $numberingmethod, $status,       $biblionumber,   $callnumber,
353
            $notes,           $letter,       $hemisphere,     $manualhistory,$internalnotes,
356
            $notes,           $letter,       $hemisphere,     $manualhistory,$internalnotes,
354
            $serialsadditems, $staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate,$subscriptionid
357
            $serialsadditems, $staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate,$subscriptionid,$seriallifespan
355
        );
358
        );
359
356
        ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
360
        ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
357
    print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
361
    print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
358
    return;
362
    return;
(-)a/serials/subscription-detail.pl (-1 / +1 lines)
Lines 139-144 $template->param( Link Here
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
    (uc(C4::Context->preference("marcflavour"))) => 1
141
    (uc(C4::Context->preference("marcflavour"))) => 1
142
    "seriallifespan" => $subs->{'seriallifespan'},
142
    );
143
    );
143
144
144
output_html_with_http_headers $query, $cookie, $template->output;
145
output_html_with_http_headers $query, $cookie, $template->output;
145
- 

Return to bug 8587