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

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

Return to bug 9780