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

(-)a/C4/Serials.pm (-7 / +10 lines)
Lines 1284-1290 sub ModSubscription { Link Here
1284
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1284
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1285
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1285
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1286
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1286
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1287
    $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq
1287
    $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq, $serial_lifespan
1288
    ) = @_;
1288
    ) = @_;
1289
1289
1290
    my $dbh   = C4::Context->dbh;
1290
    my $dbh   = C4::Context->dbh;
Lines 1297-1303 sub ModSubscription { Link Here
1297
            callnumber=?, notes=?, letter=?, manualhistory=?,
1297
            callnumber=?, notes=?, letter=?, manualhistory=?,
1298
            internalnotes=?, serialsadditems=?, staffdisplaycount=?,
1298
            internalnotes=?, serialsadditems=?, staffdisplaycount=?,
1299
            opacdisplaycount=?, graceperiod=?, location = ?, enddate=?,
1299
            opacdisplaycount=?, graceperiod=?, location = ?, enddate=?,
1300
            skip_serialseq=?
1300
            skip_serialseq=?,
1301
            serial_lifespan=?
1301
        WHERE subscriptionid = ?";
1302
        WHERE subscriptionid = ?";
1302
1303
1303
    my $sth = $dbh->prepare($query);
1304
    my $sth = $dbh->prepare($query);
Lines 1311-1317 sub ModSubscription { Link Here
1311
        $letter,          ($manualhistory ? $manualhistory : 0),
1312
        $letter,          ($manualhistory ? $manualhistory : 0),
1312
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1313
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1313
        $graceperiod,     $location,       $enddate,        $skip_serialseq,
1314
        $graceperiod,     $location,       $enddate,        $skip_serialseq,
1314
        $subscriptionid
1315
        $serial_lifespan, $subscriptionid
1315
    );
1316
    );
1316
    my $rows = $sth->rows;
1317
    my $rows = $sth->rows;
1317
1318
Lines 1343-1349 sub NewSubscription { Link Here
1343
    $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
1344
    $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
1344
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1345
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1345
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1346
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1346
    $location, $enddate, $skip_serialseq
1347
    $location, $enddate, $skip_serialseq, $serial_lifespan
1347
    ) = @_;
1348
    ) = @_;
1348
    my $dbh = C4::Context->dbh;
1349
    my $dbh = C4::Context->dbh;
1349
1350
Lines 1356-1363 sub NewSubscription { Link Here
1356
            lastvalue3, innerloop3, status, notes, letter, firstacquidate,
1357
            lastvalue3, innerloop3, status, notes, letter, firstacquidate,
1357
            irregularity, numberpattern, locale, callnumber,
1358
            irregularity, numberpattern, locale, callnumber,
1358
            manualhistory, internalnotes, serialsadditems, staffdisplaycount,
1359
            manualhistory, internalnotes, serialsadditems, staffdisplaycount,
1359
            opacdisplaycount, graceperiod, location, enddate, skip_serialseq)
1360
            opacdisplaycount, graceperiod, location, enddate, skip_serialseq,
1360
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
1361
            serial_lifespan)
1362
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
1361
        |;
1363
        |;
1362
    my $sth = $dbh->prepare($query);
1364
    my $sth = $dbh->prepare($query);
1363
    $sth->execute(
1365
    $sth->execute(
Lines 1367-1373 sub NewSubscription { Link Here
1367
        $lastvalue3, $innerloop3, $status, $notes, $letter,
1369
        $lastvalue3, $innerloop3, $status, $notes, $letter,
1368
        $firstacquidate, $irregularity, $numberpattern, $locale, $callnumber,
1370
        $firstacquidate, $irregularity, $numberpattern, $locale, $callnumber,
1369
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
1371
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
1370
        $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq
1372
        $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq,
1373
        $serial_lifespan
1371
    );
1374
    );
1372
1375
1373
    my $subscriptionid = $dbh->{'mysql_insertid'};
1376
    my $subscriptionid = $dbh->{'mysql_insertid'};
(-)a/installer/data/mysql/atomicupdate/subscription_seriallifespan.sql (+1 lines)
Line 0 Link Here
1
ALTER TABLE subscription ADD `serial_lifespan` TINYINT(1) DEFAULT -1;
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2123-2128 CREATE TABLE `subscription` ( -- information related to the subscription Link Here
2123
  `enddate` date default NULL, -- subscription end date
2123
  `enddate` date default NULL, -- subscription end date
2124
  `closed` INT(1) NOT NULL DEFAULT 0, -- yes / no if the subscription is closed
2124
  `closed` INT(1) NOT NULL DEFAULT 0, -- yes / no if the subscription is closed
2125
  `reneweddate` date default NULL, -- date of last renewal for the subscription
2125
  `reneweddate` date default NULL, -- date of last renewal for the subscription
2126
  `serial_lifespan` TINYINT(1) DEFAULT -1, -- lifespan of serial subscriptions
2126
  PRIMARY KEY  (`subscriptionid`),
2127
  PRIMARY KEY  (`subscriptionid`),
2127
  CONSTRAINT subscription_ibfk_1 FOREIGN KEY (periodicity) REFERENCES subscription_frequencies (id) ON DELETE SET NULL ON UPDATE CASCADE,
2128
  CONSTRAINT subscription_ibfk_1 FOREIGN KEY (periodicity) REFERENCES subscription_frequencies (id) ON DELETE SET NULL ON UPDATE CASCADE,
2128
  CONSTRAINT subscription_ibfk_2 FOREIGN KEY (numberpattern) REFERENCES subscription_numberpatterns (id) ON DELETE SET NULL ON UPDATE CASCADE
2129
  CONSTRAINT subscription_ibfk_2 FOREIGN KEY (numberpattern) REFERENCES subscription_numberpatterns (id) ON DELETE SET NULL ON UPDATE CASCADE
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/help/serials/subscription-add.tt (+1 lines)
Lines 42-47 Link Here
42
	<li>If no values are entered in these fields, they will use the OPACSerialIssueDisplayCount and StaffSerialIssueDisplayCount system preference values</li>
42
	<li>If no values are entered in these fields, they will use the OPACSerialIssueDisplayCount and StaffSerialIssueDisplayCount system preference values</li>
43
</ul>
43
</ul>
44
</li>
44
</li>
45
    <li>Serial lifespan: A serial will be considered "out of date" after the chosen time period. This field is not tied to any functionality, and is only used in reports.</li>
45
	<li>In 'First issue publication date' you want to enter the date of the issue you have in your hand, the date from which the prediction pattern will start</li>
46
	<li>In 'First issue publication date' you want to enter the date of the issue you have in your hand, the date from which the prediction pattern will start</li>
46
	<li>There are several pre-defined options for the 'Frequency' of publication
47
	<li>There are several pre-defined options for the 'Frequency' of publication
47
<ul>
48
<ul>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (+32 lines)
Lines 445-450 $(document).ready(function() { Link Here
445
    if($("#numberpattern").val() != ""){
445
    if($("#numberpattern").val() != ""){
446
        numberpatternload();
446
        numberpatternload();
447
    }
447
    }
448
    $("#lifespan_type").change(function(){
449
        if($(this).val() > 0){
450
            $("#serial_lifespan").show();
451
            [% IF serial_lifespan > 0  %]
452
                $("#serial_lifespan").val([% serial_lifespan %]);
453
            [% ELSE %]
454
                $("#serial_lifespan").val(1);
455
            [% END %]
456
457
        }
458
        else{
459
            $("#serial_lifespan").hide();
460
            $("#serial_lifespan").val(-1);
461
        }
462
    });
463
    $("#lifespan_type").change();
448
464
449
    var node;
465
    var node;
450
    [% FOREACH field IN dont_export_field_loop %]
466
    [% FOREACH field IN dont_export_field_loop %]
Lines 632-637 $(document).ready(function() { Link Here
632
                                <legend>Serials planning</legend>
648
                                <legend>Serials planning</legend>
633
                                <ol>
649
                                <ol>
634
                                    <li>
650
                                    <li>
651
                                        <label for="serial_lifespan">Serial lifespan:</label>
652
                                        <select id="lifespan_type">
653
                                        [% IF ( !serial_lifespan || serial_lifespan < 1 ) %]
654
                                             <option value="-1" selected="selected">Permanent</option>
655
                                             <option value="1">Years</option>
656
                                        [% ELSE %]
657
                                             <option value="-1">Permanent</option>
658
                                             <option value="1" selected="selected">Years</option>
659
                                        [% END %]
660
                                        </select>
661
662
                                        <input name="serial_lifespan" id="serial_lifespan" type="number" min="1"
663
                                            value="[% IF serial_lifespan %][% serial_lifespan %][% ELSE %]-1[% END %]"/>
664
                                        <div class="hint">Set the subscription's serial lifespan. A serial will be considered "out of date" after the chosen time period.</div>
665
                                    </li>
666
                                    <li>
635
                                        <label for="firstacquidate" class="required">First issue publication date:</label>
667
                                        <label for="firstacquidate" class="required">First issue publication date:</label>
636
                                        [% UNLESS (more_than_one_serial) %]
668
                                        [% UNLESS (more_than_one_serial) %]
637
                                          <input type="text" size="10" id="acqui_date" name="firstacquidate" value="[% firstacquidate | $KohaDates %]" class="datepicker required" required="required" />
669
                                          <input type="text" size="10" id="acqui_date" name="firstacquidate" value="[% firstacquidate | $KohaDates %]" class="datepicker required" required="required" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (+20 lines)
Lines 180-185 $(document).ready(function() { Link Here
180
        [% IF ( numberlength ) %]<li><span class="label">Number of issues:</span> [% numberlength %]</li>[% END %]
180
        [% IF ( numberlength ) %]<li><span class="label">Number of issues:</span> [% numberlength %]</li>[% END %]
181
        [% IF ( weeklength ) %]<li><span class="label">Number of weeks:</span> [% weeklength %]</li>[% END %]
181
        [% IF ( weeklength ) %]<li><span class="label">Number of weeks:</span> [% weeklength %]</li>[% END %]
182
        [% IF ( monthlength ) %]<li><span class="label">Number of months:</span> [% monthlength %]</li>[% END %]
182
        [% IF ( monthlength ) %]<li><span class="label">Number of months:</span> [% monthlength %]</li>[% END %]
183
                <li><span class="label">Serial lifespan:</span>
184
                    [% IF serial_lifespan == -1 %]
185
                        <span>Permanent</span>
186
                    [% ELSIF serial_lifespan == 1%]
187
                        <span>[% serial_lifespan %] year</span>
188
                    [% ELSE %]
189
                        <span>[% serial_lifespan %] years</span>
190
                    [% END %]
191
            </li>
183
        </ol>
192
        </ol>
184
    </div>
193
    </div>
185
    </div>
194
    </div>
Lines 246-251 $(document).ready(function() { Link Here
246
            </table>
255
            </table>
247
    </div>
256
    </div>
248
    <div id="subscription_issues">
257
    <div id="subscription_issues">
258
        <h2>Serial issues</h2>
259
        <p>
260
            <label>Serial lifespan :</label>
261
            [% IF serial_lifespan == -1 %]
262
                <span>Permanent</span>
263
            [% ELSIF serial_lifespan == 1%]
264
                <span>[% serial_lifespan %] year</span>
265
            [% ELSE %]
266
                <span>[% serial_lifespan %] years</span>
267
            [% END %]
268
        </p>
249
        <table>
269
        <table>
250
        <tr>
270
        <tr>
251
            <th>Issue number</th>
271
            <th>Issue number</th>
(-)a/serials/subscription-add.pl (-2 / +7 lines)
Lines 104-109 if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { Link Here
104
                    "subtype_$sub_on" => 1,
104
                    "subtype_$sub_on" => 1,
105
                    sublength =>$sub_length,
105
                    sublength =>$sub_length,
106
                    history => ($op eq 'modify'),
106
                    history => ($op eq 'modify'),
107
                    "periodicity".$subs->{'periodicity'} => 1,
108
                    "numberpattern".$subs->{'numberpattern'} => 1,
109
                    "serial_lifespan" => $subs->{'serial_lifespan'},
107
                    firstacquiyear => substr($firstissuedate,0,4),
110
                    firstacquiyear => substr($firstissuedate,0,4),
108
                    );
111
                    );
109
112
Lines 311-316 sub redirect_add_subscription { Link Here
311
    my $opacdisplaycount  = $query->param('opacdisplaycount');
314
    my $opacdisplaycount  = $query->param('opacdisplaycount');
312
    my $location          = $query->param('location');
315
    my $location          = $query->param('location');
313
    my $skip_serialseq    = $query->param('skip_serialseq');
316
    my $skip_serialseq    = $query->param('skip_serialseq');
317
    my $serial_lifespan   = $query->param('serial_lifespan');
314
    my $startdate = format_date_in_iso( $query->param('startdate') );
318
    my $startdate = format_date_in_iso( $query->param('startdate') );
315
    my $enddate = format_date_in_iso( $query->param('enddate') );
319
    my $enddate = format_date_in_iso( $query->param('enddate') );
316
    my $firstacquidate  = format_date_in_iso($query->param('firstacquidate'));
320
    my $firstacquidate  = format_date_in_iso($query->param('firstacquidate'));
Lines 330-336 sub redirect_add_subscription { Link Here
330
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
334
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
331
        $manualhistory, $internalnotes, $serialsadditems,
335
        $manualhistory, $internalnotes, $serialsadditems,
332
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
336
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
333
        $skip_serialseq
337
        $skip_serialseq, $serial_lifespan
334
    );
338
    );
335
339
336
    print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
340
    print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
Lines 379-384 sub redirect_mod_subscription { Link Here
379
    my $graceperiod     = $query->param('graceperiod') || 0;
383
    my $graceperiod     = $query->param('graceperiod') || 0;
380
    my $location = $query->param('location');
384
    my $location = $query->param('location');
381
    my $skip_serialseq    = $query->param('skip_serialseq');
385
    my $skip_serialseq    = $query->param('skip_serialseq');
386
    my $serial_lifespan    = $query->param('serial_lifespan');
382
387
383
    # Guess end date
388
    # Guess end date
384
    if(!defined $enddate || $enddate eq '') {
389
    if(!defined $enddate || $enddate eq '') {
Lines 405-411 sub redirect_mod_subscription { Link Here
405
        $status, $biblionumber, $callnumber, $notes, $letter,
410
        $status, $biblionumber, $callnumber, $notes, $letter,
406
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
411
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
407
        $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
412
        $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
408
        $skip_serialseq
413
        $skip_serialseq, $serial_lifespan
409
    );
414
    );
410
415
411
    print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
416
    print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
(-)a/serials/subscription-detail.pl (-1 / +1 lines)
Lines 159-164 $template->param( Link Here
159
    show_acquisition_details => defined $tmpl_infos->{ordered_exists} || defined $tmpl_infos->{spent_exists} ? 1 : 0,
159
    show_acquisition_details => defined $tmpl_infos->{ordered_exists} || defined $tmpl_infos->{spent_exists} ? 1 : 0,
160
    basketno => $order->{basketno},
160
    basketno => $order->{basketno},
161
    %$tmpl_infos,
161
    %$tmpl_infos,
162
    seriallifespan => $subs->{'seriallifespan'},
162
);
163
);
163
164
164
output_html_with_http_headers $query, $cookie, $template->output;
165
output_html_with_http_headers $query, $cookie, $template->output;
165
- 

Return to bug 8587