Bugzilla – Attachment 142160 Details for
Bug 31858
TT syntax for ACQORDER notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31858: add TT syntax for ACQORDER notices
Bug-31858-add-TT-syntax-for-ACQORDER-notices.patch (text/plain), 4.48 KB, created by
Alex Arnaud
on 2022-10-19 14:41:45 UTC
(
hide
)
Description:
Bug 31858: add TT syntax for ACQORDER notices
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2022-10-19 14:41:45 UTC
Size:
4.48 KB
patch
obsolete
>From b225a9f46181ae97a75bb7bbe1cda1f8890df699 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Wed, 19 Oct 2022 11:42:19 +0000 >Subject: [PATCH] Bug 31858: add TT syntax for ACQORDER notices > >Test Plan: > 1) Set your ACQORDER notice content to: > [%- USE Price -%] > [% bookseller.name %] > [% FOREACH order IN orders %] > Ordernumber [% order.ordernumber %] ([% order.biblio.title %] - [% order.biblio.biblioitem.publicationyear %]) (quantity: [% order.quantity %]) ($[% order.listprice | $Price %] each). > [% END %] > Thank you, > [% branch.branchname %] > 2) Set up a vendor with an email, set contact for email so the "E-mail > order" button shows on a basket for that vendor > 3) E-mail the basket > 4) Check the content is correct >--- > C4/Letters.pm | 24 ++++++++++++++++-------- > 1 file changed, 16 insertions(+), 8 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 4d60753cc6..97a3e620da 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -365,6 +365,7 @@ sub SendAlerts { > my $dataorders; > my $action; > my $basketno; >+ my %loops; > if ( $type eq 'claimacquisition') { > $strsth = qq{ > SELECT aqorders.*,aqbasket.*,biblio.*,biblioitems.* >@@ -430,25 +431,24 @@ sub SendAlerts { > $sthorders = $dbh->prepare($strsth); > $sthorders->execute($basketno); > $dataorders = $sthorders->fetchall_arrayref( {} ); >+ %loops = ( >+ aqorders => [ map { $_->{ordernumber} } @$dataorders ] >+ ); > } > >- my $sthbookseller = >- $dbh->prepare("select * from aqbooksellers where id=?"); >- $sthbookseller->execute( $dataorders->[0]->{booksellerid} ); >- my $databookseller = $sthbookseller->fetchrow_hashref; >- >+ my $booksellerid = $dataorders->[0]->{booksellerid}; > my $addressee = $type eq 'claimacquisition' || $type eq 'orderacquisition' ? 'acqprimary' : 'serialsprimary'; > > my $sthcontact = > $dbh->prepare("SELECT * FROM aqcontacts WHERE booksellerid=? AND $type=1 ORDER BY $addressee DESC"); >- $sthcontact->execute( $dataorders->[0]->{booksellerid} ); >+ $sthcontact->execute( $booksellerid ); > my $datacontact = $sthcontact->fetchrow_hashref; > > my @email; > my @cc; > push @email, $datacontact->{email} if ( $datacontact && $datacontact->{email} ); > unless (@email) { >- warn "Bookseller $dataorders->[0]->{booksellerid} without emails"; >+ warn "Bookseller $booksellerid without emails"; > return { error => "no_email" }; > } > my $addlcontact; >@@ -463,11 +463,12 @@ sub SendAlerts { > branchcode => $userenv->{branch}, > tables => { > 'branches' => $userenv->{branch}, >- 'aqbooksellers' => $databookseller, >+ 'aqbooksellers' => $booksellerid, > 'aqcontacts' => $datacontact, > 'aqbasket' => $basketno, > }, > repeat => $dataorders, >+ loops => \%loops, > want_librarian => 1, > ) or return { error => "no_letter" }; > >@@ -750,6 +751,7 @@ sub _parseletter_sth { > ($table eq 'aqbooksellers') ? "SELECT * FROM $table WHERE id = ?" : > ($table eq 'aqorders' ) ? "SELECT * FROM $table WHERE ordernumber = ?" : > ($table eq 'aqbasket' ) ? "SELECT * FROM $table WHERE basketno = ?" : >+ ($table eq 'aqbookseller' ) ? "SELECT * FROM $table WHERE basketno = ?" : > ($table eq 'illrequests' ) ? "SELECT * FROM $table WHERE illrequest_id = ?" : > ($table eq 'article_requests') ? "SELECT * FROM $table WHERE id = ?" : > ($table eq 'borrower_modifications') ? "SELECT * FROM $table WHERE verification_token = ?" : >@@ -1645,6 +1647,12 @@ sub _get_tt_params { > plural => 'baskets', > pk => 'basketno', > }, >+ aqbooksellers => { >+ module => 'Koha::Acquisition::Booksellers', >+ singular => 'bookseller', >+ plural => 'booksellers', >+ pk => 'id', >+ }, > biblio => { > module => 'Koha::Biblios', > singular => 'biblio', >-- >2.30.2
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 31858
:
142160
|
142161
|
142162
|
142163
|
145246
|
146904
|
146905
|
146906