/*
* type ... 1 customers - email sent to customer - set in email or in different text parts of e.g. invoice
* type ... 2 others - email sent to all others
*
*/
public static function completeText($body, $replace, $type = 1)
{
$body = isset($replace['name']) ? str_replace('{name}', $replace['name'], $body) : $body;
if ($type == 3) {
$body = isset($replace['email_gift_recipient']) ? str_replace('{emailgiftrecipient}', $replace['email_gift_recipient'], $body) : $body;
$body = isset($replace['name_gift_recipient']) ? str_replace('{namegiftrecipient}', $replace['name_gift_recipient'], $body) : $body;
$body = isset($replace['name_gift_sender']) ? str_replace('{namegiftbuyer}', $replace['name_gift_sender'], $body) : $body;
// Valid To variable is limited only to first gift card, because when the variable is replaced by first gift card, it cannot be set for next gift cards
$body = isset($replace['valid_to_gift']) ? str_replace('{giftvalidto}', $replace['valid_to_gift'], $body) : $body;
} else {
if ($type == 2) {
$body = isset($replace['email_others']) ? str_replace('{emailothers}', $replace['email_others'], $body) : $body;
} else {
if ($type == 1) {
$body = isset($replace['email']) ? str_replace('{email}', $replace['email'], $body) : $body;
}
}
}
$body = isset($replace['downloadlink']) ? str_replace('{downloadlink}', $replace['downloadlink'], $body) : $body;
$body = isset($replace['orderlink']) ? str_replace('{orderlink}', $replace['orderlink'], $body) : $body;
$body = isset($replace['orderlinktoken']) ? str_replace('{orderlinktoken}', $replace['orderlinktoken'], $body) : $body;
$body = isset($replace['ordertoken']) ? str_replace('{ordertoken}', $replace['ordertoken'], $body) : $body;
$body = isset($replace['trackinglink']) ? str_replace('{trackinglink}', $replace['trackinglink'], $body) : $body;
$body = isset($replace['trackingnumber']) ? str_replace('{trackingnumber}', $replace['trackingnumber'], $body) : $body;
$body = isset($replace['trackingdescription']) ? str_replace('{trackingdescription}', $replace['trackingdescription'], $body) : $body;
$body = isset($replace['shippingtitle']) ? str_replace('{shippingtitle}', $replace['shippingtitle'], $body) : $body;
$body = isset($replace['shippingdescriptioninfo']) ? str_replace('{shippingdescriptioninfo}', $replace['shippingdescriptioninfo'], $body) : $body;
$body = isset($replace['paymenttitle']) ? str_replace('{paymenttitle}', $replace['paymenttitle'], $body) : $body;
$body = isset($replace['paymentdescriptioninfo']) ? str_replace('{paymentdescriptioninfo}', $replace['paymentdescriptioninfo'], $body) : $body;
$body = isset($replace['dateshipped']) ? str_replace('{dateshipped}', $replace['dateshipped'], $body) : $body;
$body = isset($replace['customercomment']) ? str_replace('{customercomment}', $replace['customercomment'], $body) : $body;
$body = isset($replace['websitename']) ? str_replace('{websitename}', $replace['websitename'], $body) : $body;
$body = isset($replace['websiteurl']) ? str_replace('{websiteurl}', $replace['websiteurl'], $body) : $body;
$body = isset($replace['orderid']) ? str_replace('{orderid}', $replace['orderid'], $body) : $body;
$body = isset($replace['ordernumber']) ? str_replace('{ordernumber}', $replace['ordernumber'], $body) : $body;
$body = isset($replace['invoicenumber']) ? str_replace('{invoicenumber}', $replace['invoicenumber'], $body) : $body;
$body = isset($replace['receiptnumber']) ? str_replace('{receiptnumber}', $replace['receiptnumber'], $body) : $body;
$body = isset($replace['queuenumber']) ? str_replace('{queuenumber}', $replace['queuenumber'], $body) : $body;
$body = isset($replace['paymentreferencenumber']) ? str_replace('{paymentreferencenumber}', $replace['paymentreferencenumber'], $body) : $body;
$body = isset($replace['invoiceduedate']) ? str_replace('{invoiceduedate}', $replace['invoiceduedate'], $body) : $body;
$body = isset($replace['invoicedate']) ? str_replace('{invoicedate}', $replace['invoicedate'], $body) : $body;
$body = isset($replace['invoicetimeofsupply']) ? str_replace('{invoicetimeofsupply}', $replace['invoicetimeofsupply'], $body) : $body;
$body = isset($replace['invoicedueyear']) ? str_replace('{invoicedueyear}', $replace['invoicedueyear'], $body) : $body;
$body = isset($replace['invoiceduemonth']) ? str_replace('{invoiceduemonth}', $replace['invoiceduemonth'], $body) : $body;
$body = isset($replace['invoicedueday']) ? str_replace('{invoicedueday}', $replace['invoicedueday'], $body) : $body;
$body = isset($replace['invoiceyear']) ? str_replace('{invoiceyear}', $replace['invoiceyear'], $body) : $body;
$body = isset($replace['invoicemonth']) ? str_replace('{invoicemonth}', $replace['invoicemonth'], $body) : $body;
$body = isset($replace['invoiceday']) ? str_replace('{invoiceday}', $replace['invoiceday'], $body) : $body;
$body = isset($replace['orderdate']) ? str_replace('{orderdate}', $replace['orderdate'], $body) : $body;
$body = isset($replace['totaltopay']) ? str_replace('{totaltopay}', $replace['totaltopay'], $body) : $body;
$body = isset($replace['orderyear']) ? str_replace('{orderyear}', $replace['orderyear'], $body) : $body;
$body = isset($replace['ordermonth']) ? str_replace('{ordermonth}', $replace['ordermonth'], $body) : $body;
$body = isset($replace['orderday']) ? str_replace('{orderday}', $replace['orderday'], $body) : $body;
$body = isset($replace['ordernumbertxt']) ? str_replace('{ordernumbertxt}', $replace['ordernumbertxt'], $body) : $body;
$body = isset($replace['bankaccountnumber']) ? str_replace('{bankaccountnumber}', $replace['bankaccountnumber'], $body) : $body;
$body = isset($replace['iban']) ? str_replace('{iban}', $replace['iban'], $body) : $body;
$body = isset($replace['bicswift']) ? str_replace('{bicswift}', $replace['bicswift'], $body) : $body;
$body = isset($replace['totaltopaynoformat']) ? str_replace('{totaltopaynoformat}', $replace['totaltopaynoformat'], $body) : $body;
$body = isset($replace['totaltopaynoformatcomma']) ? str_replace('{totaltopaynoformatcomma}', $replace['totaltopaynoformatcomma'], $body) : $body;
$body = isset($replace['currencycode']) ? str_replace('{currencycode}', $replace['currencycode'], $body) : $body;
$body = isset($replace['openingtimesinfo']) ? str_replace('{openingtimesinfo}', $replace['openingtimesinfo'], $body) : $body;
$body = isset($replace['vendorname']) ? str_replace('{vendorname}', $replace['vendorname'], $body) : $body;
$body = isset($replace['vendorusername']) ? str_replace('{vendorusername}', $replace['vendorusername'], $body) : $body;
return $body;
}