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

(-)a/C4/Serials.pm (-10 / +8 lines)
Lines 1130-1142 sub ModSerialStatus { Link Here
1130
    #It is a usual serial
1130
    #It is a usual serial
1131
    # 1st, get previous status :
1131
    # 1st, get previous status :
1132
    my $dbh   = C4::Context->dbh;
1132
    my $dbh   = C4::Context->dbh;
1133
    my $query = "SELECT serial.subscriptionid,serial.status,subscription.periodicity
1133
    my $query = "SELECT serial.subscriptionid,serial.status,subscription.periodicity,serial.routingnotes
1134
        FROM serial, subscription
1134
        FROM serial, subscription
1135
        WHERE serial.subscriptionid=subscription.subscriptionid
1135
        WHERE serial.subscriptionid=subscription.subscriptionid
1136
            AND serialid=?";
1136
            AND serialid=?";
1137
    my $sth   = $dbh->prepare($query);
1137
    my $sth   = $dbh->prepare($query);
1138
    $sth->execute($serialid);
1138
    $sth->execute($serialid);
1139
    my ( $subscriptionid, $oldstatus, $periodicity ) = $sth->fetchrow;
1139
    my ( $subscriptionid, $oldstatus, $periodicity, $routingnotes ) = $sth->fetchrow;
1140
    my $frequency = GetSubscriptionFrequency($periodicity);
1140
    my $frequency = GetSubscriptionFrequency($periodicity);
1141
1141
1142
    # change status & update subscriptionhistory
1142
    # change status & update subscriptionhistory
Lines 1144-1159 sub ModSerialStatus { Link Here
1144
    if ( $status == DELETED ) {
1144
    if ( $status == DELETED ) {
1145
        DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } );
1145
        DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } );
1146
    } else {
1146
    } else {
1147
1148
        my $query = '
1147
        my $query = '
1149
            UPDATE serial
1148
            UPDATE serial
1150
            SET serialseq = ?, publisheddate = ?, publisheddatetext = ?,
1149
            SET serialseq = ?, publisheddate = ?, publisheddatetext = ?,
1151
                planneddate = ?, status = ?, notes = ?
1150
                planneddate = ?, status = ?, notes = ?, routingnotes = ?
1152
            WHERE  serialid = ?
1151
            WHERE  serialid = ?
1153
        ';
1152
        ';
1154
        $sth = $dbh->prepare($query);
1153
        $sth = $dbh->prepare($query);
1155
        $sth->execute( $serialseq, $publisheddate, $publisheddatetext,
1154
        $sth->execute( $serialseq, $publisheddate, $publisheddatetext,
1156
            $planneddate, $status, $notes, $serialid );
1155
            $planneddate, $status, $notes, $routingnotes, $serialid );
1157
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1156
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1158
        $sth   = $dbh->prepare($query);
1157
        $sth   = $dbh->prepare($query);
1159
        $sth->execute($subscriptionid);
1158
        $sth->execute($subscriptionid);
Lines 1207-1215 sub ModSerialStatus { Link Here
1207
                    WHERE  subscriptionid = ?";
1206
                    WHERE  subscriptionid = ?";
1208
        $sth = $dbh->prepare($query);
1207
        $sth = $dbh->prepare($query);
1209
        $sth->execute( $newlastvalue1, $newlastvalue2, $newlastvalue3, $newinnerloop1, $newinnerloop2, $newinnerloop3, $subscriptionid );
1208
        $sth->execute( $newlastvalue1, $newlastvalue2, $newlastvalue3, $newinnerloop1, $newinnerloop2, $newinnerloop3, $subscriptionid );
1210
1209
        NewIssue( $newserialseq, $subscriptionid, $subscription->{'biblionumber'}, 1, $nextpubdate, $nextpubdate, $publisheddatetext, $notes, $routingnotes );
1211
        NewIssue( $newserialseq, $subscriptionid, $subscription->{'biblionumber'}, 1, $nextpubdate, $nextpubdate );
1212
1213
        # check if an alert must be sent... (= a letter is defined & status became "arrived"
1210
        # check if an alert must be sent... (= a letter is defined & status became "arrived"
1214
        if ( $subscription->{letter} && $status == ARRIVED && $oldstatus != ARRIVED ) {
1211
        if ( $subscription->{letter} && $status == ARRIVED && $oldstatus != ARRIVED ) {
1215
            require C4::Letters;
1212
            require C4::Letters;
Lines 1558-1564 sub ReNewSubscription { Link Here
1558
1555
1559
=head2 NewIssue
1556
=head2 NewIssue
1560
1557
1561
NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $planneddate, $publisheddate,  $notes)
1558
NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $planneddate, $publisheddate, $notes, $routingnotes)
1562
1559
1563
Create a new issue stored on the database.
1560
Create a new issue stored on the database.
1564
Note : we have to update the recievedlist and missinglist on subscriptionhistory for this subscription.
1561
Note : we have to update the recievedlist and missinglist on subscriptionhistory for this subscription.
Lines 1568-1574 returns the serial id Link Here
1568
1565
1569
sub NewIssue {
1566
sub NewIssue {
1570
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate,
1567
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate,
1571
        $publisheddate, $publisheddatetext, $notes ) = @_;
1568
        $publisheddate, $publisheddatetext, $notes, $routingnotes ) = @_;
1572
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1569
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1573
1570
1574
    return unless ($subscriptionid);
1571
    return unless ($subscriptionid);
Lines 1590-1595 sub NewIssue { Link Here
1590
            publisheddate     => $publisheddate,
1587
            publisheddate     => $publisheddate,
1591
            publisheddatetext => $publisheddatetext,
1588
            publisheddatetext => $publisheddatetext,
1592
            notes             => $notes,
1589
            notes             => $notes,
1590
            routingnotes      => $routingnotes
1593
        }
1591
        }
1594
    )->store();
1592
    )->store();
1595
1593
(-)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 235-241 if ( $op and $op eq 'serialchangestatus' ) { Link Here
235
                    $plan_date,
235
                    $plan_date,
236
                    $pub_date,
236
                    $pub_date,
237
                    $publisheddatetexts[$i],
237
                    $publisheddatetexts[$i],
238
                    $notes[$i]
238
                    $notes[$i],
239
                    $serialdatalist[0]->{'routingnotes'}
239
                );
240
                );
240
            }
241
            }
241
        }
242
        }
(-)a/t/db_dependent/Serials.t (-2 / +1 lines)
Lines 166-172 subtest 'Values should not be erased on editing' => sub { Link Here
166
    );
166
    );
167
    my ( undef, undef, $itemnumber ) = C4::Items::AddItemFromMarc( $item_record, $biblionumber );
167
    my ( undef, undef, $itemnumber ) = C4::Items::AddItemFromMarc( $item_record, $biblionumber );
168
    my $serialid = C4::Serials::NewIssue( "serialseq", $subscriptionid, $biblionumber,
168
    my $serialid = C4::Serials::NewIssue( "serialseq", $subscriptionid, $biblionumber,
169
                                          1, undef, undef, "publisheddatetext", "notes" );
169
                                          1, undef, undef, "publisheddatetext", "notes", "routingnotes" );
170
    C4::Serials::AddItem2Serial( $serialid, $itemnumber );
170
    C4::Serials::AddItem2Serial( $serialid, $itemnumber );
171
    my $serial_info = C4::Serials::GetSerialInformation($serialid);
171
    my $serial_info = C4::Serials::GetSerialInformation($serialid);
172
    my ($itemcallnumber_info) = grep { $_->{kohafield} eq 'items.itemcallnumber' }
172
    my ($itemcallnumber_info) = grep { $_->{kohafield} eq 'items.itemcallnumber' }
173
- 

Return to bug 11492