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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (+3 lines)
Lines 43-48 $(document).ready(function() { Link Here
43
	[% INCLUDE 'serials-toolbar.inc' %]
43
	[% INCLUDE 'serials-toolbar.inc' %]
44
44
45
    <h1>Subscription for [% bibliotitle%] [% IF closed %](closed)[% END %]</h1>
45
    <h1>Subscription for [% bibliotitle%] [% IF closed %](closed)[% END %]</h1>
46
    [% IF ! ( startdate && enddate && firstacquidate ) %]
47
        <div class="dialog error">One ore more date(s) not properly defined. Please edit subscription to check/define them.</div>
48
    [% END %]
46
    [% IF ( abouttoexpire ) %]
49
    [% IF ( abouttoexpire ) %]
47
      [% UNLESS closed %]
50
      [% UNLESS closed %]
48
        <div class="dialog message">Subscription will expire [% enddate %]. <a href="#" id="renewsub">Renew this subscription</a>.</div>
51
        <div class="dialog message">Subscription will expire [% enddate %]. <a href="#" id="renewsub">Renew this subscription</a>.</div>
(-)a/serials/subscription-add.pl (-11 / +38 lines)
Lines 15-20 Link Here
15
# You should have received a copy of the GNU General Public License
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
17
18
# FIXME: Processing of invalid dates (00/00/0000 or 33/33/2999) needs
19
# some more attention. At the moment subscription will be saved with
20
# empty dates, subscription detail page will display a warning if
21
# startdate and/or enddate are empty.
22
18
use strict;
23
use strict;
19
use warnings;
24
use warnings;
20
25
Lines 324-345 sub redirect_add_subscription { Link Here
324
    my $skip_serialseq    = $query->param('skip_serialseq');
329
    my $skip_serialseq    = $query->param('skip_serialseq');
325
330
326
    my $startdate = $query->param('startdate');
331
    my $startdate = $query->param('startdate');
327
    $startdate = eval { dt_from_string( $startdate ); } if ( $startdate );
332
    my $startdate_dt;
328
    $startdate = output_pref( { dt => $startdate, dateonly => 1, dateformat => 'iso' } ) if ( $startdate );
333
    $startdate_dt = eval { dt_from_string( $startdate ); } if ( $startdate );
334
    if ( $startdate_dt ) {
335
        $startdate = output_pref( { dt => $startdate_dt, dateonly => 1, dateformat => 'iso' } );
336
    }
337
    else {
338
        $startdate = output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } );
339
    }
329
340
330
    my $enddate = $query->param('enddate');
341
    my $enddate = $query->param('enddate');
331
    $enddate = eval { dt_from_string( $enddate ); } if ( $enddate );
342
    my $enddate_dt;
332
    $enddate = output_pref( { dt => $enddate, dateonly => 1, dateformat => 'iso' } ) if ( $enddate );
343
    $enddate_dt = eval { dt_from_string( $enddate ); } if ( $enddate );
344
    if ( $enddate_dt ) {
345
        $enddate = output_pref( { dt => $enddate_dt, dateonly => 1, dateformat => 'iso' } );
346
    }
347
    else {
348
        $enddate = undef;
349
    }
350
333
    my $firstacquidate  = $query->param('firstacquidate');
351
    my $firstacquidate  = $query->param('firstacquidate');
334
    $firstacquidate = eval { dt_from_string( $firstacquidate ); } if ( $firstacquidate );
352
    my $firstacquidate_dt;
335
    $firstacquidate = output_pref( { dt => $enddate, dateonly => 1, dateformat => 'iso' } ) if ( $firstacquidate );
353
    $firstacquidate_dt = eval { dt_from_string( $firstacquidate ); } if ( $firstacquidate );
354
    if ($firstacquidate_dt ) {
355
        $firstacquidate = output_pref( { dt => $firstacquidate_dt, dateonly => 1, dateformat => 'iso' } );
356
    }
357
    else {
358
        $firstacquidate = undef;
359
    }
336
360
337
    if(!defined $enddate || $enddate eq '') {
361
    if(!defined $enddate || $enddate eq '') {
338
        if($subtype eq "issues") {
362
        if($subtype eq "issues") {
339
            $enddate = _guess_enddate($firstacquidate, $periodicity, $numberlength, $weeklength, $monthlength);
363
            $enddate = eval { _guess_enddate($firstacquidate, $periodicity, $numberlength, $weeklength, $monthlength); };
340
        } else {
364
        } else {
341
            $enddate = _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength);
365
            $enddate = eval { _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength); };
342
        }
366
        }
367
        #FIXME We set $enddate to empty string if there was a problem with guessing;
368
        $enddate = '';
343
    }
369
    }
344
370
345
    my $subscriptionid = NewSubscription(
371
    my $subscriptionid = NewSubscription(
Lines 418-427 sub redirect_mod_subscription { Link Here
418
    # Guess end date
444
    # Guess end date
419
    if(!defined $enddate || $enddate eq '') {
445
    if(!defined $enddate || $enddate eq '') {
420
        if($subtype eq "issues") {
446
        if($subtype eq "issues") {
421
            $enddate = _guess_enddate($nextacquidate, $periodicity, $numberlength, $weeklength, $monthlength);
447
            $enddate = eval { _guess_enddate($nextacquidate, $periodicity, $numberlength, $weeklength, $monthlength); };
422
        } else {
448
        } else {
423
            $enddate = _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength);
449
            $enddate = eval {_guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength); };
424
        }
450
        }
451
        #FIXME We set $enddate totoday if it is empty;
452
        $enddate = output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ) unless ( $enddate );
425
    }
453
    }
426
454
427
    my $nextexpected = GetNextExpected($subscriptionid);
455
    my $nextexpected = GetNextExpected($subscriptionid);
428
- 

Return to bug 14969