From 309442c1c3caa2a3fb260b6679ae0e25e3e9f664 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 10 May 2023 12:34:08 +0200 Subject: [PATCH] Bug 33403: Fix Letters.t if number pattern with id=1 does not exist Content-Type: text/plain; charset=utf-8 Bad assumption in DB, we should create the data we need Test plan: > delete from subscription_numberpatterns; prove t/db_dependent/Letters.t Signed-off-by: Marcel de Rooy --- t/db_dependent/Letters.t | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t index 2f52882606..3d1e34a6bb 100755 --- a/t/db_dependent/Letters.t +++ b/t/db_dependent/Letters.t @@ -549,12 +549,17 @@ use C4::Serials qw( NewSubscription GetSerials findSerialsByStatus ModSerialStat my $notes = 'notes'; my $internalnotes = 'intnotes'; -$dbh->do(q|UPDATE subscription_numberpatterns SET numberingmethod='No. {X}' WHERE id=1|); +my $number_pattern = $builder->build_object( + { + class => 'Koha::Subscription::Numberpatterns', + value => { numberingmethod => 'No. {X}' } + } +); my $subscriptionid = NewSubscription( undef, "", undef, undef, undef, $biblionumber, '2013-01-01', 1, undef, undef, undef, undef, undef, undef, undef, undef, undef, - 1, $notes,undef, '2013-01-01', undef, 1, + 1, $notes,undef, '2013-01-01', undef, $number_pattern->id, undef, undef, 0, $internalnotes, 0, undef, undef, 0, undef, '2013-12-31', 0 ); @@ -643,12 +648,18 @@ subtest 'SendAlerts - claimissue' => sub { } my ($biblionumber) = AddBiblio($bib, ''); - $dbh->do(q|UPDATE subscription_numberpatterns SET numberingmethod='No. {X}' WHERE id=1|); + my $number_pattern = $builder->build_object( + { + class => 'Koha::Subscription::Numberpatterns', + value => { numberingmethod => 'No. {X}' } + } + ); + my $subscriptionid = NewSubscription( undef, "", $booksellerid, undef, undef, $biblionumber, '2013-01-01', 1, undef, undef, undef, undef, undef, undef, undef, undef, undef, - 1, 'public',undef, '2013-01-01', undef, 1, + 1, 'public',undef, '2013-01-01', undef, $number_pattern->id, undef, undef, 0, 'internal', 0, undef, undef, 0, undef, '2013-12-31', 0 ); -- 2.30.2