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