Merge branch 'fronkdev' into 'master'

Fixed price with comma in PreorderApi submitPreorder()

See merge request fronk/thetool!639
This commit is contained in:
Frank Schubert
2024-09-20 11:09:43 +00:00
2 changed files with 21 additions and 1 deletions

View File

@@ -830,8 +830,14 @@ class PreorderApicontroller extends mfBaseApicontroller {
//$preorder_data['price_setup'] = round($product->price_setup - (($product->price_setup) / 100) * TT_PREORDER_DISCOUNT_BUSINESS);
$preorder_data['price_setup'] = ($product->attributes["presales_setup_price_business"]->value) ? $product->attributes["presales_setup_price_business"]->value : $product->price_setup;
}
if($preorder_data['price_setup']) {
$preorder_data['price_setup'] = str_replace(',', '.', $preorder_data['price_setup']);
}
}
/*
* get customer data
@@ -1021,6 +1027,8 @@ class PreorderApicontroller extends mfBaseApicontroller {
}
if(!$preorder_id || !$preorder->ucode) {
$err_id = uniqid('err');
$this->log->error(__METHOD__.": [$err_id] Error saving Preorder");
if($unit_changed) $unit->rollbackTransaction();
return mfResponse::InternalServerError();
}

View File

@@ -122,6 +122,18 @@ class Emailnotification {
//$log->debug(print_r($headers, true));
$mail =& Mail::factory('mail', ["-f ".$this->email_from]);
/*
* PHP 8's mail() function now outputs proper line endings in headers (CRLF instead of LF).
* Mail_mail < 2.0 would detect a unix system and change the headers line ending to LF.
* On Mail submission to Exim (via sendmail), mail() adds its own headers first with CRLF line ending,
* making Exim treat every subsequent header's LF as an invalid line ending, adding a whitespace after the LF,
* making all our custom headers into one long header.
*
* See: https://www.exim.org/exim-html-current/doc/html/spec_html/ch-message_processing.html#SECTlineendings
*
* So we force CRLF line endings for headers here.
*/
$mail->sep = "\r\n";
$mail->send($this->email_to, $headers, $body);
}