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

(-)a/C4/Acquisition.pm (-18 / +103 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 75-80 BEGIN { Link Here
75
        &GetItemnumbersFromOrder
75
        &GetItemnumbersFromOrder
76
76
77
        &AddClaim
77
        &AddClaim
78
        &GetBiblioCountByBasketno
78
    );
79
    );
79
}
80
}
80
81
Lines 225-230 sub CloseBasket { Link Here
225
    ";
226
    ";
226
    my $sth = $dbh->prepare($query);
227
    my $sth = $dbh->prepare($query);
227
    $sth->execute($basketno);
228
    $sth->execute($basketno);
229
230
    my @orders = GetOrders($basketno);
231
    foreach my $order (@orders) {
232
        $query = qq{
233
            UPDATE aqorders
234
            SET orderstatus = 1
235
            WHERE ordernumber = ?;
236
        };
237
        $sth = $dbh->prepare($query);
238
        $sth->execute($order->{'ordernumber'});
239
    }
228
}
240
}
229
241
230
#------------------------------------------------------------#
242
#------------------------------------------------------------#
Lines 464-469 sub ModBasket { Link Here
464
    my $dbh = C4::Context->dbh;
476
    my $dbh = C4::Context->dbh;
465
    my $sth = $dbh->prepare($query);
477
    my $sth = $dbh->prepare($query);
466
    $sth->execute(@params);
478
    $sth->execute(@params);
479
480
    # set orders status = new
481
    my @orders = GetOrders($basketinfo->{'basketno'});
482
    foreach my $order (@orders) {
483
        $query = qq{
484
            UPDATE aqorders
485
            SET orderstatus = 0
486
            WHERE ordernumber = ?;
487
        };
488
        $sth = $dbh->prepare($query);
489
        $sth->execute($order->{'ordernumber'});
490
    }
491
467
    $sth->finish;
492
    $sth->finish;
468
}
493
}
469
494
Lines 1040-1046 The following keys are used: "biblionumber", "title", "basketno", "quantity", "n Link Here
1040
1065
1041
sub NewOrder {
1066
sub NewOrder {
1042
    my $orderinfo = shift;
1067
    my $orderinfo = shift;
1043
#### ------------------------------
1068
    my $parent_ordernumber = shift;
1069
1044
    my $dbh = C4::Context->dbh;
1070
    my $dbh = C4::Context->dbh;
1045
    my @params;
1071
    my @params;
1046
1072
Lines 1313-1318 sub ModReceiveOrder { Link Here
1313
        $sth=$dbh->prepare("
1339
        $sth=$dbh->prepare("
1314
            UPDATE aqorders
1340
            UPDATE aqorders
1315
            SET quantity = ?
1341
            SET quantity = ?
1342
                ordernumber = 2
1316
            WHERE ordernumber = ?
1343
            WHERE ordernumber = ?
1317
        ");
1344
        ");
1318
1345
Lines 1339-1345 sub ModReceiveOrder { Link Here
1339
    } else {
1366
    } else {
1340
        $sth=$dbh->prepare("update aqorders
1367
        $sth=$dbh->prepare("update aqorders
1341
                            set quantityreceived=?,datereceived=?,invoiceid=?,
1368
                            set quantityreceived=?,datereceived=?,invoiceid=?,
1342
                                unitprice=?,rrp=?,ecost=?
1369
                                unitprice=?,rrp=?,ecost=?,orderstatus=3
1343
                            where biblionumber=? and ordernumber=?");
1370
                            where biblionumber=? and ordernumber=?");
1344
        $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$ecost,$biblionumber,$ordernumber);
1371
        $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$ecost,$biblionumber,$ordernumber);
1345
        $sth->finish;
1372
        $sth->finish;
Lines 1556-1562 sub DelOrder { Link Here
1556
    my $dbh = C4::Context->dbh;
1583
    my $dbh = C4::Context->dbh;
1557
    my $query = "
1584
    my $query = "
1558
        UPDATE aqorders
1585
        UPDATE aqorders
1559
        SET    datecancellationprinted=now()
1586
        SET    datecancellationprinted=now(), orderstatus=4
1560
        WHERE  biblionumber=? AND ordernumber=?
1587
        WHERE  biblionumber=? AND ordernumber=?
1561
    ";
1588
    ";
1562
    my $sth = $dbh->prepare($query);
1589
    my $sth = $dbh->prepare($query);
Lines 1917-1922 sub GetHistory { Link Here
1917
    my $basket = $params{basket};
1944
    my $basket = $params{basket};
1918
    my $booksellerinvoicenumber = $params{booksellerinvoicenumber};
1945
    my $booksellerinvoicenumber = $params{booksellerinvoicenumber};
1919
    my $basketgroupname = $params{basketgroupname};
1946
    my $basketgroupname = $params{basketgroupname};
1947
    my $budget = $params{budget};
1948
    my $branchcode = $params{branchcode};
1949
    my $orderstatus = $params{orderstatus};
1950
1920
    my @order_loop;
1951
    my @order_loop;
1921
    my $total_qty         = 0;
1952
    my $total_qty         = 0;
1922
    my $total_qtyreceived = 0;
1953
    my $total_qtyreceived = 0;
Lines 1925-1934 sub GetHistory { Link Here
1925
    my $dbh   = C4::Context->dbh;
1956
    my $dbh   = C4::Context->dbh;
1926
    my $query ="
1957
    my $query ="
1927
        SELECT
1958
        SELECT
1928
            biblio.title,
1959
            COALESCE(biblio.title,     deletedbiblio.title)     AS title,
1929
            biblio.author,
1960
            COALESCE(biblio.author,    deletedbiblio.author)    AS author,
1930
	    biblioitems.isbn,
1961
            COALESCE(biblioitems.isbn, deletedbiblioitems.isbn) AS isbn,
1931
        biblioitems.ean,
1962
            COALESCE(biblioitems.ean,  deletedbiblioitems.ean)  AS ean,
1932
            aqorders.basketno,
1963
            aqorders.basketno,
1933
            aqbasket.basketname,
1964
            aqbasket.basketname,
1934
            aqbasket.basketgroupid,
1965
            aqbasket.basketgroupid,
Lines 1942-1960 sub GetHistory { Link Here
1942
            aqorders.ordernumber,
1973
            aqorders.ordernumber,
1943
            aqinvoices.invoicenumber,
1974
            aqinvoices.invoicenumber,
1944
            aqbooksellers.id as id,
1975
            aqbooksellers.id as id,
1945
            aqorders.biblionumber
1976
            aqorders.biblionumber,
1977
            aqorders.orderstatus,
1978
            aqorders.parent_ordernumber";
1979
    $query .= ", aqbudgets.budget_id AS budget" if defined $budget;
1980
    $query .= ", aqorders.branchcode " if ( not C4::Context->preference("IndependantBranches")  and defined $branchcode and $branchcode );
1981
    $query .= "
1946
        FROM aqorders
1982
        FROM aqorders
1947
        LEFT JOIN aqbasket ON aqorders.basketno=aqbasket.basketno
1983
        LEFT JOIN aqbasket ON aqorders.basketno=aqbasket.basketno
1948
        LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
1984
        LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
1949
        LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
1985
        LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
1950
	LEFT JOIN biblioitems ON biblioitems.biblionumber=aqorders.biblionumber
1986
        LEFT JOIN biblioitems ON biblioitems.biblionumber=aqorders.biblionumber
1951
        LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber
1987
        LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber
1952
    LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid";
1988
        LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid
1989
        LEFT JOIN deletedbiblio ON deletedbiblio.biblionumber=aqorders.biblionumber
1990
        LEFT JOIN deletedbiblioitems ON deletedbiblioitems.biblionumber=aqorders.biblionumber
1991
        ";
1992
1993
    $query .= " LEFT JOIN aqbudgets ON aqorders.budget_id=aqbudgets.budget_id"
1994
        if defined $budget;
1995
1996
    if ( C4::Context->preference("IndependantBranches") ) {
1997
        $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber";
1998
    } elsif ( defined $branchcode and $branchcode) {
1999
        $query .= " LEFT JOIN borrowers ON aqorders.branchcode=borrowers.branchcode"
2000
    }
1953
2001
1954
    $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber"
2002
    $query .= " WHERE 1 ";
1955
    if ( C4::Context->preference("IndependantBranches") );
1956
2003
1957
    $query .= " WHERE (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') ";
2004
    $query .= " AND (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') " if $orderstatus ne '4';
1958
2005
1959
    my @query_params  = ();
2006
    my @query_params  = ();
1960
2007
Lines 1973-1979 sub GetHistory { Link Here
1973
        $query .= " AND biblioitems.isbn LIKE ? ";
2020
        $query .= " AND biblioitems.isbn LIKE ? ";
1974
        push @query_params, "%$isbn%";
2021
        push @query_params, "%$isbn%";
1975
    }
2022
    }
1976
    if ( defined $ean and $ean ) {
2023
    if ( $ean ) {
1977
        $query .= " AND biblioitems.ean = ? ";
2024
        $query .= " AND biblioitems.ean = ? ";
1978
        push @query_params, "$ean";
2025
        push @query_params, "$ean";
1979
    }
2026
    }
Lines 1982-1987 sub GetHistory { Link Here
1982
        push @query_params, "%$name%";
2029
        push @query_params, "%$name%";
1983
    }
2030
    }
1984
2031
2032
    if ( $budget ) {
2033
        $query .= " AND aqbudgets.budget_id = ? ";
2034
        push @query_params, "$budget";
2035
    }
2036
1985
    if ( $from_placed_on ) {
2037
    if ( $from_placed_on ) {
1986
        $query .= " AND creationdate >= ? ";
2038
        $query .= " AND creationdate >= ? ";
1987
        push @query_params, $from_placed_on;
2039
        push @query_params, $from_placed_on;
Lines 1992-1997 sub GetHistory { Link Here
1992
        push @query_params, $to_placed_on;
2044
        push @query_params, $to_placed_on;
1993
    }
2045
    }
1994
2046
2047
    if ( defined $orderstatus and $orderstatus ne '') {
2048
        $query .= " AND aqorders.orderstatus = ? ";
2049
        push @query_params, "$orderstatus";
2050
    }
2051
1995
    if ($basket) {
2052
    if ($basket) {
1996
        if ($basket =~ m/^\d+$/) {
2053
        if ($basket =~ m/^\d+$/) {
1997
            $query .= " AND aqorders.basketno = ? ";
2054
            $query .= " AND aqorders.basketno = ? ";
Lines 2018-2023 sub GetHistory { Link Here
2018
            $query .= " AND (borrowers.branchcode = ? OR borrowers.branchcode ='' ) ";
2075
            $query .= " AND (borrowers.branchcode = ? OR borrowers.branchcode ='' ) ";
2019
            push @query_params, $userenv->{branch};
2076
            push @query_params, $userenv->{branch};
2020
        }
2077
        }
2078
    } elsif ( defined $branchcode and $branchcode ) {
2079
        $query .= " AND aqorders.branchcode = ? ";
2080
        push @query_params, $branchcode;
2021
    }
2081
    }
2022
    $query .= " ORDER BY id";
2082
    $query .= " ORDER BY id";
2023
    my $sth = $dbh->prepare($query);
2083
    my $sth = $dbh->prepare($query);
Lines 2027-2035 sub GetHistory { Link Here
2027
        $line->{count} = $cnt++;
2087
        $line->{count} = $cnt++;
2028
        $line->{toggle} = 1 if $cnt % 2;
2088
        $line->{toggle} = 1 if $cnt % 2;
2029
        push @order_loop, $line;
2089
        push @order_loop, $line;
2030
        $total_qty         += $line->{'quantity'};
2090
        $total_qty         += ( $line->{quantity} ) ? $line->{quantity} : 0;
2031
        $total_qtyreceived += $line->{'quantityreceived'};
2091
        $total_qtyreceived += ( $line->{quantityreceived} ) ? $line->{quantityreceived} : 0;
2032
        $total_price       += $line->{'quantity'} * $line->{'ecost'};
2092
        $total_price       += ( $line->{quantity} and $line->{ecost} ) ? $line->{quantity} * $line->{ecost} : 0;
2033
    }
2093
    }
2034
    return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
2094
    return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
2035
}
2095
}
Lines 2491-2496 sub ReopenInvoice { Link Here
2491
    $sth->execute($invoiceid);
2551
    $sth->execute($invoiceid);
2492
}
2552
}
2493
2553
2554
=head3 GetBiblioCountByBasketno
2555
2556
$biblio_count = &GetBiblioCountByBasketno($basketno);
2557
2558
Looks up the biblio's count that has basketno value $basketno
2559
2560
Returns a quantity
2561
2562
=cut
2563
2564
sub GetBiblioCountByBasketno {
2565
    my ($basketno) = @_;
2566
    my $dbh          = C4::Context->dbh;
2567
    my $query        = "
2568
        SELECT COUNT( DISTINCT( biblionumber ) )
2569
        FROM   aqorders
2570
        WHERE  basketno = ?
2571
            AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00')
2572
        ";
2573
2574
    my $sth = $dbh->prepare($query);
2575
    $sth->execute($basketno);
2576
    return $sth->fetchrow;
2577
}
2578
2494
1;
2579
1;
2495
__END__
2580
__END__
2496
2581
(-)a/acqui/histsearch.pl (-2 / +48 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 70-75 my $booksellerinvoicenumber = $input->param( 'booksellerinvoicenumber' ); Link Here
70
my $do_search               = $input->param('do_search') || 0;
72
my $do_search               = $input->param('do_search') || 0;
71
my $from_placed_on          = C4::Dates->new($input->param('from'));
73
my $from_placed_on          = C4::Dates->new($input->param('from'));
72
my $to_placed_on            = C4::Dates->new($input->param('to'));
74
my $to_placed_on            = C4::Dates->new($input->param('to'));
75
my $budget                  = $input->param( 'budget' );
76
my $branchcode              = $input->param( 'branchcode' );
77
my $orderstatus             = $input->param( 'orderstatus' );
78
73
if ( not $input->param('from') ) {
79
if ( not $input->param('from') ) {
74
    # FIXME Dirty but we can't sent a Date::Calc to C4::Dates ?
80
    # FIXME Dirty but we can't sent a Date::Calc to C4::Dates ?
75
    # We would use a function like Add_Delta_YM(-1, 0, 0);
81
    # We would use a function like Add_Delta_YM(-1, 0, 0);
Lines 110-130 if ($do_search) { Link Here
110
        basket => $basket,
116
        basket => $basket,
111
        booksellerinvoicenumber => $booksellerinvoicenumber,
117
        booksellerinvoicenumber => $booksellerinvoicenumber,
112
        basketgroupname => $basketgroupname,
118
        basketgroupname => $basketgroupname,
119
        budget => $budget,
120
        branchcode => $branchcode,
121
        orderstatus => $orderstatus,
113
    );
122
    );
114
}
123
}
115
124
116
my $from_date = $from_placed_on ? $from_placed_on->output('syspref') : undef;
125
my $from_date = $from_placed_on ? $from_placed_on->output('syspref') : undef;
117
my $to_date = $to_placed_on ? $to_placed_on->output('syspref') : undef;
126
my $to_date = $to_placed_on ? $to_placed_on->output('syspref') : undef;
118
127
128
my $budgetperiods = C4::Budgets::GetBudgetPeriods;
129
my $bp_loop = $budgetperiods;
130
for my $bp ( @{$budgetperiods} ) {
131
    my $hierarchy = C4::Budgets::GetBudgetHierarchy( $$bp{budget_period_id} );
132
    for my $budget ( @{$hierarchy} ) {
133
        $$budget{budget_display_name} = sprintf("%s", ">" x $$budget{depth} . $$budget{budget_name});
134
    }
135
    $$bp{hierarchy} = $hierarchy;
136
}
137
138
if ( not C4::Context->preference("IndependantBranches") ){
139
    my $branches = GetBranches();
140
    my @branchloop;
141
    foreach my $thisbranch ( keys %$branches ) {
142
        my %row = (
143
            value      => $thisbranch,
144
            branchname => $branches->{$thisbranch}->{'branchname'},
145
        );
146
        push @branchloop, \%row;
147
    }
148
    $template->param(
149
        branchcode           => $branchcode,
150
        display_branchcode   => !C4::Context->preference("IndependantBranches"),
151
        branchloop          => \@branchloop
152
    );
153
}
154
155
my $orderstatusloop = GetAuthorisedValues( "ORDRSTATUS" );
156
my %order_status = map {
157
    $_->{authorised_value} => $_->{lib}
158
} @$orderstatusloop;
159
160
$_->{lib_orderstatus} = $order_status{$_->{orderstatus}}
161
    for @$order_loop;
162
119
$template->param(
163
$template->param(
120
    suggestions_loop        => $order_loop,
164
    order_loop              => $order_loop,
121
    total_qty               => $total_qty,
165
    total_qty               => $total_qty,
122
    total_qtyreceived       => $total_qtyreceived,
166
    total_qtyreceived       => $total_qtyreceived,
123
    total_price             => sprintf( "%.2f", $total_price ),
167
    total_price             => sprintf( "%.2f", $total_price ),
124
    numresults              => $order_loop ? scalar(@$order_loop) : undef,
168
    numresults              => $order_loop ? scalar(@$order_loop) : undef,
125
    title                   => $title,
169
    title                   => $title,
126
    author                  => $author,
170
    author                  => $author,
127
    isbn		    => $isbn,
171
    isbn                    => $isbn,
128
    ean                     => $ean,
172
    ean                     => $ean,
129
    name                    => $name,
173
    name                    => $name,
130
    basket                  => $basket,
174
    basket                  => $basket,
Lines 132-137 $template->param( Link Here
132
    basketgroupname         => $basketgroupname,
176
    basketgroupname         => $basketgroupname,
133
    from_placed_on          => $from_date,
177
    from_placed_on          => $from_date,
134
    to_placed_on            => $to_date,
178
    to_placed_on            => $to_date,
179
    bp_loop                 => $bp_loop,
180
    orderstatusloop         => $orderstatusloop,
135
    DHTMLcalendar_dateformat=> C4::Dates->DHTMLcalendar(),
181
    DHTMLcalendar_dateformat=> C4::Dates->DHTMLcalendar(),
136
    dateformat              => C4::Dates->new()->format(),
182
    dateformat              => C4::Dates->new()->format(),
137
    debug                   => $debug || $input->param('debug') || 0,
183
    debug                   => $debug || $input->param('debug') || 0,
(-)a/installer/data/mysql/de-DE/optional/auth_val.sql (+7 lines)
Lines 57-59 INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_ Link Here
57
INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'PAT', 'Benutzer');
57
INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'PAT', 'Benutzer');
58
INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'ACQ', 'Erwerbung');
58
INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'ACQ', 'Erwerbung');
59
INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'ACC', 'Gebühren');
59
INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'ACC', 'Gebühren');
60
61
-- order status
62
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '0', 'New');
63
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '1', 'Ordered');
64
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '2', 'Partial');
65
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '3', 'Complete');
66
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '4', 'Deleted');
(-)a/installer/data/mysql/en/optional/auth_val.sql (+7 lines)
Lines 57-59 INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_ Link Here
57
INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'PAT', 'Patrons');
57
INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'PAT', 'Patrons');
58
INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'ACQ', 'Acquisitions');
58
INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'ACQ', 'Acquisitions');
59
INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'ACC', 'Accounts');
59
INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'ACC', 'Accounts');
60
61
-- order status
62
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '0', 'New');
63
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '1', 'Ordered');
64
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '2', 'Partial');
65
INSERT INTO `authorised_values` ( `category`, `authorised_value`, `lib`) VALUES ( 'ORDRSTATUS', '3', 'Complete');
66
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', 'Ordered');
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', 'Ordered');
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 (+1 lines)
Lines 2805-2810 CREATE TABLE `aqorders` ( -- information related to the basket line items Link Here
2805
  `claims_count` int(11) default 0, -- count of claim letters generated
2805
  `claims_count` int(11) default 0, -- count of claim letters generated
2806
  `claimed_date` date default NULL, -- last date a claim was generated
2806
  `claimed_date` date default NULL, -- last date a claim was generated
2807
  parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2807
  parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2808
  `orderstatus` tinyint(2) default 0, -- the current status for this line item
2808
  PRIMARY KEY  (`ordernumber`),
2809
  PRIMARY KEY  (`ordernumber`),
2809
  KEY `basketno` (`basketno`),
2810
  KEY `basketno` (`basketno`),
2810
  KEY `biblionumber` (`biblionumber`),
2811
  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', 'Ordered');
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', 'Ordered');
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 (+20 lines)
Lines 6181-6186 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6181
    SetVersion ($DBversion);
6181
    SetVersion ($DBversion);
6182
}
6182
}
6183
6183
6184
$DBversion = "3.11.00.XXX";
6185
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6186
    my $return_count;
6187
    eval { $return_count = $dbh->do("SELECT 1 FROM authorised_values WHERE category='ORDRSTATUS'"); };
6188
    if ( $return_count == 0 ) {
6189
        $dbh->do("INSERT IGNORE INTO authorised_values ( category, authorised_value, lib) VALUES ( 'ORDRSTATUS', '0', 'New')");
6190
        $dbh->do("INSERT IGNORE INTO authorised_values ( category, authorised_value, lib) VALUES ( 'ORDRSTATUS', '1', 'Ordered')");
6191
        $dbh->do("INSERT IGNORE INTO authorised_values ( category, authorised_value, lib) VALUES ( 'ORDRSTATUS', '2', 'Partial')");
6192
        $dbh->do("INSERT IGNORE INTO authorised_values ( category, authorised_value, lib) VALUES ( 'ORDRSTATUS', '3', 'Complete')");
6193
        $dbh->do("INSERT IGNORE INTO authorised_values ( category, authorised_value, lib) VALUES ( 'ORDRSTATUS', '4', 'Deleted')");
6194
        $dbh->do("ALTER TABLE aqorders ADD COLUMN orderstatus tinyint(2) DEFAULT 0 AFTER parent_ordernumber");
6195
        $dbh->do("UPDATE aqorders SET orderstatus=1 WHERE basketno IN (SELECT basketno FROM aqbasket WHERE closedate IS NOT NULL)");
6196
        $dbh->do("UPDATE aqorders SET orderstatus=2 WHERE quantity > quantityreceived AND quantityreceived > 0");
6197
        $dbh->do("UPDATE aqorders SET orderstatus=3 WHERE quantity=quantityreceived");
6198
        $dbh->do("UPDATE aqorders SET orderstatus=4 WHERE datecancellationprinted IS NOT NULL");
6199
    }
6200
    print "Upgrade to $DBversion done (Add category ORDRSTATUS values in authorised_values table)\n";
6201
    SetVersion($DBversion);
6202
}
6203
6184
=head1 FUNCTIONS
6204
=head1 FUNCTIONS
6185
6205
6186
=head2 TableExists($table)
6206
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt (-28 / +75 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 46-51 Link Here
46
            <label for="basketgroupname">Basket group:</label>
46
            <label for="basketgroupname">Basket group:</label>
47
            <input type="text" name="basketgroupname" id="basketgroupname" value="[% basketgroupname %]" />
47
            <input type="text" name="basketgroupname" id="basketgroupname" value="[% basketgroupname %]" />
48
        </li>
48
        </li>
49
50
        <li>
51
            <label for="orderstatus">Order Status: </label>
52
            <select name="orderstatus" id="orderstatus">
53
                <option value=""></option>
54
                [% FOREACH order_loo IN orderstatusloop %]
55
                    <option value="[% order_loo.authorised_value %]">[% order_loo.lib %]</option>
56
                [% END %]
57
            </select>
58
        </li>
59
60
        [% IF ( display_branchcode ) %]
61
            <li>
62
                <label for="branchcode">Branch: </label>
63
                <select name="branchcode" id="branchcode">
64
                    <option value=""></option>
65
                    [% FOREACH branch IN branchloop %]
66
                        <option value="[% branch.value %]">
67
                            [% branch.value %] - [% branch.branchname %]
68
                        </option>
69
                    [% END %]
70
                </select>
71
            </li>
72
        [% END %]
73
74
        <li>
75
            <label for="budget">Budget: </label>
76
            <select name="budget" id="budget">
77
                <option value="">All budgets</option>
78
                [% FOREACH bp_loo IN bp_loop %]
79
                    <optgroup label="[% bp_loo.budget_period_description %]">
80
                    [% FOREACH h_loo IN bp_loo.hierarchy %]
81
                        <option type="text" name="budget" value="[% h_loo.budget_id %]" branchcode="[% h_loo.budget_branchcode %]">
82
                            [% h_loo.budget_display_name %]
83
                        </option>
84
                    [% END %]
85
                    </optgroup>
86
                [% END %]
87
            </select>
88
        </li>
89
49
		<li><label for="from">From: </label> 
90
		<li><label for="from">From: </label> 
50
        <input type="text" size="10" id="from" name="from" value="[% from_placed_on %]" class="datepickerfrom" />
91
        <input type="text" size="10" id="from" name="from" value="[% from_placed_on %]" class="datepickerfrom" />
51
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
92
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
Lines 59-69 Link Here
59
    <input type="hidden" name="do_search" value="1" />
100
    <input type="hidden" name="do_search" value="1" />
60
	<fieldset class="action"><input type="submit" value="Search" /></fieldset>
101
	<fieldset class="action"><input type="submit" value="Search" /></fieldset>
61
	</form>[% END %]
102
	</form>[% END %]
62
    [% IF ( suggestions_loop ) %]<h1>Search results</h1>
103
    [% IF ( order_loop ) %]<h1>Search results</h1>
63
	<div id="acqui_histsearch">
104
	<div id="acqui_histsearch">
64
        <table id="histsearcht">
105
        <table id="histsearcht">
65
            <thead>
106
            <thead>
66
			<tr>
107
			<tr>
108
                <th>Order line</th>
67
				<th>Basket</th>
109
				<th>Basket</th>
68
				<th>Basket group</th>
110
				<th>Basket group</th>
69
                <th>Invoice number</th>
111
                <th>Invoice number</th>
Lines 72-112 Link Here
72
				<th>Vendor</th>
114
				<th>Vendor</th>
73
				<th>Placed on</th>
115
				<th>Placed on</th>
74
				<th>Received on</th>
116
				<th>Received on</th>
75
				<th>Quantity ordered</th>
117
                <th>Status</th>
118
				<th>Quantity received</th>
119
                <th>Pending order</th>
76
				<th>Unit cost</th>
120
				<th>Unit cost</th>
77
			</tr>
121
			</tr>
78
            </thead>
122
            </thead>
79
            <tbody>
123
            <tbody>
80
			[% FOREACH suggestions_loo IN suggestions_loop %]
124
            [% FOREACH order IN order_loop %]
81
				<tr>
125
                <tr>
82
                    <td>[% suggestions_loo.basketname %] (<a href="basket.pl?basketno=[% suggestions_loo.basketno %]">[% suggestions_loo.basketno %]</a>)</td>
126
                    <td>[% order.parent_ordernumber %]</td>
127
                    <td>[% order.basketname %] (<a href="basket.pl?basketno=[% order.basketno %]">[% order.basketno %]</a>)</td>
83
                    <td>
128
                    <td>
84
                        [% IF ( suggestions_loo.basketgroupid ) %]
129
                        [% IF ( order.basketgroupid ) %]
85
                            [% suggestions_loo.groupname %] (<a href="basketgroup.pl?booksellerid=[% suggestions_loo.id %]">[% suggestions_loo.basketgroupid %]</a>)
130
                            [% order.groupname %] (<a href="basketgroup.pl?booksellerid=[% order.id %]">[% order.basketgroupid %]</a>)
86
                        [% ELSE %]
131
                        [% ELSE %]
87
                            &nbsp;
132
                            &nbsp;
88
                        [% END %]
133
                        [% END %]
89
                    </td>
134
                    </td>
90
					<td>[% IF ( suggestions_loo.invoicenumber ) %]
135
                    <td>[% IF ( order.invoicenumber ) %]
91
					        <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>
136
                            <a href="/cgi-bin/koha/acqui/parcel.pl?invoice=[% order.invoicenumber %]&amp;booksellerid=[% order.id %]&amp;datereceived=[% order.datereceived %]">[% order.invoicenumber %]</a>
92
					    [% ELSE %]
137
                        [% ELSE %]
93
					        &nbsp;
138
                            &nbsp;
94
					    [% END %]
139
                        [% END %]
95
					</td>
140
                    </td>
96
                    <td>[% suggestions_loo.ordernumber %]</td>
141
                    <td>[% order.ordernumber %]</td>
97
					<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% suggestions_loo.biblionumber %]">[% suggestions_loo.title |html %]</a>
142
                    <td>
98
                        <br />[% suggestions_loo.author %] <br /> [% suggestions_loo.isbn %]</td>
143
                        <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber %]">[% order.title |html %]</a>
99
					<td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% suggestions_loo.id %]">[% suggestions_loo.name %]</a></td>
144
                        <br />[% order.author %] <br /> [% IF ( order.internalnotes ) %][% order.internalnotes %]<br />[% END %][% order.isbn %]</td>
100
					<td>[% suggestions_loo.creationdate | $KohaDates %]</td>
145
                    <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.id %]">[% order.name %]</a></td>
146
                    <td>[% order.creationdate | $KohaDates %]</td>
101
                    <td>
147
                    <td>
102
                        [% IF suggestions_loo.datereceived %]
148
                        [% IF order.datereceived %]
103
                            [% suggestions_loo.datereceived | $KohaDates %]
149
                            [% order.datereceived | $KohaDates %]
104
                        [% END %]
150
                        [% END %]
105
                    </td>
151
                    </td>
106
					<td>[% suggestions_loo.quantity %]</td>
152
                    <td>[% order.lib_orderstatus %]</td>
107
					<td>[% suggestions_loo.ecost %]</td>
153
                    <td>[% order.quantityreceived %]</td>
108
				</tr>
154
                    <td>[% order.quantity %]</td>
109
			[% END %]
155
                    <td>[% order.ecost %]</td>
156
                </tr>
157
            [% END %]
110
            </tbody>
158
            </tbody>
111
		</table>
159
		</table>
112
	</div>[% ELSE %][% END %]
160
	</div>[% ELSE %][% END %]
113
- 

Return to bug 5336