Bugzilla – Attachment 73623 Details for
Bug 19855
Move the "alert" code to Koha::Subscription
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19855: Remove C4::Letters::findrelatedto
Bug-19855-Remove-C4Lettersfindrelatedto.patch (text/plain), 3.20 KB, created by
Jonathan Druart
on 2018-04-04 13:01:44 UTC
(
hide
)
Description:
Bug 19855: Remove C4::Letters::findrelatedto
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-04-04 13:01:44 UTC
Size:
3.20 KB
patch
obsolete
>From a179ed0518ddb4c70782fd9056b67a2e561d3555 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 20 Dec 2017 14:14:57 -0300 >Subject: [PATCH] Bug 19855: Remove C4::Letters::findrelatedto > >This subroutine is called only once. It only concat firstname and >surname for subscribers. >It can be easily replaced with Koha::Patron >--- > C4/Letters.pm | 33 +-------------------------------- > serials/viewalerts.pl | 6 ++++-- > 2 files changed, 5 insertions(+), 34 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 62579eb049..18841fc674 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -45,7 +45,7 @@ BEGIN { > require Exporter; > @ISA = qw(Exporter); > @EXPORT = qw( >- &GetLetters &GetLettersAvailableForALibrary &GetLetterTemplates &DelLetter &GetPreparedLetter &GetWrappedLetter &addalert &getalert &delalert &findrelatedto &SendAlerts &GetPrintMessages &GetMessageTransportTypes >+ &GetLetters &GetLettersAvailableForALibrary &GetLetterTemplates &DelLetter &GetPreparedLetter &GetWrappedLetter &addalert &getalert &delalert &SendAlerts &GetPrintMessages &GetMessageTransportTypes > ); > } > >@@ -336,37 +336,6 @@ sub getalert { > return $sth->fetchall_arrayref({}); > } > >-=head2 findrelatedto($type, $externalid) >- >- parameters : >- - $type : the type of alert >- - $externalid : the id of the "object" to query >- >- In the table alert, a "id" is stored in the externalid field. This "id" is related to another table, depending on the type of the alert. >- When type=issue, the id is related to a subscriptionid and this sub returns the name of the biblio. >- >-=cut >- >-# outmoded POD: >-# When type=virtual, the id is related to a virtual shelf and this sub returns the name of the sub >- >-sub findrelatedto { >- my $type = shift or return; >- my $externalid = shift or return; >- my $q = ($type eq 'issue' ) ? >-"select title as result from subscription left join biblio on subscription.biblionumber=biblio.biblionumber where subscriptionid=?" : >- ($type eq 'borrower') ? >-"select concat(firstname,' ',surname) from borrowers where borrowernumber=?" : undef; >- unless ($q) { >- warn "findrelatedto(): Illegal type '$type'"; >- return; >- } >- my $sth = C4::Context->dbh->prepare($q); >- $sth->execute($externalid); >- my ($result) = $sth->fetchrow; >- return $result; >-} >- > =head2 SendAlerts > > my $err = &SendAlerts($type, $externalid, $letter_code); >diff --git a/serials/viewalerts.pl b/serials/viewalerts.pl >index 451032f1e8..63ed214a91 100755 >--- a/serials/viewalerts.pl >+++ b/serials/viewalerts.pl >@@ -46,8 +46,10 @@ my $subscriptionid=$input->param('subscriptionid'); > my $borrowers = getalert('','issue',$subscriptionid); > my $subscription = GetSubscription($subscriptionid); > >-foreach (@$borrowers) { >- $_->{name} = findrelatedto('borrower',$_->{borrowernumber}); >+for my $borrowernumber (@$borrowers) { >+ my $patron = Koha::Patrons->find( $borrowernumber ); >+ next unless $borrowernumber; # Just in case... >+ $borrowers->{name} = join( ' ', $patron->firstname, $patron->surname ); > } > $template->param(alertloop => $borrowers, > bibliotitle => $subscription->{bibliotitle}, >-- >2.11.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 19855
:
69970
|
69971
|
69972
|
69973
|
69974
|
73621
|
73622
|
73623
|
73624
|
73625
|
74611
|
74612
|
74613
|
74614
|
74615
|
74688
|
74689
|
74690
|
74691
|
74692
|
74750