Lines 1130-1142
sub ModSerialStatus {
Link Here
|
1130 |
#It is a usual serial |
1130 |
#It is a usual serial |
1131 |
# 1st, get previous status : |
1131 |
# 1st, get previous status : |
1132 |
my $dbh = C4::Context->dbh; |
1132 |
my $dbh = C4::Context->dbh; |
1133 |
my $query = "SELECT serial.subscriptionid,serial.status,subscription.periodicity |
1133 |
my $query = "SELECT serial.subscriptionid,serial.status,subscription.periodicity,serial.routingnotes |
1134 |
FROM serial, subscription |
1134 |
FROM serial, subscription |
1135 |
WHERE serial.subscriptionid=subscription.subscriptionid |
1135 |
WHERE serial.subscriptionid=subscription.subscriptionid |
1136 |
AND serialid=?"; |
1136 |
AND serialid=?"; |
1137 |
my $sth = $dbh->prepare($query); |
1137 |
my $sth = $dbh->prepare($query); |
1138 |
$sth->execute($serialid); |
1138 |
$sth->execute($serialid); |
1139 |
my ( $subscriptionid, $oldstatus, $periodicity ) = $sth->fetchrow; |
1139 |
my ( $subscriptionid, $oldstatus, $periodicity, $routingnotes ) = $sth->fetchrow; |
1140 |
my $frequency = GetSubscriptionFrequency($periodicity); |
1140 |
my $frequency = GetSubscriptionFrequency($periodicity); |
1141 |
|
1141 |
|
1142 |
# change status & update subscriptionhistory |
1142 |
# change status & update subscriptionhistory |
Lines 1144-1159
sub ModSerialStatus {
Link Here
|
1144 |
if ( $status == DELETED ) { |
1144 |
if ( $status == DELETED ) { |
1145 |
DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } ); |
1145 |
DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } ); |
1146 |
} else { |
1146 |
} else { |
1147 |
|
|
|
1148 |
my $query = ' |
1147 |
my $query = ' |
1149 |
UPDATE serial |
1148 |
UPDATE serial |
1150 |
SET serialseq = ?, publisheddate = ?, publisheddatetext = ?, |
1149 |
SET serialseq = ?, publisheddate = ?, publisheddatetext = ?, |
1151 |
planneddate = ?, status = ?, notes = ? |
1150 |
planneddate = ?, status = ?, notes = ?, routingnotes = ? |
1152 |
WHERE serialid = ? |
1151 |
WHERE serialid = ? |
1153 |
'; |
1152 |
'; |
1154 |
$sth = $dbh->prepare($query); |
1153 |
$sth = $dbh->prepare($query); |
1155 |
$sth->execute( $serialseq, $publisheddate, $publisheddatetext, |
1154 |
$sth->execute( $serialseq, $publisheddate, $publisheddatetext, |
1156 |
$planneddate, $status, $notes, $serialid ); |
1155 |
$planneddate, $status, $notes, $routingnotes, $serialid ); |
1157 |
$query = "SELECT * FROM subscription WHERE subscriptionid = ?"; |
1156 |
$query = "SELECT * FROM subscription WHERE subscriptionid = ?"; |
1158 |
$sth = $dbh->prepare($query); |
1157 |
$sth = $dbh->prepare($query); |
1159 |
$sth->execute($subscriptionid); |
1158 |
$sth->execute($subscriptionid); |
Lines 1207-1215
sub ModSerialStatus {
Link Here
|
1207 |
WHERE subscriptionid = ?"; |
1206 |
WHERE subscriptionid = ?"; |
1208 |
$sth = $dbh->prepare($query); |
1207 |
$sth = $dbh->prepare($query); |
1209 |
$sth->execute( $newlastvalue1, $newlastvalue2, $newlastvalue3, $newinnerloop1, $newinnerloop2, $newinnerloop3, $subscriptionid ); |
1208 |
$sth->execute( $newlastvalue1, $newlastvalue2, $newlastvalue3, $newinnerloop1, $newinnerloop2, $newinnerloop3, $subscriptionid ); |
1210 |
|
1209 |
NewIssue( $newserialseq, $subscriptionid, $subscription->{'biblionumber'}, 1, $nextpubdate, $nextpubdate, $publisheddatetext, $notes, $routingnotes ); |
1211 |
NewIssue( $newserialseq, $subscriptionid, $subscription->{'biblionumber'}, 1, $nextpubdate, $nextpubdate ); |
|
|
1212 |
|
1213 |
# check if an alert must be sent... (= a letter is defined & status became "arrived" |
1210 |
# check if an alert must be sent... (= a letter is defined & status became "arrived" |
1214 |
if ( $subscription->{letter} && $status == ARRIVED && $oldstatus != ARRIVED ) { |
1211 |
if ( $subscription->{letter} && $status == ARRIVED && $oldstatus != ARRIVED ) { |
1215 |
require C4::Letters; |
1212 |
require C4::Letters; |
Lines 1558-1564
sub ReNewSubscription {
Link Here
|
1558 |
|
1555 |
|
1559 |
=head2 NewIssue |
1556 |
=head2 NewIssue |
1560 |
|
1557 |
|
1561 |
NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $planneddate, $publisheddate, $notes) |
1558 |
NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $planneddate, $publisheddate, $notes, $routingnotes) |
1562 |
|
1559 |
|
1563 |
Create a new issue stored on the database. |
1560 |
Create a new issue stored on the database. |
1564 |
Note : we have to update the recievedlist and missinglist on subscriptionhistory for this subscription. |
1561 |
Note : we have to update the recievedlist and missinglist on subscriptionhistory for this subscription. |
Lines 1568-1574
returns the serial id
Link Here
|
1568 |
|
1565 |
|
1569 |
sub NewIssue { |
1566 |
sub NewIssue { |
1570 |
my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, |
1567 |
my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, |
1571 |
$publisheddate, $publisheddatetext, $notes ) = @_; |
1568 |
$publisheddate, $publisheddatetext, $notes, $routingnotes ) = @_; |
1572 |
### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ? |
1569 |
### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ? |
1573 |
|
1570 |
|
1574 |
return unless ($subscriptionid); |
1571 |
return unless ($subscriptionid); |
Lines 1590-1595
sub NewIssue {
Link Here
|
1590 |
publisheddate => $publisheddate, |
1587 |
publisheddate => $publisheddate, |
1591 |
publisheddatetext => $publisheddatetext, |
1588 |
publisheddatetext => $publisheddatetext, |
1592 |
notes => $notes, |
1589 |
notes => $notes, |
|
|
1590 |
routingnotes => $routingnotes |
1593 |
} |
1591 |
} |
1594 |
)->store(); |
1592 |
)->store(); |
1595 |
|
1593 |
|