Lines 79-95
pod2usage( -verbose => 2 ) if $man;
Link Here
|
79 |
|
79 |
|
80 |
$verbose and !$confirm and print "### Database will not be modified ###\n"; |
80 |
$verbose and !$confirm and print "### Database will not be modified ###\n"; |
81 |
|
81 |
|
82 |
if ($note && $nonote) { |
82 |
if ( $note && $nonote ) { |
83 |
$note = ''; |
83 |
$note = ''; |
84 |
} |
84 |
} |
85 |
if (!$note && !$nonote) { |
85 |
if ( !$note && !$nonote ) { |
86 |
$note = 'Automatically set to late'; |
86 |
$note = 'Automatically set to late'; |
87 |
} |
87 |
} |
88 |
$verbose and print $note ? "Note : $note\n" : "No note\n"; |
88 |
$verbose and print $note ? "Note : $note\n" : "No note\n"; |
89 |
|
89 |
|
90 |
# select all serials with not "irregular" periodicity that are late |
90 |
# select all serials with not "irregular" periodicity that are late |
91 |
my $sth = $dbh->prepare(" |
91 |
my $sth = $dbh->prepare( |
92 |
SELECT * |
92 |
q{ |
|
|
93 |
SELECT |
94 |
serial.serialid, |
95 |
serial.serialseq, |
96 |
serial.planneddate, |
97 |
serial.publisheddate |
98 |
subscription.subscriptionid |
93 |
FROM serial |
99 |
FROM serial |
94 |
LEFT JOIN subscription |
100 |
LEFT JOIN subscription |
95 |
ON (subscription.subscriptionid=serial.subscriptionid) |
101 |
ON (subscription.subscriptionid=serial.subscriptionid) |
Lines 97-115
my $sth = $dbh->prepare("
Link Here
|
97 |
AND periodicity <> 32 |
103 |
AND periodicity <> 32 |
98 |
AND DATE_ADD(planneddate, INTERVAL CAST(graceperiod AS SIGNED) DAY) < NOW() |
104 |
AND DATE_ADD(planneddate, INTERVAL CAST(graceperiod AS SIGNED) DAY) < NOW() |
99 |
AND subscription.closed = 0 |
105 |
AND subscription.closed = 0 |
100 |
"); |
106 |
} |
|
|
107 |
); |
101 |
$sth->execute(); |
108 |
$sth->execute(); |
102 |
|
109 |
|
103 |
while ( my $issue = $sth->fetchrow_hashref ) { |
110 |
while ( my $issue = $sth->fetchrow_hashref ) { |
104 |
|
111 |
|
105 |
my $subscription = &GetSubscription( $issue->{subscriptionid} ); |
112 |
my $subscription = &GetSubscription( $issue->{subscriptionid} ); |
106 |
my $planneddate = $issue->{planneddate}; |
113 |
my $planneddate = $issue->{planneddate}; |
107 |
|
114 |
|
108 |
if( $subscription && $planneddate && $planneddate ne "0000-00-00" ){ |
115 |
if ( $subscription && $planneddate && $planneddate ne "0000-00-00" ) { |
109 |
my $nextpublisheddate = GetNextDate( $planneddate, $subscription ); |
116 |
my $nextpublisheddate = GetNextDate( $planneddate, $subscription ); |
110 |
my $today = format_date_in_iso( C4::Dates->new()->output() ); |
117 |
my $today = format_date_in_iso( C4::Dates->new()->output() ); |
111 |
|
118 |
|
112 |
if ($nextpublisheddate && $today){ |
119 |
if ( $nextpublisheddate && $today ) { |
113 |
my ( $year, $month, $day ) = split( /-/, $nextpublisheddate ); |
120 |
my ( $year, $month, $day ) = split( /-/, $nextpublisheddate ); |
114 |
my ( $tyear, $tmonth, $tday ) = split( /-/, $today ); |
121 |
my ( $tyear, $tmonth, $tday ) = split( /-/, $today ); |
115 |
if ( check_date( $year, $month, $day ) |
122 |
if ( check_date( $year, $month, $day ) |
Lines 117-132
while ( my $issue = $sth->fetchrow_hashref ) {
Link Here
|
117 |
&& Date_to_Days( $year, $month, $day ) < |
124 |
&& Date_to_Days( $year, $month, $day ) < |
118 |
Date_to_Days( $tyear, $tmonth, $tday ) ) |
125 |
Date_to_Days( $tyear, $tmonth, $tday ) ) |
119 |
{ |
126 |
{ |
120 |
$confirm and |
127 |
$confirm |
121 |
ModSerialStatus( $issue->{serialid}, $issue->{serialseq}, |
128 |
and ModSerialStatus( $issue->{serialid}, $issue->{serialseq}, |
122 |
$issue->{planneddate}, $issue->{publisheddate}, |
129 |
$issue->{planneddate}, $issue->{publisheddate}, |
123 |
3, $note ); |
130 |
3, $note ); |
124 |
$verbose and print "Serial id=" . $issue->{serialid}." update\n"; |
131 |
$verbose |
|
|
132 |
and print "Serial id=" . $issue->{serialid} . " update\n"; |
125 |
} |
133 |
} |
126 |
}else{ |
134 |
} |
127 |
$verbose and print "Error with serial(".$issue->{serialid}.") has no existent |
135 |
else { |
128 |
subscription(".$issue->{subscriptionid}.") attached |
136 |
$verbose |
129 |
or planneddate is wrong\n"; |
137 |
and print "Error with serial(" |
|
|
138 |
. $issue->{serialid} |
139 |
. ") has no existent subscription(" |
140 |
. $issue->{subscriptionid} |
141 |
. ") attached or planneddate is wrong\n"; |
130 |
} |
142 |
} |
131 |
} |
143 |
} |
132 |
} |
144 |
} |
133 |
- |
|
|