1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-18 09:04:35 +01:00
invoiceninja/app/DataMapper/EmailTemplateDefaults.php

231 lines
6.8 KiB
PHP
Raw Normal View History

<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\DataMapper;
use Illuminate\Support\Facades\App;
class EmailTemplateDefaults
{
public static function getDefaultTemplate($template, $locale)
{
App::setLocale($locale);
switch ($template) {
/* Template */
case 'email_template_invoice':
return self::emailInvoiceTemplate();
break;
case 'email_template_quote':
return self::emailQuoteTemplate();
break;
2020-10-15 23:55:24 +02:00
case 'email_template_credit':
return self::emailCreditTemplate();
break;
case 'email_template_payment':
return self::emailPaymentTemplate();
break;
case 'email_template_payment_partial':
2020-10-09 13:13:33 +02:00
return self::emailPaymentPartialTemplate();
break;
case 'email_template_statement':
return self::emailStatementTemplate();
break;
case 'email_template_reminder1':
return self::emailReminder1Template();
break;
case 'email_template_reminder2':
return self::emailReminder2Template();
break;
case 'email_template_reminder3':
return self::emailReminder3Template();
break;
case 'email_template_reminder_endless':
return self::emailReminderEndlessTemplate();
break;
case 'email_template_custom1':
return self::emailInvoiceTemplate();
break;
case 'email_template_custom2':
return self::emailInvoiceTemplate();
break;
case 'email_template_custom3':
return self::emailInvoiceTemplate();
break;
/* Subject */
case 'email_subject_invoice':
return self::emailInvoiceSubject();
break;
case 'email_subject_quote':
return self::emailQuoteSubject();
break;
2020-10-15 23:55:24 +02:00
case 'email_subject_credit':
return self::emailCreditSubject();
break;
case 'email_subject_payment':
return self::emailPaymentSubject();
break;
case 'email_subject_payment_partial':
2020-10-09 13:13:33 +02:00
return self::emailPaymentPartialSubject();
break;
case 'email_subject_statement':
return self::emailStatementSubject();
break;
case 'email_subject_reminder1':
return self::emailReminder1Subject();
break;
case 'email_subject_reminder2':
return self::emailReminder2Subject();
break;
case 'email_subject_reminder3':
return self::emailReminder3Subject();
break;
case 'email_subject_reminder_endless':
return self::emailReminderEndlessSubject();
break;
case 'email_subject_custom1':
return self::emailInvoiceSubject();
break;
case 'email_subject_custom2':
return self::emailInvoiceSubject();
break;
case 'email_subject_custom3':
return self::emailInvoiceSubject();
break;
default:
return self::emailInvoiceTemplate();
break;
}
}
public static function emailInvoiceSubject()
{
return ctrans('texts.invoice_subject', ['number'=>'$number', 'account'=>'$company.name']);
2020-10-15 23:55:24 +02:00
}
public static function emailCreditSubject()
{
return ctrans('texts.credit_subject', ['number'=>'$number', 'account'=>'$company.name']);
}
public static function emailInvoiceTemplate()
{
2021-03-10 14:32:17 +01:00
$invoice_message = '<p>'.self::transformText('invoice_message').'</p><div class="center">$view_link</div>';
return $invoice_message;
}
public static function emailQuoteSubject()
{
return ctrans('texts.quote_subject', ['number'=>'$number', 'account'=>'$company.name']);
}
public static function emailQuoteTemplate()
{
2021-03-10 14:32:17 +01:00
$quote_message = '<p>'.self::transformText('quote_message').'</p><div class="center">$view_link</div>';
2020-10-26 22:54:59 +01:00
return $quote_message;
}
public static function emailPaymentSubject()
{
return ctrans('texts.payment_subject');
}
public static function emailPaymentTemplate()
{
2021-03-10 14:32:17 +01:00
$payment_message = '<p>'.self::transformText('payment_message').'</p><div class="center">$view_link</div>';
2020-10-30 07:54:25 +01:00
return $payment_message;
2020-10-09 13:13:33 +02:00
}
2020-10-15 23:55:24 +02:00
public static function emailCreditTemplate()
{
2021-03-10 14:32:17 +01:00
$credit_message = '<p>'.self::transformText('credit_message').'</p><div class="center">$view_link</div>';
2020-10-15 23:55:24 +02:00
2020-10-26 22:54:59 +01:00
return $credit_message;
2020-10-15 23:55:24 +02:00
}
2020-10-09 22:31:24 +02:00
public static function emailPaymentPartialTemplate()
{
2021-03-10 14:32:17 +01:00
$payment_message = '<p>'.self::transformText('payment_message').'</p><div class="center">$view_link</div>';
2020-10-30 07:54:25 +01:00
return $payment_message;
2020-10-09 22:31:24 +02:00
}
2020-10-09 13:13:33 +02:00
public static function emailPaymentPartialSubject()
{
return ctrans('texts.payment_subject');
}
public static function emailReminder1Subject()
{
return ctrans('texts.reminder_subject', ['invoice'=>'$invoice.number', 'account'=>'$company.name']);
}
public static function emailReminder1Template()
{
2020-10-19 23:18:09 +02:00
return '';
}
public static function emailReminder2Subject()
{
return ctrans('texts.reminder_subject', ['invoice'=>'$invoice.number', 'account'=>'$company.name']);
}
public static function emailReminder2Template()
{
2020-10-19 23:18:09 +02:00
return '';
}
public static function emailReminder3Subject()
{
return ctrans('texts.reminder_subject', ['invoice'=>'$invoice.number', 'account'=>'$company.name']);
}
public static function emailReminder3Template()
{
2020-10-19 12:59:58 +02:00
return '';
}
public static function emailReminderEndlessSubject()
{
return ctrans('texts.reminder_subject', ['invoice'=>'$invoice.number', 'account'=>'$company.name']);
}
public static function emailReminderEndlessTemplate()
{
2020-10-19 12:59:58 +02:00
return '';
}
public static function emailStatementSubject()
{
2020-10-19 12:59:58 +02:00
return '';
}
public static function emailStatementTemplate()
{
2020-10-19 12:59:58 +02:00
return '';
}
private static function transformText($string)
{
//preformat the string, removing trailing colons.
2021-02-04 12:48:01 +01:00
return str_replace(':', '$', rtrim( ctrans('texts.'.$string), ":"));
}
}