[Koha-patches] [PATCH] (bug #4990) fix email link in overdues to have a pre-generated message
Nahuel ANGELINETTI
nahuel.angelinetti at biblibre.com
Tue Jul 13 16:03:49 CEST 2010
This fix the link in overdues.pl to have great link with pre-generated emails, they are based on the letter "MANUAL_ODUE" in "circulation" module.
---
circ/overdue.pl | 21 ++++++++++++++++++++
.../prog/en/modules/circ/overdue.tmpl | 4 ++-
2 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/circ/overdue.pl b/circ/overdue.pl
index 2bd2302..e8e8b58 100755
--- a/circ/overdue.pl
+++ b/circ/overdue.pl
@@ -122,6 +122,27 @@ my $datedueto = format_date_in_iso($input->param( 'datedueto' ));
my @overduedata = @{GetOverduesByBorrowers($branchfilter, $borcatfilter, $itemtypefilter, $borflagsfilter, $bornamefilter, $order, $dateduefrom, $datedueto)};
+# Generate letters
+
+for my $borrower (@overduedata){
+ my $letter = C4::Letters::getletter( 'circulation', 'MANUAL_ODUE' );
+
+ my $itemscontent;
+ for my $overdue( @{$borrower->{overdues}} ){
+ $itemscontent .=
+ "$overdue->{title} $overdue->{author} $overdue->{barcode} $overdue->{itemcallnumber} $overdue->{issuedate}\n";
+ }
+ $letter->{content} =~ s/<<items.content>>/$itemscontent/g;
+
+ C4::Letters::parseletter( $letter, 'borrowers', $borrower->{borrowernumber});
+ C4::Letters::parseletter( $letter, 'branches', $borrower->{'branchcode'} );
+
+ $letter->{content} =~ s/\n/%0D%0A/g;
+
+ $borrower->{letter_content} = $letter->{content};
+ $borrower->{letter_title} = $letter->{title};
+}
+
$template->param(
todaysdate => format_date($todaysdate),
overdueloop => \@overduedata
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tmpl
index bdd98ae..7e78dcd 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tmpl
@@ -39,7 +39,9 @@
<tbody><!-- TMPL_LOOP NAME="overdueloop" -->
<tr>
<td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR name="borrowernumber"-->"><!-- TMPL_VAR NAME="surname" --> <!-- TMPL_VAR NAME="firstname" --></a>
- <!-- TMPL_IF NAME="email" -->[<a href="mailto:<!-- TMPL_VAR NAME="email" -->?subject=Overdue: <!-- TMPL_VAR NAME="title" -->">email</a>]<!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="email" -->
+ [<a href="mailto:<!-- TMPL_VAR NAME="email" -->?subject=<!-- TMPL_VAR ESCAPE="HTML" NAME="letter_title" -->&body=<!-- TMPL_VAR ESCAPE="HTML" NAME="letter_content" -->">email</a>]
+ <!-- /TMPL_IF -->
(<!--TMPL_IF NAME="phone" --><!-- TMPL_VAR NAME="phone" --><!-- TMPL_ELSIF NAME="mobile" --><!-- TMPL_VAR NAME="mobile" --><!-- TMPL_ELSIF NAME="phonepro" --><!-- TMPL_VAR NAME="phonepro" --><!-- /TMPL_IF -->)</td>
<td><!-- TMPL_VAR name="branchcode" --></td>
<td>
--
1.7.0.4
More information about the Koha-patches
mailing list