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

(-)a/C4/Acquisition.pm (-20 / +116 lines)
Lines 28-34 use MARC::Record; Link Here
28
use C4::Suggestions;
28
use C4::Suggestions;
29
use C4::Biblio;
29
use C4::Biblio;
30
use C4::Debug;
30
use C4::Debug;
31
use C4::SQLHelper qw(InsertInTable);
31
use C4::SQLHelper qw(InsertInTable UpdateInTable);
32
use C4::Bookseller qw(GetBookSellerFromId);
32
use C4::Bookseller qw(GetBookSellerFromId);
33
use C4::Templates qw(gettemplate);
33
use C4::Templates qw(gettemplate);
34
34
Lines 67-72 BEGIN { Link Here
67
        &GetItemnumbersFromOrder
67
        &GetItemnumbersFromOrder
68
68
69
        &AddClaim
69
        &AddClaim
70
        &GetBiblioCountByBasketno
70
    );
71
    );
71
}
72
}
72
73
Lines 219-224 sub CloseBasket { Link Here
219
    ";
220
    ";
220
    my $sth = $dbh->prepare($query);
221
    my $sth = $dbh->prepare($query);
221
    $sth->execute($basketno);
222
    $sth->execute($basketno);
223
224
    my @orders = GetOrders($basketno);
225
    foreach my $order (@orders) {
226
        $query = qq{
227
            UPDATE aqorders
228
            SET orderstatus = 1
229
            WHERE ordernumber = ?;
230
        };
231
        $sth = $dbh->prepare($query);
232
        $sth->execute($order->{'ordernumber'});
233
    }
222
}
234
}
223
235
224
#------------------------------------------------------------#
236
#------------------------------------------------------------#
Lines 453-458 sub ModBasket { Link Here
453
    my $dbh = C4::Context->dbh;
465
    my $dbh = C4::Context->dbh;
454
    my $sth = $dbh->prepare($query);
466
    my $sth = $dbh->prepare($query);
455
    $sth->execute(@params);
467
    $sth->execute(@params);
468
469
    # set orders status = new
470
    my @orders = GetOrders($basketinfo->{'basketno'});
471
    foreach my $order (@orders) {
472
        $query = qq{
473
            UPDATE aqorders
474
            SET orderstatus = 0
475
            WHERE ordernumber = ?;
476
        };
477
        $sth = $dbh->prepare($query);
478
        $sth->execute($order->{'ordernumber'});
479
    }
480
456
    $sth->finish;
481
    $sth->finish;
457
}
482
}
458
483
Lines 1008-1014 The following keys are used: "biblionumber", "title", "basketno", "quantity", "n Link Here
1008
1033
1009
sub NewOrder {
1034
sub NewOrder {
1010
    my $orderinfo = shift;
1035
    my $orderinfo = shift;
1011
#### ------------------------------
1036
    my $parent_ordernumber = shift;
1037
1012
    my $dbh = C4::Context->dbh;
1038
    my $dbh = C4::Context->dbh;
1013
    my @params;
1039
    my @params;
1014
1040
Lines 1028-1034 sub NewOrder { Link Here
1028
        $orderinfo->{quantityreceived} = 0;
1054
        $orderinfo->{quantityreceived} = 0;
1029
    }
1055
    }
1030
1056
1031
    my $ordernumber=InsertInTable("aqorders",$orderinfo);
1057
    $orderinfo->{parent_ordernumber} = $parent_ordernumber if $parent_ordernumber;
1058
1059
    my $ordernumber = InsertInTable("aqorders",$orderinfo);
1060
    if ( not $parent_ordernumber ) {
1061
        $orderinfo->{parent_ordernumber} = $ordernumber;
1062
        $orderinfo->{ordernumber} = $ordernumber;
1063
        UpdateInTable( "aqorders", $orderinfo );
1064
    }
1065
1032
    return ( $orderinfo->{'basketno'}, $ordernumber );
1066
    return ( $orderinfo->{'basketno'}, $ordernumber );
1033
}
1067
}
1034
1068
Lines 1274-1279 sub ModReceiveOrder { Link Here
1274
                , freight=?
1308
                , freight=?
1275
                , rrp=?
1309
                , rrp=?
1276
                , quantity=?
1310
                , quantity=?
1311
                , orderstatus=3
1277
            WHERE biblionumber=? AND ordernumber=?");
1312
            WHERE biblionumber=? AND ordernumber=?");
1278
1313
1279
        $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$quantrec,$biblionumber,$ordernumber);
1314
        $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$quantrec,$biblionumber,$ordernumber);
Lines 1285-1291 sub ModReceiveOrder { Link Here
1285
        }
1320
        }
1286
        $order->{'quantity'} -= $quantrec;
1321
        $order->{'quantity'} -= $quantrec;
1287
        $order->{'quantityreceived'} = 0;
1322
        $order->{'quantityreceived'} = 0;
1288
        my $newOrder = NewOrder($order);
1323
        $order->{orderstatus} = 2;
1324
        my $newOrder = NewOrder($order, $order->{parent_ordernumber});
1289
        # Change ordernumber in aqorders_items for items not received
1325
        # Change ordernumber in aqorders_items for items not received
1290
        my @orderitems = GetItemnumbersFromOrder( $order->{'ordernumber'} );
1326
        my @orderitems = GetItemnumbersFromOrder( $order->{'ordernumber'} );
1291
        my $count = scalar @orderitems;
1327
        my $count = scalar @orderitems;
Lines 1301-1307 sub ModReceiveOrder { Link Here
1301
    } else {
1337
    } else {
1302
        $sth=$dbh->prepare("update aqorders
1338
        $sth=$dbh->prepare("update aqorders
1303
                            set quantityreceived=?,datereceived=?,booksellerinvoicenumber=?,
1339
                            set quantityreceived=?,datereceived=?,booksellerinvoicenumber=?,
1304
                                unitprice=?,freight=?,rrp=?
1340
                                unitprice=?,freight=?,rrp=?,orderstatus=3
1305
                            where biblionumber=? and ordernumber=?");
1341
                            where biblionumber=? and ordernumber=?");
1306
        $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$biblionumber,$ordernumber);
1342
        $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$biblionumber,$ordernumber);
1307
        $sth->finish;
1343
        $sth->finish;
Lines 1403-1409 sub DelOrder { Link Here
1403
    my $dbh = C4::Context->dbh;
1439
    my $dbh = C4::Context->dbh;
1404
    my $query = "
1440
    my $query = "
1405
        UPDATE aqorders
1441
        UPDATE aqorders
1406
        SET    datecancellationprinted=now()
1442
        SET    datecancellationprinted=now(), orderstatus=4
1407
        WHERE  biblionumber=? AND ordernumber=?
1443
        WHERE  biblionumber=? AND ordernumber=?
1408
    ";
1444
    ";
1409
    my $sth = $dbh->prepare($query);
1445
    my $sth = $dbh->prepare($query);
Lines 1756-1761 sub GetHistory { Link Here
1756
    my $to_placed_on = $params{to_placed_on};
1792
    my $to_placed_on = $params{to_placed_on};
1757
    my $basket = $params{basket};
1793
    my $basket = $params{basket};
1758
    my $booksellerinvoicenumber = $params{booksellerinvoicenumber};
1794
    my $booksellerinvoicenumber = $params{booksellerinvoicenumber};
1795
    my $budget = $params{budget};
1796
    my $branchcode = $params{branchcode};
1797
    my $orderstatus = $params{orderstatus};
1798
1759
    my @order_loop;
1799
    my @order_loop;
1760
    my $total_qty         = 0;
1800
    my $total_qty         = 0;
1761
    my $total_qtyreceived = 0;
1801
    my $total_qtyreceived = 0;
Lines 1764-1773 sub GetHistory { Link Here
1764
    my $dbh   = C4::Context->dbh;
1804
    my $dbh   = C4::Context->dbh;
1765
    my $query ="
1805
    my $query ="
1766
        SELECT
1806
        SELECT
1767
            biblio.title,
1807
            IFNULL(biblio.title,     deletedbiblio.title)     AS title,
1768
            biblio.author,
1808
            IFNULL(biblio.author,    deletedbiblio.author)    AS author,
1769
	    biblioitems.isbn,
1809
            IFNULL(biblioitems.isbn, deletedbiblioitems.isbn) AS isbn,
1770
        biblioitems.ean,
1810
            IFNULL(biblioitems.ean,  deletedbiblioitems.ean)  AS ean,
1771
            aqorders.basketno,
1811
            aqorders.basketno,
1772
            aqbasket.basketname,
1812
            aqbasket.basketname,
1773
            aqbasket.basketgroupid,
1813
            aqbasket.basketgroupid,
Lines 1781-1798 sub GetHistory { Link Here
1781
            aqorders.ordernumber,
1821
            aqorders.ordernumber,
1782
            aqorders.booksellerinvoicenumber as invoicenumber,
1822
            aqorders.booksellerinvoicenumber as invoicenumber,
1783
            aqbooksellers.id as id,
1823
            aqbooksellers.id as id,
1784
            aqorders.biblionumber
1824
            aqorders.biblionumber,
1825
            aqorders.orderstatus,
1826
            aqorders.parent_ordernumber";
1827
    $query .= ", aqbudgets.budget_id AS budget" if defined $budget;
1828
    $query .= ", aqorders.branchcode " if ( not C4::Context->preference("IndependantBranches")  and defined $branchcode and $branchcode );
1829
    $query .= "
1785
        FROM aqorders
1830
        FROM aqorders
1786
        LEFT JOIN aqbasket ON aqorders.basketno=aqbasket.basketno
1831
        LEFT JOIN aqbasket ON aqorders.basketno=aqbasket.basketno
1787
        LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
1832
        LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
1788
        LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
1833
        LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
1789
	LEFT JOIN biblioitems ON biblioitems.biblionumber=aqorders.biblionumber
1834
        LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber
1790
        LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber";
1835
        LEFT JOIN biblioitems ON biblioitems.biblionumber=aqorders.biblionumber
1836
        LEFT JOIN deletedbiblio ON deletedbiblio.biblionumber=aqorders.biblionumber
1837
        LEFT JOIN deletedbiblioitems ON deletedbiblioitems.biblionumber=aqorders.biblionumber
1838
        ";
1839
1840
    $query .= " LEFT JOIN aqbudgets ON aqorders.budget_id=aqbudgets.budget_id"
1841
        if defined $budget;
1842
1843
    if ( C4::Context->preference("IndependantBranches") ) {
1844
        $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber";
1845
    } elsif ( defined $branchcode and $branchcode) {
1846
        $query .= " LEFT JOIN borrowers ON aqorders.branchcode=borrowers.branchcode"
1847
    }
1791
1848
1792
    $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber"
1849
    $query .= " WHERE 1 ";
1793
    if ( C4::Context->preference("IndependantBranches") );
1794
1850
1795
    $query .= " WHERE (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') ";
1851
    $query .= " AND (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') " if $orderstatus ne '4';
1796
1852
1797
    my @query_params  = ();
1853
    my @query_params  = ();
1798
1854
Lines 1811-1817 sub GetHistory { Link Here
1811
        $query .= " AND biblioitems.isbn LIKE ? ";
1867
        $query .= " AND biblioitems.isbn LIKE ? ";
1812
        push @query_params, "%$isbn%";
1868
        push @query_params, "%$isbn%";
1813
    }
1869
    }
1814
    if ( defined $ean and $ean ) {
1870
    if ( $ean ) {
1815
        $query .= " AND biblioitems.ean = ? ";
1871
        $query .= " AND biblioitems.ean = ? ";
1816
        push @query_params, "$ean";
1872
        push @query_params, "$ean";
1817
    }
1873
    }
Lines 1820-1825 sub GetHistory { Link Here
1820
        push @query_params, "%$name%";
1876
        push @query_params, "%$name%";
1821
    }
1877
    }
1822
1878
1879
    if ( $budget ) {
1880
        $query .= " AND aqbudgets.budget_id = ? ";
1881
        push @query_params, "$budget";
1882
    }
1883
1823
    if ( $from_placed_on ) {
1884
    if ( $from_placed_on ) {
1824
        $query .= " AND creationdate >= ? ";
1885
        $query .= " AND creationdate >= ? ";
1825
        push @query_params, $from_placed_on;
1886
        push @query_params, $from_placed_on;
Lines 1830-1835 sub GetHistory { Link Here
1830
        push @query_params, $to_placed_on;
1891
        push @query_params, $to_placed_on;
1831
    }
1892
    }
1832
1893
1894
    if ( defined $orderstatus and $orderstatus ne '') {
1895
        $query .= " AND aqorders.orderstatus = ? ";
1896
        push @query_params, "$orderstatus";
1897
    }
1898
1833
    if ($basket) {
1899
    if ($basket) {
1834
        if ($basket =~ m/^\d+$/) {
1900
        if ($basket =~ m/^\d+$/) {
1835
            $query .= " AND aqorders.basketno = ? ";
1901
            $query .= " AND aqorders.basketno = ? ";
Lines 1851-1856 sub GetHistory { Link Here
1851
            $query .= " AND (borrowers.branchcode = ? OR borrowers.branchcode ='' ) ";
1917
            $query .= " AND (borrowers.branchcode = ? OR borrowers.branchcode ='' ) ";
1852
            push @query_params, $userenv->{branch};
1918
            push @query_params, $userenv->{branch};
1853
        }
1919
        }
1920
    } elsif ( defined $branchcode and $branchcode ) {
1921
        $query .= " AND aqorders.branchcode = ? ";
1922
        push @query_params, $branchcode;
1854
    }
1923
    }
1855
    $query .= " ORDER BY id";
1924
    $query .= " ORDER BY id";
1856
    my $sth = $dbh->prepare($query);
1925
    my $sth = $dbh->prepare($query);
Lines 1860-1868 sub GetHistory { Link Here
1860
        $line->{count} = $cnt++;
1929
        $line->{count} = $cnt++;
1861
        $line->{toggle} = 1 if $cnt % 2;
1930
        $line->{toggle} = 1 if $cnt % 2;
1862
        push @order_loop, $line;
1931
        push @order_loop, $line;
1863
        $total_qty         += $line->{'quantity'};
1932
        $total_qty         += ( $line->{quantity} ) ? $line->{quantity} : 0;
1864
        $total_qtyreceived += $line->{'quantityreceived'};
1933
        $total_qtyreceived += ( $line->{quantityreceived} ) ? $line->{quantityreceived} : 0;
1865
        $total_price       += $line->{'quantity'} * $line->{'ecost'};
1934
        $total_price       += ( $line->{quantity} and $line->{ecost} ) ? $line->{quantity} * $line->{ecost} : 0;
1866
    }
1935
    }
1867
    return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
1936
    return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
1868
}
1937
}
Lines 1986-1991 sub AddClaim { Link Here
1986
2055
1987
}
2056
}
1988
2057
2058
=head3 GetBiblioCountByBasketno
2059
2060
=over 4
2061
2062
$biblio_count = &GetBiblioCountByBasketno($basketno);
2063
2064
Looks up the biblio's count that has basketno value $basketno
2065
2066
Returns a quantity
2067
=back
2068
2069
=cut
2070
sub GetBiblioCountByBasketno {
2071
    my ($basketno) = @_;
2072
    my $dbh          = C4::Context->dbh;
2073
    my $query        = "
2074
        SELECT COUNT( DISTINCT( biblionumber ) )
2075
        FROM   aqorders
2076
        WHERE  basketno = ?
2077
            AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00')
2078
        ";
2079
2080
    my $sth = $dbh->prepare($query);
2081
    $sth->execute($basketno);
2082
    return $sth->fetchrow;
2083
}
2084
1989
1;
2085
1;
1990
__END__
2086
__END__
1991
2087
(-)a/acqui/histsearch.pl (-2 / +49 lines)
Lines 57-62 use C4::Output; Link Here
57
use C4::Acquisition;
57
use C4::Acquisition;
58
use C4::Dates;
58
use C4::Dates;
59
use C4::Debug;
59
use C4::Debug;
60
use C4::Branch;
61
use C4::Koha;
60
62
61
my $input = new CGI;
63
my $input = new CGI;
62
my $title                   = $input->param( 'title');
64
my $title                   = $input->param( 'title');
Lines 69-74 my $booksellerinvoicenumber = $input->param( 'booksellerinvoicenumber' ); Link Here
69
my $do_search               = $input->param('do_search') || 0;
71
my $do_search               = $input->param('do_search') || 0;
70
my $from_placed_on          = C4::Dates->new($input->param('from'));
72
my $from_placed_on          = C4::Dates->new($input->param('from'));
71
my $to_placed_on            = C4::Dates->new($input->param('to'));
73
my $to_placed_on            = C4::Dates->new($input->param('to'));
74
my $budget                  = $input->param( 'budget' );
75
my $branchcode              = $input->param( 'branchcode' );
76
my $orderstatus             = $input->param( 'orderstatus' );
77
72
if ( not $input->param('from') ) {
78
if ( not $input->param('from') ) {
73
    # FIXME Dirty but we can't sent a Date::Calc to C4::Dates ?
79
    # FIXME Dirty but we can't sent a Date::Calc to C4::Dates ?
74
    # We would use a function like Add_Delta_YM(-1, 0, 0);
80
    # We would use a function like Add_Delta_YM(-1, 0, 0);
Lines 108-134 if ($do_search) { Link Here
108
        to_placed_on => $to_iso,
114
        to_placed_on => $to_iso,
109
        basket => $basket,
115
        basket => $basket,
110
        booksellerinvoicenumber => $booksellerinvoicenumber,
116
        booksellerinvoicenumber => $booksellerinvoicenumber,
117
        budget => $budget,
118
        branchcode => $branchcode,
119
        orderstatus => $orderstatus,
111
    );
120
    );
112
}
121
}
113
122
114
my $from_date = $from_placed_on ? $from_placed_on->output('syspref') : undef;
123
my $from_date = $from_placed_on ? $from_placed_on->output('syspref') : undef;
115
my $to_date = $to_placed_on ? $to_placed_on->output('syspref') : undef;
124
my $to_date = $to_placed_on ? $to_placed_on->output('syspref') : undef;
116
125
126
my $budgetperiods = C4::Budgets::GetBudgetPeriods;
127
my $bp_loop = $budgetperiods;
128
for my $bp ( @{$budgetperiods} ) {
129
    my $hierarchy = C4::Budgets::GetBudgetHierarchy( $$bp{budget_period_id} );
130
    for my $budget ( @{$hierarchy} ) {
131
        #warn Data::Dumper::Dumper $budget;
132
        $$budget{budget_display_name} = sprintf("%s", ">" x $$budget{depth} . $$budget{budget_name});
133
    }
134
    $$bp{hierarchy} = $hierarchy;
135
}
136
137
if ( not C4::Context->preference("IndependantBranches") ){
138
    my $branches = GetBranches();
139
    my @branchloop;
140
    foreach my $thisbranch ( keys %$branches ) {
141
        my %row = (
142
            value      => $thisbranch,
143
            branchname => $branches->{$thisbranch}->{'branchname'},
144
        );
145
        push @branchloop, \%row;
146
    }
147
    $template->param(
148
        branchcode           => $branchcode,
149
        display_branchcode   => !C4::Context->preference("IndependantBranches"),
150
        branchloop          => \@branchloop
151
    );
152
}
153
154
my $orderstatusloop = GetAuthorisedValues( "ORDRSTATUS" );
155
my %order_status = map {
156
    $_->{authorised_value} => $_->{lib}
157
} @$orderstatusloop;
158
159
$_->{lib_orderstatus} = $order_status{$_->{orderstatus}}
160
    for @$order_loop;
161
117
$template->param(
162
$template->param(
118
    suggestions_loop        => $order_loop,
163
    order_loop              => $order_loop,
119
    total_qty               => $total_qty,
164
    total_qty               => $total_qty,
120
    total_qtyreceived       => $total_qtyreceived,
165
    total_qtyreceived       => $total_qtyreceived,
121
    total_price             => sprintf( "%.2f", $total_price ),
166
    total_price             => sprintf( "%.2f", $total_price ),
122
    numresults              => $order_loop ? scalar(@$order_loop) : undef,
167
    numresults              => $order_loop ? scalar(@$order_loop) : undef,
123
    title                   => $title,
168
    title                   => $title,
124
    author                  => $author,
169
    author                  => $author,
125
    isbn		    => $isbn,
170
    isbn                    => $isbn,
126
    ean                     => $ean,
171
    ean                     => $ean,
127
    name                    => $name,
172
    name                    => $name,
128
    basket                  => $basket,
173
    basket                  => $basket,
129
    booksellerinvoicenumber => $booksellerinvoicenumber,
174
    booksellerinvoicenumber => $booksellerinvoicenumber,
130
    from_placed_on          => $from_date,
175
    from_placed_on          => $from_date,
131
    to_placed_on            => $to_date,
176
    to_placed_on            => $to_date,
177
    bp_loop                 => $bp_loop,
178
    orderstatusloop         => $orderstatusloop,
132
    DHTMLcalendar_dateformat=> C4::Dates->DHTMLcalendar(),
179
    DHTMLcalendar_dateformat=> C4::Dates->DHTMLcalendar(),
133
    dateformat              => C4::Dates->new()->format(),
180
    dateformat              => C4::Dates->new()->format(),
134
    debug                   => $debug || $input->param('debug') || 0,
181
    debug                   => $debug || $input->param('debug') || 0,
(-)a/installer/data/mysql/de-DE/optional/auth_val.sql (+7 lines)
Lines 46-48 INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('MANUA Link Here
46
46
47
-- custom borrower notes
47
-- custom borrower notes
48
INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('BOR_NOTES','ADDR','Adresse kontrollieren');
48
INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('BOR_NOTES','ADDR','Adresse kontrollieren');
49
50
-- order status
51
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '0', 'New');
52
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '1', 'Requested');
53
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '2', 'Partial');
54
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '3', 'Complete');
55
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '4', 'Deleted');
(-)a/installer/data/mysql/en/optional/auth_val.sql (+7 lines)
Lines 50-52 INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('BOR_N Link Here
50
-- OPAC Suggestions reasons
50
-- OPAC Suggestions reasons
51
INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('OPAC_SUG','damaged','The copy on the shelf is damaged','The copy on the shelf is damaged');
51
INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('OPAC_SUG','damaged','The copy on the shelf is damaged','The copy on the shelf is damaged');
52
INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('OPAC_SUG','bestseller','Upcoming title by popular author','Upcoming title by popular author');
52
INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('OPAC_SUG','bestseller','Upcoming title by popular author','Upcoming title by popular author');
53
54
-- order status
55
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '0', 'New');
56
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '1', 'Requested');
57
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '2', 'Partial');
58
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '3', 'Complete');
59
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '4', 'Deleted');
(-)a/installer/data/mysql/es-ES/optional/auth_val.sql (+7 lines)
Lines 50-52 INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('BOR_N Link Here
50
-- OPAC Suggestions reasons
50
-- OPAC Suggestions reasons
51
INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('OPAC_SUG','damaged','The copy on the shelf is damaged','The copy on the shelf is damaged');
51
INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('OPAC_SUG','damaged','The copy on the shelf is damaged','The copy on the shelf is damaged');
52
INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('OPAC_SUG','bestseller','Upcoming title by popular author','Upcoming title by popular author');
52
INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('OPAC_SUG','bestseller','Upcoming title by popular author','Upcoming title by popular author');
53
54
-- order status
55
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '0', 'New');
56
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '1', 'Requested');
57
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '2', 'Partial');
58
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '3', 'Complete');
59
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '4', 'Deleted');
(-)a/installer/data/mysql/fr-FR/1-Obligatoire/authorised_values.sql (+5 lines)
Lines 351-353 INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES Link Here
351
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '295', 'Donneur de grades');
351
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '295', 'Donneur de grades');
352
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '010', 'Adaptateur');
352
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'qualif', '010', 'Adaptateur');
353
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LOC', 'En reliure', 'En reliure');
353
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'LOC', 'En reliure', 'En reliure');
354
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '0', 'Nouveau');
355
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '1', 'Demandé');
356
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '2', 'Partielle');
357
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '3', 'Complète');
358
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '4', 'Supprimée')
(-)a/installer/data/mysql/it-IT/necessari/auth_val.sql (+7 lines)
Lines 79-82 INSERT INTO authorised_values (category, authorised_value, lib) VALUES Link Here
79
('LANG', 'fre', 'francese'),
79
('LANG', 'fre', 'francese'),
80
('LANG', 'lat', 'latino');
80
('LANG', 'lat', 'latino');
81
81
82
-- order status
83
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '0', 'New');
84
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '1', 'Requested');
85
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '2', 'Partial');
86
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '3', 'Complete');
87
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '4', 'Deleted');
88
82
SET FOREIGN_KEY_CHECKS=1;
89
SET FOREIGN_KEY_CHECKS=1;
(-)a/installer/data/mysql/kohastructure.sql (+2 lines)
Lines 2771-2776 CREATE TABLE `aqorders` ( -- information related to the basket line items Link Here
2771
  `uncertainprice` tinyint(1), -- was this price uncertain (1 for yes, 0 for no)
2771
  `uncertainprice` tinyint(1), -- was this price uncertain (1 for yes, 0 for no)
2772
  `claims_count` int(11) default 0, -- count of claim letters generated
2772
  `claims_count` int(11) default 0, -- count of claim letters generated
2773
  `claimed_date` date default NULL, -- last date a claim was generated
2773
  `claimed_date` date default NULL, -- last date a claim was generated
2774
  `orderstatus` tinyint(2) default 0, -- the current status for this line item
2775
  `parent_ordernumber` int(11) default NULL, -- the ordernumber's parent
2774
  PRIMARY KEY  (`ordernumber`),
2776
  PRIMARY KEY  (`ordernumber`),
2775
  KEY `basketno` (`basketno`),
2777
  KEY `basketno` (`basketno`),
2776
  KEY `biblionumber` (`biblionumber`),
2778
  KEY `biblionumber` (`biblionumber`),
(-)a/installer/data/mysql/nb-NO/2-Valgfritt/auth_val.sql (+7 lines)
Lines 71-73 INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('BOR_N Link Here
71
-- OPAC Suggestions reasons
71
-- OPAC Suggestions reasons
72
INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('OPAC_SUG','damaged','Eksemplaret på hylla er skadet','Eksemplaret på hylla er skadet');
72
INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('OPAC_SUG','damaged','Eksemplaret på hylla er skadet','Eksemplaret på hylla er skadet');
73
INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('OPAC_SUG','bestseller','Kommende tittel av populær forfatter','Kommende tittel av populær forfatter');
73
INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('OPAC_SUG','bestseller','Kommende tittel av populær forfatter','Kommende tittel av populær forfatter');
74
75
-- order status
76
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '0', 'New');
77
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '1', 'Requested');
78
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '2', 'Partial');
79
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '3', 'Complete');
80
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '4', 'Deleted');
(-)a/installer/data/mysql/pl-PL/optional/auth_val.sql (+7 lines)
Lines 38-40 INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('NOT_L Link Here
38
38
39
-- restricted status of an item, linked to items.restricted
39
-- restricted status of an item, linked to items.restricted
40
INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('RESTRICTED','1','Restricted Access');
40
INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('RESTRICTED','1','Restricted Access');
41
42
-- order status
43
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '0', 'New');
44
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '1', 'Requested');
45
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '2', 'Partial');
46
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '3', 'Complete');
47
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '4', 'Deleted');
(-)a/installer/data/mysql/updatedatabase.pl (+28 lines)
Lines 5635-5640 if(C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5635
    SetVersion($DBversion);
5635
    SetVersion($DBversion);
5636
}
5636
}
5637
5637
5638
$DBversion = "3.09.00.XXX";
5639
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5640
    my $return_count;
5641
    eval { $return_count = $dbh->do("SELECT 1 FROM authorised_values WHERE category='ORDRSTATUS'"); };
5642
    if ( $return_count == 0 ) {
5643
        $dbh->do("INSERT IGNORE INTO authorised_values ( category, authorised_value, lib) VALUES ( 'ORDRSTATUS', '0', 'New')");
5644
        $dbh->do("INSERT IGNORE INTO authorised_values ( category, authorised_value, lib) VALUES ( 'ORDRSTATUS', '1', 'Requested')");
5645
        $dbh->do("INSERT IGNORE INTO authorised_values ( category, authorised_value, lib) VALUES ( 'ORDRSTATUS', '2', 'Partial')");
5646
        $dbh->do("INSERT IGNORE INTO authorised_values ( category, authorised_value, lib) VALUES ( 'ORDRSTATUS', '3', 'Complete')");
5647
        $dbh->do("INSERT IGNORE INTO authorised_values ( category, authorised_value, lib) VALUES ( 'ORDRSTATUS', '4', 'Deleted')");
5648
        $dbh->do("ALTER TABLE aqorders ADD COLUMN orderstatus tinyint(2) DEFAULT 0");
5649
        $dbh->do("UPDATE aqorders SET orderstatus=1 WHERE basketno IN (SELECT basketno FROM aqbasket WHERE closedate IS NOT NULL)");
5650
        $dbh->do("UPDATE aqorders SET orderstatus=2 WHERE quantity > quantityreceived AND quantityreceived > 0");
5651
        $dbh->do("UPDATE aqorders SET orderstatus=3 WHERE quantity=quantityreceived");
5652
        $dbh->do("UPDATE aqorders SET orderstatus=4 WHERE datecancellationprinted IS NOT NULL");
5653
    }
5654
    print "Upgrade to $DBversion done (Add category ORDRSTATUS values in authorised_values table)\n";
5655
    SetVersion($DBversion);
5656
}
5657
5658
$DBversion = "3.09.00.XXX";
5659
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5660
    $dbh->do("ALTER TABLE aqorders ADD parent_ordernumber int(11) NULL");
5661
    $dbh->do("UPDATE aqorders SET parent_ordernumber=ordernumber");
5662
    print "Upgrade to $DBversion done (Add parent_ordernumber in aqorders)\n";
5663
    SetVersion($DBversion);
5664
}
5665
5638
=head1 FUNCTIONS
5666
=head1 FUNCTIONS
5639
5667
5640
=head2 TableExists($table)
5668
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt (-20 / +67 lines)
Lines 1-6 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( suggestions_loop ) %]Orders search &rsaquo; Search results[% ELSE %]Order search[% END %]</title>
3
<title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( order_loop ) %]Orders search &rsaquo; Search results[% ELSE %]Order search[% END %]</title>
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
5
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'calendar.inc' %]
6
[% INCLUDE 'calendar.inc' %]
Lines 21-27 Link Here
21
[% INCLUDE 'header.inc' %]
21
[% INCLUDE 'header.inc' %]
22
[% INCLUDE 'acquisitions-search.inc' %]
22
[% INCLUDE 'acquisitions-search.inc' %]
23
23
24
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; [% IF ( suggestions_loop ) %]<a href="/cgi-bin/koha/acqui/histsearch.pl">Orders search</a> &rsaquo; Search results[% ELSE %]Order search[% END %]</div>
24
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; [% IF ( order_loop ) %]<a href="/cgi-bin/koha/acqui/histsearch.pl">Orders search</a> &rsaquo; Search results[% ELSE %]Order search[% END %]</div>
25
25
26
<div id="doc3" class="yui-t2">
26
<div id="doc3" class="yui-t2">
27
   
27
   
Lines 29-35 Link Here
29
	<div id="yui-main">
29
	<div id="yui-main">
30
	<div class="yui-b">
30
	<div class="yui-b">
31
	
31
	
32
		[% UNLESS ( suggestions_loop ) %]<form action="/cgi-bin/koha/acqui/histsearch.pl" method="post">
32
		[% UNLESS ( order_loop ) %]<form action="/cgi-bin/koha/acqui/histsearch.pl" method="post">
33
<fieldset class="rows">
33
<fieldset class="rows">
34
	<legend>Search Orders</legend>
34
	<legend>Search Orders</legend>
35
		<ol>
35
		<ol>
Lines 42-47 Link Here
42
		<li><label for="name">Vendor: </label> <input type="text" name="name" id="name" value="[% name %]" /></li>
42
		<li><label for="name">Vendor: </label> <input type="text" name="name" id="name" value="[% name %]" /></li>
43
		<li><label for="basket">Basket: </label> <input type="text" name="basket" id="basket" value="[% basket %]" /></li>
43
		<li><label for="basket">Basket: </label> <input type="text" name="basket" id="basket" value="[% basket %]" /></li>
44
        <li><label for="booksellerinvoicenumber ">Bookseller invoice no: </label> <input type="text" name="booksellerinvoicenumber" id="booksellerinvoicenumber" value="[% booksellerinvoicenumber %]" /></li>
44
        <li><label for="booksellerinvoicenumber ">Bookseller invoice no: </label> <input type="text" name="booksellerinvoicenumber" id="booksellerinvoicenumber" value="[% booksellerinvoicenumber %]" /></li>
45
46
        <li>
47
            <label for="orderstatus">Order Status: </label>
48
            <select name="orderstatus" id="orderstatus">
49
                <option value=""></option>
50
                [% FOREACH order_loo IN orderstatusloop %]
51
                    <option value="[% order_loo.authorised_value %]">[% order_loo.lib %]</option>
52
                [% END %]
53
            </select>
54
        </li>
55
56
        [% IF ( display_branchcode ) %]
57
            <li>
58
                <label for="branchcode">Branch: </label>
59
                <select name="branchcode" id="branchcode">
60
                    <option value=""></option>
61
                    [% FOREACH branch IN branchloop %]
62
                        <option value="[% branch.value %]">
63
                            [% branch.value %] - [% branch.branchname %]
64
                        </option>
65
                    [% END %]
66
                </select>
67
            </li>
68
        [% END %]
69
70
        <li>
71
            <label for="budget">Budget: </label>
72
            <select name="budget" id="budget">
73
                <option value="">All budgets</option>
74
                [% FOREACH bp_loo IN bp_loop %]
75
                    <optgroup label="[% bp_loo.budget_period_description %]">
76
                    [% FOREACH h_loo IN bp_loo.hierarchy %]
77
                        <option type="text" name="budget" value="[% h_loo.budget_id %]" branchcode="[% h_loo.budget_branchcode %]">
78
                            [% h_loo.budget_display_name %]
79
                        </option>
80
                    [% END %]
81
                    </optgroup>
82
                [% END %]
83
            </select>
84
        </li>
85
45
		<li><label for="from">From: </label> 
86
		<li><label for="from">From: </label> 
46
        <input type="text" size="10" id="from" name="from" value="[% from_placed_on %]" class="datepickerfrom" />
87
        <input type="text" size="10" id="from" name="from" value="[% from_placed_on %]" class="datepickerfrom" />
47
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
88
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
Lines 55-65 Link Here
55
    <input type="hidden" name="do_search" value="1" />
96
    <input type="hidden" name="do_search" value="1" />
56
	<fieldset class="action"><input type="submit" value="Search" /></fieldset>
97
	<fieldset class="action"><input type="submit" value="Search" /></fieldset>
57
	</form>[% END %]
98
	</form>[% END %]
58
    [% IF ( suggestions_loop ) %]<h1>Search results</h1>
99
    [% IF ( order_loop ) %]<h1>Search results</h1>
59
	<div id="acqui_histsearch">
100
	<div id="acqui_histsearch">
60
        <table id="histsearcht">
101
        <table id="histsearcht">
61
            <thead>
102
            <thead>
62
			<tr>
103
			<tr>
104
                <th>Order line</th>
63
				<th>Basket</th>
105
				<th>Basket</th>
64
				<th>Basket group</th>
106
				<th>Basket group</th>
65
                <th>Invoice number</th>
107
                <th>Invoice number</th>
Lines 68-102 Link Here
68
				<th>Vendor</th>
110
				<th>Vendor</th>
69
				<th>Placed on</th>
111
				<th>Placed on</th>
70
				<th>Received on</th>
112
				<th>Received on</th>
71
				<th>Quantity ordered</th>
113
                <th>Status</th>
114
				<th>Quantity received</th>
115
                <th>Pending order</th>
72
				<th>Unit cost</th>
116
				<th>Unit cost</th>
73
			</tr>
117
			</tr>
74
            </thead>
118
            </thead>
75
            <tbody>
119
            <tbody>
76
			[% FOREACH suggestions_loo IN suggestions_loop %]
120
			[% FOREACH order IN order_loop %]
77
				<tr>
121
				<tr>
78
                    <td>[% suggestions_loo.basketname %] (<a href="basket.pl?basketno=[% suggestions_loo.basketno %]">[% suggestions_loo.basketno %]</a>)</td>
122
                    <td>[% order.parent_ordernumber %]</td>
123
                    <td>[% order.basketname %] (<a href="basket.pl?basketno=[% order.basketno %]">[% order.basketno %]</a>)</td>
79
                    <td>
124
                    <td>
80
                        [% IF ( suggestions_loo.basketgroupid ) %]
125
                        [% IF ( order.basketgroupid ) %]
81
                            [% suggestions_loo.groupname %] (<a href="basketgroup.pl?booksellerid=[% suggestions_loo.id %]">[% suggestions_loo.basketgroupid %]</a>)
126
                            [% order.groupname %] (<a href="basketgroup.pl?booksellerid=[% order.id %]">[% order.basketgroupid %]</a>)
82
                        [% ELSE %]
127
                        [% ELSE %]
83
                            &nbsp;
128
                            &nbsp;
84
                        [% END %]
129
                        [% END %]
85
                    </td>
130
                    </td>
86
					<td>[% IF ( suggestions_loo.invoicenumber ) %]
131
					<td>[% IF ( order.invoicenumber ) %]
87
					        <a href="/cgi-bin/koha/acqui/parcel.pl?invoice=[% suggestions_loo.invoicenumber %]&amp;booksellerid=[% suggestions_loo.id %]&amp;datereceived=[% suggestions_loo.datereceived %]">[% suggestions_loo.invoicenumber %]</a>
132
					        <a href="/cgi-bin/koha/acqui/parcel.pl?invoice=[% order.invoicenumber %]&amp;booksellerid=[% order.id %]&amp;datereceived=[% order.datereceived %]">[% order.invoicenumber %]</a>
88
					    [% ELSE %]
133
					    [% ELSE %]
89
					        &nbsp;
134
					        &nbsp;
90
					    [% END %]
135
					    [% END %]
91
					</td>
136
					</td>
92
                    <td>[% suggestions_loo.ordernumber %]</td>
137
                    <td>[% order.ordernumber %]</td>
93
					<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% suggestions_loo.biblionumber %]">[% suggestions_loo.title |html %]</a>
138
                    <td>
94
                        <br />[% suggestions_loo.author %] <br /> [% suggestions_loo.isbn %]</td>
139
                        <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber %]">[% order.title |html %]</a>
95
					<td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% suggestions_loo.id %]">[% suggestions_loo.name %]</a></td>
140
                        <br />[% order.author %] <br /> [% IF ( order.internalnotes ) %][% order.internalnotes %]<br />[% END %][% order.isbn %]</td>
96
					<td>[% suggestions_loo.creationdate | $KohaDates %]</td>
141
					<td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.id %]">[% order.name %]</a></td>
97
					<td>[% suggestions_loo.datereceived | $KohaDates %]</td>
142
					<td>[% order.creationdate | $KohaDates %]</td>
98
					<td>[% suggestions_loo.quantity %]</td>
143
					<td>[% order.datereceived | $KohaDates %]</td>
99
					<td>[% suggestions_loo.ecost %]</td>
144
                    <td>[% order.lib_orderstatus %]</td>
145
					<td>[% order.quantityreceived %]</td>
146
					<td>[% order.quantity %]</td>
147
					<td>[% order.ecost %]</td>
100
				</tr>
148
				</tr>
101
			[% END %]
149
			[% END %]
102
            </tbody>
150
            </tbody>
103
- 

Return to bug 5336