Bugzilla – Attachment 189394 Details for
Bug 39711
Migrate C4::Contract to object classes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39711: Update all calls to GetContracts
Bug-39711-Update-all-calls-to-GetContracts.patch (text/plain), 4.47 KB, created by
Matt Blenkinsop
on 2025-11-10 13:21:38 UTC
(
hide
)
Description:
Bug 39711: Update all calls to GetContracts
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2025-11-10 13:21:38 UTC
Size:
4.47 KB
patch
obsolete
>From 237f05de49b2a425bf3d56327adb4c0a10ba8d72 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> >Date: Thu, 24 Apr 2025 14:11:46 +0100 >Subject: [PATCH] Bug 39711: Update all calls to GetContracts > >--- > Koha/Acquisition/Bookseller.pm | 12 ++++-------- > acqui/basketheader.pl | 28 ++++++++-------------------- > admin/aqcontract.pl | 3 +-- > 3 files changed, 13 insertions(+), 30 deletions(-) > >diff --git a/Koha/Acquisition/Bookseller.pm b/Koha/Acquisition/Bookseller.pm >index ac85f4e33d3..45049d64cb0 100644 >--- a/Koha/Acquisition/Bookseller.pm >+++ b/Koha/Acquisition/Bookseller.pm >@@ -21,10 +21,9 @@ use Koha::Acquisition::Bookseller::Aliases; > use Koha::Acquisition::Bookseller::Contacts; > use Koha::Acquisition::Bookseller::Interfaces; > use Koha::Acquisition::Bookseller::Issues; >+use Koha::Acquisition::Contracts; > use Koha::Subscriptions; > >-use C4::Contract qw( GetContracts ); >- > use base qw( Koha::Object ); > > =head1 NAME >@@ -86,7 +85,7 @@ sub contacts { > =head3 contracts > > my $vendor = Koha::Acquisition::Booksellers->find( $id ); >- my @contracts = $vendor->contracts(); >+ my $contracts = $vendor->contracts(); > > Returns the list of contracts for the vendor > >@@ -94,11 +93,8 @@ Returns the list of contracts for the vendor > > sub contracts { > my ($self) = @_; >- return GetContracts( >- { >- booksellerid => $self->id, >- } >- ); >+ my $contracts_rs = $self->_result->aqcontracts; >+ return Koha::Acquisition::Contracts->_new_from_dbic($contracts_rs); > } > > =head3 subscriptions >diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl >index 5a1162d5b43..0cdfc59c77a 100755 >--- a/acqui/basketheader.pl >+++ b/acqui/basketheader.pl >@@ -51,10 +51,11 @@ use C4::Context; > use C4::Auth qw( get_template_and_user ); > use C4::Output qw( output_html_with_http_headers ); > use C4::Acquisition qw( GetBasket ModBasket ModBasketHeader NewBasket ); >-use C4::Contract qw( GetContracts GetContract ); >+use C4::Contract qw( GetContract ); > > use Koha::Acquisition::Booksellers; > use Koha::Acquisition::Baskets; >+use Koha::Acquisition::Contracts; > use Koha::AdditionalFields; > use Koha::Database; > >@@ -78,7 +79,12 @@ my $is_an_edit = $input->param('is_an_edit'); > $template->param( available_additional_fields => Koha::AdditionalFields->search( { tablename => 'aqbasket' } ) ); > > if ( $op eq 'add_form' ) { >+ my @contracts = Koha::Acquisition::Contracts->search( >+ { booksellerid => $booksellerid, contractenddate => { '>=' => \'now()' } } )->as_list; > my @contractloop; >+ foreach my $contract (@contracts) { >+ push( @contractloop, $contract->unblessed ); >+ } > if ($basketno) { > > #this is an edit >@@ -86,33 +92,15 @@ if ( $op eq 'add_form' ) { > if ( !$booksellerid ) { > $booksellerid = $basket->{'booksellerid'}; > } >- my $contracts = GetContracts( >- { >- booksellerid => $booksellerid, >- activeonly => 1, >- } >- ); > >- @contractloop = @$contracts; > for (@contractloop) { > if ( $basket->{'contractnumber'} eq $_->{'contractnumber'} ) { >- $_->{'selected'} = 1; >+ $_->{selected} = 1; > } > } > $template->param( is_an_edit => 1 ); > $template->param( additional_field_values => > Koha::Acquisition::Baskets->find($basketno)->get_additional_field_values_for_template ); >- } else { >- >- #new basket >- my $basket; >- my $contracts = GetContracts( >- { >- booksellerid => $booksellerid, >- activeonly => 1, >- } >- ); >- push( @contractloop, @$contracts ); > } > my $bookseller = Koha::Acquisition::Booksellers->find($booksellerid); > my $count = scalar @contractloop; >diff --git a/admin/aqcontract.pl b/admin/aqcontract.pl >index 4b0af3bd392..637a9765758 100755 >--- a/admin/aqcontract.pl >+++ b/admin/aqcontract.pl >@@ -29,7 +29,6 @@ use C4::Contract qw( > AddContract > DelContract > GetContract >- GetContracts > ModContract > ); > use Koha::DateUtils qw( dt_from_string ); >@@ -169,7 +168,7 @@ if ( $op eq 'list' ) { > $template->param( else => 1 ); > > # get contracts >- my @contracts = @{ GetContracts( { booksellerid => $booksellerid } ) }; >+ my @contracts = Koha::Acquisition::Contracts->search( { booksellerid => $booksellerid } )->as_list; > > $template->param( loop => \@contracts ); > >-- >2.50.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39711
:
181453
|
181454
|
181455
|
181456
|
181457
|
181458
|
181459
|
181460
|
181461
|
181580
|
181581
|
181582
|
181583
|
181584
|
181586
|
181587
|
181588
|
189393
| 189394 |
189395
|
189396
|
189397
|
189398
|
189399
|
189400
|
189401
|
189402
|
189403
|
189404
|
189405
|
189406
|
189407