Bugzilla – Attachment 181588 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: (bugfix) Allow to clear basket's contract
Bug-39711-bugfix-Allow-to-clear-baskets-contract.patch (text/plain), 2.20 KB, created by
Jonathan Druart
on 2025-04-28 10:51:28 UTC
(
hide
)
Description:
Bug 39711: (bugfix) Allow to clear basket's contract
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-04-28 10:51:28 UTC
Size:
2.20 KB
patch
obsolete
>From ff20c8418ccbbb766dca2a93db1eeb7b51ad2a86 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 28 Apr 2025 12:50:22 +0200 >Subject: [PATCH] Bug 39711: (bugfix) Allow to clear basket's contract > >--- > C4/Acquisition.pm | 9 ++++----- > t/db_dependent/Acquisition.t | 18 +++++++++++++++++- > 2 files changed, 21 insertions(+), 6 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 685d6217a2a..724f0f23ab2 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -622,11 +622,10 @@ sub ModBasketHeader { > $create_items || undef, $basketno > ); > >- if ($contractnumber) { >- my $query2 = "UPDATE aqbasket SET contractnumber=? WHERE basketno=?"; >- my $sth2 = $dbh->prepare($query2); >- $sth2->execute( $contractnumber, $basketno ); >- } >+ if ( !$contractnumber ) { $contractnumber = undef; } >+ my $query2 = "UPDATE aqbasket SET contractnumber=? WHERE basketno=?"; >+ my $sth2 = $dbh->prepare($query2); >+ $sth2->execute( $contractnumber, $basketno ); > > # Log the basket update > if ( C4::Context->preference("AcquisitionLog") ) { >diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t >index 7552a2d3458..513c4004042 100755 >--- a/t/db_dependent/Acquisition.t >+++ b/t/db_dependent/Acquisition.t >@@ -20,7 +20,7 @@ use Modern::Perl; > use POSIX qw(strftime); > > use Test::NoWarnings; >-use Test::More tests => 74; >+use Test::More tests => 75; > use t::lib::Mocks; > use Koha::Database; > use Koha::DateUtils qw(dt_from_string output_pref); >@@ -1390,3 +1390,19 @@ subtest 'GetInvoices() tests with additional fields' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'ModBasketHeader' => sub { >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ my $basket = $builder->build_object( { class => 'Koha::Acquisition::Baskets' } ); >+ isnt( $basket->contractnumber, undef ); >+ C4::Acquisition::ModBasketHeader( >+ $basket->basketno, $basket->basketname, $basket->note, $basket->booksellernote, >+ undef, $basket->booksellerid >+ ); >+ $basket = $basket->get_from_storage; >+ is( $basket->contractnumber, undef ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.34.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