Lines 1086-1098
sub ModSerialStatus {
Link Here
|
1086 |
#It is a usual serial |
1086 |
#It is a usual serial |
1087 |
# 1st, get previous status : |
1087 |
# 1st, get previous status : |
1088 |
my $dbh = C4::Context->dbh; |
1088 |
my $dbh = C4::Context->dbh; |
1089 |
my $query = "SELECT serial.subscriptionid,serial.status,subscription.periodicity |
1089 |
my $query = "SELECT serial.subscriptionid,serial.status,subscription.periodicity,serial.routingnotes |
1090 |
FROM serial, subscription |
1090 |
FROM serial, subscription |
1091 |
WHERE serial.subscriptionid=subscription.subscriptionid |
1091 |
WHERE serial.subscriptionid=subscription.subscriptionid |
1092 |
AND serialid=?"; |
1092 |
AND serialid=?"; |
1093 |
my $sth = $dbh->prepare($query); |
1093 |
my $sth = $dbh->prepare($query); |
1094 |
$sth->execute($serialid); |
1094 |
$sth->execute($serialid); |
1095 |
my ( $subscriptionid, $oldstatus, $periodicity ) = $sth->fetchrow; |
1095 |
my ( $subscriptionid, $oldstatus, $periodicity, $routingnotes ) = $sth->fetchrow; |
1096 |
my $frequency = GetSubscriptionFrequency($periodicity); |
1096 |
my $frequency = GetSubscriptionFrequency($periodicity); |
1097 |
|
1097 |
|
1098 |
# change status & update subscriptionhistory |
1098 |
# change status & update subscriptionhistory |
Lines 1100-1115
sub ModSerialStatus {
Link Here
|
1100 |
if ( $status == DELETED ) { |
1100 |
if ( $status == DELETED ) { |
1101 |
DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } ); |
1101 |
DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } ); |
1102 |
} else { |
1102 |
} else { |
1103 |
|
|
|
1104 |
my $query = ' |
1103 |
my $query = ' |
1105 |
UPDATE serial |
1104 |
UPDATE serial |
1106 |
SET serialseq = ?, publisheddate = ?, publisheddatetext = ?, |
1105 |
SET serialseq = ?, publisheddate = ?, publisheddatetext = ?, |
1107 |
planneddate = ?, status = ?, notes = ? |
1106 |
planneddate = ?, status = ?, notes = ?, routingnotes = ? |
1108 |
WHERE serialid = ? |
1107 |
WHERE serialid = ? |
1109 |
'; |
1108 |
'; |
1110 |
$sth = $dbh->prepare($query); |
1109 |
$sth = $dbh->prepare($query); |
1111 |
$sth->execute( $serialseq, $publisheddate, $publisheddatetext, |
1110 |
$sth->execute( $serialseq, $publisheddate, $publisheddatetext, |
1112 |
$planneddate, $status, $notes, $serialid ); |
1111 |
$planneddate, $status, $notes, $routingnotes, $serialid ); |
1113 |
$query = "SELECT * FROM subscription WHERE subscriptionid = ?"; |
1112 |
$query = "SELECT * FROM subscription WHERE subscriptionid = ?"; |
1114 |
$sth = $dbh->prepare($query); |
1113 |
$sth = $dbh->prepare($query); |
1115 |
$sth->execute($subscriptionid); |
1114 |
$sth->execute($subscriptionid); |
Lines 1164-1172
sub ModSerialStatus {
Link Here
|
1164 |
WHERE subscriptionid = ?"; |
1163 |
WHERE subscriptionid = ?"; |
1165 |
$sth = $dbh->prepare($query); |
1164 |
$sth = $dbh->prepare($query); |
1166 |
$sth->execute( $newlastvalue1, $newlastvalue2, $newlastvalue3, $newinnerloop1, $newinnerloop2, $newinnerloop3, $subscriptionid ); |
1165 |
$sth->execute( $newlastvalue1, $newlastvalue2, $newlastvalue3, $newinnerloop1, $newinnerloop2, $newinnerloop3, $subscriptionid ); |
1167 |
|
1166 |
NewIssue( $newserialseq, $subscriptionid, $subscription->{'biblionumber'}, 1, $nextpubdate, $nextpubdate, $publisheddatetext, $notes, $routingnotes ); |
1168 |
NewIssue( $newserialseq, $subscriptionid, $subscription->{'biblionumber'}, 1, $nextpubdate, $nextpubdate ); |
|
|
1169 |
|
1170 |
# check if an alert must be sent... (= a letter is defined & status became "arrived" |
1167 |
# check if an alert must be sent... (= a letter is defined & status became "arrived" |
1171 |
if ( $subscription->{letter} && $status == ARRIVED && $oldstatus != ARRIVED ) { |
1168 |
if ( $subscription->{letter} && $status == ARRIVED && $oldstatus != ARRIVED ) { |
1172 |
require C4::Letters; |
1169 |
require C4::Letters; |
Lines 1533-1539
sub ReNewSubscription {
Link Here
|
1533 |
|
1530 |
|
1534 |
=head2 NewIssue |
1531 |
=head2 NewIssue |
1535 |
|
1532 |
|
1536 |
NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $planneddate, $publisheddate, $notes) |
1533 |
NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $planneddate, $publisheddate, $notes, $routingnotes) |
1537 |
|
1534 |
|
1538 |
Create a new issue stored on the database. |
1535 |
Create a new issue stored on the database. |
1539 |
Note : we have to update the recievedlist and missinglist on subscriptionhistory for this subscription. |
1536 |
Note : we have to update the recievedlist and missinglist on subscriptionhistory for this subscription. |
Lines 1543-1549
returns the serial id
Link Here
|
1543 |
|
1540 |
|
1544 |
sub NewIssue { |
1541 |
sub NewIssue { |
1545 |
my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, |
1542 |
my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, |
1546 |
$publisheddate, $publisheddatetext, $notes ) = @_; |
1543 |
$publisheddate, $publisheddatetext, $notes, $routingnotes ) = @_; |
1547 |
### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ? |
1544 |
### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ? |
1548 |
|
1545 |
|
1549 |
return unless ($subscriptionid); |
1546 |
return unless ($subscriptionid); |
Lines 1565-1570
sub NewIssue {
Link Here
|
1565 |
publisheddate => $publisheddate, |
1562 |
publisheddate => $publisheddate, |
1566 |
publisheddatetext => $publisheddatetext, |
1563 |
publisheddatetext => $publisheddatetext, |
1567 |
notes => $notes, |
1564 |
notes => $notes, |
|
|
1565 |
routingnotes => $routingnotes |
1568 |
} |
1566 |
} |
1569 |
)->store(); |
1567 |
)->store(); |
1570 |
|
1568 |
|