Lines 1087-1099
sub ModSerialStatus {
Link Here
|
1087 |
#It is a usual serial |
1087 |
#It is a usual serial |
1088 |
# 1st, get previous status : |
1088 |
# 1st, get previous status : |
1089 |
my $dbh = C4::Context->dbh; |
1089 |
my $dbh = C4::Context->dbh; |
1090 |
my $query = "SELECT serial.subscriptionid,serial.status,subscription.periodicity |
1090 |
my $query = "SELECT serial.subscriptionid,serial.status,subscription.periodicity,serial.routingnotes |
1091 |
FROM serial, subscription |
1091 |
FROM serial, subscription |
1092 |
WHERE serial.subscriptionid=subscription.subscriptionid |
1092 |
WHERE serial.subscriptionid=subscription.subscriptionid |
1093 |
AND serialid=?"; |
1093 |
AND serialid=?"; |
1094 |
my $sth = $dbh->prepare($query); |
1094 |
my $sth = $dbh->prepare($query); |
1095 |
$sth->execute($serialid); |
1095 |
$sth->execute($serialid); |
1096 |
my ( $subscriptionid, $oldstatus, $periodicity ) = $sth->fetchrow; |
1096 |
my ( $subscriptionid, $oldstatus, $periodicity, $routingnotes ) = $sth->fetchrow; |
1097 |
my $frequency = GetSubscriptionFrequency($periodicity); |
1097 |
my $frequency = GetSubscriptionFrequency($periodicity); |
1098 |
|
1098 |
|
1099 |
# change status & update subscriptionhistory |
1099 |
# change status & update subscriptionhistory |
Lines 1101-1116
sub ModSerialStatus {
Link Here
|
1101 |
if ( $status == DELETED ) { |
1101 |
if ( $status == DELETED ) { |
1102 |
DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } ); |
1102 |
DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } ); |
1103 |
} else { |
1103 |
} else { |
1104 |
|
|
|
1105 |
my $query = ' |
1104 |
my $query = ' |
1106 |
UPDATE serial |
1105 |
UPDATE serial |
1107 |
SET serialseq = ?, publisheddate = ?, publisheddatetext = ?, |
1106 |
SET serialseq = ?, publisheddate = ?, publisheddatetext = ?, |
1108 |
planneddate = ?, status = ?, notes = ? |
1107 |
planneddate = ?, status = ?, notes = ?, routingnotes = ? |
1109 |
WHERE serialid = ? |
1108 |
WHERE serialid = ? |
1110 |
'; |
1109 |
'; |
1111 |
$sth = $dbh->prepare($query); |
1110 |
$sth = $dbh->prepare($query); |
1112 |
$sth->execute( $serialseq, $publisheddate, $publisheddatetext, |
1111 |
$sth->execute( $serialseq, $publisheddate, $publisheddatetext, |
1113 |
$planneddate, $status, $notes, $serialid ); |
1112 |
$planneddate, $status, $notes, $routingnotes, $serialid ); |
1114 |
$query = "SELECT * FROM subscription WHERE subscriptionid = ?"; |
1113 |
$query = "SELECT * FROM subscription WHERE subscriptionid = ?"; |
1115 |
$sth = $dbh->prepare($query); |
1114 |
$sth = $dbh->prepare($query); |
1116 |
$sth->execute($subscriptionid); |
1115 |
$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 1515-1521
sub ReNewSubscription {
Link Here
|
1515 |
|
1512 |
|
1516 |
=head2 NewIssue |
1513 |
=head2 NewIssue |
1517 |
|
1514 |
|
1518 |
NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $planneddate, $publisheddate, $notes) |
1515 |
NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $planneddate, $publisheddate, $notes, $routingnotes) |
1519 |
|
1516 |
|
1520 |
Create a new issue stored on the database. |
1517 |
Create a new issue stored on the database. |
1521 |
Note : we have to update the recievedlist and missinglist on subscriptionhistory for this subscription. |
1518 |
Note : we have to update the recievedlist and missinglist on subscriptionhistory for this subscription. |
Lines 1525-1531
returns the serial id
Link Here
|
1525 |
|
1522 |
|
1526 |
sub NewIssue { |
1523 |
sub NewIssue { |
1527 |
my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, |
1524 |
my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, |
1528 |
$publisheddate, $publisheddatetext, $notes ) = @_; |
1525 |
$publisheddate, $publisheddatetext, $notes, $routingnotes ) = @_; |
1529 |
### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ? |
1526 |
### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ? |
1530 |
|
1527 |
|
1531 |
return unless ($subscriptionid); |
1528 |
return unless ($subscriptionid); |
Lines 1547-1552
sub NewIssue {
Link Here
|
1547 |
publisheddate => $publisheddate, |
1544 |
publisheddate => $publisheddate, |
1548 |
publisheddatetext => $publisheddatetext, |
1545 |
publisheddatetext => $publisheddatetext, |
1549 |
notes => $notes, |
1546 |
notes => $notes, |
|
|
1547 |
routingnotes => $routingnotes |
1550 |
} |
1548 |
} |
1551 |
)->store(); |
1549 |
)->store(); |
1552 |
|
1550 |
|