Bug 8435: DBRev 3.13.00.038
[koha.git] / C4 / Letters.pm
index bb327a2..7125148 100644 (file)
@@ -613,10 +613,10 @@ sub _parseletter {
         my @waitingdate = split /-/, $values->{'waitingdate'};
 
         my $dt = dt_from_string();
-        $dt->add( days => C4::Context->preference('ReservesMaxPickUpDelay') );
-        $values->{'expirationdate'} = output_pref( $dt, undef, 1 );
+        $dt->add( days => C4::Context->preference('ReservesMaxPickUpDelay') || 0);
+        $values->{'expirationdate'} = output_pref({ dt => $dt, dateonly => 1 });
 
-        $values->{'waitingdate'} = output_pref( dt_from_string( $values->{'waitingdate'} ), undef, 1 );
+        $values->{'waitingdate'} = output_pref({ dt => dt_from_string( $values->{'waitingdate'} ), dateonly => 1 });
 
     }
 
@@ -945,9 +945,12 @@ sub _send_message_by_email {
     my $content = encode('utf8', $message->{'content'});
     my $content_type = $message->{'content_type'} || 'text/plain; charset="UTF-8"';
     my $is_html = $content_type =~ m/html/io;
+
+    my $branch_email = ( $member ) ? GetBranchDetail( $member->{'branchcode'} )->{'branchemail'} : undef;
+
     my %sendmail_params = (
         To   => $to_address,
-        From => $message->{'from_address'} || GetBranchDetail( $member->{'branchcode'} )->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress'),
+        From => $message->{'from_address'} || $branch_email || C4::Context->preference('KohaAdminEmailAddress'),
         Subject => $subject,
         charset => 'utf8',
         Message => $is_html ? _wrap_html($content, $subject) : $content,