Bugzilla – Attachment 181454 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-04-24 14:40:58 UTC
(
hide
)
Description:
Bug 39711: Update all calls to GetContracts
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2025-04-24 14:40:58 UTC
Size:
4.47 KB
patch
obsolete
>From 51d513d13029d6958b3907d0f6433ce4e92b4db3 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 3745e506739..84b459a96ce 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 4ab854258d4..5a36b88b82f 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; > > my $input = CGI->new; >@@ -77,7 +78,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 >@@ -85,33 +91,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 00f1ea45a04..53f7bd45316 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.48.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