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

(-)a/C4/Serials.pm (-10 / +8 lines)
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
(-)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 90-96 if($op eq 'gennext' && @subscriptionid){ Link Here
90
             my $planneddate = $date_received_today ? dt_from_string : $nextpublisheddate;
90
             my $planneddate = $date_received_today ? dt_from_string : $nextpublisheddate;
91
             ## Creating the new issue
91
             ## Creating the new issue
92
             NewIssue( $newserialseq, $subscriptionid, $subscription->{'biblionumber'},
92
             NewIssue( $newserialseq, $subscriptionid, $subscription->{'biblionumber'},
93
                     1, $planneddate, $nextpublisheddate );
93
                     1, $planneddate, $nextpublisheddate, $issue->{publisheddatetext},
94
                     $issue->{notes}, $issue->{routingnotes} );
94
95
95
             ## Updating the subscription seq status
96
             ## Updating the subscription seq status
96
             my $squery = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=?
97
             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 163-169 subtest 'Values should not be erased on editing' => sub { Link Here
163
    );
163
    );
164
    my ( undef, undef, $itemnumber ) = C4::Items::AddItemFromMarc( $item_record, $biblionumber );
164
    my ( undef, undef, $itemnumber ) = C4::Items::AddItemFromMarc( $item_record, $biblionumber );
165
    my $serialid = C4::Serials::NewIssue( "serialseq", $subscriptionid, $biblionumber,
165
    my $serialid = C4::Serials::NewIssue( "serialseq", $subscriptionid, $biblionumber,
166
                                          1, undef, undef, "publisheddatetext", "notes" );
166
                                          1, undef, undef, "publisheddatetext", "notes", "routingnotes" );
167
    C4::Serials::AddItem2Serial( $serialid, $itemnumber );
167
    C4::Serials::AddItem2Serial( $serialid, $itemnumber );
168
    my $serial_info = C4::Serials::GetSerialInformation($serialid);
168
    my $serial_info = C4::Serials::GetSerialInformation($serialid);
169
    my ($itemcallnumber_info) = grep { $_->{kohafield} eq 'items.itemcallnumber' }
169
    my ($itemcallnumber_info) = grep { $_->{kohafield} eq 'items.itemcallnumber' }
170
- 

Return to bug 11492