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

(-)a/C4/Acquisition.pm (-7 / +7 lines)
Lines 23-29 use Text::CSV_XS; Link Here
23
use C4::Context;
23
use C4::Context;
24
use C4::Suggestions qw( GetSuggestion GetSuggestionFromBiblionumber ModSuggestion );
24
use C4::Suggestions qw( GetSuggestion GetSuggestionFromBiblionumber ModSuggestion );
25
use C4::Biblio      qw( GetMarcFromKohaField GetMarcStructure IsMarcStructureInternal );
25
use C4::Biblio      qw( GetMarcFromKohaField GetMarcStructure IsMarcStructureInternal );
26
use C4::Contract    qw( GetContract );
27
use C4::Log         qw( logaction );
26
use C4::Log         qw( logaction );
28
use C4::Templates   qw(gettemplate);
27
use C4::Templates   qw(gettemplate);
29
use Koha::DateUtils qw( dt_from_string );
28
use Koha::DateUtils qw( dt_from_string );
Lines 31-36 use Koha::Acquisition::Baskets; Link Here
31
use Koha::Acquisition::Booksellers;
30
use Koha::Acquisition::Booksellers;
32
use Koha::Acquisition::Invoices;
31
use Koha::Acquisition::Invoices;
33
use Koha::Acquisition::Orders;
32
use Koha::Acquisition::Orders;
33
use Koha::Acquisition::Contracts;
34
use Koha::AdditionalFieldValue;
34
use Koha::AdditionalFieldValue;
35
use Koha::Biblios;
35
use Koha::Biblios;
36
use Koha::Exceptions;
36
use Koha::Exceptions;
Lines 264-270 sub GetBasketAsCSV { Link Here
264
    my ( $basketno, $cgi, $csv_profile_id ) = @_;
264
    my ( $basketno, $cgi, $csv_profile_id ) = @_;
265
    my $basket   = GetBasket($basketno);
265
    my $basket   = GetBasket($basketno);
266
    my @orders   = GetOrders($basketno);
266
    my @orders   = GetOrders($basketno);
267
    my $contract = GetContract( { contractnumber => $basket->{'contractnumber'} } );
267
    my $contract = Koha::Acquisition::Contracts->find( $basket->{'contractnumber'} );
268
268
269
    my $template = C4::Templates::gettemplate( "acqui/csv/basket.tt", "intranet", $cgi );
269
    my $template = C4::Templates::gettemplate( "acqui/csv/basket.tt", "intranet", $cgi );
270
    my @rows;
270
    my @rows;
Lines 309-315 sub GetBasketAsCSV { Link Here
309
            my $biblioitem = $biblio->biblioitem;
309
            my $biblioitem = $biblio->biblioitem;
310
            $order = { %$order, %{ $biblioitem->unblessed } };
310
            $order = { %$order, %{ $biblioitem->unblessed } };
311
            if ($contract) {
311
            if ($contract) {
312
                $order = { %$order, %$contract };
312
                $order = { %$order, %{ $contract->unblessed } };
313
            }
313
            }
314
            $order = { %$order, %$basket, %{ $biblio->unblessed } };
314
            $order = { %$order, %$basket, %{ $biblio->unblessed } };
315
            for my $field (@fields) {
315
            for my $field (@fields) {
Lines 332-338 sub GetBasketAsCSV { Link Here
332
                $biblioitem = $biblio->biblioitem;
332
                $biblioitem = $biblio->biblioitem;
333
            }
333
            }
334
            my $row = {
334
            my $row = {
335
                contractname    => $contract->{'contractname'},
335
                contractname    => $contract->contractname,
336
                ordernumber     => $order->{'ordernumber'},
336
                ordernumber     => $order->{'ordernumber'},
337
                entrydate       => $order->{'entrydate'},
337
                entrydate       => $order->{'entrydate'},
338
                isbn            => $order->{'isbn'},
338
                isbn            => $order->{'isbn'},
Lines 394-400 sub GetBasketGroupAsCSV { Link Here
394
    my @rows;
394
    my @rows;
395
    for my $basket (@$baskets) {
395
    for my $basket (@$baskets) {
396
        my @orders      = GetOrders( $basket->{basketno} );
396
        my @orders      = GetOrders( $basket->{basketno} );
397
        my $contract    = GetContract( { contractnumber => $basket->{contractnumber} } );
397
        my $contract    = Koha::Acquisition::Contracts->find( $basket->{'contractnumber'} );
398
        my $bookseller  = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} );
398
        my $bookseller  = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} );
399
        my $basketgroup = GetBasketgroup( $$basket{basketgroupid} );
399
        my $basketgroup = GetBasketgroup( $$basket{basketgroupid} );
400
400
Lines 425-432 sub GetBasketGroupAsCSV { Link Here
425
                booksellername     => $bookseller->name,
425
                booksellername     => $bookseller->name,
426
                bookselleraddress  => $bookseller->address1,
426
                bookselleraddress  => $bookseller->address1,
427
                booksellerpostal   => $bookseller->postal,
427
                booksellerpostal   => $bookseller->postal,
428
                contractnumber     => $contract->{contractnumber},
428
                contractnumber     => $contract->contractnumber,
429
                contractname       => $contract->{contractname},
429
                contractname       => $contract->contractname,
430
            };
430
            };
431
            my $temp = {
431
            my $temp = {
432
                basketgroupdeliveryplace => $basketgroup->{deliveryplace},
432
                basketgroupdeliveryplace => $basketgroup->{deliveryplace},
(-)a/acqui/basket.pl (-3 / +3 lines)
Lines 27-37 use CGI qw ( -utf8 ); Link Here
27
use C4::Acquisition
27
use C4::Acquisition
28
    qw( GetBasket CanUserManageBasket GetBasketAsCSV NewBasket NewBasketgroup ModBasket ReopenBasket ModBasketUsers GetBasketgroup GetBasketgroups GetBasketUsers GetOrders GetOrder get_rounded_price );
28
    qw( GetBasket CanUserManageBasket GetBasketAsCSV NewBasket NewBasketgroup ModBasket ReopenBasket ModBasketUsers GetBasketgroup GetBasketgroups GetBasketUsers GetOrders GetOrder get_rounded_price );
29
use C4::Budgets     qw( GetBudgetHierarchy GetBudget CanUserUseBudget );
29
use C4::Budgets     qw( GetBudgetHierarchy GetBudget CanUserUseBudget );
30
use C4::Contract    qw( GetContract );
31
use C4::Suggestions qw( GetSuggestion GetSuggestionInfoFromBiblionumber GetSuggestionInfo );
30
use C4::Suggestions qw( GetSuggestion GetSuggestionInfoFromBiblionumber GetSuggestionInfo );
32
use Koha::Biblios;
31
use Koha::Biblios;
33
use Koha::Acquisition::Baskets;
32
use Koha::Acquisition::Baskets;
34
use Koha::Acquisition::Booksellers;
33
use Koha::Acquisition::Booksellers;
34
use Koha::Acquisition::Contracts;
35
use Koha::Acquisition::Orders;
35
use Koha::Acquisition::Orders;
36
use Koha::Libraries;
36
use Koha::Libraries;
37
use C4::Letters qw( SendAlerts );
37
use C4::Letters qw( SendAlerts );
Lines 400-406 if ( $op eq 'list' ) { Link Here
400
        push @cancelledorders_loop, $line;
400
        push @cancelledorders_loop, $line;
401
    }
401
    }
402
402
403
    my $contract = GetContract( { contractnumber => $basket->{contractnumber} } );
403
    my $contract = Koha::Acquisition::Contracts->find( $basket->{contractnumber} );
404
404
405
    if ( $basket->{basketgroupid} ) {
405
    if ( $basket->{basketgroupid} ) {
406
        $basketgroup = GetBasketgroup( $basket->{basketgroupid} );
406
        $basketgroup = GetBasketgroup( $basket->{basketgroupid} );
Lines 425-431 if ( $op eq 'list' ) { Link Here
425
        basketnote            => $basket->{note},
425
        basketnote            => $basket->{note},
426
        basketbooksellernote  => $basket->{booksellernote},
426
        basketbooksellernote  => $basket->{booksellernote},
427
        basketcontractno      => $basket->{contractnumber},
427
        basketcontractno      => $basket->{contractnumber},
428
        basketcontractname    => $contract->{contractname},
428
        basketcontractname    => $contract->contractname,
429
        branches_loop         => \@branches_loop,
429
        branches_loop         => \@branches_loop,
430
        creationdate          => $basket->{creationdate},
430
        creationdate          => $basket->{creationdate},
431
        edi_order             => $edi_order,
431
        edi_order             => $edi_order,
(-)a/acqui/basketheader.pl (-1 lines)
Lines 51-57 use C4::Context; Link Here
51
use C4::Auth        qw( get_template_and_user );
51
use C4::Auth        qw( get_template_and_user );
52
use C4::Output      qw( output_html_with_http_headers );
52
use C4::Output      qw( output_html_with_http_headers );
53
use C4::Acquisition qw( GetBasket ModBasket ModBasketHeader NewBasket );
53
use C4::Acquisition qw( GetBasket ModBasket ModBasketHeader NewBasket );
54
use C4::Contract    qw( GetContract );
55
54
56
use Koha::Acquisition::Booksellers;
55
use Koha::Acquisition::Booksellers;
57
use Koha::Acquisition::Baskets;
56
use Koha::Acquisition::Baskets;
(-)a/acqui/neworderempty.pl (-3 / +3 lines)
Lines 71-77 use C4::Auth qw( get_template_and_user ); Link Here
71
use C4::Budgets qw( GetBudget GetBudgetHierarchy CanUserUseBudget );
71
use C4::Budgets qw( GetBudget GetBudgetHierarchy CanUserUseBudget );
72
72
73
use C4::Acquisition qw( GetOrder GetBasket FillWithDefaultValues GetOrderUsers );
73
use C4::Acquisition qw( GetOrder GetBasket FillWithDefaultValues GetOrderUsers );
74
use C4::Contract    qw( GetContract );
75
use C4::Suggestions qw( GetSuggestion GetSuggestionInfo );
74
use C4::Suggestions qw( GetSuggestion GetSuggestionInfo );
76
use C4::Biblio      qw(
75
use C4::Biblio      qw(
77
    AddBiblio
76
    AddBiblio
Lines 89-94 use C4::Search qw( FindDuplicate ); Link Here
89
use C4::ImportBatch qw( SetImportRecordStatus SetMatchedBiblionumber GetImportRecordMarc );
88
use C4::ImportBatch qw( SetImportRecordStatus SetMatchedBiblionumber GetImportRecordMarc );
90
89
91
use Koha::Acquisition::Booksellers;
90
use Koha::Acquisition::Booksellers;
91
use Koha::Acquisition::Contracts;
92
use Koha::Acquisition::Currencies qw( get_active );
92
use Koha::Acquisition::Currencies qw( get_active );
93
use Koha::Biblios;
93
use Koha::Biblios;
94
use Koha::BiblioFrameworks;
94
use Koha::BiblioFrameworks;
Lines 158-164 $template->param( Link Here
158
output_and_exit( $input, $cookie, $template, 'order_cannot_be_edited' )
158
output_and_exit( $input, $cookie, $template, 'order_cannot_be_edited' )
159
    if $ordernumber and ( $basketobj->closedate || $data->{orderstatus} eq "complete" );
159
    if $ordernumber and ( $basketobj->closedate || $data->{orderstatus} eq "complete" );
160
160
161
my $contract = GetContract( { contractnumber => $basket->{contractnumber} } );
161
my $contract = Koha::Acquisition::Contracts->find( $basket->{contractnumber} );
162
162
163
my $listprice = 0;    # the price, that can be in MARC record if we have one
163
my $listprice = 0;    # the price, that can be in MARC record if we have one
164
if ( $ordernumber eq '' and defined $breedingid ) {
164
if ( $ordernumber eq '' and defined $breedingid ) {
Lines 454-460 $template->param( Link Here
454
    booksellerid         => $basket->{'booksellerid'},
454
    booksellerid         => $basket->{'booksellerid'},
455
    basketbooksellernote => $basket->{booksellernote},
455
    basketbooksellernote => $basket->{booksellernote},
456
    basketcontractno     => $basket->{contractnumber},
456
    basketcontractno     => $basket->{contractnumber},
457
    basketcontractname   => $contract->{contractname},
457
    basketcontractname   => $contract->contractname,
458
    creationdate         => $basket->{creationdate},
458
    creationdate         => $basket->{creationdate},
459
    authorisedby         => $basket->{'authorisedby'},
459
    authorisedby         => $basket->{'authorisedby'},
460
    authorisedbyname     => $basket->{'authorisedbyname'},
460
    authorisedbyname     => $basket->{'authorisedbyname'},
(-)a/admin/aqcontract.pl (-14 / +13 lines)
Lines 28-39 use C4::Output qw( output_html_with_http_headers ); Link Here
28
use C4::Contract qw(
28
use C4::Contract qw(
29
    AddContract
29
    AddContract
30
    DelContract
30
    DelContract
31
    GetContract
32
    ModContract
31
    ModContract
33
);
32
);
34
use Koha::DateUtils qw( dt_from_string );
33
use Koha::DateUtils qw( dt_from_string );
35
34
36
use Koha::Acquisition::Booksellers;
35
use Koha::Acquisition::Booksellers;
36
use Koha::Acquisition::Contracts;
37
37
38
my $input          = CGI->new;
38
my $input          = CGI->new;
39
my $contractnumber = $input->param('contractnumber');
39
my $contractnumber = $input->param('contractnumber');
Lines 66-79 if ( $op eq 'add_form' ) { Link Here
66
66
67
    # if contractnumber exists, it's a modify action, so read values to modify...
67
    # if contractnumber exists, it's a modify action, so read values to modify...
68
    if ($contractnumber) {
68
    if ($contractnumber) {
69
        my $contract = GetContract( { contractnumber => $contractnumber } );
69
        my $contract = Koha::Acquisition::Contracts->find($contractnumber);
70
70
71
        $template->param(
71
        $template->param(
72
            contractnumber      => $contract->{contractnumber},
72
            contractnumber      => $contract->contractnumber,
73
            contractname        => $contract->{contractname},
73
            contractname        => $contract->contractname,
74
            contractdescription => $contract->{contractdescription},
74
            contractdescription => $contract->contractdescription,
75
            contractstartdate   => $contract->{contractstartdate},
75
            contractstartdate   => $contract->contractstartdate,
76
            contractenddate     => $contract->{contractenddate},
76
            contractenddate     => $contract->contractenddate,
77
        );
77
        );
78
    } else {
78
    } else {
79
        $template->param(
79
        $template->param(
Lines 135-148 elsif ( $op eq 'cud-add_validate' ) { Link Here
135
elsif ( $op eq 'delete_confirm' ) {
135
elsif ( $op eq 'delete_confirm' ) {
136
    $template->param( delete_confirm => 1 );
136
    $template->param( delete_confirm => 1 );
137
137
138
    my $contract = GetContract( { contractnumber => $contractnumber } );
138
    my $contract = Koha::Acquisition::Contracts->find($contractnumber);
139
139
140
    $template->param(
140
    $template->param(
141
        contractnumber      => $$contract{contractnumber},
141
        contractnumber      => $contract->contractnumber,
142
        contractname        => $$contract{contractname},
142
        contractname        => $contract->contractname,
143
        contractdescription => $$contract{contractdescription},
143
        contractdescription => $contract->contractdescription,
144
        contractstartdate   => $$contract{contractstartdate},
144
        contractstartdate   => $contract->contractstartdate,
145
        contractenddate     => $$contract{contractenddate},
145
        contractenddate     => $contract->contractenddate,
146
    );
146
    );
147
147
148
    # END $OP eq DELETE_CONFIRM
148
    # END $OP eq DELETE_CONFIRM
149
- 

Return to bug 39711