mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for ledger id in transformer
This commit is contained in:
parent
f0b532847d
commit
3d40df6264
@ -154,10 +154,12 @@ class CompanySettings extends BaseSettings
|
||||
public $email_style_custom = ''; //the template itself
|
||||
public $email_subject_invoice = '';
|
||||
public $email_subject_quote = '';
|
||||
public $email_subject_credit = '';
|
||||
public $email_subject_payment = '';
|
||||
public $email_subject_payment_partial = '';
|
||||
public $email_subject_statement = '';
|
||||
public $email_template_invoice = '';
|
||||
public $email_template_credit = '';
|
||||
public $email_template_quote = '';
|
||||
public $email_template_payment = '';
|
||||
public $email_template_payment_partial = '';
|
||||
@ -350,10 +352,12 @@ class CompanySettings extends BaseSettings
|
||||
'email_signature' => 'string',
|
||||
'email_subject_invoice' => 'string',
|
||||
'email_subject_quote' => 'string',
|
||||
'email_subject_credit' => 'string',
|
||||
'email_subject_payment' => 'string',
|
||||
'email_subject_payment_partial' => 'string',
|
||||
'email_template_invoice' => 'string',
|
||||
'email_template_quote' => 'string',
|
||||
'email_template_credit' => 'string',
|
||||
'email_template_payment' => 'string',
|
||||
'email_template_payment_partial' => 'string',
|
||||
'email_subject_reminder1' => 'string',
|
||||
|
@ -30,6 +30,9 @@ class EmailTemplateDefaults
|
||||
case 'email_template_quote':
|
||||
return self::emailQuoteTemplate();
|
||||
break;
|
||||
case 'email_template_credit':
|
||||
return self::emailCreditTemplate();
|
||||
break;
|
||||
case 'email_template_payment':
|
||||
return self::emailPaymentTemplate();
|
||||
break;
|
||||
@ -69,6 +72,9 @@ class EmailTemplateDefaults
|
||||
case 'email_subject_quote':
|
||||
return self::emailQuoteSubject();
|
||||
break;
|
||||
case 'email_subject_credit':
|
||||
return self::emailCreditSubject();
|
||||
break;
|
||||
case 'email_subject_payment':
|
||||
return self::emailPaymentSubject();
|
||||
break;
|
||||
@ -109,7 +115,11 @@ class EmailTemplateDefaults
|
||||
public static function emailInvoiceSubject()
|
||||
{
|
||||
return ctrans('texts.invoice_subject', ['number'=>'$number', 'account'=>'$company.name']);
|
||||
//return Parsedown::instance()->line(self::transformText('invoice_subject'));
|
||||
}
|
||||
|
||||
public static function emailCreditSubject()
|
||||
{
|
||||
return ctrans('texts.credit_subject', ['number'=>'$number', 'account'=>'$company.name']);
|
||||
}
|
||||
|
||||
public static function emailInvoiceTemplate()
|
||||
@ -122,14 +132,11 @@ class EmailTemplateDefaults
|
||||
$invoice_message = '<p>'.self::transformText('invoice_message').'</p><br><br><p>$view_link</p>';
|
||||
|
||||
return $invoice_message;
|
||||
//return $converter->convertToHtml($invoice_message);
|
||||
}
|
||||
|
||||
public static function emailQuoteSubject()
|
||||
{
|
||||
return ctrans('texts.quote_subject', ['number'=>'$number', 'account'=>'$company.name']);
|
||||
|
||||
//return Parsedown::instance()->line(self::transformText('quote_subject'));
|
||||
}
|
||||
|
||||
public static function emailQuoteTemplate()
|
||||
@ -158,6 +165,17 @@ class EmailTemplateDefaults
|
||||
|
||||
}
|
||||
|
||||
public static function emailCreditTemplate()
|
||||
{
|
||||
$converter = new CommonMarkConverter([
|
||||
'html_input' => 'strip',
|
||||
'allow_unsafe_links' => false,
|
||||
]);
|
||||
|
||||
return $converter->convertToHtml(self::transformText('credit_message'));
|
||||
|
||||
}
|
||||
|
||||
public static function emailPaymentPartialTemplate()
|
||||
{
|
||||
$converter = new CommonMarkConverter([
|
||||
|
@ -28,7 +28,7 @@ class CompanyLedgerTransformer extends EntityTransformer
|
||||
*/
|
||||
public function transform(CompanyLedger $company_ledger)
|
||||
{
|
||||
$entity_name = lcfirst(class_basename($company_ledger->company_ledgerable_type)).'_id';
|
||||
$entity_name = lcfirst(rtrim(class_basename($company_ledger->company_ledgerable_type), 's')).'_id';
|
||||
|
||||
return [
|
||||
$entity_name => (string) $this->encodePrimaryKey($company_ledger->company_ledgerable_id),
|
||||
|
@ -104,6 +104,10 @@ trait AppSetup
|
||||
'subject' => EmailTemplateDefaults::emailStatementSubject(),
|
||||
'body' => EmailTemplateDefaults::emailStatementTemplate(),
|
||||
],
|
||||
'credit' => [
|
||||
'subject' => EmailTemplateDefaults::emailCreditSubject(),
|
||||
'body' => EmailTemplateDefaults::emailCreditTemplate(),
|
||||
],
|
||||
];
|
||||
|
||||
Cache::forever($name, $data);
|
||||
|
@ -3283,5 +3283,7 @@ return [
|
||||
'saved_at' => 'Saved at :time',
|
||||
'credit_payment' => 'Credit applied to Invoice :invoice_number',
|
||||
|
||||
'credit_subject' => 'New credit :number from :account',
|
||||
'credit_message' => 'To view your credit for :amount, click the link below.',
|
||||
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user