View | Details | Raw Unified | Return to bug 11492
Collapse All | Expand All

(-)a/C4/Serials.pm (-10 / +8 lines)
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
(-)a/serials/serials-collection.pl (-2 / +3 lines)
Lines 59-65 if($op eq 'gennext' && @subscriptionid){ Link Here
59
    my $subscriptionid = $subscriptionid[0];
59
    my $subscriptionid = $subscriptionid[0];
60
    my $sth = $dbh->prepare("
60
    my $sth = $dbh->prepare("
61
        SELECT publisheddate, publisheddatetext, serialid, serialseq,
61
        SELECT publisheddate, publisheddatetext, serialid, serialseq,
62
            planneddate
62
            planneddate, notes, routingnotes
63
        FROM serial
63
        FROM serial
64
        WHERE status = 1 AND subscriptionid = ?
64
        WHERE status = 1 AND subscriptionid = ?
65
    ");
65
    ");
Lines 88-94 if($op eq 'gennext' && @subscriptionid){ Link Here
88
             my $planneddate = $date_received_today ? dt_from_string : $nextpublisheddate;
88
             my $planneddate = $date_received_today ? dt_from_string : $nextpublisheddate;
89
             ## Creating the new issue
89
             ## Creating the new issue
90
             NewIssue( $newserialseq, $subscriptionid, $subscription->{'biblionumber'},
90
             NewIssue( $newserialseq, $subscriptionid, $subscription->{'biblionumber'},
91
                     1, $planneddate, $nextpublisheddate );
91
                     1, $planneddate, $nextpublisheddate, $issue->{publisheddatetext},
92
                     $issue->{notes}, $issue->{routingnotes} );
92
93
93
             ## Updating the subscription seq status
94
             ## Updating the subscription seq status
94
             my $squery = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=?
95
             my $squery = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=?
(-)a/serials/serials-edit.pl (-1 / +2 lines)
Lines 238-244 if ( $op and $op eq 'serialchangestatus' ) { Link Here
238
                    $plan_date,
238
                    $plan_date,
239
                    $pub_date,
239
                    $pub_date,
240
                    $publisheddatetexts[$i],
240
                    $publisheddatetexts[$i],
241
                    $notes[$i]
241
                    $notes[$i],
242
                    $serialdatalist[0]->{'routingnotes'}
242
                );
243
                );
243
            }
244
            }
244
        }
245
        }
(-)a/t/db_dependent/Serials.t (-2 / +1 lines)
Lines 164-170 subtest 'Values should not be erased on editing' => sub { Link Here
164
    );
164
    );
165
    my ( undef, undef, $itemnumber ) = C4::Items::AddItemFromMarc( $item_record, $biblionumber );
165
    my ( undef, undef, $itemnumber ) = C4::Items::AddItemFromMarc( $item_record, $biblionumber );
166
    my $serialid = C4::Serials::NewIssue( "serialseq", $subscriptionid, $biblionumber,
166
    my $serialid = C4::Serials::NewIssue( "serialseq", $subscriptionid, $biblionumber,
167
                                          1, undef, undef, "publisheddatetext", "notes" );
167
                                          1, undef, undef, "publisheddatetext", "notes", "routingnotes" );
168
    C4::Serials::AddItem2Serial( $serialid, $itemnumber );
168
    C4::Serials::AddItem2Serial( $serialid, $itemnumber );
169
    my $serial_info = C4::Serials::GetSerialInformation($serialid);
169
    my $serial_info = C4::Serials::GetSerialInformation($serialid);
170
    my ($itemcallnumber_info) = grep { $_->{kohafield} eq 'items.itemcallnumber' }
170
    my ($itemcallnumber_info) = grep { $_->{kohafield} eq 'items.itemcallnumber' }
171
- 

Return to bug 11492