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 Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
0ef8e6aff9
commit
09ceb26b57
1 changed files with 15 additions and 8 deletions
|
@ -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" };
|
||||
|
||||
|
@ -1656,6 +1657,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',
|
||||
|
|
Loading…
Reference in a new issue