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

(-)a/C4/Acquisition.pm (+1 lines)
Lines 924-929 fields from the aqorders, biblio, and biblioitems tables in the Koha database. Link Here
924
924
925
sub GetOrdersByBiblionumber {
925
sub GetOrdersByBiblionumber {
926
    my $biblionumber = shift;
926
    my $biblionumber = shift;
927
    return unless $biblionumber;
927
    my $dbh   = C4::Context->dbh;
928
    my $dbh   = C4::Context->dbh;
928
    my $query  ="
929
    my $query  ="
929
        SELECT biblio.*,biblioitems.*,
930
        SELECT biblio.*,biblioitems.*,
(-)a/t/db_dependent/Acquisition.t (-2 / +18 lines)
Lines 10-16 use POSIX qw(strftime); Link Here
10
10
11
use C4::Bookseller qw( GetBookSellerFromId );
11
use C4::Bookseller qw( GetBookSellerFromId );
12
12
13
use Test::More tests => 37;
13
use Test::More tests => 42;
14
14
15
BEGIN {
15
BEGIN {
16
    use_ok('C4::Acquisition');
16
    use_ok('C4::Acquisition');
Lines 32-37 my $grouped = 0; Link Here
32
my $orders = GetPendingOrders( $supplierid, $grouped );
32
my $orders = GetPendingOrders( $supplierid, $grouped );
33
isa_ok( $orders, 'ARRAY' );
33
isa_ok( $orders, 'ARRAY' );
34
34
35
# testing GetOrdersByBiblionumber
36
# result should be undef if no params
37
my @ordersbybiblionumber = GetOrdersByBiblionumber();
38
is(@ordersbybiblionumber,0,'GetOrdersByBiblionumber : no argument, return undef');
39
# TODO : create 2 orders using the same biblionumber, and check the result of GetOrdersByBiblionumber
40
# if a record is used in at least one order, result should be an array with at least one element
41
SKIP: {
42
   skip 'No Orders, cannot test GetOrdersByBiblionumber', 3 unless( scalar @$orders );
43
   my $testorder = @$orders[0];
44
   my $testbiblio = $testorder->{'biblionumber'};
45
   my @listorders = GetOrdersByBiblionumber($testbiblio);
46
   isa_ok( ref @listorders, 'ARRAY','GetOrdersByBiblionumber : result is an array' );
47
   ok( scalar (@listorders) >0,'GetOrdersByBiblionumber : result contains at least one element' );
48
   my @matched_biblios = grep {$_->{biblionumber} == $testbiblio} @listorders;
49
   ok ( @matched_biblios == @listorders, "all orders match");
50
}
51
35
my @lateorders = GetLateOrders(0);
52
my @lateorders = GetLateOrders(0);
36
SKIP: {
53
SKIP: {
37
   skip 'No Late Orders, cannot test AddClaim', 1 unless @lateorders;
54
   skip 'No Late Orders, cannot test AddClaim', 1 unless @lateorders;
38
- 

Return to bug 9780