From 218d7d846fb273d20c41ff0b979b76645fdd52dc Mon Sep 17 00:00:00 2001 From: Mason James Date: Tue, 30 Apr 2013 14:45:53 +1200 Subject: [PATCH] Bug 9084 - Dates in notices should be formatted according to dateformat system preference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" to test… - apply patch - choose a patron to checkout item - in 'Patron messaging preferences' section, of patrons 'details' page - tick 'email' box for 'Item checkout' ---------------------------------------- Patron messaging preferences Days in advance Email Item checkout - x <==== Hold filled - - Item due - - Item check-in - - ---------------------------------------- - cut/paste below notice, for CHECKOUT, in 'Home › Tools › Notices & Slips › Modify notice' bib: <> due: <> issue: <> return: <> - delete issues and message_queue tables, before test mysql> truncate issues; mysql> truncate message_queue; - issue a test item to patron - check message_queue table for notice, with correctly formatted dates, with stripped time mysql> select content from message_queue\G content: bib: TESTAMENTS OF LOVE due: 20/05/2013 issue: 30/04/2013 return: 30/04/2013 1 row in set (0.00 sec) --- C4/Letters.pm | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index b8e2722..f3f35a9 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -617,7 +617,23 @@ sub _parseletter { $letter->{content} =~ s/<>/$todaysdate/go; } - while ( my ($field, $val) = each %$values ) { + my @dates = qq| + issues.date_due issues.returndate issues.issuedate issues.lastreneweddate + old_issues.date_due old_issues.returndate old_issues.issuedate old_issues.lastreneweddate + |; + + while ( my ( $field, $val ) = each %$values ) { + + # Bug 9084 - Dates in notices should be formatted + # according to dateformat system preference + my $match = "$table.$field"; + if ( grep /$match/, @dates ) { + + # display syspref formatted date, and strip time + my $dateonly = 1; + $val = output_pref( dt_from_string($val), undef, undef, $dateonly ); + } + my $replacetablefield = "<<$table.$field>>"; my $replacefield = "<<$field>>"; $val =~ s/\p{P}$// if $val && $table=~/biblio/; -- 1.7.2.5