Bugzilla – Attachment 44798 Details for
Bug 15030
Certain values in serials' items are lost on next edit
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15030: Add tests
Bug-15030-Add-tests.patch (text/plain), 3.60 KB, created by
Jonathan Druart
on 2015-11-12 12:31:07 UTC
(
hide
)
Description:
Bug 15030: Add tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-11-12 12:31:07 UTC
Size:
3.60 KB
patch
obsolete
>From 06522f51eae7b25bb1901074efc13d7273714169 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 12 Nov 2015 12:28:38 +0000 >Subject: [PATCH] Bug 15030: Add tests > >This test will prevent regression on the lost of data when >items.itemcallnumber is linked with a plugin. >--- > t/db_dependent/Serials.t | 31 +++++++++++++++++++++++++++++-- > 1 file changed, 29 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Serials.t b/t/db_dependent/Serials.t >index 3a4942d..6d195a3 100644 >--- a/t/db_dependent/Serials.t >+++ b/t/db_dependent/Serials.t >@@ -14,14 +14,16 @@ use C4::Debug; > use C4::Bookseller; > use C4::Biblio; > use C4::Budgets; >+use C4::Items; > use Koha::DateUtils; >-use Test::More tests => 46; >+use Test::More tests => 47; > > BEGIN { > use_ok('C4::Serials'); > } > > my $dbh = C4::Context->dbh; >+$dbh->do(q|UPDATE marc_subfield_structure SET value_builder="callnumber.pl" where kohafield="items.itemcallnumber" and frameworkcode=''|); > > # Start transaction > $dbh->{AutoCommit} = 0; >@@ -106,6 +108,7 @@ if (not $frequency->{unit}) { > $frequency->{issuesperunit} = 1; > $frequency->{description} = "Frequency created by t/db_dependant/Serials.t"; > $subscriptioninformation->{periodicity} = AddSubscriptionFrequency($frequency); >+ $subscriptioninformation->{serialsadditems} = 1; > > ModSubscription( @$subscriptioninformation{qw( > librarian branchcode aqbooksellerid cost aqbudgetid startdate >@@ -130,6 +133,21 @@ ok(C4::Serials::GetSerialStatusFromSerialId($serial->{serialid}), 'test getting > > isa_ok(C4::Serials::GetSerialInformation($serial->{serialid}), 'HASH', 'test getting Serial Information'); > >+subtest 'Values should not be erased on editing' => sub { >+ plan tests => 1; >+ ( $biblionumber, $biblioitemnumber ) = get_biblio(); >+ my ( $icn_tag, $icn_sf ) = GetMarcFromKohaField( 'items.itemcallnumber', '' ); >+ my $item_record = new MARC::Record; >+ my $itemcallnumber = 'XXXmy itemcallnumberXXX'; >+ $item_record->append_fields( MARC::Field->new( '080', '', '', "a" => "default" ), MARC::Field->new( $icn_tag, '', '', $icn_sf => $itemcallnumber ), ); >+ my ( undef, undef, $itemnumber ) = C4::Items::AddItemFromMarc( $item_record, $biblionumber ); >+ my $serialid = C4::Serials::NewIssue( "serialseq", $subscriptionid, $biblionumber, 1, undef, undef, "publisheddatetext", "notes" ); >+ C4::Serials::AddItem2Serial( $serialid, $itemnumber ); >+ my $serial_info = C4::Serials::GetSerialInformation($serialid); >+ my ($itemcallnumber_info) = grep { $_->{kohafield} eq 'items.itemcallnumber' } @{ $serial_info->{items}[0]->{iteminformation} }; >+ like( $itemcallnumber_info->{marc_value}, qr|value="$itemcallnumber"| ); >+}; >+ > # Delete created frequency > if ($old_frequency) { > my $freq_to_delete = $subscriptioninformation->{periodicity}; >@@ -148,7 +166,6 @@ if ($old_frequency) { > DelSubscriptionFrequency($freq_to_delete); > } > >- > # Test calling subs without parameters > is(C4::Serials::AddItem2Serial(), undef, 'test adding item to serial'); > is(C4::Serials::UpdateClaimdateIssues(), undef, 'test updating claim date'); >@@ -247,3 +264,13 @@ for my $am ( @arrived_missing ) { > is( $subscription->{missinglist}, join('; ', @serialseqs), "subscription missinglist is updated after ModSerialStatus" ); > > $dbh->rollback; >+ >+sub get_biblio { >+ my $bib = MARC::Record->new(); >+ $bib->append_fields( >+ MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'), >+ MARC::Field->new('245', ' ', ' ', a => 'Silence in the library'), >+ ); >+ my ($bibnum, $bibitemnum) = AddBiblio($bib, ''); >+ return ($bibnum, $bibitemnum); >+} >-- >2.1.0
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 15030
:
43601
|
43701
|
43785
|
44798
|
45297
|
45753
|
49908
|
49909
|
49910
|
49911
|
53449
|
53450
|
53456
|
53457
|
53458
|
53459
|
59671
|
59672
|
59673
|
59674
|
59723
|
59724
|
59725
|
59726
|
59792
|
59793
|
59794
|
59795