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

(-)a/C4/Serials.pm (-3 / +3 lines)
Lines 767-773 sub GetSerials { Link Here
767
    my $counter = 0;
767
    my $counter = 0;
768
    $count = 5 unless ($count);
768
    $count = 5 unless ($count);
769
    my @serials;
769
    my @serials;
770
    my $query = "SELECT serialid,serialseq, status, publisheddate, planneddate,notes, routingnotes
770
    my $query = "SELECT serialid,serialseq, status, publisheddate, planneddate,notes
771
                        FROM   serial
771
                        FROM   serial
772
                        WHERE  subscriptionid = ? AND status NOT IN (2, 4, 41, 42, 43, 44, 5)
772
                        WHERE  subscriptionid = ? AND status NOT IN (2, 4, 41, 42, 43, 44, 5)
773
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
773
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
Lines 787-793 sub GetSerials { Link Here
787
    }
787
    }
788
788
789
    # OK, now add the last 5 issues arrives/missing
789
    # OK, now add the last 5 issues arrives/missing
790
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
790
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,notes
791
       FROM     serial
791
       FROM     serial
792
       WHERE    subscriptionid = ?
792
       WHERE    subscriptionid = ?
793
       AND      (status in (2, 4, 41, 42, 43, 44, 5))
793
       AND      (status in (2, 4, 41, 42, 43, 44, 5))
Lines 832-838 sub GetSerials2 { Link Here
832
832
833
    my $dbh   = C4::Context->dbh;
833
    my $dbh   = C4::Context->dbh;
834
    my $query = qq|
834
    my $query = qq|
835
                 SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
835
                 SELECT   serialid,serialseq, status, planneddate, publisheddate,notes
836
                 FROM     serial 
836
                 FROM     serial 
837
                 WHERE    subscriptionid=$subscription AND status IN ($status)
837
                 WHERE    subscriptionid=$subscription AND status IN ($status)
838
                 ORDER BY publisheddate,serialid DESC
838
                 ORDER BY publisheddate,serialid DESC
(-)a/installer/data/mysql/updatedatabase.pl (-5 / +7 lines)
Lines 9788-9802 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
9788
9788
9789
    # Migrate data from old subscriptionroutinglist table
9789
    # Migrate data from old subscriptionroutinglist table
9790
    my $query = qq{
9790
    my $query = qq{
9791
        SELECT DISTINCT subscriptionid
9791
        SELECT serial.subscriptionid, serial.routingnotes
9792
        FROM tmp_subscriptionroutinglist
9792
        FROM tmp_subscriptionroutinglist
9793
        LEFT JOIN serial ON (tmp_subscriptionroutinglist.subscriptionid = serial.subscriptionid)
9794
        GROUP BY serial.subscriptionid
9793
    };
9795
    };
9794
    my $sth = $dbh->prepare($query);
9796
    my $sth = $dbh->prepare($query);
9795
    $sth->execute();
9797
    $sth->execute();
9796
    my $results = $sth->fetchall_arrayref( {} );
9798
    my $results = $sth->fetchall_arrayref( {} );
9797
    $query = qq{
9799
    $query = qq{
9798
        INSERT INTO subscriptionroutinglist (subscriptionid, title)
9800
        INSERT INTO subscriptionroutinglist (subscriptionid, title, notes)
9799
        VALUES (?, ?)
9801
        VALUES (?, ?, ?)
9800
    };
9802
    };
9801
    $sth = $dbh->prepare($query);
9803
    $sth = $dbh->prepare($query);
9802
    $query = qq{
9804
    $query = qq{
Lines 9811-9817 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
9811
    };
9813
    };
9812
    my $insert_sth = $dbh->prepare($query);
9814
    my $insert_sth = $dbh->prepare($query);
9813
    foreach ( @$results ) {
9815
    foreach ( @$results ) {
9814
        $sth->execute($_->{subscriptionid}, 'import');
9816
        $sth->execute($_->{subscriptionid}, 'import', $_->{routingnotes});
9815
        my $routinglistid = $dbh->last_insert_id(undef, undef, 'subscriptionroutinglist', undef);
9817
        my $routinglistid = $dbh->last_insert_id(undef, undef, 'subscriptionroutinglist', undef);
9816
        $select_sth->execute($_->{subscriptionid});
9818
        $select_sth->execute($_->{subscriptionid});
9817
        my $routings = $select_sth->fetchall_arrayref( {} );
9819
        my $routings = $select_sth->fetchall_arrayref( {} );
Lines 9821-9826 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
9821
    }
9823
    }
9822
9824
9823
    $dbh->do("DROP TABLE tmp_subscriptionroutinglist");
9825
    $dbh->do("DROP TABLE tmp_subscriptionroutinglist");
9826
    $dbh->do("ALTER TABLE serial DROP COLUMN routingnotes");
9824
    print "Upgrade to $DBversion done (New subscription routing list system).\n";
9827
    print "Upgrade to $DBversion done (New subscription routing list system).\n";
9825
    SetVersion($DBversion);
9828
    SetVersion($DBversion);
9826
}
9829
}
9827
- 

Return to bug 7957