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

(-)a/C4/Acquisition.pm (-10 / +10 lines)
Lines 29-35 use C4::Debug; Link Here
29
use C4::Templates qw(gettemplate);
29
use C4::Templates qw(gettemplate);
30
use Koha::DateUtils qw( dt_from_string output_pref );
30
use Koha::DateUtils qw( dt_from_string output_pref );
31
use Koha::Acquisition::Order;
31
use Koha::Acquisition::Order;
32
use Koha::Acquisition::Bookseller;
32
use Koha::Acquisition::Booksellers;
33
use Koha::Number::Price;
33
use Koha::Number::Price;
34
use Koha::Libraries;
34
use Koha::Libraries;
35
35
Lines 351-363 sub GetBasketGroupAsCSV { Link Here
351
        my $contract   = GetContract({
351
        my $contract   = GetContract({
352
            contractnumber => $basket->{contractnumber}
352
            contractnumber => $basket->{contractnumber}
353
        });
353
        });
354
        my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $basket->{booksellerid} });
354
        my $bookseller = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} );
355
        my $basketgroup = GetBasketgroup( $$basket{basketgroupid} );
355
        my $basketgroup = GetBasketgroup( $$basket{basketgroupid} );
356
356
357
        foreach my $order (@orders) {
357
        foreach my $order (@orders) {
358
            my $bd = GetBiblioData( $order->{'biblionumber'} );
358
            my $bd = GetBiblioData( $order->{'biblionumber'} );
359
            my $row = {
359
            my $row = {
360
                clientnumber => $bookseller->{accountnumber},
360
                clientnumber => $bookseller->accountnumber,
361
                basketname => $basket->{basketname},
361
                basketname => $basket->{basketname},
362
                ordernumber => $order->{ordernumber},
362
                ordernumber => $order->{ordernumber},
363
                author => $bd->{author},
363
                author => $bd->{author},
Lines 369-382 sub GetBasketGroupAsCSV { Link Here
369
                quantity => $order->{quantity},
369
                quantity => $order->{quantity},
370
                rrp_tax_included => $order->{rrp_tax_included},
370
                rrp_tax_included => $order->{rrp_tax_included},
371
                rrp_tax_excluded => $order->{rrp_tax_excluded},
371
                rrp_tax_excluded => $order->{rrp_tax_excluded},
372
                discount => $bookseller->{discount},
372
                discount => $bookseller->discount,
373
                ecost_tax_included => $order->{ecost_tax_included},
373
                ecost_tax_included => $order->{ecost_tax_included},
374
                ecost_tax_excluded => $order->{ecost_tax_excluded},
374
                ecost_tax_excluded => $order->{ecost_tax_excluded},
375
                notes => $order->{order_vendornote},
375
                notes => $order->{order_vendornote},
376
                entrydate => $order->{entrydate},
376
                entrydate => $order->{entrydate},
377
                booksellername => $bookseller->{name},
377
                booksellername => $bookseller->name,
378
                bookselleraddress => $bookseller->{address1},
378
                bookselleraddress => $bookseller->address1,
379
                booksellerpostal => $bookseller->{postal},
379
                booksellerpostal => $bookseller->postal,
380
                contractnumber => $contract->{contractnumber},
380
                contractnumber => $contract->{contractnumber},
381
                contractname => $contract->{contractname},
381
                contractname => $contract->{contractname},
382
            };
382
            };
Lines 2864-2870 sub populate_order_with_prices { Link Here
2864
    my $booksellerid = $params->{booksellerid};
2864
    my $booksellerid = $params->{booksellerid};
2865
    return unless $booksellerid;
2865
    return unless $booksellerid;
2866
2866
2867
    my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
2867
    my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
2868
2868
2869
    my $receiving = $params->{receiving};
2869
    my $receiving = $params->{receiving};
2870
    my $ordering  = $params->{ordering};
2870
    my $ordering  = $params->{ordering};
Lines 2873-2879 sub populate_order_with_prices { Link Here
2873
2873
2874
    if ($ordering) {
2874
    if ($ordering) {
2875
        $order->{tax_rate_on_ordering} //= $order->{tax_rate};
2875
        $order->{tax_rate_on_ordering} //= $order->{tax_rate};
2876
        if ( $bookseller->{listincgst} ) {
2876
        if ( $bookseller->listincgst ) {
2877
            # The user entered the rrp tax included
2877
            # The user entered the rrp tax included
2878
            $order->{rrp_tax_included} = $order->{rrp};
2878
            $order->{rrp_tax_included} = $order->{rrp};
2879
2879
Lines 2910-2916 sub populate_order_with_prices { Link Here
2910
2910
2911
    if ($receiving) {
2911
    if ($receiving) {
2912
        $order->{tax_rate_on_receiving} //= $order->{tax_rate};
2912
        $order->{tax_rate_on_receiving} //= $order->{tax_rate};
2913
        if ( $bookseller->{invoiceincgst} ) {
2913
        if ( $bookseller->invoiceincgst ) {
2914
            # Trick for unitprice. If the unit price rounded value is the same as the ecost rounded value
2914
            # Trick for unitprice. If the unit price rounded value is the same as the ecost rounded value
2915
            # we need to keep the exact ecost value
2915
            # we need to keep the exact ecost value
2916
            if ( Koha::Number::Price->new( $order->{unitprice} )->round == Koha::Number::Price->new( $order->{ecost_tax_included} )->round ) {
2916
            if ( Koha::Number::Price->new( $order->{unitprice} )->round == Koha::Number::Price->new( $order->{ecost_tax_included} )->round ) {
(-)a/C4/Bookseller.pm (-136 lines)
Lines 27-35 use C4::Bookseller::Contact; Link Here
27
27
28
our @EXPORT_OK = qw(
28
our @EXPORT_OK = qw(
29
  GetBooksellersWithLateOrders
29
  GetBooksellersWithLateOrders
30
  ModBookseller
31
  DelBookseller
32
  AddBookseller
33
);
30
);
34
31
35
=head1 NAME
32
=head1 NAME
Lines 113-251 sub GetBooksellersWithLateOrders { Link Here
113
    return %supplierlist;
110
    return %supplierlist;
114
}
111
}
115
112
116
#--------------------------------------------------------------------#
117
118
=head2 AddBookseller
119
120
$id = &AddBookseller($bookseller);
121
122
Creates a new bookseller. C<$bookseller> is a reference-to-hash whose
123
keys are the fields of the aqbooksellers table in the Koha database.
124
All fields must be present.
125
126
Returns the ID of the newly-created bookseller.
127
128
=cut
129
130
sub AddBookseller {
131
    my ($data, $contacts) = @_;
132
    my $dbh    = C4::Context->dbh;
133
    my $query = q|
134
        INSERT INTO aqbooksellers
135
            (
136
                name,      address1,      address2,     address3, address4,
137
                postal,    phone,         accountnumber,fax,      url,
138
                active,    listprice,     invoiceprice, gstreg,
139
                listincgst,invoiceincgst, tax_rate,      discount, notes,
140
                deliverytime
141
            )
142
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
143
      ;
144
    my $sth = $dbh->prepare($query);
145
    $sth->execute(
146
        $data->{'name'},         $data->{'address1'},
147
        $data->{'address2'},     $data->{'address3'},
148
        $data->{'address4'},     $data->{'postal'},
149
        $data->{'phone'},        $data->{'accountnumber'},
150
        $data->{'fax'},          $data->{'url'},
151
        $data->{'active'},       $data->{'listprice'},
152
        $data->{'invoiceprice'}, $data->{'gstreg'},
153
        $data->{'listincgst'},   $data->{'invoiceincgst'},
154
        $data->{'tax_rate'},      $data->{'discount'},
155
        $data->{notes},          $data->{deliverytime},
156
    );
157
158
    # return the id of this new supplier
159
    my $id = $dbh->{'mysql_insertid'};
160
    if ($id && $contacts) {
161
        foreach my $contact (@$contacts) {
162
            $contact = C4::Bookseller::Contact->new( $contact )
163
                unless ref $contacts eq 'C4::Bookseller::Contact';
164
            $contact->bookseller($id);
165
            $contact->save();
166
        }
167
    }
168
    return $id;
169
}
170
171
#-----------------------------------------------------------------#
172
173
=head2 ModBookseller
174
175
ModBookseller($bookseller);
176
177
Updates the information for a given bookseller. C<$bookseller> is a
178
reference-to-hash whose keys are the fields of the aqbooksellers table
179
in the Koha database. It must contain entries for all of the fields.
180
The entry to modify is determined by C<$bookseller-E<gt>{id}>.
181
182
The easiest way to get all of the necessary fields is to look up a
183
book seller with C<Koha::Acquisition::Bookseller>, modify what's necessary, then call
184
C<&ModBookseller> with the result.
185
186
=cut
187
188
sub ModBookseller {
189
    my ($data, $contacts) = @_;
190
    my $dbh    = C4::Context->dbh;
191
    return unless $data->{'id'};
192
    my $query  = 'UPDATE aqbooksellers
193
        SET name=?,address1=?,address2=?,address3=?,address4=?,
194
            postal=?,phone=?,accountnumber=?,fax=?,url=?,
195
            active=?,listprice=?, invoiceprice=?,
196
            gstreg=?,listincgst=?,invoiceincgst=?,
197
            discount=?,notes=?,tax_rate=?,deliverytime=?
198
        WHERE id=?';
199
    my $sth = $dbh->prepare($query);
200
    my $cnt = $sth->execute(
201
        $data->{'name'},         $data->{'address1'},
202
        $data->{'address2'},     $data->{'address3'},
203
        $data->{'address4'},     $data->{'postal'},
204
        $data->{'phone'},        $data->{'accountnumber'},
205
        $data->{'fax'},          $data->{'url'},
206
        $data->{'active'},       $data->{'listprice'},
207
        $data->{'invoiceprice'}, $data->{'gstreg'},
208
        $data->{'listincgst'},   $data->{'invoiceincgst'},
209
        $data->{'discount'},     $data->{'notes'},
210
        $data->{'tax_rate'},      $data->{deliverytime},
211
        $data->{'id'}
212
    );
213
    $contacts ||= $data->{'contacts'};
214
    my $contactquery = "DELETE FROM aqcontacts WHERE booksellerid = ?";
215
    my @contactparams = ($data->{'id'});
216
    if ($contacts) {
217
        foreach my $contact (@$contacts) {
218
            $contact = C4::Bookseller::Contact->new( $contact )
219
                unless ref $contacts eq 'C4::Bookseller::Contact';
220
            $contact->bookseller($data->{'id'});
221
            $contact->save();
222
            push @contactparams, $contact->id if $contact->id;
223
        }
224
        if ($#contactparams > 0) {
225
            $contactquery .= ' AND id NOT IN (' . ('?, ' x ($#contactparams - 1)) . '?);';
226
        }
227
    }
228
    $sth = $dbh->prepare($contactquery);
229
    $sth->execute(@contactparams);
230
    return $cnt;
231
}
232
233
=head2 DelBookseller
234
235
DelBookseller($booksellerid);
236
237
delete the supplier record identified by $booksellerid
238
This sub assumes it is called only if the supplier has no order.
239
240
=cut
241
242
sub DelBookseller {
243
    my $id  = shift;
244
    my $dbh = C4::Context->dbh;
245
    my $sth = $dbh->prepare('DELETE FROM aqbooksellers WHERE id=?');
246
    return $sth->execute($id);
247
}
248
249
1;
113
1;
250
114
251
__END__
115
__END__
(-)a/Koha/Acquisition/Bookseller.pm (-95 / +23 lines)
Lines 3-122 package Koha::Acquisition::Bookseller; Link Here
3
use Modern::Perl;
3
use Modern::Perl;
4
4
5
use Koha::Database;
5
use Koha::Database;
6
use Koha::DateUtils qw( dt_from_string output_pref );
6
use base qw( Koha::Object );
7
8
use Carp qw( croak );
9
10
use base qw( Class::Accessor );
11
12
use C4::Bookseller::Contact;
13
14
sub fetch {
15
    my ( $class, $params ) = @_;
16
    my $id = $params->{id};
17
    return unless $id;
18
    my $schema = Koha::Database->new->schema;
19
20
    my $bookseller =
21
      $schema->resultset('Aqbookseller')->find( { id => $id },
22
        { result_class => 'DBIx::Class::ResultClass::HashRefInflator' } );
23
24
    return unless $bookseller;
25
26
    my $self = $class->new( $bookseller );
27
    $self->contacts; # TODO: This should be generated on demand.
28
    return $self;
29
}
30
31
sub search {
32
    my ( $class, $params ) = @_;
33
34
    my $schema = Koha::Database->new->schema;
35
36
    my $search_params;
37
    while ( my ( $field, $value ) = each %$params ) {
38
        if ( $field eq 'name' ) {
39
            # Use "like" if search on name
40
            $search_params->{name} = { -like => "%$value%" };
41
        } else {
42
            $search_params->{$field} = $value;
43
        }
44
    }
45
    my $rs = $schema->resultset('Aqbookseller')->search(
46
        $search_params,
47
        { order_by => 'name' }
48
    );
49
50
    my @booksellers;
51
    while ( my $b = $rs->next ) {
52
        my $t = Koha::Acquisition::Bookseller->fetch({ id => $b->id });
53
        push @booksellers, $t;
54
    }
55
    return @booksellers;
56
}
57
7
58
sub basket_count {
8
use Koha::DateUtils qw( dt_from_string output_pref );
59
    my ( $self ) = @_;
60
    my $schema = Koha::Database->new->schema;
61
9
62
    return $schema->resultset('Aqbasket')->count( { booksellerid => $self->{id} });
10
use Koha::Acquisition::Bookseller::Contacts;
63
}
64
11
65
sub subscription_count {
12
sub baskets {
66
    my ( $self ) = @_;
13
    my ( $self ) = @_;
67
14
    return $self->{_result}->aqbaskets;
68
    my $schema = Koha::Database->new->schema;
69
70
    return $schema->resultset('Subscription')->count( { aqbooksellerid => $self->{id} });
71
}
15
}
72
16
73
sub contacts {
17
sub contacts {
74
    my ( $self ) = @_;
18
    my ($self) = @_;
75
19
    $self->{contacts} = Koha::Acquisition::Bookseller::Contacts->search(
76
    return $self->{contacts} if $self->{contacts};
20
        { booksellerid => $self->id } );
77
    $self->{contacts} = C4::Bookseller::Contact->get_from_bookseller($self->{id});
78
    return $self->{contacts};
21
    return $self->{contacts};
79
}
22
}
80
23
81
sub insert {
24
sub store {
82
    my ($self) = @_;
25
    my ($self) = @_;
83
26
84
    # if these parameters are missing, we can't continue
27
    if ( $self->{contacts} ) {
85
    for my $key (qw( id )) {
28
        $self->{contacts}->reset;
86
        croak "Cannot insert bookseller: Mandatory parameter $key is missing"
29
        while ( my $contact = $self->{contacts}->next ) {
87
          unless $self->{$key};
30
            $contact->store;
88
    }
89
90
    $self->{quantityreceived} ||= 0;
91
    $self->{entrydate} ||=
92
      output_pref( { dt => dt_from_string, dateformat => 'iso' } );
93
94
    my $schema  = Koha::Database->new->schema;
95
    my @columns = $schema->source('Aqorder')->columns;
96
    my $rs = $schema->resultset('Aqorder')->create(
97
        {
98
            map {
99
                exists $self->{$_} ? ( $_ => $self->{$_} ) : ()
100
            } @columns
101
        }
31
        }
102
    );
103
    $self->{ordernumber} = $rs->id;
104
105
    unless ( $self->{parent_ordernumber} ) {
106
        $rs->update( { parent_ordernumber => $self->{ordernumber} } );
107
    }
32
    }
108
33
109
    return $self;
34
    return $self->SUPER::store;
110
}
35
}
111
36
112
# TODO Move code from ModBookseller
37
sub subscriptions {
113
sub update {
38
    my ($self) = @_;
114
    die "not implemented yet";
39
40
    my $schema = Koha::Database->new->schema;
41
42
    return $schema->resultset('Subscription')
43
      ->search( { aqbooksellerid => $self->id } );
115
}
44
}
116
45
117
# TODO Move code from DelBookseller
46
sub _type {
118
sub delete {
47
    return 'Aqbookseller';
119
    die "not implemented yet";
120
}
48
}
121
49
122
1;
50
1;
(-)a/Koha/Object.pm (-1 lines)
Lines 221-227 sub _columns { Link Here
221
    return $self->{_columns};
221
    return $self->{_columns};
222
}
222
}
223
223
224
225
=head3 AUTOLOAD
224
=head3 AUTOLOAD
226
225
227
The autoload method is used only to get and set values for an objects properties.
226
The autoload method is used only to get and set values for an objects properties.
(-)a/acqui/addorderiso2709.pl (-6 / +6 lines)
Lines 44-50 use C4::Members; Link Here
44
use Koha::Number::Price;
44
use Koha::Number::Price;
45
use Koha::Acquisition::Currencies;
45
use Koha::Acquisition::Currencies;
46
use Koha::Acquisition::Order;
46
use Koha::Acquisition::Order;
47
use Koha::Acquisition::Bookseller;
47
use Koha::Acquisition::Booksellers;
48
48
49
my $input = new CGI;
49
my $input = new CGI;
50
my ($template, $loggedinuser, $cookie, $userflags) = get_template_and_user({
50
my ($template, $loggedinuser, $cookie, $userflags) = get_template_and_user({
Lines 60-70 my $cgiparams = $input->Vars; Link Here
60
my $op = $cgiparams->{'op'} || '';
60
my $op = $cgiparams->{'op'} || '';
61
my $booksellerid  = $input->param('booksellerid');
61
my $booksellerid  = $input->param('booksellerid');
62
my $allmatch = $input->param('allmatch');
62
my $allmatch = $input->param('allmatch');
63
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
63
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
64
64
65
$template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl",
65
$template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl",
66
                booksellerid => $booksellerid,
66
                booksellerid => $booksellerid,
67
                booksellername => $bookseller->{name},
67
                booksellername => $bookseller->name,
68
                );
68
                );
69
69
70
if ($cgiparams->{'import_batch_id'} && $op eq ""){
70
if ($cgiparams->{'import_batch_id'} && $op eq ""){
Lines 218-226 if ($op eq ""){ Link Here
218
            # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
218
            # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
219
            $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
219
            $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
220
            $price = Koha::Number::Price->new($price)->unformat;
220
            $price = Koha::Number::Price->new($price)->unformat;
221
            $orderinfo{tax_rate} = $bookseller->{tax_rate};
221
            $orderinfo{tax_rate} = $bookseller->tax_rate;
222
            my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
222
            my $c = $c_discount ? $c_discount : $bookseller->discount / 100;
223
            if ( $bookseller->{listincgst} ) {
223
            if ( $bookseller->listincgst ) {
224
                if ( $c_discount ) {
224
                if ( $c_discount ) {
225
                    $orderinfo{ecost} = $price;
225
                    $orderinfo{ecost} = $price;
226
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
226
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
(-)a/acqui/basket.pl (-8 / +9 lines)
Lines 33-38 use C4::Biblio; Link Here
33
use C4::Members qw/GetMember/;  #needed for permissions checking for changing basketgroup of a basket
33
use C4::Members qw/GetMember/;  #needed for permissions checking for changing basketgroup of a basket
34
use C4::Items;
34
use C4::Items;
35
use C4::Suggestions;
35
use C4::Suggestions;
36
use Koha::Acquisition::Booksellers;
36
use Koha::Libraries;
37
use Koha::Libraries;
37
use C4::Letters qw/SendAlerts/;
38
use C4::Letters qw/SendAlerts/;
38
use Date::Calc qw/Add_Delta_Days/;
39
use Date::Calc qw/Add_Delta_Days/;
Lines 86-92 my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user( Link Here
86
87
87
my $basket = GetBasket($basketno);
88
my $basket = GetBasket($basketno);
88
$booksellerid = $basket->{booksellerid} unless $booksellerid;
89
$booksellerid = $basket->{booksellerid} unless $booksellerid;
89
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
90
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
90
my $schema = Koha::Database->new()->schema();
91
my $schema = Koha::Database->new()->schema();
91
my $rs = $schema->resultset('VendorEdiAccount')->search(
92
my $rs = $schema->resultset('VendorEdiAccount')->search(
92
    { vendor_id => $booksellerid, } );
93
    { vendor_id => $booksellerid, } );
Lines 98-104 unless (CanUserManageBasket($loggedinuser, $basket, $userflags)) { Link Here
98
        basketno => $basketno,
99
        basketno => $basketno,
99
        basketname => $basket->{basketname},
100
        basketname => $basket->{basketname},
100
        booksellerid => $booksellerid,
101
        booksellerid => $booksellerid,
101
        name => $bookseller->{name}
102
        name => $bookseller->name,
102
    );
103
    );
103
    output_html_with_http_headers $query, $cookie, $template->output;
104
    output_html_with_http_headers $query, $cookie, $template->output;
104
    exit;
105
    exit;
Lines 293-299 if ( $op eq 'list' ) { Link Here
293
    my $estimateddeliverydate;
294
    my $estimateddeliverydate;
294
    if( $basket->{closedate} ) {
295
    if( $basket->{closedate} ) {
295
        my ($year, $month, $day) = ($basket->{closedate} =~ /(\d+)-(\d+)-(\d+)/);
296
        my ($year, $month, $day) = ($basket->{closedate} =~ /(\d+)-(\d+)-(\d+)/);
296
        ($year, $month, $day) = Add_Delta_Days($year, $month, $day, $bookseller->{deliverytime});
297
        ($year, $month, $day) = Add_Delta_Days($year, $month, $day, $bookseller->deliverytime);
297
        $estimateddeliverydate = sprintf( "%04d-%02d-%02d", $year, $month, $day );
298
        $estimateddeliverydate = sprintf( "%04d-%02d-%02d", $year, $month, $day );
298
    }
299
    }
299
300
Lines 395-403 if ( $op eq 'list' ) { Link Here
395
        is_standing          => $basket->{is_standing},
396
        is_standing          => $basket->{is_standing},
396
        deliveryplace        => $basket->{deliveryplace},
397
        deliveryplace        => $basket->{deliveryplace},
397
        billingplace         => $basket->{billingplace},
398
        billingplace         => $basket->{billingplace},
398
        active               => $bookseller->{'active'},
399
        active               => $bookseller->active,
399
        booksellerid         => $bookseller->{'id'},
400
        booksellerid         => $bookseller->id,
400
        name                 => $bookseller->{'name'},
401
        name                 => $bookseller->name,
401
        books_loop           => \@books_loop,
402
        books_loop           => \@books_loop,
402
        book_foot_loop       => \@book_foot_loop,
403
        book_foot_loop       => \@book_foot_loop,
403
        cancelledorders_loop => \@cancelledorders_loop,
404
        cancelledorders_loop => \@cancelledorders_loop,
Lines 406-412 if ( $op eq 'list' ) { Link Here
406
        total_tax_included   => $total_tax_included,
407
        total_tax_included   => $total_tax_included,
407
        total_tax_value      => $total_tax_value,
408
        total_tax_value      => $total_tax_value,
408
        currency             => $active_currency->currency,
409
        currency             => $active_currency->currency,
409
        listincgst           => $bookseller->{listincgst},
410
        listincgst           => $bookseller->listincgst,
410
        basketgroups         => $basketgroups,
411
        basketgroups         => $basketgroups,
411
        basketgroup          => $basketgroup,
412
        basketgroup          => $basketgroup,
412
        grouped              => $basket->{basketgroupid},
413
        grouped              => $basket->{basketgroupid},
Lines 491-497 sub get_order_infos { Link Here
491
    foreach my $key (qw(transferred_from transferred_to)) {
492
    foreach my $key (qw(transferred_from transferred_to)) {
492
        if ($line{$key}) {
493
        if ($line{$key}) {
493
            my $order = GetOrder($line{$key});
494
            my $order = GetOrder($line{$key});
494
            my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $basket->{booksellerid} });
495
            my $bookseller = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} );
495
            $line{$key} = {
496
            $line{$key} = {
496
                order => $order,
497
                order => $order,
497
                basket => $basket,
498
                basket => $basket,
(-)a/acqui/basketgroup.pl (-8 / +8 lines)
Lines 55-61 use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsBy Link Here
55
use C4::Members qw/GetMember/;
55
use C4::Members qw/GetMember/;
56
use Koha::EDI qw/create_edi_order get_edifact_ean/;
56
use Koha::EDI qw/create_edi_order get_edifact_ean/;
57
57
58
use Koha::Acquisition::Bookseller;
58
use Koha::Acquisition::Booksellers;
59
59
60
our $input=new CGI;
60
our $input=new CGI;
61
61
Lines 75-87 sub BasketTotal { Link Here
75
    my @orders = GetOrders($basketno);
75
    my @orders = GetOrders($basketno);
76
    for my $order (@orders){
76
    for my $order (@orders){
77
        # FIXME The following is wrong
77
        # FIXME The following is wrong
78
        if ( $bookseller->{listincgst} ) {
78
        if ( $bookseller->listincgst ) {
79
            $total = $total + ( $order->{ecost_tax_included} * $order->{quantity} );
79
            $total = $total + ( $order->{ecost_tax_included} * $order->{quantity} );
80
        } else {
80
        } else {
81
            $total = $total + ( $order->{ecost_tax_excluded} * $order->{quantity} );
81
            $total = $total + ( $order->{ecost_tax_excluded} * $order->{quantity} );
82
        }
82
        }
83
    }
83
    }
84
    $total .= " " . ($bookseller->{invoiceprice} // 0);
84
    $total .= " " . ($bookseller->invoiceprice // 0);
85
    return $total;
85
    return $total;
86
}
86
}
87
87
Lines 118-124 sub displaybasketgroups { Link Here
118
        }
118
        }
119
    }
119
    }
120
    $template->param(baskets => $baskets);
120
    $template->param(baskets => $baskets);
121
    $template->param( booksellername => $bookseller ->{'name'});
121
    $template->param( booksellername => $bookseller->name);
122
}
122
}
123
123
124
sub printbasketgrouppdf{
124
sub printbasketgrouppdf{
Lines 143-149 sub printbasketgrouppdf{ Link Here
143
    }
143
    }
144
    
144
    
145
    my $basketgroup = GetBasketgroup($basketgroupid);
145
    my $basketgroup = GetBasketgroup($basketgroupid);
146
    my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $basketgroup->{booksellerid} });
146
    my $bookseller = Koha::Acquisition::Booksellers->find( $basketgroup->{booksellerid} );
147
    my $baskets = GetBasketsByBasketgroup($basketgroupid);
147
    my $baskets = GetBasketsByBasketgroup($basketgroupid);
148
    
148
    
149
    my %orders;
149
    my %orders;
Lines 206-212 sub printbasketgrouppdf{ Link Here
206
        -type       => 'application/pdf',
206
        -type       => 'application/pdf',
207
        -attachment => ( $basketgroup->{name} || $basketgroupid ) . '.pdf'
207
        -attachment => ( $basketgroup->{name} || $basketgroupid ) . '.pdf'
208
    );
208
    );
209
    my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->{tax_rate} // C4::Context->preference("gist")) || die "pdf generation failed";
209
    my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->tax_rate // C4::Context->preference("gist")) || die "pdf generation failed";
210
    print $pdf;
210
    print $pdf;
211
211
212
}
212
}
Lines 243-249 if ( $op eq "add" ) { Link Here
243
# else, edit (if it is open) or display (if it is close) the basketgroup basketgroupid
243
# else, edit (if it is open) or display (if it is close) the basketgroup basketgroupid
244
# the template will know if basketgroup must be displayed or edited, depending on the value of closed key
244
# the template will know if basketgroup must be displayed or edited, depending on the value of closed key
245
#
245
#
246
    my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
246
    my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
247
    my $basketgroupid = $input->param('basketgroupid');
247
    my $basketgroupid = $input->param('basketgroupid');
248
    my $billingplace;
248
    my $billingplace;
249
    my $deliveryplace;
249
    my $deliveryplace;
Lines 392-398 if ( $op eq "add" ) { Link Here
392
}else{
392
}else{
393
# no param : display the list of all basketgroups for a given vendor
393
# no param : display the list of all basketgroups for a given vendor
394
    my $basketgroups = &GetBasketgroups($booksellerid);
394
    my $basketgroups = &GetBasketgroups($booksellerid);
395
    my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
395
    my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
396
    my $baskets = &GetBasketsByBookseller($booksellerid);
396
    my $baskets = &GetBasketsByBookseller($booksellerid);
397
397
398
    displaybasketgroups($basketgroups, $bookseller, $baskets);
398
    displaybasketgroups($basketgroups, $bookseller, $baskets);
(-)a/acqui/basketheader.pl (-4 / +4 lines)
Lines 54-60 use C4::Output; Link Here
54
use C4::Acquisition qw/GetBasket NewBasket ModBasketHeader/;
54
use C4::Acquisition qw/GetBasket NewBasket ModBasketHeader/;
55
use C4::Contract qw/GetContracts/;
55
use C4::Contract qw/GetContracts/;
56
56
57
use Koha::Acquisition::Bookseller;
57
use Koha::Acquisition::Booksellers;
58
58
59
my $input = new CGI;
59
my $input = new CGI;
60
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
60
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 104-121 if ( $op eq 'add_form' ) { Link Here
104
        });
104
        });
105
        push(@contractloop, @$contracts);
105
        push(@contractloop, @$contracts);
106
    }
106
    }
107
    my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
107
    my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
108
    my $count = scalar @contractloop;
108
    my $count = scalar @contractloop;
109
    if ( $count > 0) {
109
    if ( $count > 0) {
110
        $template->param(contractloop => \@contractloop,
110
        $template->param(contractloop => \@contractloop,
111
                         basketcontractnumber => $basket->{'contractnumber'});
111
                         basketcontractnumber => $basket->{'contractnumber'});
112
    }
112
    }
113
    my @booksellers = Koha::Acquisition::Bookseller->search;
113
    my @booksellers = Koha::Acquisition::Booksellers->search;
114
    $template->param( add_form => 1,
114
    $template->param( add_form => 1,
115
                    basketname => $basket->{'basketname'},
115
                    basketname => $basket->{'basketname'},
116
                    basketnote => $basket->{'note'},
116
                    basketnote => $basket->{'note'},
117
                    basketbooksellernote => $basket->{'booksellernote'},
117
                    basketbooksellernote => $basket->{'booksellernote'},
118
                    booksellername => $bookseller->{'name'},
118
                    booksellername => $bookseller->name,
119
                    booksellerid => $booksellerid,
119
                    booksellerid => $booksellerid,
120
                    basketno => $basketno,
120
                    basketno => $basketno,
121
                    booksellers => \@booksellers,
121
                    booksellers => \@booksellers,
(-)a/acqui/booksellers.pl (-11 / +11 lines)
Lines 63-69 use C4::Acquisition qw/ GetBasketsInfosByBookseller CanUserManageBasket /; Link Here
63
use C4::Members qw/GetMember/;
63
use C4::Members qw/GetMember/;
64
use C4::Context;
64
use C4::Context;
65
65
66
use Koha::Acquisition::Bookseller;
66
use Koha::Acquisition::Booksellers;
67
67
68
my $query = CGI->new;
68
my $query = CGI->new;
69
my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user(
69
my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user(
Lines 83-100 my $allbaskets= $query->param('allbaskets')||0; Link Here
83
my @suppliers;
83
my @suppliers;
84
84
85
if ($booksellerid) {
85
if ($booksellerid) {
86
    push @suppliers, Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
86
    push @suppliers, Koha::Acquisition::Booksellers->find( $booksellerid );
87
} else {
87
} else {
88
    @suppliers = Koha::Acquisition::Bookseller->search({ name => $supplier });
88
    @suppliers = Koha::Acquisition::Booksellers->search({ name => $supplier });
89
}
89
}
90
90
91
my $supplier_count = @suppliers;
91
my $supplier_count = @suppliers;
92
if ( $supplier_count == 1 ) {
92
if ( $supplier_count == 1 ) {
93
    $template->param(
93
    $template->param(
94
        supplier_name => $suppliers[0]->{'name'},
94
        supplier_name => $suppliers[0]->name,
95
        booksellerid  => $suppliers[0]->{'id'},
95
        booksellerid  => $suppliers[0]->id,
96
        basketcount   => $suppliers[0]->{'basketcount'},
96
        basketcount   => $suppliers[0]->baskets->count,
97
        active        => $suppliers[0]->{active},
97
        active        => $suppliers[0]->active,
98
    );
98
    );
99
}
99
}
100
100
Lines 124-130 foreach my $r (@{$budgets}) { Link Here
124
my $loop_suppliers = [];
124
my $loop_suppliers = [];
125
125
126
for my $vendor (@suppliers) {
126
for my $vendor (@suppliers) {
127
    my $baskets = GetBasketsInfosByBookseller( $vendor->{id}, $allbaskets );
127
    my $baskets = GetBasketsInfosByBookseller( $vendor->id, $allbaskets );
128
128
129
    my $loop_basket = [];
129
    my $loop_basket = [];
130
130
Lines 150-158 for my $vendor (@suppliers) { Link Here
150
150
151
    push @{$loop_suppliers},
151
    push @{$loop_suppliers},
152
      { loop_basket => $loop_basket,
152
      { loop_basket => $loop_basket,
153
        booksellerid  => $vendor->{id},
153
        booksellerid  => $vendor->id,
154
        name        => $vendor->{name},
154
        name        => $vendor->name,
155
        active      => $vendor->{active},
155
        active      => $vendor->active,
156
      };
156
      };
157
157
158
}
158
}
(-)a/acqui/finishreceive.pl (-4 / +1 lines)
Lines 28-38 use C4::Output; Link Here
28
use C4::Context;
28
use C4::Context;
29
use C4::Acquisition;
29
use C4::Acquisition;
30
use C4::Biblio;
30
use C4::Biblio;
31
use C4::Bookseller;
32
use C4::Items;
31
use C4::Items;
33
use C4::Search;
32
use C4::Search;
34
33
35
use Koha::Acquisition::Bookseller;
34
use Koha::Acquisition::Booksellers;
36
35
37
use List::MoreUtils qw/any/;
36
use List::MoreUtils qw/any/;
38
37
Lines 84-91 if ($quantityrec > $origquantityrec ) { Link Here
84
    $order->{tax_rate_on_receiving} = $input->param("tax_rate");
83
    $order->{tax_rate_on_receiving} = $input->param("tax_rate");
85
    $order->{unitprice} = $unitprice;
84
    $order->{unitprice} = $unitprice;
86
85
87
    my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
88
89
    $order = C4::Acquisition::populate_order_with_prices(
86
    $order = C4::Acquisition::populate_order_with_prices(
90
        {
87
        {
91
            order => $order,
88
            order => $order,
(-)a/acqui/invoice.pl (-3 / +3 lines)
Lines 35-41 use C4::Output; Link Here
35
use C4::Acquisition;
35
use C4::Acquisition;
36
use C4::Budgets;
36
use C4::Budgets;
37
37
38
use Koha::Acquisition::Bookseller;
38
use Koha::Acquisition::Booksellers;
39
use Koha::Acquisition::Currencies;
39
use Koha::Acquisition::Currencies;
40
use Koha::DateUtils;
40
use Koha::DateUtils;
41
use Koha::Misc::Files;
41
use Koha::Misc::Files;
Lines 112-118 elsif ( $op && $op eq 'delete' ) { Link Here
112
112
113
113
114
my $details = GetInvoiceDetails($invoiceid);
114
my $details = GetInvoiceDetails($invoiceid);
115
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $details->{booksellerid} });
115
my $bookseller = Koha::Acquisition::Booksellers->find( $details->{booksellerid} );
116
my @orders_loop = ();
116
my @orders_loop = ();
117
my $orders = $details->{'orders'};
117
my $orders = $details->{'orders'};
118
my @foot_loop;
118
my @foot_loop;
Lines 177-183 $template->param( Link Here
177
    total_tax_value  => $total_tax_value,
177
    total_tax_value  => $total_tax_value,
178
    total_tax_excluded_shipment => $total_tax_excluded + $details->{shipmentcost},
178
    total_tax_excluded_shipment => $total_tax_excluded + $details->{shipmentcost},
179
    total_tax_included_shipment => $total_tax_included + $details->{shipmentcost},
179
    total_tax_included_shipment => $total_tax_included + $details->{shipmentcost},
180
    invoiceincgst    => $bookseller->{invoiceincgst},
180
    invoiceincgst    => $bookseller->invoiceincgst,
181
    currency         => Koha::Acquisition::Currencies->get_active,
181
    currency         => Koha::Acquisition::Currencies->get_active,
182
    budgets_loop     => \@budgets_loop,
182
    budgets_loop     => \@budgets_loop,
183
);
183
);
(-)a/acqui/modordernotes.pl (-4 / +4 lines)
Lines 33-39 use C4::Auth; Link Here
33
use C4::Output;
33
use C4::Output;
34
use C4::Acquisition;
34
use C4::Acquisition;
35
35
36
use Koha::Acquisition::Bookseller;
36
use Koha::Acquisition::Booksellers;
37
37
38
my $input = new CGI;
38
my $input = new CGI;
39
my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( {
39
my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( {
Lines 51-57 my $referrer = $input->param('referrer') || $input->referer(); Link Here
51
my $type = $input->param('type');
51
my $type = $input->param('type');
52
my $order = GetOrder($ordernumber);
52
my $order = GetOrder($ordernumber);
53
my $basket = GetBasket($order->{basketno});
53
my $basket = GetBasket($order->{basketno});
54
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $basket->{booksellerid} });
54
my $bookseller = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} );
55
55
56
56
57
if($op and $op eq 'save') {
57
if($op and $op eq 'save') {
Lines 79-86 if($op) { Link Here
79
$template->param(
79
$template->param(
80
    basketname           => $basket->{'basketname'},
80
    basketname           => $basket->{'basketname'},
81
    basketno             => $order->{basketno},
81
    basketno             => $order->{basketno},
82
    booksellerid         => $bookseller->{'id'},
82
    booksellerid         => $bookseller->id,
83
    booksellername       => $bookseller->{'name'},
83
    booksellername       => $bookseller->name,
84
    ordernumber => $ordernumber,
84
    ordernumber => $ordernumber,
85
    referrer => $referrer,
85
    referrer => $referrer,
86
    type => $type,
86
    type => $type,
(-)a/acqui/neworderbiblio.pl (-6 / +6 lines)
Lines 67-73 use C4::Koha; Link Here
67
use C4::Members qw/ GetMember /;
67
use C4::Members qw/ GetMember /;
68
use C4::Budgets qw/ GetBudgetHierarchy /;
68
use C4::Budgets qw/ GetBudgetHierarchy /;
69
69
70
use Koha::Acquisition::Bookseller;
70
use Koha::Acquisition::Booksellers;
71
use Koha::SearchEngine;
71
use Koha::SearchEngine;
72
use Koha::SearchEngine::Search;
72
use Koha::SearchEngine::Search;
73
use Koha::SearchEngine::QueryBuilder;
73
use Koha::SearchEngine::QueryBuilder;
Lines 83-89 my $results_per_page = $params->{'num'} || 20; Link Here
83
my $booksellerid     = $params->{'booksellerid'};
83
my $booksellerid     = $params->{'booksellerid'};
84
my $basketno         = $params->{'basketno'};
84
my $basketno         = $params->{'basketno'};
85
my $sub              = $params->{'sub'};
85
my $sub              = $params->{'sub'};
86
my $bookseller       = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
86
my $bookseller       = Koha::Acquisition::Booksellers->find( $booksellerid );
87
87
88
# getting the template
88
# getting the template
89
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
89
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 115-122 if (defined $error) { Link Here
115
    $template->param(
115
    $template->param(
116
        query_error => $error,
116
        query_error => $error,
117
        basketno             => $basketno,
117
        basketno             => $basketno,
118
        booksellerid     => $bookseller->{'id'},
118
        booksellerid     => $bookseller->id,
119
        name             => $bookseller->{'name'},
119
        name             => $bookseller->name,
120
    );
120
    );
121
    output_html_with_http_headers $input, $cookie, $template->output;
121
    output_html_with_http_headers $input, $cookie, $template->output;
122
    exit;
122
    exit;
Lines 147-154 foreach my $r (@{$budgets}) { Link Here
147
$template->param(
147
$template->param(
148
    has_budgets          => $has_budgets,
148
    has_budgets          => $has_budgets,
149
    basketno             => $basketno,
149
    basketno             => $basketno,
150
    booksellerid         => $bookseller->{'id'},
150
    booksellerid         => $bookseller->id,
151
    name                 => $bookseller->{'name'},
151
    name                 => $bookseller->name,
152
    resultsloop          => \@results,
152
    resultsloop          => \@results,
153
    total                => $total_hits,
153
    total                => $total_hits,
154
    query                => $query,
154
    query                => $query,
(-)a/acqui/neworderempty.pl (-9 / +9 lines)
Lines 87-93 use C4::Search qw/FindDuplicate/; Link Here
87
#needed for z3950 import:
87
#needed for z3950 import:
88
use C4::ImportBatch qw/GetImportRecordMarc SetImportRecordStatus/;
88
use C4::ImportBatch qw/GetImportRecordMarc SetImportRecordStatus/;
89
89
90
use Koha::Acquisition::Bookseller;
90
use Koha::Acquisition::Booksellers;
91
use Koha::Acquisition::Currencies;
91
use Koha::Acquisition::Currencies;
92
use Koha::ItemTypes;
92
use Koha::ItemTypes;
93
93
Lines 130-136 if(!$basketno) { Link Here
130
130
131
our $basket = GetBasket($basketno);
131
our $basket = GetBasket($basketno);
132
$booksellerid = $basket->{booksellerid} unless $booksellerid;
132
$booksellerid = $basket->{booksellerid} unless $booksellerid;
133
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
133
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
134
134
135
my $contract = GetContract({
135
my $contract = GetContract({
136
    contractnumber => $basket->{contractnumber}
136
    contractnumber => $basket->{contractnumber}
Lines 320-339 $template->param( Link Here
320
    firstnamesuggestedby => $suggestion->{firstnamesuggestedby},
320
    firstnamesuggestedby => $suggestion->{firstnamesuggestedby},
321
    biblionumber         => $biblionumber,
321
    biblionumber         => $biblionumber,
322
    uncertainprice       => $data->{'uncertainprice'},
322
    uncertainprice       => $data->{'uncertainprice'},
323
    discount_2dp         => sprintf( "%.2f",  $bookseller->{'discount'} ) ,   # for display
323
    discount_2dp         => sprintf( "%.2f",  $bookseller->discount ) ,   # for display
324
    discount             => $bookseller->{'discount'},
324
    discount             => $bookseller->discount,
325
    orderdiscount_2dp    => sprintf( "%.2f", $data->{'discount'} || 0 ),
325
    orderdiscount_2dp    => sprintf( "%.2f", $data->{'discount'} || 0 ),
326
    orderdiscount        => $data->{'discount'},
326
    orderdiscount        => $data->{'discount'},
327
    order_internalnote   => $data->{'order_internalnote'},
327
    order_internalnote   => $data->{'order_internalnote'},
328
    order_vendornote     => $data->{'order_vendornote'},
328
    order_vendornote     => $data->{'order_vendornote'},
329
    listincgst       => $bookseller->{'listincgst'},
329
    listincgst       => $bookseller->listincgst,
330
    invoiceincgst    => $bookseller->{'invoiceincgst'},
330
    invoiceincgst    => $bookseller->invoiceincgst,
331
    name             => $bookseller->{'name'},
331
    name             => $bookseller->name,
332
    cur_active_sym   => $active_currency->symbol,
332
    cur_active_sym   => $active_currency->symbol,
333
    cur_active       => $active_currency->currency,
333
    cur_active       => $active_currency->currency,
334
    currencies       => \@currencies,
334
    currencies       => \@currencies,
335
    currency         => $data->{currency},
335
    currency         => $data->{currency},
336
    vendor_currency  => $bookseller->{listprice},
336
    vendor_currency  => $bookseller->listprice,
337
    orderexists      => ( $new eq 'yes' ) ? 0 : 1,
337
    orderexists      => ( $new eq 'yes' ) ? 0 : 1,
338
    title            => $data->{'title'},
338
    title            => $data->{'title'},
339
    author           => $data->{'author'},
339
    author           => $data->{'author'},
Lines 348-354 $template->param( Link Here
348
    quantityrec      => $quantity,
348
    quantityrec      => $quantity,
349
    rrp              => $data->{'rrp'},
349
    rrp              => $data->{'rrp'},
350
    gst_values       => \@gst_values,
350
    gst_values       => \@gst_values,
351
    tax_rate         => $data->{tax_rate_on_ordering} ? $data->{tax_rate_on_ordering}+0.0 : $bookseller->{tax_rate} ? $bookseller->{tax_rate}+0.0 : 0,
351
    tax_rate         => $data->{tax_rate_on_ordering} ? $data->{tax_rate_on_ordering}+0.0 : $bookseller->tax_rate ? $bookseller->tax_rate+0.0 : 0,
352
    listprice        => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice),
352
    listprice        => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice),
353
    total            => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ),
353
    total            => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ),
354
    ecost            => sprintf( "%.2f", $data->{ecost} || 0),
354
    ecost            => sprintf( "%.2f", $data->{ecost} || 0),
(-)a/acqui/newordersubscription.pl (-3 / +3 lines)
Lines 25-31 use C4::Context; Link Here
25
use C4::Output;
25
use C4::Output;
26
use C4::Serials;
26
use C4::Serials;
27
27
28
use Koha::Acquisition::Bookseller;
28
use Koha::Acquisition::Booksellers;
29
29
30
my $query        = new CGI;
30
my $query        = new CGI;
31
my $title        = $query->param('title_filter');
31
my $title        = $query->param('title_filter');
Lines 52-58 my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( Link Here
52
52
53
my $basket = GetBasket($basketno);
53
my $basket = GetBasket($basketno);
54
$booksellerid = $basket->{booksellerid} unless $booksellerid;
54
$booksellerid = $basket->{booksellerid} unless $booksellerid;
55
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
55
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
56
56
57
my @subscriptions;
57
my @subscriptions;
58
if ($searched) {
58
if ($searched) {
Lines 88-93 $template->param( Link Here
88
    booksellerid     => $booksellerid,
88
    booksellerid     => $booksellerid,
89
    basketno         => $basket->{basketno},
89
    basketno         => $basket->{basketno},
90
    basketname       => $basket->{basketname},
90
    basketname       => $basket->{basketname},
91
    booksellername   => $bookseller->{name},
91
    booksellername   => $bookseller->name,
92
);
92
);
93
output_html_with_http_headers $query, $cookie, $template->output;
93
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/acqui/newordersuggestion.pl (-3 / +3 lines)
Lines 97-103 use C4::Output; Link Here
97
use C4::Suggestions;
97
use C4::Suggestions;
98
use C4::Biblio;
98
use C4::Biblio;
99
99
100
use Koha::Acquisition::Bookseller;
100
use Koha::Acquisition::Booksellers;
101
101
102
my $input = new CGI;
102
my $input = new CGI;
103
103
Lines 137-148 my $suggestions_loop = SearchSuggestion( Link Here
137
        STATUS        => 'ACCEPTED'
137
        STATUS        => 'ACCEPTED'
138
    }
138
    }
139
);
139
);
140
my $vendor = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
140
my $vendor = Koha::Acquisition::Booksellers->find( $booksellerid );
141
$template->param(
141
$template->param(
142
    suggestions_loop        => $suggestions_loop,
142
    suggestions_loop        => $suggestions_loop,
143
    basketno                => $basketno,
143
    basketno                => $basketno,
144
    booksellerid              => $booksellerid,
144
    booksellerid              => $booksellerid,
145
    name					=> $vendor->{'name'},
145
    name                    => $vendor->name,
146
    loggedinuser            => $borrowernumber,
146
    loggedinuser            => $borrowernumber,
147
    "op_$op"                => 1,
147
    "op_$op"                => 1,
148
);
148
);
(-)a/acqui/orderreceive.pl (-4 / +4 lines)
Lines 73-79 use C4::Items; Link Here
73
use C4::Biblio;
73
use C4::Biblio;
74
use C4::Suggestions;
74
use C4::Suggestions;
75
75
76
use Koha::Acquisition::Bookseller;
76
use Koha::Acquisition::Booksellers;
77
use Koha::DateUtils qw( dt_from_string );
77
use Koha::DateUtils qw( dt_from_string );
78
78
79
my $input      = new CGI;
79
my $input      = new CGI;
Lines 85-91 my $booksellerid = $invoice->{booksellerid}; Link Here
85
my $freight      = $invoice->{shipmentcost};
85
my $freight      = $invoice->{shipmentcost};
86
my $ordernumber  = $input->param('ordernumber');
86
my $ordernumber  = $input->param('ordernumber');
87
87
88
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
88
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
89
my $results;
89
my $results;
90
$results = SearchOrders({
90
$results = SearchOrders({
91
    ordernumber => $ordernumber
91
    ordernumber => $ordernumber
Lines 155-161 $order->{quantityreceived} = '' if $order->{quantityreceived} == 0; Link Here
155
155
156
my $unitprice = $order->{unitprice};
156
my $unitprice = $order->{unitprice};
157
my ( $rrp, $ecost );
157
my ( $rrp, $ecost );
158
if ( $bookseller->{invoiceincgst} ) {
158
if ( $bookseller->invoiceincgst ) {
159
    $rrp = $order->{rrp_tax_included};
159
    $rrp = $order->{rrp_tax_included};
160
    $ecost = $order->{ecost_tax_included};
160
    $ecost = $order->{ecost_tax_included};
161
    unless ( $unitprice != 0 and defined $unitprice) {
161
    unless ( $unitprice != 0 and defined $unitprice) {
Lines 198-204 $template->param( Link Here
198
    subscriptionid        => $order->{subscriptionid},
198
    subscriptionid        => $order->{subscriptionid},
199
    booksellerid          => $order->{'booksellerid'},
199
    booksellerid          => $order->{'booksellerid'},
200
    freight               => $freight,
200
    freight               => $freight,
201
    name                  => $bookseller->{'name'},
201
    name                  => $bookseller->name,
202
    title                 => $order->{'title'},
202
    title                 => $order->{'title'},
203
    author                => $order->{'author'},
203
    author                => $order->{'author'},
204
    copyrightdate         => $order->{'copyrightdate'},
204
    copyrightdate         => $order->{'copyrightdate'},
(-)a/acqui/parcel.pl (-8 / +8 lines)
Lines 67-73 use C4::Output; Link Here
67
use C4::Suggestions;
67
use C4::Suggestions;
68
use C4::Reserves qw/GetReservesFromBiblionumber/;
68
use C4::Reserves qw/GetReservesFromBiblionumber/;
69
69
70
use Koha::Acquisition::Bookseller;
70
use Koha::Acquisition::Booksellers;
71
use Koha::DateUtils;
71
use Koha::DateUtils;
72
72
73
use JSON;
73
use JSON;
Lines 110-116 unless( $invoiceid and $invoice->{invoiceid} ) { Link Here
110
}
110
}
111
111
112
my $booksellerid = $invoice->{booksellerid};
112
my $booksellerid = $invoice->{booksellerid};
113
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
113
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
114
114
115
my @orders        = @{ $invoice->{orders} };
115
my @orders        = @{ $invoice->{orders} };
116
my $countlines    = scalar @orders;
116
my $countlines    = scalar @orders;
Lines 124-134 my $subtotal_for_funds; Link Here
124
for my $order ( @orders ) {
124
for my $order ( @orders ) {
125
    $order->{'unitprice'} += 0;
125
    $order->{'unitprice'} += 0;
126
126
127
    if ( $bookseller->{listincgst} and not $bookseller->{invoiceincgst} ) {
127
    if ( $bookseller->listincgst and not $bookseller->invoiceincgst ) {
128
        $order->{ecost}     = $order->{ecost_tax_excluded};
128
        $order->{ecost}     = $order->{ecost_tax_excluded};
129
        $order->{unitprice} = $order->{unitprice_tax_excluded};
129
        $order->{unitprice} = $order->{unitprice_tax_excluded};
130
    }
130
    }
131
    elsif ( not $bookseller->{listinct} and $bookseller->{invoiceincgst} ) {
131
    elsif ( not $bookseller->listinct and $bookseller->invoiceincgst ) {
132
        $order->{ecost}     = $order->{ecost_tax_included};
132
        $order->{ecost}     = $order->{ecost_tax_included};
133
        $order->{unitprice} = $order->{unitprice_tax_included};
133
        $order->{unitprice} = $order->{unitprice_tax_included};
134
    } else {
134
    } else {
Lines 224-232 unless( defined $invoice->{closedate} ) { Link Here
224
    for (my $i = 0 ; $i < $countpendings ; $i++) {
224
    for (my $i = 0 ; $i < $countpendings ; $i++) {
225
        my $order = $pendingorders->[$i];
225
        my $order = $pendingorders->[$i];
226
226
227
        if ( $bookseller->{listincgst} and not $bookseller->{invoiceincgst} ) {
227
        if ( $bookseller->listincgst and not $bookseller->invoiceincgst ) {
228
            $order->{ecost} = $order->{ecost_tax_excluded};
228
            $order->{ecost} = $order->{ecost_tax_excluded};
229
        } elsif ( not $bookseller->{listinct} and $bookseller->{invoiceincgst} ) {
229
        } elsif ( not $bookseller->listinct and $bookseller->invoiceincgst ) {
230
            $order->{ecost} = $order->{ecost_tax_included};
230
            $order->{ecost} = $order->{ecost_tax_included};
231
        } else {
231
        } else {
232
            $order->{ecost} = $order->{ecost_tax_excluded};
232
            $order->{ecost} = $order->{ecost_tax_excluded};
Lines 287-294 $template->param( Link Here
287
    invoice               => $invoice->{invoicenumber},
287
    invoice               => $invoice->{invoicenumber},
288
    invoiceclosedate      => $invoice->{closedate},
288
    invoiceclosedate      => $invoice->{closedate},
289
    datereceived          => dt_from_string,
289
    datereceived          => dt_from_string,
290
    name                  => $bookseller->{'name'},
290
    name                  => $bookseller->name,
291
    booksellerid          => $bookseller->{id},
291
    booksellerid          => $bookseller->id,
292
    loop_received         => \@loop_received,
292
    loop_received         => \@loop_received,
293
    loop_orders           => \@loop_orders,
293
    loop_orders           => \@loop_orders,
294
    book_foot_loop        => \@book_foot_loop,
294
    book_foot_loop        => \@book_foot_loop,
(-)a/acqui/parcels.pl (-3 / +3 lines)
Lines 75-81 use C4::Output; Link Here
75
use C4::Acquisition;
75
use C4::Acquisition;
76
use C4::Budgets;
76
use C4::Budgets;
77
77
78
use Koha::Acquisition::Bookseller;
78
use Koha::Acquisition::Booksellers;
79
use Koha::DateUtils qw( output_pref dt_from_string );
79
use Koha::DateUtils qw( output_pref dt_from_string );
80
80
81
my $input          = CGI->new;
81
my $input          = CGI->new;
Lines 139-145 if ($op and $op eq 'confirm') { Link Here
139
    }
139
    }
140
}
140
}
141
141
142
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
142
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
143
my @parcels = GetInvoices(
143
my @parcels = GetInvoices(
144
    supplierid => $booksellerid,
144
    supplierid => $booksellerid,
145
    invoicenumber => $code,
145
    invoicenumber => $code,
Lines 203-209 $template->param( Link Here
203
    datefrom                 => $datefrom,
203
    datefrom                 => $datefrom,
204
    dateto                   => $dateto,
204
    dateto                   => $dateto,
205
    resultsperpage           => $resultsperpage,
205
    resultsperpage           => $resultsperpage,
206
    name                     => $bookseller->{'name'},
206
    name                     => $bookseller->name,
207
    shipmentdate_today       => dt_from_string,
207
    shipmentdate_today       => dt_from_string,
208
    booksellerid             => $booksellerid,
208
    booksellerid             => $booksellerid,
209
    GST                      => C4::Context->preference('gist'),
209
    GST                      => C4::Context->preference('gist'),
(-)a/acqui/pdfformat/layout2pages.pm (-6 / +6 lines)
Lines 199-215 sub printhead { Link Here
199
    
199
    
200
    # print bookseller infos
200
    # print bookseller infos
201
    $text->translate(100/mm, ($height-180)/mm);
201
    $text->translate(100/mm, ($height-180)/mm);
202
    $text->text($bookseller->{name});
202
    $text->text($bookseller->name);
203
    $text->translate(100/mm, ($height-185)/mm);
203
    $text->translate(100/mm, ($height-185)/mm);
204
    $text->text($bookseller->{postal});
204
    $text->text($bookseller->postal);
205
    $text->translate(100/mm, ($height-190)/mm);
205
    $text->translate(100/mm, ($height-190)/mm);
206
    $text->text($bookseller->{address1});
206
    $text->text($bookseller->address1);
207
    $text->translate(100/mm, ($height-195)/mm);
207
    $text->translate(100/mm, ($height-195)/mm);
208
    $text->text($bookseller->{address2});
208
    $text->text($bookseller->address2);
209
    $text->translate(100/mm, ($height-200)/mm);
209
    $text->translate(100/mm, ($height-200)/mm);
210
    $text->text($bookseller->{address3});
210
    $text->text($bookseller->address3);
211
    $text->translate(100/mm, ($height-205)/mm);
211
    $text->translate(100/mm, ($height-205)/mm);
212
    $text->text($bookseller->{accountnumber});
212
    $text->text($bookseller->accountnumber);
213
    
213
    
214
    # print delivery infos
214
    # print delivery infos
215
    $text->font( $pdf->corefont("Times-Bold", -encoding => "utf8"), 4/mm );
215
    $text->font( $pdf->corefont("Times-Bold", -encoding => "utf8"), 4/mm );
(-)a/acqui/pdfformat/layout2pagesde.pm (-6 / +6 lines)
Lines 199-215 sub printhead { Link Here
199
    
199
    
200
    # print bookseller infos
200
    # print bookseller infos
201
    $text->translate(100/mm, ($height-180)/mm);
201
    $text->translate(100/mm, ($height-180)/mm);
202
    $text->text($bookseller->{name});
202
    $text->text($bookseller->name);
203
    $text->translate(100/mm, ($height-185)/mm);
203
    $text->translate(100/mm, ($height-185)/mm);
204
    $text->text($bookseller->{postal});
204
    $text->text($bookseller->postal);
205
    $text->translate(100/mm, ($height-190)/mm);
205
    $text->translate(100/mm, ($height-190)/mm);
206
    $text->text($bookseller->{address1});
206
    $text->text($bookseller->address1);
207
    $text->translate(100/mm, ($height-195)/mm);
207
    $text->translate(100/mm, ($height-195)/mm);
208
    $text->text($bookseller->{address2});
208
    $text->text($bookseller->address2);
209
    $text->translate(100/mm, ($height-200)/mm);
209
    $text->translate(100/mm, ($height-200)/mm);
210
    $text->text($bookseller->{address3});
210
    $text->text($bookseller->address3);
211
    $text->translate(100/mm, ($height-205)/mm);
211
    $text->translate(100/mm, ($height-205)/mm);
212
    $text->text($bookseller->{accountnumber});
212
    $text->text($bookseller->accountnumber);
213
    
213
    
214
    # print delivery infos
214
    # print delivery infos
215
    $text->font( $pdf->corefont("Times-Bold", -encoding => "utf8"), 4/mm );
215
    $text->font( $pdf->corefont("Times-Bold", -encoding => "utf8"), 4/mm );
(-)a/acqui/pdfformat/layout3pages.pm (-6 / +6 lines)
Lines 365-381 sub printhead { Link Here
365
    
365
    
366
    # print bookseller infos
366
    # print bookseller infos
367
    $text->translate(100/mm,  ($height-180)/mm);
367
    $text->translate(100/mm,  ($height-180)/mm);
368
    $text->text($bookseller->{name});
368
    $text->text($bookseller->name);
369
    $text->translate(100/mm,  ($height-185)/mm);
369
    $text->translate(100/mm,  ($height-185)/mm);
370
    $text->text($bookseller->{postal});
370
    $text->text($bookseller->postal);
371
    $text->translate(100/mm,  ($height-190)/mm);
371
    $text->translate(100/mm,  ($height-190)/mm);
372
    $text->text($bookseller->{address1});
372
    $text->text($bookseller->address1);
373
    $text->translate(100/mm,  ($height-195)/mm);
373
    $text->translate(100/mm,  ($height-195)/mm);
374
    $text->text($bookseller->{address2});
374
    $text->text($bookseller->address2);
375
    $text->translate(100/mm,  ($height-200)/mm);
375
    $text->translate(100/mm,  ($height-200)/mm);
376
    $text->text($bookseller->{address3});
376
    $text->text($bookseller->address3);
377
    $text->translate(100/mm, ($height-205)/mm);
377
    $text->translate(100/mm, ($height-205)/mm);
378
    $text->text($bookseller->{accountnumber});
378
    $text->text($bookseller->accountnumber);
379
    
379
    
380
    # print delivery infos
380
    # print delivery infos
381
    $text->font( $pdf->corefont("Times-Bold", -encoding => "utf8"), 4/mm );
381
    $text->font( $pdf->corefont("Times-Bold", -encoding => "utf8"), 4/mm );
(-)a/acqui/pdfformat/layout3pagesfr.pm (-6 / +6 lines)
Lines 365-381 sub printhead { Link Here
365
365
366
    # print bookseller infos
366
    # print bookseller infos
367
    $text->translate(100/mm,  ($height-180)/mm);
367
    $text->translate(100/mm,  ($height-180)/mm);
368
    $text->text($bookseller->{name});
368
    $text->text($bookseller->name);
369
    $text->translate(100/mm,  ($height-185)/mm);
369
    $text->translate(100/mm,  ($height-185)/mm);
370
    $text->text($bookseller->{postal});
370
    $text->text($bookseller->postal);
371
    $text->translate(100/mm,  ($height-190)/mm);
371
    $text->translate(100/mm,  ($height-190)/mm);
372
    $text->text($bookseller->{address1});
372
    $text->text($bookseller->address1);
373
    $text->translate(100/mm,  ($height-195)/mm);
373
    $text->translate(100/mm,  ($height-195)/mm);
374
    $text->text($bookseller->{address2});
374
    $text->text($bookseller->address2);
375
    $text->translate(100/mm,  ($height-200)/mm);
375
    $text->translate(100/mm,  ($height-200)/mm);
376
    $text->text($bookseller->{address3});
376
    $text->text($bookseller->address3);
377
    $text->translate(100/mm, ($height-205)/mm);
377
    $text->translate(100/mm, ($height-205)/mm);
378
    $text->text($bookseller->{accountnumber});
378
    $text->text($bookseller->accountnumber);
379
379
380
    # print delivery infos
380
    # print delivery infos
381
    $text->font( $pdf->corefont("Times-Bold", -encoding => "utf8"), 4/mm );
381
    $text->font( $pdf->corefont("Times-Bold", -encoding => "utf8"), 4/mm );
(-)a/acqui/supplier.pl (-16 / +16 lines)
Lines 48-58 use C4::Biblio; Link Here
48
use C4::Output;
48
use C4::Output;
49
use CGI qw ( -utf8 );
49
use CGI qw ( -utf8 );
50
50
51
use C4::Bookseller qw( DelBookseller );
52
use C4::Bookseller::Contact;
51
use C4::Bookseller::Contact;
53
use C4::Budgets;
52
use C4::Budgets;
54
53
55
use Koha::Acquisition::Bookseller;
54
use Koha::Acquisition::Booksellers;
56
use Koha::Acquisition::Currencies;
55
use Koha::Acquisition::Currencies;
57
56
58
my $query    = CGI->new;
57
my $query    = CGI->new;
Lines 67-77 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
67
    }
66
    }
68
);
67
);
69
my $booksellerid       = $query->param('booksellerid');
68
my $booksellerid       = $query->param('booksellerid');
70
my $supplier = {};
69
my $supplier;
71
if ($booksellerid) {
70
if ($booksellerid) {
72
    $supplier = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
71
    $supplier = Koha::Acquisition::Booksellers->find( $booksellerid );
73
    foreach ( keys %{$supplier} ) {
72
    my $supplier_hashref = $supplier->unblessed;
74
        $template->{'VARS'}->{$_} = $supplier->{$_};
73
    foreach ( keys %{$supplier_hashref} ) {
74
        $template->{'VARS'}->{$_} = $supplier->$_;
75
    }
75
    }
76
    $template->{'VARS'}->{'booksellerid'} = $booksellerid;
76
    $template->{'VARS'}->{'booksellerid'} = $booksellerid;
77
}
77
}
Lines 81-99 if ( $op eq 'display' ) { Link Here
81
    my $contracts = GetContracts( { booksellerid => $booksellerid } );
81
    my $contracts = GetContracts( { booksellerid => $booksellerid } );
82
82
83
    $template->param(
83
    $template->param(
84
        active        => $supplier->{'active'},
84
        active        => $supplier->active,
85
        tax_rate       => $supplier->{'tax_rate'} + 0.0,
85
        tax_rate      => $supplier->tax_rate + 0.0,
86
        invoiceprice  => $supplier->{'invoiceprice'},
86
        invoiceprice  => $supplier->invoiceprice,
87
        listprice     => $supplier->{'listprice'},
87
        listprice     => $supplier->listprice,
88
        basketcount   => $supplier->{'basketcount'},
88
        basketcount   => $supplier->baskets->count,
89
        subscriptioncount   => $supplier->{'subscriptioncount'},
89
        subscriptioncount => $supplier->subscriptions->count,
90
        contracts     => $contracts,
90
        contracts     => $contracts,
91
    );
91
    );
92
} elsif ( $op eq 'delete' ) {
92
} elsif ( $op eq 'delete' ) {
93
    # no further message needed for the user
93
    # no further message needed for the user
94
    # the DELETE button only appears in the template if basketcount == 0
94
    # the DELETE button only appears in the template if basketcount == 0
95
    if ( $supplier->{'basketcount'} == 0 ) {
95
    if ( $supplier->baskets->count == 0 ) {
96
        DelBookseller($booksellerid);
96
        Koha::Acquisition::Booksellers->find($booksellerid)->delete;
97
    }
97
    }
98
    print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl');
98
    print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl');
99
    exit;
99
    exit;
Lines 107-114 if ( $op eq 'display' ) { Link Here
107
107
108
    $template->param(
108
    $template->param(
109
        # set active ON by default for supplier add (id empty for add)
109
        # set active ON by default for supplier add (id empty for add)
110
        active       => $booksellerid ? $supplier->{'active'} : 1,
110
        active     => $supplier ? $supplier->active         : 1,
111
        tax_rate       => $supplier->{tax_rate} ? $supplier->{'tax_rate'}+0.0 : 0,
111
        tax_rate   => $supplier ? $supplier->tax_rate + 0.0 : 0,
112
        gst_values    => \@gst_values,
112
        gst_values    => \@gst_values,
113
        currencies    => \@currencies,
113
        currencies    => \@currencies,
114
        enter         => 1,
114
        enter         => 1,
(-)a/acqui/transferorder.pl (-9 / +10 lines)
Lines 27-32 use C4::Output; Link Here
27
use C4::Context;
27
use C4::Context;
28
use C4::Acquisition;
28
use C4::Acquisition;
29
use C4::Members;
29
use C4::Members;
30
use Koha::Acquisition::Booksellers;
30
31
31
my $input = new CGI;
32
my $input = new CGI;
32
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
33
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 54-68 if($order) { Link Here
54
    $bookselleridfrom = $basket->{booksellerid} if $basket;
55
    $bookselleridfrom = $basket->{booksellerid} if $basket;
55
}
56
}
56
57
57
my $booksellerfrom = Koha::Acquisition::Bookseller->fetch({ id => $bookselleridfrom });
58
my $booksellerfrom = Koha::Acquisition::Booksellers->find( $bookselleridfrom );
58
my $booksellerfromname;
59
my $booksellerfromname;
59
if($booksellerfrom){
60
if($booksellerfrom){
60
    $booksellerfromname = $booksellerfrom->{name};
61
    $booksellerfromname = $booksellerfrom->name;
61
}
62
}
62
my $booksellerto = Koha::Acquisition::Bookseller->fetch({ id => $bookselleridto });
63
my $booksellerto = Koha::Acquisition::Booksellers->finf( $bookselleridto );
63
my $booksellertoname;
64
my $booksellertoname;
64
if($booksellerto){
65
if($booksellerto){
65
    $booksellertoname = $booksellerto->{name};
66
    $booksellertoname = $booksellerto->name;
66
}
67
}
67
68
68
69
Lines 70-77 if( $basketno && $ordernumber) { Link Here
70
    # Transfer order and exit
71
    # Transfer order and exit
71
    my $order = GetOrder( $ordernumber );
72
    my $order = GetOrder( $ordernumber );
72
    my $basket = GetBasket($order->{basketno});
73
    my $basket = GetBasket($order->{basketno});
73
    my $booksellerfrom = Koha::Acquisition::Bookseller->fetch({ id => $basket->{booksellerid} });
74
    my $booksellerfrom = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} );
74
    my $bookselleridfrom = $booksellerfrom->{id};
75
    my $bookselleridfrom = $booksellerfrom->id;
75
76
76
    TransferOrder($ordernumber, $basketno);
77
    TransferOrder($ordernumber, $basketno);
77
78
Lines 80-87 if( $basketno && $ordernumber) { Link Here
80
    # Show open baskets for this bookseller
81
    # Show open baskets for this bookseller
81
    my $order = GetOrder( $ordernumber );
82
    my $order = GetOrder( $ordernumber );
82
    my $basketfrom = GetBasket( $order->{basketno} );
83
    my $basketfrom = GetBasket( $order->{basketno} );
83
    my $booksellerfrom = Koha::Acquisition::Bookseller->fetch({ id => $basketfrom->{booksellerid} });
84
    my $booksellerfrom = Koha::Acquisition::Booksellers->find( $basketfrom->{booksellerid} );
84
    $booksellerfromname = $booksellerfrom->{name};
85
    $booksellerfromname = $booksellerfrom->name;
85
    my $baskets = GetBasketsByBookseller( $bookselleridto );
86
    my $baskets = GetBasketsByBookseller( $bookselleridto );
86
    my $basketscount = scalar @$baskets;
87
    my $basketscount = scalar @$baskets;
87
    my @basketsloop = ();
88
    my @basketsloop = ();
Lines 117-123 if( $basketno && $ordernumber) { Link Here
117
    # Search for booksellers to transfer from/to
118
    # Search for booksellers to transfer from/to
118
    $op = '' unless $op;
119
    $op = '' unless $op;
119
    if( $op eq "do_search" ) {
120
    if( $op eq "do_search" ) {
120
        my @booksellers = Koha::Acquisition::Bookseller->search({ name => $query });
121
        my @booksellers = Koha::Acquisition::Booksellers->search({ name => $query });
121
        $template->param(
122
        $template->param(
122
            query => $query,
123
            query => $query,
123
            do_search => 1,
124
            do_search => 1,
(-)a/acqui/uncertainprice.pl (-18 / +18 lines)
Lines 54-60 use C4::Bookseller::Contact; Link Here
54
use C4::Acquisition qw/SearchOrders GetOrder ModOrder/;
54
use C4::Acquisition qw/SearchOrders GetOrder ModOrder/;
55
use C4::Biblio qw/GetBiblioData/;
55
use C4::Biblio qw/GetBiblioData/;
56
56
57
use Koha::Acquisition::Bookseller;
57
use Koha::Acquisition::Booksellers;
58
58
59
my $input=new CGI;
59
my $input=new CGI;
60
60
Lines 71-77 my $booksellerid = $input->param('booksellerid'); Link Here
71
my $basketno     = $input->param('basketno');
71
my $basketno     = $input->param('basketno');
72
my $op = $input->param('op');
72
my $op = $input->param('op');
73
my $owner = $input->param('owner') || 0 ; # flag to see only "my" orders, or everyone orders
73
my $owner = $input->param('owner') || 0 ; # flag to see only "my" orders, or everyone orders
74
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
74
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
75
75
76
#show all orders that have uncertain price for the bookseller
76
#show all orders that have uncertain price for the bookseller
77
my $pendingorders = SearchOrders({
77
my $pendingorders = SearchOrders({
Lines 106-112 if ( $op eq 'validate' ) { Link Here
106
        my $ordernumber = $order->{ordernumber};
106
        my $ordernumber = $order->{ordernumber};
107
        my $order_as_from_db=GetOrder($order->{ordernumber});
107
        my $order_as_from_db=GetOrder($order->{ordernumber});
108
        $order->{'listprice'} = $input->param('price'.$ordernumber);
108
        $order->{'listprice'} = $input->param('price'.$ordernumber);
109
        $order->{'ecost'}= $input->param('price'.$ordernumber) - (($input->param('price'.$ordernumber) /100) * $bookseller->{'discount'});
109
        $order->{'ecost'}= $input->param('price'.$ordernumber) - (($input->param('price'.$ordernumber) /100) * $bookseller->discount);
110
        $order->{'rrp'} = $input->param('price'.$ordernumber);
110
        $order->{'rrp'} = $input->param('price'.$ordernumber);
111
        $order->{'quantity'}=$input->param('qty'.$ordernumber);
111
        $order->{'quantity'}=$input->param('qty'.$ordernumber);
112
        $order->{'uncertainprice'}=$input->param('uncertainprice'.$ordernumber);
112
        $order->{'uncertainprice'}=$input->param('uncertainprice'.$ordernumber);
Lines 115-135 if ( $op eq 'validate' ) { Link Here
115
}
115
}
116
116
117
$template->param( uncertainpriceorders => \@orders,
117
$template->param( uncertainpriceorders => \@orders,
118
                                   booksellername => "".$bookseller->{'name'},
118
                                   booksellername => "".$bookseller->name,
119
                                   booksellerid => $bookseller->{'id'},
119
                                   booksellerid => $bookseller->id,
120
                                   booksellerpostal =>$bookseller->{'postal'},
120
                                   booksellerpostal =>$bookseller->postal,
121
                                   bookselleraddress1 => $bookseller->{'address1'},
121
                                   bookselleraddress1 => $bookseller->address1,
122
                                   bookselleraddress2 => $bookseller->{'address2'},
122
                                   bookselleraddress2 => $bookseller->address2,
123
                                   bookselleraddress3 => $bookseller->{'address3'},
123
                                   bookselleraddress3 => $bookseller->address3,
124
                                   bookselleraddress4 => $bookseller->{'address4'},
124
                                   bookselleraddress4 => $bookseller->address4,
125
                                   booksellerphone =>$bookseller->{'phone'},
125
                                   booksellerphone =>$bookseller->phone,
126
                                   booksellerfax => $bookseller->{'fax'},
126
                                   booksellerfax => $bookseller->fax,
127
                                   booksellerurl => $bookseller->{'url'},
127
                                   booksellerurl => $bookseller->url,
128
                                   booksellernotes => $bookseller->{'notes'},
128
                                   booksellernotes => $bookseller->notes,
129
                                   basketcount   => $bookseller->{'basketcount'},
129
                                   basketcount   => $bookseller->baskets->count,
130
                                   subscriptioncount   => $bookseller->{'subscriptioncount'},
130
                                   subscriptioncount   => $bookseller->subscriptions->count,
131
                                   active => $bookseller->{active},
131
                                   active => $bookseller->active,
132
                                   owner => $owner,
132
                                   owner => $owner,
133
                                   scriptname => "/cgi-bin/koha/acqui/uncertainprice.pl");
133
                                   scriptname => "/cgi-bin/koha/acqui/uncertainprice.pl");
134
$template->{'VARS'}->{'contacts'} = $bookseller->{'contacts'};
134
$template->{'VARS'}->{'contacts'} = $bookseller->contacts;
135
output_html_with_http_headers $input, $cookie, $template->output;
135
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/acqui/updatesupplier.pl (-7 / +23 lines)
Lines 52-61 use List::Util; Link Here
52
use C4::Context;
52
use C4::Context;
53
use C4::Auth;
53
use C4::Auth;
54
54
55
use C4::Bookseller qw( ModBookseller AddBookseller );
56
use C4::Bookseller::Contact;
55
use C4::Bookseller::Contact;
57
use C4::Biblio;
56
use C4::Biblio;
58
use C4::Output;
57
use C4::Output;
58
59
use Koha::Acquisition::Booksellers;
59
use CGI qw ( -utf8 );
60
use CGI qw ( -utf8 );
60
61
61
my $input=new CGI;
62
my $input=new CGI;
Lines 108-122 for my $cnt (0..scalar(@{$contact_info{'id'}})) { Link Here
108
        $contact{$_} = $contact_info{$_}->[$cnt];
109
        $contact{$_} = $contact_info{$_}->[$cnt];
109
        $real_contact = 1 if $contact{$_};
110
        $real_contact = 1 if $contact{$_};
110
    }
111
    }
111
    push @contacts, C4::Bookseller::Contact->new(\%contact) if $real_contact;
112
    push @contacts, \%contact if $real_contact;
112
}
113
}
113
114
114
if($data{'name'}) {
115
if($data{'name'}) {
115
	if ($data{'id'}){
116
    if ( $data{id} ) {
116
        ModBookseller(\%data, \@contacts);
117
        # Update
117
	} else {
118
        my $bookseller = Koha::Acquisition::Booksellers->find( $data{id} )->set(\%data)->store;
118
        $data{id}=AddBookseller(\%data, \@contacts);
119
        my $contacts = $bookseller->contacts;
119
	}
120
        # Delete existing contacts
121
        while ( my $contact = $contacts->next ) {
122
            $contact->delete;
123
        }
124
    } else {
125
        # Insert
126
        delete $data{id}; # Remove the key if exists
127
        my $bookseller = Koha::Acquisition::Bookseller->new( \%data )->store;
128
        $data{id} = $bookseller->id;
129
    }
130
    # Insert contacts
131
    for my $contact ( @contacts ) {
132
        $contact->{booksellerid} = $data{id};
133
        Koha::Acquisition::Bookseller::Contact->new( $contact )->store
134
    }
135
120
    #redirect to booksellers.pl
136
    #redirect to booksellers.pl
121
    print $input->redirect("booksellers.pl?booksellerid=".$data{id});
137
    print $input->redirect("booksellers.pl?booksellerid=".$data{id});
122
} else {
138
} else {
(-)a/acqui/z3950_search.pl (-3 / +3 lines)
Lines 29-35 use C4::Context; Link Here
29
use C4::Breeding;
29
use C4::Breeding;
30
use C4::Koha;
30
use C4::Koha;
31
31
32
use Koha::Acquisition::Bookseller;
32
use Koha::Acquisition::Booksellers;
33
use Koha::BiblioFrameworks;
33
use Koha::BiblioFrameworks;
34
34
35
my $input           = new CGI;
35
my $input           = new CGI;
Lines 52-58 $page = $input->param('goto_page') if $input->param('changepage_go Link Here
52
# get framework list
52
# get framework list
53
my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] });
53
my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] });
54
54
55
my $vendor = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
55
my $vendor = Koha::Acquisition::Booksellers->find( $booksellerid );
56
56
57
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
57
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
58
    {
58
    {
Lines 66-72 $template->param( Link Here
66
        frameworks   => $frameworks,
66
        frameworks   => $frameworks,
67
        booksellerid => $booksellerid,
67
        booksellerid => $booksellerid,
68
        basketno     => $basketno,
68
        basketno     => $basketno,
69
        name         => $vendor->{'name'},
69
        name         => $vendor->name,
70
        isbn         => $isbn,
70
        isbn         => $isbn,
71
        issn         => $issn,
71
        issn         => $issn,
72
        lccn         => $lccn,
72
        lccn         => $lccn,
(-)a/admin/aqcontract.pl (-6 / +6 lines)
Lines 29-42 use C4::Output; Link Here
29
use C4::Contract;
29
use C4::Contract;
30
use Koha::DateUtils;
30
use Koha::DateUtils;
31
31
32
use Koha::Acquisition::Bookseller;
32
use Koha::Acquisition::Booksellers;
33
33
34
my $input          = new CGI;
34
my $input          = new CGI;
35
my $contractnumber = $input->param('contractnumber');
35
my $contractnumber = $input->param('contractnumber');
36
my $booksellerid   = $input->param('booksellerid');
36
my $booksellerid   = $input->param('booksellerid');
37
my $op             = $input->param('op') || 'list';
37
my $op             = $input->param('op') || 'list';
38
38
39
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
39
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
40
40
41
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
41
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
42
    {   template_name   => "admin/aqcontract.tt",
42
    {   template_name   => "admin/aqcontract.tt",
Lines 51-60 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
51
$template->param(
51
$template->param(
52
    contractnumber => $contractnumber,
52
    contractnumber => $contractnumber,
53
    booksellerid   => $booksellerid,
53
    booksellerid   => $booksellerid,
54
    booksellername => $bookseller->{name},
54
    booksellername => $bookseller->name,
55
    basketcount   => $bookseller->{'basketcount'},
55
    basketcount   => $bookseller->baskets->count,
56
    active         => $bookseller->{active},
56
    active         => $bookseller->active,
57
    subscriptioncount   => $bookseller->{'subscriptioncount'},
57
    subscriptioncount   => $bookseller->subscriptions->count,
58
);
58
);
59
59
60
#ADD_FORM: called if $op is 'add_form'. Used to create form to add or  modify a record
60
#ADD_FORM: called if $op is 'add_form'. Used to create form to add or  modify a record
(-)a/catalogue/moredetail.pl (-3 / +3 lines)
Lines 35-41 use C4::Search; # enabled_staff_search_views Link Here
35
use C4::Members qw/GetHideLostItemsPreference/;
35
use C4::Members qw/GetHideLostItemsPreference/;
36
use C4::Reserves qw(GetReservesFromBiblionumber);
36
use C4::Reserves qw(GetReservesFromBiblionumber);
37
37
38
use Koha::Acquisition::Bookseller;
38
use Koha::Acquisition::Booksellers;
39
use Koha::AuthorisedValues;
39
use Koha::AuthorisedValues;
40
use Koha::DateUtils;
40
use Koha::DateUtils;
41
use Koha::Items;
41
use Koha::Items;
Lines 159-166 foreach my $item (@items){ Link Here
159
    $item->{'orderdate'}               = $order->{'entrydate'};
159
    $item->{'orderdate'}               = $order->{'entrydate'};
160
    if ($item->{'basketno'}){
160
    if ($item->{'basketno'}){
161
	    my $basket = GetBasket($item->{'basketno'});
161
	    my $basket = GetBasket($item->{'basketno'});
162
        my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $basket->{booksellerid} });
162
        my $bookseller = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} );
163
	    $item->{'vendor'} = $bookseller->{'name'};
163
        $item->{'vendor'} = $bookseller->name;
164
    }
164
    }
165
    $item->{'invoiceid'}               = $order->{'invoiceid'};
165
    $item->{'invoiceid'}               = $order->{'invoiceid'};
166
    if($item->{invoiceid}) {
166
    if($item->{invoiceid}) {
(-)a/serials/subscription-detail.pl (-5 / +5 lines)
Lines 122-128 if ( defined $subscriptionid ) { Link Here
122
    my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid;
122
    my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid;
123
    if ( defined $lastOrderNotReceived ) {
123
    if ( defined $lastOrderNotReceived ) {
124
        my $basket = GetBasket $lastOrderNotReceived->{basketno};
124
        my $basket = GetBasket $lastOrderNotReceived->{basketno};
125
        my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $basket->{booksellerid} });
125
        my $bookseller = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} );
126
        ( $tmpl_infos->{value_tax_included_ordered}, $tmpl_infos->{value_tax_excluded_ordered} ) = get_value_with_gst_params ( $lastOrderNotReceived->{ecost}, $lastOrderNotReceived->{tax_rate}, $bookseller );
126
        ( $tmpl_infos->{value_tax_included_ordered}, $tmpl_infos->{value_tax_excluded_ordered} ) = get_value_with_gst_params ( $lastOrderNotReceived->{ecost}, $lastOrderNotReceived->{tax_rate}, $bookseller );
127
        $tmpl_infos->{value_tax_included_ordered} = sprintf( "%.2f", $tmpl_infos->{value_tax_included_ordered} );
127
        $tmpl_infos->{value_tax_included_ordered} = sprintf( "%.2f", $tmpl_infos->{value_tax_included_ordered} );
128
        $tmpl_infos->{value_tax_excluded_ordered} = sprintf( "%.2f", $tmpl_infos->{value_tax_excluded_ordered} );
128
        $tmpl_infos->{value_tax_excluded_ordered} = sprintf( "%.2f", $tmpl_infos->{value_tax_excluded_ordered} );
Lines 132-138 if ( defined $subscriptionid ) { Link Here
132
    }
132
    }
133
    if ( defined $lastOrderReceived ) {
133
    if ( defined $lastOrderReceived ) {
134
        my $basket = GetBasket $lastOrderReceived->{basketno};
134
        my $basket = GetBasket $lastOrderReceived->{basketno};
135
        my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $basket->{booksellerid} });
135
        my $bookseller = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} );
136
        ( $tmpl_infos->{value_tax_included_spent}, $tmpl_infos->{value_tax_excluded_spent} ) = get_value_with_gst_params ( $lastOrderReceived->{unitprice}, $lastOrderReceived->{tax_rate}, $bookseller );
136
        ( $tmpl_infos->{value_tax_included_spent}, $tmpl_infos->{value_tax_excluded_spent} ) = get_value_with_gst_params ( $lastOrderReceived->{unitprice}, $lastOrderReceived->{tax_rate}, $bookseller );
137
        $tmpl_infos->{value_tax_included_spent} = sprintf( "%.2f", $tmpl_infos->{value_tax_included_spent} );
137
        $tmpl_infos->{value_tax_included_spent} = sprintf( "%.2f", $tmpl_infos->{value_tax_included_spent} );
138
        $tmpl_infos->{value_tax_excluded_spent} = sprintf( "%.2f", $tmpl_infos->{value_tax_excluded_spent} );
138
        $tmpl_infos->{value_tax_excluded_spent} = sprintf( "%.2f", $tmpl_infos->{value_tax_excluded_spent} );
Lines 193-199 sub get_value_with_gst_params { Link Here
193
    my $value = shift;
193
    my $value = shift;
194
    my $tax_rate = shift;
194
    my $tax_rate = shift;
195
    my $bookseller = shift;
195
    my $bookseller = shift;
196
    if ( $bookseller->{listincgst} ) {
196
    if ( $bookseller->listincgst ) {
197
        return ( $value, $value / ( 1 + $tax_rate ) );
197
        return ( $value, $value / ( 1 + $tax_rate ) );
198
    } else {
198
    } else {
199
        return ( $value * ( 1 + $tax_rate ), $value );
199
        return ( $value * ( 1 + $tax_rate ), $value );
Lines 204-210 sub get_tax_excluded { Link Here
204
    my $value = shift;
204
    my $value = shift;
205
    my $tax_rate = shift;
205
    my $tax_rate = shift;
206
    my $bookseller = shift;
206
    my $bookseller = shift;
207
    if ( $bookseller->{invoiceincgst} ) {
207
    if ( $bookseller->invoiceincgst ) {
208
        return $value / ( 1 + $tax_rate );
208
        return $value / ( 1 + $tax_rate );
209
    } else {
209
    } else {
210
        return $value;
210
        return $value;
Lines 215-221 sub get_gst { Link Here
215
    my $value = shift;
215
    my $value = shift;
216
    my $tax_rate = shift;
216
    my $tax_rate = shift;
217
    my $bookseller = shift;
217
    my $bookseller = shift;
218
    if ( $bookseller->{invoiceincgst} ) {
218
    if ( $bookseller->invoiceincgst ) {
219
        return $value / ( 1 + $tax_rate ) * $tax_rate;
219
        return $value / ( 1 + $tax_rate ) * $tax_rate;
220
    } else {
220
    } else {
221
        return $value * ( 1 + $tax_rate ) - $value;
221
        return $value * ( 1 + $tax_rate ) - $value;
(-)a/t/Prices.t (-1 lines)
Lines 15-21 BEGIN { Link Here
15
}
15
}
16
16
17
use_ok('C4::Acquisition');
17
use_ok('C4::Acquisition');
18
use_ok('C4::Bookseller');
19
use_ok('C4::Context');
18
use_ok('C4::Context');
20
use_ok('Koha::Number::Price');
19
use_ok('Koha::Number::Price');
21
20
(-)a/t/db_dependent/Acquisition.t (-9 / +7 lines)
Lines 19-35 use Modern::Perl; Link Here
19
19
20
use POSIX qw(strftime);
20
use POSIX qw(strftime);
21
21
22
use Test::More tests => 65;
22
use Test::More tests => 63;
23
use Koha::Database;
23
use Koha::Database;
24
24
25
BEGIN {
25
BEGIN {
26
    use_ok('C4::Acquisition');
26
    use_ok('C4::Acquisition');
27
    use_ok('C4::Bookseller');
28
    use_ok('C4::Biblio');
27
    use_ok('C4::Biblio');
29
    use_ok('C4::Budgets');
28
    use_ok('C4::Budgets');
30
    use_ok('C4::Bookseller');
31
    use_ok('Koha::Acquisition::Order');
29
    use_ok('Koha::Acquisition::Order');
32
    use_ok('Koha::Acquisition::Bookseller');
30
    use_ok('Koha::Acquisition::Booksellers');
33
}
31
}
34
32
35
# Sub used for testing C4::Acquisition subs returning order(s):
33
# Sub used for testing C4::Acquisition subs returning order(s):
Lines 125-131 my $dbh = C4::Context->dbh; Link Here
125
$dbh->{RaiseError} = 1;
123
$dbh->{RaiseError} = 1;
126
124
127
# Creating some orders
125
# Creating some orders
128
my $booksellerid = C4::Bookseller::AddBookseller(
126
my $bookseller = Koha::Acquisition::Bookseller->new(
129
    {
127
    {
130
        name         => "my vendor",
128
        name         => "my vendor",
131
        address1     => "bookseller's address",
129
        address1     => "bookseller's address",
Lines 133-143 my $booksellerid = C4::Bookseller::AddBookseller( Link Here
133
        active       => 1,
131
        active       => 1,
134
        deliverytime => 5,
132
        deliverytime => 5,
135
    }
133
    }
136
);
134
)->store;
137
135
my $booksellerid = $bookseller->id;
138
my $booksellerinfo = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
139
136
140
is( $booksellerinfo->{deliverytime},
137
my $booksellerinfo = Koha::Acquisition::Booksellers->find( $booksellerid );
138
is( $booksellerinfo->deliverytime,
141
    5, 'set deliverytime when creating vendor (Bug 10556)' );
139
    5, 'set deliverytime when creating vendor (Bug 10556)' );
142
140
143
my ( $basket, $basketno );
141
my ( $basket, $basketno );
(-)a/t/db_dependent/Acquisition/CancelReceipt.t (-4 / +4 lines)
Lines 7-18 use C4::Context; Link Here
7
use C4::Acquisition;
7
use C4::Acquisition;
8
use C4::Biblio;
8
use C4::Biblio;
9
use C4::Items;
9
use C4::Items;
10
use C4::Bookseller;
11
use C4::Budgets;
10
use C4::Budgets;
12
use t::lib::Mocks;
11
use t::lib::Mocks;
13
12
14
use Koha::Database;
13
use Koha::Database;
15
use Koha::DateUtils;
14
use Koha::DateUtils;
15
use Koha::Acquisition::Booksellers;
16
use Koha::Acquisition::Order;
16
use Koha::Acquisition::Order;
17
use MARC::Record;
17
use MARC::Record;
18
18
Lines 21-37 $schema->storage->txn_begin(); Link Here
21
my $dbh = C4::Context->dbh;
21
my $dbh = C4::Context->dbh;
22
$dbh->{RaiseError} = 1;
22
$dbh->{RaiseError} = 1;
23
23
24
my $booksellerid1 = C4::Bookseller::AddBookseller(
24
my $bookseller = Koha::Acquisition::Bookseller->new(
25
    {
25
    {
26
        name => "my vendor 1",
26
        name => "my vendor 1",
27
        address1 => "bookseller's address",
27
        address1 => "bookseller's address",
28
        phone => "0123456",
28
        phone => "0123456",
29
        active => 1
29
        active => 1
30
    }
30
    }
31
);
31
)->store;
32
32
33
my $basketno1 = C4::Acquisition::NewBasket(
33
my $basketno1 = C4::Acquisition::NewBasket(
34
    $booksellerid1
34
    $bookseller->id
35
);
35
);
36
36
37
my $budgetid = C4::Budgets::AddBudget(
37
my $budgetid = C4::Budgets::AddBudget(
(-)a/t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t (-3 / +3 lines)
Lines 6-12 use Data::Dumper; Link Here
6
6
7
use C4::Acquisition qw( NewBasket GetBasketsInfosByBookseller );
7
use C4::Acquisition qw( NewBasket GetBasketsInfosByBookseller );
8
use C4::Biblio qw( AddBiblio );
8
use C4::Biblio qw( AddBiblio );
9
use C4::Bookseller qw( AddBookseller );
10
use C4::Budgets qw( AddBudget );
9
use C4::Budgets qw( AddBudget );
11
use C4::Context;
10
use C4::Context;
12
use Koha::Database;
11
use Koha::Database;
Lines 18-24 $schema->storage->txn_begin(); Link Here
18
my $dbh = C4::Context->dbh;
17
my $dbh = C4::Context->dbh;
19
$dbh->{RaiseError} = 1;
18
$dbh->{RaiseError} = 1;
20
19
21
my $supplierid = C4::Bookseller::AddBookseller(
20
my $supplier = Koha::Acquisition::Bookseller->new(
22
    {
21
    {
23
        name => 'my vendor',
22
        name => 'my vendor',
24
        address1 => 'bookseller\'s address',
23
        address1 => 'bookseller\'s address',
Lines 26-32 my $supplierid = C4::Bookseller::AddBookseller( Link Here
26
        active => 1,
25
        active => 1,
27
        deliverytime => 5,
26
        deliverytime => 5,
28
    }
27
    }
29
);
28
)->store;
29
my $supplierid = $supplier->id;
30
30
31
my $basketno;
31
my $basketno;
32
ok($basketno = NewBasket($supplierid, 1), 'NewBasket(  $supplierid , 1  ) returns $basketno');
32
ok($basketno = NewBasket($supplierid, 1), 'NewBasket(  $supplierid , 1  ) returns $basketno');
(-)a/t/db_dependent/Acquisition/GetOrdersByBiblionumber.t (-4 / +3 lines)
Lines 5-11 use Modern::Perl; Link Here
5
use Test::More;
5
use Test::More;
6
use C4::Acquisition;
6
use C4::Acquisition;
7
use C4::Biblio;
7
use C4::Biblio;
8
use C4::Bookseller;
9
use C4::Budgets;
8
use C4::Budgets;
10
use Koha::Database;
9
use Koha::Database;
11
use Koha::Acquisition::Order;
10
use Koha::Acquisition::Order;
Lines 18-34 $schema->storage->txn_begin(); Link Here
18
my $dbh = C4::Context->dbh;
17
my $dbh = C4::Context->dbh;
19
$dbh->{RaiseError} = 1;
18
$dbh->{RaiseError} = 1;
20
19
21
my $booksellerid = C4::Bookseller::AddBookseller(
20
my $bookseller = Koha::Acquisition::Bookseller->new(
22
    {
21
    {
23
        name => "my vendor",
22
        name => "my vendor",
24
        address1 => "bookseller's address",
23
        address1 => "bookseller's address",
25
        phone => "0123456",
24
        phone => "0123456",
26
        active => 1
25
        active => 1
27
    }
26
    }
28
);
27
)->store;
29
28
30
my $basketno = C4::Acquisition::NewBasket(
29
my $basketno = C4::Acquisition::NewBasket(
31
    $booksellerid
30
    $bookseller->id
32
);
31
);
33
32
34
my $budgetid = C4::Budgets::AddBudget(
33
my $budgetid = C4::Budgets::AddBudget(
(-)a/t/db_dependent/Acquisition/Invoices.t (-5 / +5 lines)
Lines 3-12 Link Here
3
use Modern::Perl;
3
use Modern::Perl;
4
4
5
use C4::Biblio qw( AddBiblio );
5
use C4::Biblio qw( AddBiblio );
6
use C4::Bookseller qw( AddBookseller );
7
6
8
use Koha::Acquisition::Order;
7
use Koha::Acquisition::Order;
9
use Koha::Acquisition::Bookseller;
8
use Koha::Acquisition::Booksellers;
10
use Koha::Database;
9
use Koha::Database;
11
10
12
use Test::More tests => 24;
11
use Test::More tests => 24;
Lines 22-37 $dbh->{RaiseError} = 1; Link Here
22
21
23
$dbh->do(q{DELETE FROM aqinvoices});
22
$dbh->do(q{DELETE FROM aqinvoices});
24
23
25
my $booksellerid = C4::Bookseller::AddBookseller(
24
my $bookseller = Koha::Acquisition::Bookseller->new(
26
    {
25
    {
27
        name => "my vendor",
26
        name => "my vendor",
28
        address1 => "bookseller's address",
27
        address1 => "bookseller's address",
29
        phone => "0123456",
28
        phone => "0123456",
30
        active => 1
29
        active => 1
31
    }
30
    }
32
);
31
)->store;
32
my $booksellerid = $bookseller->id;
33
33
34
my $booksellerinfo = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
34
my $booksellerinfo = Koha::Acquisition::Booksellers->find( $booksellerid );
35
my $basketno = NewBasket($booksellerid, 1);
35
my $basketno = NewBasket($booksellerid, 1);
36
my $basket   = GetBasket($basketno);
36
my $basket   = GetBasket($basketno);
37
37
(-)a/t/db_dependent/Acquisition/NewOrder.t (-5 / +5 lines)
Lines 5-15 use Modern::Perl; Link Here
5
use Test::More tests => 7;
5
use Test::More tests => 7;
6
use C4::Acquisition;
6
use C4::Acquisition;
7
use C4::Biblio;
7
use C4::Biblio;
8
use C4::Bookseller;
9
use C4::Budgets;
8
use C4::Budgets;
10
use MARC::Record;
9
use MARC::Record;
11
use Koha::Database;
10
use Koha::Database;
12
use Koha::DateUtils qw( dt_from_string output_pref );
11
use Koha::DateUtils qw( dt_from_string output_pref );
12
use Koha::Acquisition::Booksellers;
13
use Koha::Acquisition::Order;
13
use Koha::Acquisition::Order;
14
14
15
my $schema = Koha::Database->new()->schema();
15
my $schema = Koha::Database->new()->schema();
Lines 17-33 $schema->storage->txn_begin(); Link Here
17
my $dbh = C4::Context->dbh;
17
my $dbh = C4::Context->dbh;
18
$dbh->{RaiseError} = 1;
18
$dbh->{RaiseError} = 1;
19
19
20
my $booksellerid = C4::Bookseller::AddBookseller(
20
my $bookseller = Koha::Acquisition::Bookseller->new(
21
    {
21
    {
22
        name => "my vendor",
22
        name => "my vendor",
23
        address1 => "bookseller's address",
23
        address1 => "bookseller's address",
24
        phone => "0123456",
24
        phone => "0123456",
25
        active => 1
25
        active => 1
26
    }
26
    }
27
);
27
)->store;
28
28
29
my $basketno = C4::Acquisition::NewBasket(
29
my $basketno = C4::Acquisition::NewBasket(
30
    $booksellerid
30
    $bookseller->id
31
);
31
);
32
32
33
my $budgetid = C4::Budgets::AddBudget(
33
my $budgetid = C4::Budgets::AddBudget(
Lines 87-90 $order = Koha::Acquisition::Order->fetch({ ordernumber => $ordernumber }); Link Here
87
is( $order->{quantityreceived}, 0, 'Koha::Acquisition::Order->insert set quantityreceivedto 0 if undef is given' );
87
is( $order->{quantityreceived}, 0, 'Koha::Acquisition::Order->insert set quantityreceivedto 0 if undef is given' );
88
is( $order->{entrydate}, output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), 'Koha::Acquisition::Order->insert set entrydate to today' );
88
is( $order->{entrydate}, output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), 'Koha::Acquisition::Order->insert set entrydate to today' );
89
89
90
$schema->storage->txn_rollback();
90
$schema->storage->txn_rollback();
(-)a/t/db_dependent/Acquisition/OrderFromSubscription.t (-6 / +5 lines)
Lines 1-10 Link Here
1
use Modern::Perl;
1
use Modern::Perl;
2
2
3
use Test::More tests => 13;
3
use Test::More tests => 12;
4
4
5
use_ok('C4::Acquisition');
5
use_ok('C4::Acquisition');
6
use_ok('C4::Biblio');
6
use_ok('C4::Biblio');
7
use_ok('C4::Bookseller');
8
use_ok('C4::Budgets');
7
use_ok('C4::Budgets');
9
use_ok('C4::Serials');
8
use_ok('C4::Serials');
10
9
Lines 17-30 $schema->storage->txn_begin(); Link Here
17
my $dbh = C4::Context->dbh;
16
my $dbh = C4::Context->dbh;
18
$dbh->{RaiseError} = 1;
17
$dbh->{RaiseError} = 1;
19
18
20
my $booksellerid = C4::Bookseller::AddBookseller(
19
my $bookseller = Koha::Acquisition::Bookseller->new(
21
    {
20
    {
22
        name => "my vendor",
21
        name => "my vendor",
23
        address1 => "bookseller's address",
22
        address1 => "bookseller's address",
24
        phone => "0123456",
23
        phone => "0123456",
25
        active => 1
24
        active => 1
26
    }
25
    }
27
);
26
)->store;
28
27
29
my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, '');
28
my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, '');
30
my $budgetid;
29
my $budgetid;
Lines 53-59 my $subscriptionid = NewSubscription( Link Here
53
die unless $subscriptionid;
52
die unless $subscriptionid;
54
53
55
my ($basket, $basketno);
54
my ($basket, $basketno);
56
ok($basketno = NewBasket($booksellerid, 1), "NewBasket(  $booksellerid , 1  ) returns $basketno");
55
ok($basketno = NewBasket($bookseller->id, 1), "NewBasket(  " . $bookseller->id . ", 1  ) returns $basketno");
57
56
58
my $cost = 42.00;
57
my $cost = 42.00;
59
my $subscription = GetSubscription( $subscriptionid );
58
my $subscription = GetSubscription( $subscriptionid );
Lines 83-89 is ( $order->{subscriptionid}, $subscription->{subscriptionid}, "test subscripti Link Here
83
ok( $order->{ecost} == $cost, "test cost for the last order not received");
82
ok( $order->{ecost} == $cost, "test cost for the last order not received");
84
83
85
$dbh->do(q{DELETE FROM aqinvoices});
84
$dbh->do(q{DELETE FROM aqinvoices});
86
my $invoiceid = AddInvoice(invoicenumber => 'invoice1', booksellerid => $booksellerid, unknown => "unknown");
85
my $invoiceid = AddInvoice(invoicenumber => 'invoice1', booksellerid => $bookseller->id, unknown => "unknown");
87
86
88
my $invoice = GetInvoice( $invoiceid );
87
my $invoice = GetInvoice( $invoiceid );
89
$invoice->{datereceived} = '02-01-2013';
88
$invoice->{datereceived} = '02-01-2013';
(-)a/t/db_dependent/Acquisition/OrderUsers.t (-5 / +5 lines)
Lines 3-12 use Test::More tests => 3; Link Here
3
3
4
use C4::Acquisition;
4
use C4::Acquisition;
5
use C4::Biblio;
5
use C4::Biblio;
6
use C4::Bookseller;
7
use C4::Letters;
6
use C4::Letters;
8
use Koha::Database;
7
use Koha::Database;
9
use Koha::Acquisition::Order;
8
use Koha::Acquisition::Order;
9
use Koha::Acquisition::Booksellers;
10
10
11
use t::lib::TestBuilder;
11
use t::lib::TestBuilder;
12
12
Lines 19-34 my $library = $builder->build({ Link Here
19
});
19
});
20
20
21
# Creating some orders
21
# Creating some orders
22
my $booksellerid = C4::Bookseller::AddBookseller(
22
my $bookseller = Koha::Acquisition::Bookseller->new(
23
    {
23
    {
24
        name         => "my vendor",
24
        name         => "my vendor",
25
        address1     => "bookseller's address",
25
        address1     => "bookseller's address",
26
        phone        => "0123456",
26
        phone        => "0123456",
27
        active       => 1,
27
        active       => 1,
28
    }
28
    }
29
);
29
)->store;
30
30
31
my $basketno = NewBasket( $booksellerid, 1 );
31
my $basketno = NewBasket( $bookseller->id, 1 );
32
32
33
my $budgetid = C4::Budgets::AddBudget(
33
my $budgetid = C4::Budgets::AddBudget(
34
    {
34
    {
Lines 61-67 my $ordernumber = $order->{ordernumber}; Link Here
61
61
62
my $invoiceid = AddInvoice(
62
my $invoiceid = AddInvoice(
63
    invoicenumber => 'invoice',
63
    invoicenumber => 'invoice',
64
    booksellerid  => $booksellerid,
64
    booksellerid  => $bookseller->id,
65
    unknown       => "unknown"
65
    unknown       => "unknown"
66
);
66
);
67
67
(-)a/t/db_dependent/Acquisition/StandingOrders.t (-1 lines)
Lines 7-13 use C4::Context; Link Here
7
use C4::Acquisition;
7
use C4::Acquisition;
8
use C4::Biblio;
8
use C4::Biblio;
9
use C4::Items;
9
use C4::Items;
10
use C4::Bookseller;
11
use C4::Budgets;
10
use C4::Budgets;
12
use Koha::Acquisition::Order;
11
use Koha::Acquisition::Order;
13
use t::lib::Mocks;
12
use t::lib::Mocks;
(-)a/t/db_dependent/Acquisition/TransferOrder.t (-7 / +7 lines)
Lines 7-16 use C4::Context; Link Here
7
use C4::Acquisition;
7
use C4::Acquisition;
8
use C4::Biblio;
8
use C4::Biblio;
9
use C4::Items;
9
use C4::Items;
10
use C4::Bookseller;
11
use C4::Budgets;
10
use C4::Budgets;
12
use Koha::Database;
11
use Koha::Database;
13
use Koha::DateUtils;
12
use Koha::DateUtils;
13
use Koha::Acquisition::Booksellers;
14
use Koha::Acquisition::Order;
14
use Koha::Acquisition::Order;
15
use MARC::Record;
15
use MARC::Record;
16
16
Lines 20-49 $schema->storage->txn_begin(); Link Here
20
my $dbh = C4::Context->dbh;
20
my $dbh = C4::Context->dbh;
21
$dbh->{RaiseError} = 1;
21
$dbh->{RaiseError} = 1;
22
22
23
my $booksellerid1 = C4::Bookseller::AddBookseller(
23
my $bookseller1 = Koha::Acquisition::Bookseller->new(
24
    {
24
    {
25
        name => "my vendor 1",
25
        name => "my vendor 1",
26
        address1 => "bookseller's address",
26
        address1 => "bookseller's address",
27
        phone => "0123456",
27
        phone => "0123456",
28
        active => 1
28
        active => 1
29
    }
29
    }
30
);
30
)->store;
31
31
32
my $basketno1 = C4::Acquisition::NewBasket(
32
my $basketno1 = C4::Acquisition::NewBasket(
33
    $booksellerid1
33
    $bookseller1->id
34
);
34
);
35
35
36
my $booksellerid2 = C4::Bookseller::AddBookseller(
36
my $bookseller2 = Koha::Acquisition::Bookseller->new(
37
    {
37
    {
38
        name => "my vendor 2",
38
        name => "my vendor 2",
39
        address1 => "bookseller's address",
39
        address1 => "bookseller's address",
40
        phone => "0123456",
40
        phone => "0123456",
41
        active => 1
41
        active => 1
42
    }
42
    }
43
);
43
)->store;
44
44
45
my $basketno2 = C4::Acquisition::NewBasket(
45
my $basketno2 = C4::Acquisition::NewBasket(
46
    $booksellerid2
46
    $bookseller2->id
47
);
47
);
48
48
49
my $budgetid = C4::Budgets::AddBudget(
49
my $budgetid = C4::Budgets::AddBudget(
(-)a/t/db_dependent/Acquisition/close_reopen_basket.t (-4 / +4 lines)
Lines 5-14 use Modern::Perl; Link Here
5
use Test::More tests => 6;
5
use Test::More tests => 6;
6
use C4::Acquisition;
6
use C4::Acquisition;
7
use C4::Biblio qw( AddBiblio DelBiblio );
7
use C4::Biblio qw( AddBiblio DelBiblio );
8
use C4::Bookseller;
9
use C4::Budgets;
8
use C4::Budgets;
10
use C4::Context;
9
use C4::Context;
11
use Koha::Database;
10
use Koha::Database;
11
use Koha::Acquisition::Bookseller;
12
use Koha::Acquisition::Order;
12
use Koha::Acquisition::Order;
13
13
14
# Start transaction
14
# Start transaction
Lines 22-38 $dbh->do(q{ Link Here
22
    DELETE FROM aqorders;
22
    DELETE FROM aqorders;
23
});
23
});
24
24
25
my $booksellerid = C4::Bookseller::AddBookseller(
25
my $bookseller = Koha::Acquisition::Bookseller->new(
26
    {
26
    {
27
        name => "my vendor",
27
        name => "my vendor",
28
        address1 => "bookseller's address",
28
        address1 => "bookseller's address",
29
        phone => "0123456",
29
        phone => "0123456",
30
        active => 1
30
        active => 1
31
    }
31
    }
32
);
32
)->store;
33
33
34
my $basketno = C4::Acquisition::NewBasket(
34
my $basketno = C4::Acquisition::NewBasket(
35
    $booksellerid
35
    $bookseller->id
36
);
36
);
37
37
38
my $budgetid = C4::Budgets::AddBudget(
38
my $budgetid = C4::Budgets::AddBudget(
(-)a/t/db_dependent/AdditionalField.t (-10 lines)
Lines 3-9 Link Here
3
use Modern::Perl;
3
use Modern::Perl;
4
use Test::More tests => 40;
4
use Test::More tests => 40;
5
5
6
use C4::Bookseller qw( AddBookseller );
7
use C4::Context;
6
use C4::Context;
8
use Koha::AdditionalField;
7
use Koha::AdditionalField;
9
8
Lines 108-122 use C4::Serials; Link Here
108
use C4::Serials::Frequency;
107
use C4::Serials::Frequency;
109
use C4::Serials::Numberpattern;
108
use C4::Serials::Numberpattern;
110
109
111
my $booksellerid = C4::Bookseller::AddBookseller(
112
    {
113
        name => "my vendor",
114
        address1 => "bookseller's address",
115
        phone => "0123456",
116
        active => 1
117
    }
118
);
119
120
my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, '');
110
my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, '');
121
my $budgetid;
111
my $budgetid;
122
my $bpid = AddBudgetPeriod({
112
my $bpid = AddBudgetPeriod({
(-)a/t/db_dependent/Bookseller.t (-92 / +98 lines)
Lines 21-35 use Koha::Database; Link Here
21
BEGIN {
21
BEGIN {
22
    use_ok('C4::Bookseller');
22
    use_ok('C4::Bookseller');
23
    use_ok('Koha::Acquisition::Bookseller');
23
    use_ok('Koha::Acquisition::Bookseller');
24
    use_ok('Koha::Acquisition::Booksellers');
24
}
25
}
25
26
26
can_ok(
27
can_ok(
27
28
28
    'C4::Bookseller', qw(
29
    'C4::Bookseller', qw(
29
      AddBookseller
30
      DelBookseller
31
      GetBooksellersWithLateOrders
30
      GetBooksellersWithLateOrders
32
      ModBookseller )
31
    )
33
);
32
);
34
33
35
#Start transaction
34
#Start transaction
Lines 47-53 $dbh->do(q|DELETE FROM aqbooksellers|); Link Here
47
$dbh->do(q|DELETE FROM subscription|);
46
$dbh->do(q|DELETE FROM subscription|);
48
47
49
#Test AddBookseller
48
#Test AddBookseller
50
my $count            = scalar( Koha::Acquisition::Bookseller->search() );
49
my $count            = Koha::Acquisition::Booksellers->search()->count();
51
my $sample_supplier1 = {
50
my $sample_supplier1 = {
52
    name          => 'Name1',
51
    name          => 'Name1',
53
    address1      => 'address1_1',
52
    address1      => 'address1_1',
Lines 89-125 my $sample_supplier2 = { Link Here
89
    deliverytime  => 2
88
    deliverytime  => 2
90
};
89
};
91
90
92
my $id_supplier1 = C4::Bookseller::AddBookseller($sample_supplier1);
91
my $supplier1 = Koha::Acquisition::Bookseller->new($sample_supplier1)->store;
93
my $id_supplier2 = C4::Bookseller::AddBookseller($sample_supplier2);
92
my $id_supplier1 = $supplier1->id;
94
93
my $supplier2 = Koha::Acquisition::Bookseller->new($sample_supplier2)->store;
95
#my $id_bookseller3 = C4::Bookseller::AddBookseller();# NOTE : Doesn't work because the field name cannot be null
94
my $id_supplier2 = $supplier2->id;
96
95
97
like( $id_supplier1, '/^\d+$/', "AddBookseller for supplier1 return an id" );
96
like( $id_supplier1, '/^\d+$/', "AddBookseller for supplier1 return an id" );
98
like( $id_supplier2, '/^\d+$/', "AddBookseller for supplier2 return an id" );
97
like( $id_supplier2, '/^\d+$/', "AddBookseller for supplier2 return an id" );
99
my @b = Koha::Acquisition::Bookseller->search();
98
is( Koha::Acquisition::Booksellers->search()->count,
100
is ( scalar(@b),
101
    $count + 2, "Supplier1 and Supplier2 have been added" );
99
    $count + 2, "Supplier1 and Supplier2 have been added" );
102
100
103
#Test DelBookseller
101
#Test DelBookseller
104
my $del = C4::Bookseller::DelBookseller($id_supplier1);
102
my $del = $supplier1->delete;
105
is( $del, 1, "DelBookseller returns 1 - 1 supplier has been deleted " );
103
is( $del, 1, "DelBookseller returns 1 - 1 supplier has been deleted " );
106
my $b = Koha::Acquisition::Bookseller->fetch({id => $id_supplier1});
104
my $b = Koha::Acquisition::Booksellers->find( $id_supplier1 );
107
is( $b,
105
is( $b,
108
    undef, "Supplier1  has been deleted - id_supplier1 $id_supplier1 doesnt exist anymore" );
106
    undef, "Supplier1  has been deleted - id_supplier1 $id_supplier1 doesnt exist anymore" );
109
107
110
#Test get bookseller
108
#Test get bookseller
111
my @bookseller2 = Koha::Acquisition::Bookseller->search({name => $sample_supplier2->{name} });
109
my @bookseller2 = Koha::Acquisition::Booksellers->search({name => $sample_supplier2->{name} });
112
is( scalar(@bookseller2), 1, "Get only  Supplier2" );
110
is( scalar(@bookseller2), 1, "Get only  Supplier2" );
113
$bookseller2[0] = field_filter( $bookseller2[0] );
111
for my $bookseller ( @bookseller2 ) {
112
    $bookseller = field_filter( $bookseller->unblessed );
113
}
114
114
115
$sample_supplier2->{id} = $id_supplier2;
115
$sample_supplier2->{id} = $id_supplier2;
116
is_deeply( $bookseller2[0], $sample_supplier2,
116
is_deeply( $bookseller2[0], $sample_supplier2,
117
    "Koha::Acquisition::Bookseller->search returns the right informations about $sample_supplier2" );
117
    "Koha::Acquisition::Booksellers->search returns the right informations about supplier $sample_supplier2->{name}" );
118
118
119
$id_supplier1 = C4::Bookseller::AddBookseller($sample_supplier1);
119
$supplier1 = Koha::Acquisition::Bookseller->new($sample_supplier1)->store;
120
my @booksellers = Koha::Acquisition::Bookseller->search(); #NOTE :without params, it returns all the booksellers
120
$id_supplier1 = $supplier1->id;
121
for my $i ( 0 .. scalar(@booksellers) - 1 ) {
121
my @booksellers = Koha::Acquisition::Booksellers->search();
122
    $booksellers[$i] = field_filter( $booksellers[$i] );
122
for my $bookseller ( @booksellers ) {
123
    $bookseller = field_filter( $bookseller->unblessed );
123
}
124
}
124
125
125
$sample_supplier1->{id} = $id_supplier1;
126
$sample_supplier1->{id} = $id_supplier1;
Lines 128-157 my @tab = ( $sample_supplier1, $sample_supplier2 ); Link Here
128
is_deeply( \@booksellers, \@tab,
129
is_deeply( \@booksellers, \@tab,
129
    "Returns right fields of Supplier1 and Supplier2" );
130
    "Returns right fields of Supplier1 and Supplier2" );
130
131
131
#Test basket_count
132
#Test baskets
132
my @bookseller1 = Koha::Acquisition::Bookseller->search({name => $sample_supplier1->{name} });
133
my @bookseller1 = Koha::Acquisition::Booksellers->search({name => $sample_supplier1->{name} });
133
is( $bookseller1[0]->basket_count, 0, 'Supplier1 has 0 basket' );
134
is( $bookseller1[0]->baskets->count, 0, 'Supplier1 has 0 basket' );
134
my $basketno1 =
135
my $basketno1 =
135
  C4::Acquisition::NewBasket( $id_supplier1, 'authorisedby1', 'basketname1' );
136
  C4::Acquisition::NewBasket( $id_supplier1, 'authorisedby1', 'basketname1' );
136
my $basketno2 =
137
my $basketno2 =
137
  C4::Acquisition::NewBasket( $id_supplier1, 'authorisedby2', 'basketname2' );
138
  C4::Acquisition::NewBasket( $id_supplier1, 'authorisedby2', 'basketname2' );
138
@bookseller1 = Koha::Acquisition::Bookseller::search({ name => $sample_supplier1->{name} });
139
@bookseller1 = Koha::Acquisition::Booksellers->search({ name => $sample_supplier1->{name} });
139
is( $bookseller1[0]->basket_count, 2, 'Supplier1 has 2 baskets' );
140
is( $bookseller1[0]->baskets->count, 2, 'Supplier1 has 2 baskets' );
140
141
141
#Test Koha::Acquisition::Bookseller->new using id
142
#Test Koha::Acquisition::Bookseller->new using id
142
my $bookseller1fromid = Koha::Acquisition::Bookseller->fetch;
143
my $bookseller1fromid = Koha::Acquisition::Booksellers->find;
143
is( $bookseller1fromid, undef,
144
is( $bookseller1fromid, undef,
144
    "fetch returns undef if no id given" );
145
    "find returns undef if no id given" );
145
$bookseller1fromid = Koha::Acquisition::Bookseller->fetch({ id => $id_supplier1});
146
$bookseller1fromid = Koha::Acquisition::Booksellers->find( $id_supplier1 );
146
$bookseller1fromid = field_filter($bookseller1fromid);
147
$bookseller1fromid = field_filter($bookseller1fromid->unblessed);
147
is_deeply( $bookseller1fromid, $sample_supplier1,
148
is_deeply( $bookseller1fromid, $sample_supplier1,
148
    "Get Supplier1 (fetch a bookseller by id)" );
149
    "Get Supplier1 (find a bookseller by id)" );
149
150
150
#Test basket_count
151
$bookseller1fromid = Koha::Acquisition::Booksellers->find( $id_supplier1 );
151
$bookseller1fromid = Koha::Acquisition::Bookseller->fetch({ id => $id_supplier1});
152
is( $bookseller1fromid->baskets->count, 2, 'Supplier1 has 2 baskets' );
152
is( $bookseller1fromid->basket_count, 2, 'Supplier1 has 2 baskets' );
153
153
154
#Test subscription_count
154
#Test subscriptions
155
my $dt_today    = dt_from_string;
155
my $dt_today    = dt_from_string;
156
my $today       = output_pref({ dt => $dt_today, dateformat => 'iso', timeformat => '24hr', dateonly => 1 });
156
my $today       = output_pref({ dt => $dt_today, dateformat => 'iso', timeformat => '24hr', dateonly => 1 });
157
157
Lines 178-185 $bib->append_fields( Link Here
178
    MARC::Field->new('500', ' ', ' ', a => 'bib notes'),
178
    MARC::Field->new('500', ' ', ' ', a => 'bib notes'),
179
);
179
);
180
my ($biblionumber, $biblioitemnumber) = AddBiblio($bib, '');
180
my ($biblionumber, $biblioitemnumber) = AddBiblio($bib, '');
181
$bookseller1fromid = Koha::Acquisition::Bookseller->fetch({ id => $id_supplier1 });
181
$bookseller1fromid = Koha::Acquisition::Booksellers->find( $id_supplier1 );
182
is( $bookseller1fromid->subscription_count,
182
is( $bookseller1fromid->subscriptions->count,
183
    0, 'Supplier1 has 0 subscription' );
183
    0, 'Supplier1 has 0 subscription' );
184
184
185
my $id_subscription1 = NewSubscription(
185
my $id_subscription1 = NewSubscription(
Lines 203-210 my $id_subscription2 = NewSubscription( Link Here
203
    undef, undef, 0,          undef,         '2013-07-31', 0
203
    undef, undef, 0,          undef,         '2013-07-31', 0
204
);
204
);
205
205
206
$bookseller1fromid = Koha::Acquisition::Bookseller->fetch({ id => $id_supplier1 });
206
$bookseller1fromid = Koha::Acquisition::Booksellers->find( $id_supplier1 );
207
is( $bookseller1fromid->subscription_count,
207
is( $bookseller1fromid->subscriptions->count,
208
    2, 'Supplier1 has 2 subscriptions' );
208
    2, 'Supplier1 has 2 subscriptions' );
209
209
210
#Test ModBookseller
210
#Test ModBookseller
Lines 230-251 $sample_supplier2 = { Link Here
230
    deliverytime  => 2,
230
    deliverytime  => 2,
231
};
231
};
232
232
233
my $modif1 = C4::Bookseller::ModBookseller();
233
my $modif1 = Koha::Acquisition::Booksellers->find($id_supplier2)->set($sample_supplier2)->store;
234
is( $modif1, undef,
234
is( ref $modif1, 'Koha::Acquisition::Bookseller', "ModBookseller has updated the bookseller" );
235
    "ModBookseller returns undef if no params given - Nothing happened" );
235
is( Koha::Acquisition::Booksellers->search->count,
236
$modif1 = C4::Bookseller::ModBookseller($sample_supplier2);
237
is( $modif1, 1, "ModBookseller modifies only the supplier2" );
238
is( scalar( Koha::Acquisition::Bookseller->search ),
239
    $count + 2, "Supplier2 has been modified - Nothing added" );
236
    $count + 2, "Supplier2 has been modified - Nothing added" );
240
237
$supplier2 = Koha::Acquisition::Booksellers->find($id_supplier2);
241
$modif1 = C4::Bookseller::ModBookseller(
238
is( $supplier2->name, 'Name2 modified', "supplier's name should have been modified" );
242
    {
243
        id   => -1,
244
        name => 'name3'
245
    }
246
);
247
#is( $modif1, '0E0',
248
#    "ModBookseller returns OEO if the id doesnt exist - Nothing modified" );
249
239
250
#Test GetBooksellersWithLateOrders
240
#Test GetBooksellersWithLateOrders
251
#Add 2 suppliers
241
#Add 2 suppliers
Lines 288-295 my $sample_supplier4 = { Link Here
288
    discount      => '3.0000',
278
    discount      => '3.0000',
289
    notes         => 'notes3',
279
    notes         => 'notes3',
290
};
280
};
291
my $id_supplier3 = C4::Bookseller::AddBookseller($sample_supplier3);
281
my $supplier3 = Koha::Acquisition::Bookseller->new($sample_supplier3)->store;
292
my $id_supplier4 = C4::Bookseller::AddBookseller($sample_supplier4);
282
my $id_supplier3 = $supplier3->id;
283
my $supplier4 = Koha::Acquisition::Bookseller->new($sample_supplier4)->store;
284
my $id_supplier4 = $supplier4->id;
293
285
294
#Add 2 baskets
286
#Add 2 baskets
295
my $basketno3 =
287
my $basketno3 =
Lines 681-749 is( Link Here
681
    3,
673
    3,
682
    'superlibrarian can see all subscriptions with IndependentBranches on (bug 12048)'
674
    'superlibrarian can see all subscriptions with IndependentBranches on (bug 12048)'
683
);
675
);
676
684
#Test contact editing
677
#Test contact editing
685
my $booksellerid = C4::Bookseller::AddBookseller(
678
my $sample_supplier = {
686
    {
687
        name     => "my vendor",
679
        name     => "my vendor",
688
        address1 => "bookseller's address",
680
        address1 => "bookseller's address",
689
        phone    => "0123456",
681
        phone    => "0123456",
690
        active   => 1
682
        active   => 1
691
    },
683
    };
692
    [
684
my $supplier = Koha::Acquisition::Bookseller->new($sample_supplier)->store;
693
        { name => 'John Smith',  phone => '0123456x1' },
685
my $booksellerid = $supplier->id;
694
        { name => 'Leo Tolstoy', phone => '0123456x2' },
686
my $contact1 = Koha::Acquisition::Bookseller::Contact->new({
695
    ]
687
        name => 'John Smith',
696
);
688
        phone => '0123456x1',
697
689
        booksellerid => $booksellerid,
698
@booksellers = Koha::Acquisition::Bookseller->search({ name => 'my vendor' });
690
})->store;
691
my $contact2 = Koha::Acquisition::Bookseller::Contact->new({
692
        name => 'Leo Tolstoy',
693
        phone => '0123456x2',
694
        booksellerid => $booksellerid,
695
})->store;
696
697
@booksellers = Koha::Acquisition::Booksellers->search({ name => 'my vendor' });
699
ok(
698
ok(
700
    ( grep { $_->{'id'} == $booksellerid } @booksellers ),
699
    ( grep { $_->id == $booksellerid } @booksellers ),
701
    'Koha::Acquisition::Bookseller->search returns correct record when passed a name'
700
    'Koha::Acquisition::Booksellers->search returns correct record when passed a name'
702
);
701
);
703
702
704
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
703
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
705
is( $bookseller->{'id'}, $booksellerid, 'Retrieved desired record' );
704
is( $bookseller->id, $booksellerid, 'Retrieved desired record' );
706
is( $bookseller->{'phone'}, '0123456', 'New bookseller has expected phone' );
705
is( $bookseller->phone, '0123456', 'New bookseller has expected phone' );
707
my $contacts = $bookseller->contacts;
706
my $contacts = $bookseller->contacts;
708
is( ref $bookseller->contacts,
707
is( $contacts->count,
709
    'ARRAY', 'Koha::Acquisition::Bookseller->fetch returns arrayref of contacts' );
708
    2, 'bookseller should have 2 contacts' );
709
my $first_contact = $contacts->next;
710
is(
710
is(
711
    ref $bookseller->{'contacts'}->[0],
711
    ref $first_contact,
712
    'C4::Bookseller::Contact',
712
    'Koha::Acquisition::Bookseller::Contact',
713
    'First contact is a contact object'
713
    'First contact is a AqContact'
714
);
714
);
715
is( $bookseller->{'contacts'}->[0]->phone,
715
is( $first_contact->phone,
716
    '0123456x1', 'Contact has expected phone number' );
716
    '0123456x1', 'Contact has expected phone number' );
717
is( scalar @{ $bookseller->{'contacts'} }, 2, 'Saved two contacts' );
718
717
719
pop @{ $bookseller->{'contacts'} };
718
my $second_contact = $contacts->next;
720
$bookseller->{'name'} = 'your vendor';
719
$second_contact->delete;
721
$bookseller->{'contacts'}->[0]->phone('654321');
720
$bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
722
C4::Bookseller::ModBookseller($bookseller);
721
$bookseller->name('your vendor');
723
724
$bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
725
$contacts = $bookseller->contacts;
722
$contacts = $bookseller->contacts;
726
is( $bookseller->{'name'}, 'your vendor',
723
$first_contact = $contacts->next;
724
$first_contact->phone('654321');
725
$bookseller->store;
726
727
$bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
728
is( $bookseller->name, 'your vendor',
727
    'Successfully changed name of vendor' );
729
    'Successfully changed name of vendor' );
728
is( $contacts->[0]->phone,
730
$contacts = $bookseller->contacts;
731
is( $contacts->count,
732
    1, 'Only one contact after modification' );
733
$first_contact = $contacts->next;
734
is( $first_contact->phone,
729
    '654321',
735
    '654321',
730
    'Successfully changed contact phone number by modifying bookseller hash' );
736
    'Successfully changed contact phone number by modifying bookseller hash' );
731
is( scalar @$contacts,
732
    1, 'Only one contact after modification' );
733
737
734
C4::Bookseller::ModBookseller( $bookseller,
738
$first_contact->name( 'John Jacob Jingleheimer Schmidt' );
735
    [ { name => 'John Jacob Jingleheimer Schmidt' } ] );
739
$first_contact->phone(undef);
740
$bookseller->store;
736
741
737
$bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
742
$bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
738
$contacts = $bookseller->contacts;
743
$contacts = $bookseller->contacts;
744
$first_contact = $contacts->next;
739
is(
745
is(
740
    $contacts->[0]->name,
746
    $first_contact->name,
741
    'John Jacob Jingleheimer Schmidt',
747
    'John Jacob Jingleheimer Schmidt',
742
    'Changed name of contact'
748
    'Changed name of contact'
743
);
749
);
744
is( $contacts->[0]->phone,
750
is( $first_contact->phone,
745
    undef, 'Removed phone number from contact' );
751
    undef, 'Removed phone number from contact' );
746
is( scalar @$contacts,
752
is( $contacts->count,
747
    1, 'Only one contact after modification' );
753
    1, 'Only one contact after modification' );
748
754
749
#End transaction
755
#End transaction
(-)a/t/db_dependent/Budgets.t (-3 / +4 lines)
Lines 7-17 BEGIN { Link Here
7
}
7
}
8
use C4::Context;
8
use C4::Context;
9
use C4::Biblio;
9
use C4::Biblio;
10
use C4::Bookseller;
11
use C4::Acquisition;
10
use C4::Acquisition;
12
use C4::Members qw( AddMember );
11
use C4::Members qw( AddMember );
13
12
14
use Koha::Acquisition::Order;
13
use Koha::Acquisition::Order;
14
use Koha::Acquisition::Booksellers;
15
15
16
use t::lib::TestBuilder;
16
use t::lib::TestBuilder;
17
17
Lines 270-276 my $budget_id21 = AddBudget( Link Here
270
    }
270
    }
271
);
271
);
272
272
273
my $booksellerid = C4::Bookseller::AddBookseller(
273
my $bookseller = Koha::Acquisition::Bookseller->new(
274
    {
274
    {
275
        name         => "my vendor",
275
        name         => "my vendor",
276
        address1     => "bookseller's address",
276
        address1     => "bookseller's address",
Lines 278-284 my $booksellerid = C4::Bookseller::AddBookseller( Link Here
278
        active       => 1,
278
        active       => 1,
279
        deliverytime => 5,
279
        deliverytime => 5,
280
    }
280
    }
281
);
281
)->store;
282
my $booksellerid = $bookseller->id;
282
283
283
my $basketno = C4::Acquisition::NewBasket( $booksellerid, 1 );
284
my $basketno = C4::Acquisition::NewBasket( $booksellerid, 1 );
284
my ( $biblionumber, $biblioitemnumber ) =
285
my ( $biblionumber, $biblioitemnumber ) =
(-)a/t/db_dependent/Contract.t (-3 / +4 lines)
Lines 20-26 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use C4::Context;
22
use C4::Context;
23
use C4::Bookseller;
24
use Koha::DateUtils;
23
use Koha::DateUtils;
25
24
26
use DateTime::Duration;
25
use DateTime::Duration;
Lines 40-48 $dbh->do(q|DELETE FROM aqcontract|); Link Here
40
$dbh->do(q|DELETE FROM aqbooksellers|);
39
$dbh->do(q|DELETE FROM aqbooksellers|);
41
40
42
41
43
my $bookseller_id1 = C4::Bookseller::AddBookseller( { name => 'My first bookseller' } );
42
my $bookseller1 = Koha::Acquisition::Bookseller->new( { name => 'My first bookseller' } )->store;
43
my $bookseller_id1 = $bookseller1->id;
44
isnt( $bookseller_id1, undef, 'AddBookseller does not return undef' );
44
isnt( $bookseller_id1, undef, 'AddBookseller does not return undef' );
45
my $bookseller_id2 = C4::Bookseller::AddBookseller( { name => 'My second bookseller' } );
45
my $bookseller2 = Koha::Acquisition::Bookseller->new( { name => 'My second bookseller' } )->store;
46
my $bookseller_id2 = $bookseller2->id;
46
isnt( $bookseller_id2, undef, 'AddBookseller does not return undef' );
47
isnt( $bookseller_id2, undef, 'AddBookseller does not return undef' );
47
my $contracts = GetContracts();
48
my $contracts = GetContracts();
48
is( @$contracts, 0, 'GetContracts returns the correct number of contracts' );
49
is( @$contracts, 0, 'GetContracts returns the correct number of contracts' );
(-)a/t/db_dependent/Letters.t (-11 / +10 lines)
Lines 38-51 use_ok('C4::Context'); Link Here
38
use_ok('C4::Members');
38
use_ok('C4::Members');
39
use_ok('C4::Acquisition');
39
use_ok('C4::Acquisition');
40
use_ok('C4::Biblio');
40
use_ok('C4::Biblio');
41
use_ok('C4::Bookseller');
42
use_ok('C4::Letters');
41
use_ok('C4::Letters');
43
use t::lib::Mocks;
42
use t::lib::Mocks;
44
use t::lib::TestBuilder;
43
use t::lib::TestBuilder;
45
use Koha::Database;
44
use Koha::Database;
46
use Koha::DateUtils qw( dt_from_string output_pref );
45
use Koha::DateUtils qw( dt_from_string output_pref );
47
use Koha::Acquisition::Order;
46
use Koha::Acquisition::Order;
48
use Koha::Acquisition::Bookseller;
47
use Koha::Acquisition::Booksellers;
49
use Koha::Libraries;
48
use Koha::Libraries;
50
my $schema = Koha::Database->schema;
49
my $schema = Koha::Database->schema;
51
$schema->storage->txn_begin();
50
$schema->storage->txn_begin();
Lines 366-384 $dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('orde Link Here
366
    is( $values->{dateexpiry}, '2015-12-13', "_parseletter doesn't modify its parameters" );
365
    is( $values->{dateexpiry}, '2015-12-13', "_parseletter doesn't modify its parameters" );
367
}
366
}
368
367
369
my $booksellerid = C4::Bookseller::AddBookseller(
368
my $bookseller = Koha::Acquisition::Bookseller->new(
370
    {
369
    {
371
        name => "my vendor",
370
        name => "my vendor",
372
        address1 => "bookseller's address",
371
        address1 => "bookseller's address",
373
        phone => "0123456",
372
        phone => "0123456",
374
        active => 1,
373
        active => 1,
375
        deliverytime => 5,
374
        deliverytime => 5,
376
    },
375
    }
377
    [
376
)->store;
378
        { name => 'John Smith', acqprimary => 1, phone => '0123456x1', claimacquisition => 1, orderacquisition => 1 },
377
my $booksellerid = $bookseller->id;
379
        { name => 'Leo Tolstoy', phone => '0123456x2', claimissues => 1 },
378
380
    ]
379
Koha::Acquisition::Bookseller::Contact->new( { name => 'John Smith',  phone => '0123456x1', claimacquisition => 1, booksellerid => $booksellerid } )->store;
381
);
380
Koha::Acquisition::Bookseller::Contact->new( { name => 'Leo Tolstoy', phone => '0123456x2', claimissues      => 1, booksellerid => $booksellerid } )->store;
382
my $basketno = NewBasket($booksellerid, 1);
381
my $basketno = NewBasket($booksellerid, 1);
383
382
384
my $budgetid = C4::Budgets::AddBudget({
383
my $budgetid = C4::Budgets::AddBudget({
Lines 416-425 warning_like { Link Here
416
    "SendAlerts prints a warning";
415
    "SendAlerts prints a warning";
417
is($err->{'error'}, 'no_email', "Trying to send an alert when there's no e-mail results in an error");
416
is($err->{'error'}, 'no_email', "Trying to send an alert when there's no e-mail results in an error");
418
417
419
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
418
my $bookseller = Koha::Acquisition::Bookseller->find( $booksellerid );
420
$bookseller->contacts->[0]->email('testemail@mydomain.com');
419
$bookseller->contacts->[0]->email('testemail@mydomain.com');
421
C4::Bookseller::ModBookseller($bookseller);
420
C4::Bookseller::ModBookseller($bookseller);
422
$bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
421
$bookseller = Koha::Acquisition::Bookseller->find( $booksellerid );
423
422
424
# Ensure that the preference 'LetterLog' is set to logging
423
# Ensure that the preference 'LetterLog' is set to logging
425
t::lib::Mocks::mock_preference( 'LetterLog', 'on' );
424
t::lib::Mocks::mock_preference( 'LetterLog', 'on' );
(-)a/t/db_dependent/Serials.t (-2 / +2 lines)
Lines 11-20 use C4::Serials; Link Here
11
use C4::Serials::Frequency;
11
use C4::Serials::Frequency;
12
use C4::Serials::Numberpattern;
12
use C4::Serials::Numberpattern;
13
use C4::Debug;
13
use C4::Debug;
14
use C4::Bookseller;
15
use C4::Biblio;
14
use C4::Biblio;
16
use C4::Budgets;
15
use C4::Budgets;
17
use Koha::DateUtils;
16
use Koha::DateUtils;
17
use Koha::Acquisition::Booksellers;
18
use t::lib::Mocks;
18
use t::lib::Mocks;
19
use Test::More tests => 48;
19
use Test::More tests => 48;
20
20
Lines 32-38 $dbh->{RaiseError} = 1; Link Here
32
my @methods = ('updateClaim');
32
my @methods = ('updateClaim');
33
can_ok('C4::Serials', @methods);
33
can_ok('C4::Serials', @methods);
34
34
35
my $booksellerid = C4::Bookseller::AddBookseller(
35
my $bookseller = Koha::Acquisition::Bookseller->new(
36
    {
36
    {
37
        name => "my vendor",
37
        name => "my vendor",
38
        address1 => "bookseller's address",
38
        address1 => "bookseller's address",
(-)a/t/db_dependent/Serials/Claims.t (-4 / +5 lines)
Lines 2-9 use Modern::Perl; Link Here
2
use Test::More tests => 17;
2
use Test::More tests => 17;
3
3
4
use C4::Acquisition;
4
use C4::Acquisition;
5
use C4::Bookseller;
6
use C4::Budgets;
5
use C4::Budgets;
6
use Koha::Acquisition::Booksellers;
7
use_ok('C4::Serials');
7
use_ok('C4::Serials');
8
8
9
use Koha::DateUtils qw( dt_from_string output_pref );
9
use Koha::DateUtils qw( dt_from_string output_pref );
Lines 74-81 my $sample_supplier2 = { Link Here
74
    deliverytime  => 2
74
    deliverytime  => 2
75
};
75
};
76
76
77
my $supplier_id1 = C4::Bookseller::AddBookseller($sample_supplier1);
77
my $supplier1 = Koha::Acquisition::Bookseller->new($sample_supplier1)->store;
78
my $supplier_id2 = C4::Bookseller::AddBookseller($sample_supplier2);
78
my $supplier2 = Koha::Acquisition::Bookseller->new($sample_supplier2)->store;
79
my $supplier_id1 = $supplier1->id;
80
my $supplier_id2 = $supplier2->id;
79
81
80
my $supplierlist = eval { GetSuppliersWithLateIssues() };
82
my $supplierlist = eval { GetSuppliersWithLateIssues() };
81
is( length($@), 0, "No SQL problem in GetSuppliersWithLateIssues" );
83
is( length($@), 0, "No SQL problem in GetSuppliersWithLateIssues" );
82
- 

Return to bug 13726