Bugzilla – Attachment 77641 Details for
Bug 15971
Serial claim letters should allow the use of all biblio and biblioitems fields (like issn)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15971: Add biblioitems to available fields for serial claim notices and fix notices editor display
Bug-15971-Add-biblioitems-to-available-fields-for-.patch (text/plain), 8.68 KB, created by
Katrin Fischer
on 2018-08-10 03:30:45 UTC
(
hide
)
Description:
Bug 15971: Add biblioitems to available fields for serial claim notices and fix notices editor display
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2018-08-10 03:30:45 UTC
Size:
8.68 KB
patch
obsolete
>From 0451e402b58ccdec6cf64efd2015c62742335bbe Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <katrin.fischer.83@web.de> >Date: Fri, 10 Aug 2018 05:21:56 +0200 >Subject: [PATCH] Bug 15971: Add biblioitems to available fields for serial > claim notices and fix notices editor display > >This fixes 2 related problems: > >1) The editor only offered 3 entries from biblio for adding to the notice: >title, author, serial >It was not clear that actually all fields from biblio can be used. > >2) It was not possible to use fields from biblioitems in the notices >which left out important fields like the ISSN. > >The patch adds the biblioitems table and changes the editor to show >all entries from biblio and biblioitems table are shown on the left. > >To test: >- Create a subscription >- Generate next issue a few times to get late issues >- Create a new notice in the "Claim serial issue" module > - Use fields from different/all tables >- Make sure an email address is set for > - the vendor (also check for 'receives claims for late issues') > - your staff user >- Go to serials > claims >- Claim multiple issues >- Verify the email is generated and contains the correct information > >Example notice: > >Title: <<biblio.title>> >Author: <<biblio.author>> >ISSN: <<biblioitems.issn>> >ISBN: <<biblioitems.isbn>> >Issue: <<serial.serialseq>> >-- >--- > C4/Letters.pm | 9 ++-- > t/db_dependent/Letters.t | 96 +++++++++++++++++++++++++++++++++++++++- > tools/letter.pl | 10 +---- > 3 files changed, 101 insertions(+), 14 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 52db4d0ac6..4954067427 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -393,22 +393,23 @@ sub SendAlerts { > > if ($type eq 'claimissues') { > $strsth = qq{ >- SELECT serial.*,subscription.*, biblio.*, aqbooksellers.*, >+ SELECT serial.*,subscription.*, biblio.*, biblioitems.*, aqbooksellers.*, > aqbooksellers.id AS booksellerid > FROM serial > LEFT JOIN subscription ON serial.subscriptionid=subscription.subscriptionid > LEFT JOIN biblio ON serial.biblionumber=biblio.biblionumber >+ LEFT JOIN biblioitems ON serial.biblionumber = biblioitems.biblionumber > LEFT JOIN aqbooksellers ON subscription.aqbooksellerid=aqbooksellers.id > WHERE serial.serialid IN ( > }; > > if (!@$externalid){ >- carp "No Order selected"; >- return { error => "no_order_selected" }; >+ carp "No issues selected"; >+ return { error => "no_issues_selected" }; > } > > $strsth .= join( ",", ('?') x @$externalid ) . ")"; >- $action = "CLAIM ISSUE"; >+ $action = "SERIAL CLAIM"; > $sthorders = $dbh->prepare($strsth); > $sthorders->execute( @$externalid ); > $dataorders = $sthorders->fetchall_arrayref( {} ); >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index 344473c829..a66491881d 100644 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -18,7 +18,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 64; >+use Test::More tests => 65; > use Test::MockModule; > use Test::Warn; > >@@ -490,6 +490,100 @@ is($mail{'To'}, 'john.smith@test.de', "mailto correct in sent serial notificatio > is($mail{'Message'}, 'Silence in the library,'.$subscriptionid.',No. 0', 'Serial notification text constructed successfully'); > } > >+subtest 'SendAlerts - claimissue' => sub { >+ plan tests => 8; >+ >+ use C4::Serials; >+ >+ $dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('claimissues','TESTSERIALCLAIM','Serial claim test','Serial claim test','<<serial.serialid>>|<<subscription.startdate>>|<<biblio.title>>|<<biblioitems.issn>>');}); >+ >+ my $bookseller = Koha::Acquisition::Bookseller->new( >+ { >+ name => "my vendor", >+ address1 => "bookseller's address", >+ phone => "0123456", >+ active => 1, >+ deliverytime => 5, >+ } >+ )->store; >+ my $booksellerid = $bookseller->id; >+ >+ Koha::Acquisition::Bookseller::Contact->new( { name => 'Leo Tolstoy', phone => '0123456x2', claimissues => 1, booksellerid => $booksellerid } )->store; >+ >+ my $bib = MARC::Record->new(); >+ if (C4::Context->preference('marcflavour') eq 'UNIMARC') { >+ $bib->append_fields( >+ MARC::Field->new('011', ' ', ' ', a => 'xxxx-yyyy'), >+ MARC::Field->new('200', ' ', ' ', a => 'Silence in the library'), >+ ); >+ } else { >+ $bib->append_fields( >+ MARC::Field->new('022', ' ', ' ', a => 'xxxx-yyyy'), >+ MARC::Field->new('245', ' ', ' ', a => 'Silence in the library'), >+ ); >+ } >+ my ($biblionumber) = AddBiblio($bib, ''); >+ >+ $dbh->do(q|UPDATE subscription_numberpatterns SET numberingmethod='No. {X}' WHERE id=1|); >+ 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, >+ undef, undef, 0, 'internal', 0, >+ undef, undef, 0, undef, '2013-12-31', 0 >+ ); >+ >+ my ($serials_count, @serials) = GetSerials($subscriptionid); >+ my @serialids = ($serials[0]->{serialid}); >+ >+ my $err; >+ warning_like { >+ $err = SendAlerts( 'claimissues', \@serialids, 'TESTSERIALCLAIM' ) } >+ qr/^Bookseller .* without emails at/, >+ "Warn on vendor without email address"; >+ >+ $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid ); >+ $bookseller->contacts->next->email('testemail@mydomain.com')->store; >+ >+ # Ensure that the preference 'LetterLog' is set to logging >+ t::lib::Mocks::mock_preference( 'LetterLog', 'on' ); >+ >+ # SendAlerts needs branchemail or KohaAdminEmailAddress as sender >+ C4::Context->_new_userenv('DUMMY'); >+ C4::Context->set_userenv( 0, 0, 0, 'firstname', 'surname', $library->{branchcode}, 'My Library', 0, '', ''); >+ t::lib::Mocks::mock_preference( 'KohaAdminEmailAddress', 'library@domain.com' ); >+ >+ { >+ warning_is { >+ $err = SendAlerts( 'claimissues', \@serialids , 'TESTSERIALCLAIM' ) } >+ "Fake sendmail", >+ "SendAlerts is using the mocked sendmail routine (claimissues)"; >+ is($err, 1, "Successfully sent claim"); >+ is($mail{'To'}, 'testemail@mydomain.com', "mailto correct in sent claim"); >+ is($mail{'Message'}, "$serialids[0]|2013-01-01|Silence in the library|xxxx-yyyy", 'Serial claim letter for 1 issue constructed successfully'); >+ } >+ >+ { >+ my $publisheddate = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); >+ my $serialexpected = ( C4::Serials::findSerialsByStatus( 1, $subscriptionid ) )[0]; >+ ModSerialStatus( $serials[0]->{serialid}, "No. 1", $publisheddate, $publisheddate, $publisheddate, '3', 'a note' ); >+ ($serials_count, @serials) = GetSerials($subscriptionid); >+ push @serialids, ($serials[1]->{serialid}); >+ >+ $err = SendAlerts( 'claimissues', \@serialids , 'TESTSERIALCLAIM' ); >+ is($mail{'Message'}, "$serialids[0]|2013-01-01|Silence in the library|xxxx-yyyy\n$serialids[1]|2013-01-01|Silence in the library|xxxx-yyyy", "Serial claim letter for 2 issues constructed successfully"); >+ >+ $dbh->do(q{DELETE FROM letter WHERE code = 'TESTSERIALCLAIM';}); >+ warning_like { >+ $err = SendAlerts( 'orderacquisition', $basketno , 'TESTSERIALCLAIM' ) } >+ qr/No orderacquisition TESTSERIALCLAIM letter transported by email/, >+ "GetPreparedLetter warns about missing notice template"; >+ is($err->{'error'}, 'no_letter', "No TESTSERIALCLAIM letter was defined"); >+ } >+ >+}; >+ > subtest 'GetPreparedLetter' => sub { > plan tests => 4; > >diff --git a/tools/letter.pl b/tools/letter.pl >index 5f901495ee..d1c95bcf19 100755 >--- a/tools/letter.pl >+++ b/tools/letter.pl >@@ -230,15 +230,7 @@ sub add_form { > push @{$field_selection}, add_fields('aqbooksellers', 'aqbasket', 'aqorders', 'biblio', 'biblioitems'); > } > elsif ($module eq 'claimissues') { >- push @{$field_selection}, add_fields('aqbooksellers', 'serial', 'subscription'); >- push @{$field_selection}, >- { >- value => q{}, >- text => '---BIBLIO---' >- }; >- foreach(qw(title author serial)) { >- push @{$field_selection}, {value => "biblio.$_", text => ucfirst $_ }; >- } >+ push @{$field_selection}, add_fields('aqbooksellers', 'serial', 'subscription', 'biblio', 'biblioitems'); > } > elsif ($module eq 'serial') { > push @{$field_selection}, add_fields('branches', 'biblio', 'biblioitems', 'borrowers', 'subscription', 'serial'); >-- >2.17.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 15971
:
77641
|
79539
|
79555