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

(-)a/C4/Serials.pm (-10 / +8 lines)
Lines 1086-1098 sub ModSerialStatus { Link Here
1086
    #It is a usual serial
1086
    #It is a usual serial
1087
    # 1st, get previous status :
1087
    # 1st, get previous status :
1088
    my $dbh   = C4::Context->dbh;
1088
    my $dbh   = C4::Context->dbh;
1089
    my $query = "SELECT serial.subscriptionid,serial.status,subscription.periodicity
1089
    my $query = "SELECT serial.subscriptionid,serial.status,subscription.periodicity,serial.routingnotes
1090
        FROM serial, subscription
1090
        FROM serial, subscription
1091
        WHERE serial.subscriptionid=subscription.subscriptionid
1091
        WHERE serial.subscriptionid=subscription.subscriptionid
1092
            AND serialid=?";
1092
            AND serialid=?";
1093
    my $sth   = $dbh->prepare($query);
1093
    my $sth   = $dbh->prepare($query);
1094
    $sth->execute($serialid);
1094
    $sth->execute($serialid);
1095
    my ( $subscriptionid, $oldstatus, $periodicity ) = $sth->fetchrow;
1095
    my ( $subscriptionid, $oldstatus, $periodicity, $routingnotes ) = $sth->fetchrow;
1096
    my $frequency = GetSubscriptionFrequency($periodicity);
1096
    my $frequency = GetSubscriptionFrequency($periodicity);
1097
1097
1098
    # change status & update subscriptionhistory
1098
    # change status & update subscriptionhistory
Lines 1100-1115 sub ModSerialStatus { Link Here
1100
    if ( $status == DELETED ) {
1100
    if ( $status == DELETED ) {
1101
        DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } );
1101
        DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } );
1102
    } else {
1102
    } else {
1103
1104
        my $query = '
1103
        my $query = '
1105
            UPDATE serial
1104
            UPDATE serial
1106
            SET serialseq = ?, publisheddate = ?, publisheddatetext = ?,
1105
            SET serialseq = ?, publisheddate = ?, publisheddatetext = ?,
1107
                planneddate = ?, status = ?, notes = ?
1106
                planneddate = ?, status = ?, notes = ?, routingnotes = ?
1108
            WHERE  serialid = ?
1107
            WHERE  serialid = ?
1109
        ';
1108
        ';
1110
        $sth = $dbh->prepare($query);
1109
        $sth = $dbh->prepare($query);
1111
        $sth->execute( $serialseq, $publisheddate, $publisheddatetext,
1110
        $sth->execute( $serialseq, $publisheddate, $publisheddatetext,
1112
            $planneddate, $status, $notes, $serialid );
1111
            $planneddate, $status, $notes, $routingnotes, $serialid );
1113
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1112
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1114
        $sth   = $dbh->prepare($query);
1113
        $sth   = $dbh->prepare($query);
1115
        $sth->execute($subscriptionid);
1114
        $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 1533-1539 sub ReNewSubscription { Link Here
1533
1530
1534
=head2 NewIssue
1531
=head2 NewIssue
1535
1532
1536
NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $planneddate, $publisheddate,  $notes)
1533
NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $planneddate, $publisheddate, $notes, $routingnotes)
1537
1534
1538
Create a new issue stored on the database.
1535
Create a new issue stored on the database.
1539
Note : we have to update the recievedlist and missinglist on subscriptionhistory for this subscription.
1536
Note : we have to update the recievedlist and missinglist on subscriptionhistory for this subscription.
Lines 1543-1549 returns the serial id Link Here
1543
1540
1544
sub NewIssue {
1541
sub NewIssue {
1545
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate,
1542
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate,
1546
        $publisheddate, $publisheddatetext, $notes ) = @_;
1543
        $publisheddate, $publisheddatetext, $notes, $routingnotes ) = @_;
1547
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1544
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1548
1545
1549
    return unless ($subscriptionid);
1546
    return unless ($subscriptionid);
Lines 1565-1570 sub NewIssue { Link Here
1565
            publisheddate     => $publisheddate,
1562
            publisheddate     => $publisheddate,
1566
            publisheddatetext => $publisheddatetext,
1563
            publisheddatetext => $publisheddatetext,
1567
            notes             => $notes,
1564
            notes             => $notes,
1565
            routingnotes      => $routingnotes
1568
        }
1566
        }
1569
    )->store();
1567
    )->store();
1570
1568
(-)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