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