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

(-)a/misc/cronjobs/serialsUpdate.pl (-35 / +9 lines)
Lines 95-101 my $sth = $dbh->prepare( Link Here
95
       serial.publisheddate,
95
       serial.publisheddate,
96
       subscription.subscriptionid
96
       subscription.subscriptionid
97
     FROM serial 
97
     FROM serial 
98
     LEFT JOIN subscription 
98
     JOIN subscription
99
       ON (subscription.subscriptionid=serial.subscriptionid) 
99
       ON (subscription.subscriptionid=serial.subscriptionid) 
100
     LEFT JOIN subscription_frequencies
100
     LEFT JOIN subscription_frequencies
101
       ON (subscription.periodicity = subscription_frequencies.id)
101
       ON (subscription.periodicity = subscription_frequencies.id)
Lines 103-146 my $sth = $dbh->prepare( Link Here
103
       AND subscription_frequencies.unit IS NOT NULL
103
       AND subscription_frequencies.unit IS NOT NULL
104
       AND DATE_ADD(planneddate, INTERVAL CAST(graceperiod AS SIGNED) DAY) < NOW()
104
       AND DATE_ADD(planneddate, INTERVAL CAST(graceperiod AS SIGNED) DAY) < NOW()
105
       AND subscription.closed = 0
105
       AND subscription.closed = 0
106
       AND publisheddate IS NOT NULL
106
    }
107
    }
107
);
108
);
108
$sth->execute();
109
$sth->execute();
109
110
110
while ( my $issue = $sth->fetchrow_hashref ) {
111
while ( my $issue = $sth->fetchrow_hashref ) {
111
112
    if ( $confirm ){
112
    my $subscription = &GetSubscription( $issue->{subscriptionid} );
113
        ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
113
    my $publisheddate  = $issue->{publisheddate};
114
            $issue->{planneddate}, $issue->{publisheddate}, $issue->{publisheddatetext},
114
115
            3, $note );
115
    if ( $subscription && $publisheddate ) {
116
        $verbose and print "Serial issue with id=" . $issue->{serialid} . " marked late\n";
116
        my $freqdata = GetSubscriptionFrequency($subscription->{'periodicity'});
117
    } else {
117
        my $nextpublisheddate = GetNextDate( $subscription, $publisheddate, $freqdata );
118
        print "Serial issue with id=" . $issue->{serialid} . " would have been marked late\n";
118
        my $today = dt_from_string->ymd;
119
120
        if ( $nextpublisheddate && $today ) {
121
            my ( $year,  $month,  $day )  = split( /-/, $nextpublisheddate );
122
            my ( $tyear, $tmonth, $tday ) = split( /-/, $today );
123
            if (   check_date( $year, $month, $day )
124
                && check_date( $tyear, $tmonth, $tday )
125
                && Date_to_Days( $year, $month, $day ) <
126
                Date_to_Days( $tyear, $tmonth, $tday ) )
127
            {
128
                $confirm
129
                  and ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
130
                    $issue->{planneddate}, $issue->{publisheddate}, $issue->{publisheddatetext},
131
                    3, $note );
132
                $verbose
133
                  and print "Serial issue with id=" . $issue->{serialid} . " updated\n";
134
            }
135
        }
136
        else {
137
            $verbose
138
              and print "Error with serial("
139
              . $issue->{serialid}
140
              . ") has no existent subscription("
141
              . $issue->{subscriptionid}
142
              . ") attached or planneddate is wrong\n";
143
        }
144
    }
119
    }
145
}
120
}
146
121
147
- 

Return to bug 28950