Merge branch 'bug_9348' into 3.12-master

This commit is contained in:
Jared Camins-Esakov 2013-01-18 13:47:52 -05:00
commit 784f4c39af
1 changed files with 8 additions and 15 deletions

View File

@ -29,6 +29,8 @@ use C4::Branch;
use C4::Log;
use C4::SMS;
use C4::Debug;
use Koha::DateUtils;
use Date::Calc qw( Add_Delta_Days );
use Encode;
use Carp;
@ -600,17 +602,15 @@ my %columns = ();
sub _parseletter {
my ( $letter, $table, $values ) = @_;
# TEMPORARY hack until the expirationdate column is added to reserves
if ( $table eq 'reserves' && $values->{'waitingdate'} ) {
my @waitingdate = split /-/, $values->{'waitingdate'};
$values->{'expirationdate'} = C4::Dates->new(
sprintf(
'%04d-%02d-%02d',
Add_Delta_Days( @waitingdate, C4::Context->preference( 'ReservesMaxPickUpDelay' ) )
),
'iso'
)->output();
my $dt = dt_from_string();
$dt->add( days => C4::Context->preference('ReservesMaxPickUpDelay') );
$values->{'expirationdate'} = output_pref( $dt, undef, 1 );
$values->{'waitingdate'} = output_pref( dt_from_string( $values->{'waitingdate'} ), undef, 1 );
}
if ($letter->{content} && $letter->{content} =~ /<<today>>/) {
@ -619,13 +619,6 @@ sub _parseletter {
$letter->{content} =~ s/<<today>>/$todaysdate/go;
}
# and get all fields from the table
# my $columns = $columns{$table};
# unless ($columns) {
# $columns = $columns{$table} = C4::Context->dbh->selectcol_arrayref("SHOW COLUMNS FROM $table");
# }
# foreach my $field (@$columns) {
while ( my ($field, $val) = each %$values ) {
my $replacetablefield = "<<$table.$field>>";
my $replacefield = "<<$field>>";