View | Details | Raw Unified | Return to bug 9348
Collapse All | Expand All

(-)a/C4/Letters.pm (-17 / +9 lines)
Lines 29-34 use C4::Branch; Link Here
29
use C4::Log;
29
use C4::Log;
30
use C4::SMS;
30
use C4::SMS;
31
use C4::Debug;
31
use C4::Debug;
32
use Koha::DateUtils;
33
32
use Date::Calc qw( Add_Delta_Days );
34
use Date::Calc qw( Add_Delta_Days );
33
use Encode;
35
use Encode;
34
use Carp;
36
use Carp;
Lines 600-616 my %columns = (); Link Here
600
sub _parseletter {
602
sub _parseletter {
601
    my ( $letter, $table, $values ) = @_;
603
    my ( $letter, $table, $values ) = @_;
602
604
603
    # TEMPORARY hack until the expirationdate column is added to reserves
604
    if ( $table eq 'reserves' && $values->{'waitingdate'} ) {
605
    if ( $table eq 'reserves' && $values->{'waitingdate'} ) {
605
        my @waitingdate = split /-/, $values->{'waitingdate'};
606
        my @waitingdate = split /-/, $values->{'waitingdate'};
606
607
        
607
        $values->{'expirationdate'} = C4::Dates->new(
608
        my $dt = dt_from_string();
608
            sprintf(
609
        $dt->add( days => C4::Context->preference('ReservesMaxPickUpDelay') );
609
                '%04d-%02d-%02d',
610
        $values->{'expirationdate'} = output_pref( $dt, undef, 1 );
610
                Add_Delta_Days( @waitingdate, C4::Context->preference( 'ReservesMaxPickUpDelay' ) )
611
        
611
            ),
612
        $values->{'waitingdate'} = output_pref( dt_from_string( $values->{'waitingdate'} ), undef, 1 );
612
            'iso'
613
        
613
        )->output();
614
    }
614
    }
615
615
616
    if ($letter->{content} && $letter->{content} =~ /<<today>>/) {
616
    if ($letter->{content} && $letter->{content} =~ /<<today>>/) {
Lines 619-631 sub _parseletter { Link Here
619
        $letter->{content} =~ s/<<today>>/$todaysdate/go;
619
        $letter->{content} =~ s/<<today>>/$todaysdate/go;
620
    }
620
    }
621
621
622
    # and get all fields from the table
623
#   my $columns = $columns{$table};
624
#   unless ($columns) {
625
#       $columns = $columns{$table} =  C4::Context->dbh->selectcol_arrayref("SHOW COLUMNS FROM $table");
626
#   }
627
#   foreach my $field (@$columns) {
628
629
    while ( my ($field, $val) = each %$values ) {
622
    while ( my ($field, $val) = each %$values ) {
630
        my $replacetablefield = "<<$table.$field>>";
623
        my $replacetablefield = "<<$table.$field>>";
631
        my $replacefield = "<<$field>>";
624
        my $replacefield = "<<$field>>";
632
- 

Return to bug 9348