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

(-)a/C4/Letters.pm (-1 / +6 lines)
Lines 643-648 sub _parseletter { Link Here
643
    }
643
    }
644
644
645
    while ( my ($field, $val) = each %$values ) {
645
    while ( my ($field, $val) = each %$values ) {
646
        warn "warn replacing field $table.$field";
646
        my $replacetablefield = "<<$table.$field>>";
647
        my $replacetablefield = "<<$table.$field>>";
647
        my $replacefield = "<<$field>>";
648
        my $replacefield = "<<$field>>";
648
        $val =~ s/\p{P}$// if $val && $table=~/biblio/;
649
        $val =~ s/\p{P}$// if $val && $table=~/biblio/;
Lines 651-667 sub _parseletter { Link Here
651
            #but excludes items. Removed unneeded global and lookahead.
652
            #but excludes items. Removed unneeded global and lookahead.
652
653
653
        $val = GetAuthorisedValueByCode ('ROADTYPE', $val, 0) if $table=~/^borrowers$/ && $field=~/^streettype$/;
654
        $val = GetAuthorisedValueByCode ('ROADTYPE', $val, 0) if $table=~/^borrowers$/ && $field=~/^streettype$/;
655
        warn "1>" . localtime;
654
        my $replacedby   = defined ($val) ? $val : '';
656
        my $replacedby   = defined ($val) ? $val : '';
655
        if (    $replacedby
657
        if (    $replacedby
656
            and not $replacedby =~ m|0000-00-00|
658
            and not $replacedby =~ m|0000-00-00|
657
            and $replacedby =~ m|^\d{4}-\d{2}-\d{2}( \d{2}:\d{2}:\d{2})?$| )
659
            and $replacedby =~ m|^\d{4}-\d{2}-\d{2}( \d{2}:\d{2}:\d{2})?$| )
658
        {
660
        {
661
            warn "2>" . localtime;
662
            warn "Trying to replace $replaced_by";
659
            # If the value is XXXX-YY-ZZ[ AA:BB:CC] we assume it is a date
663
            # If the value is XXXX-YY-ZZ[ AA:BB:CC] we assume it is a date
660
            my $dateonly = defined $1 ? 0 : 1; #$1 refers to the capture group wrapped in parentheses. In this case, that's the hours, minutes, seconds.
664
            my $dateonly = defined $1 ? 0 : 1; #$1 refers to the capture group wrapped in parentheses. In this case, that's the hours, minutes, seconds.
661
            eval {
665
            eval {
662
                $replacedby = output_pref({ dt => dt_from_string( $replacedby ), dateonly => $dateonly });
666
                $replacedby = output_pref({ dt => dt_from_string( $replacedby ), dateonly => $dateonly });
663
            };
667
            };
664
            warn "$replacedby seems to be a date but an error occurs on generating it ($@)" if $@;
668
            warn "$replacedby seems to be a date but an error occurs on generating it ($@)" if $@;
669
            warn "3>" . localtime;
670
            warn "Has been replaced by $replaced_by";
665
        }
671
        }
666
        ($letter->{title}  ) and do {
672
        ($letter->{title}  ) and do {
667
            $letter->{title}   =~ s/$replacetablefield/$replacedby/g;
673
            $letter->{title}   =~ s/$replacetablefield/$replacedby/g;
668
- 

Return to bug 13226