Fixed failed tests for transactions refs #2326

This commit is contained in:
Burak Çakırel 2021-12-01 13:22:24 +00:00
parent 4c8a14f10a
commit 0fccac0dc2
No known key found for this signature in database
GPG Key ID: 48FFBB7771B99C7C

View File

@ -104,6 +104,9 @@ abstract class TransactionTemplate extends Base
/** @var string */
public $textPaidBy;
/** @var string */
public $textContactInfo;
/** @var bool */
public $hideContact;
@ -176,7 +179,7 @@ abstract class TransactionTemplate extends Base
bool $hideContentTitle = false,bool $hidePaidAt = false, bool $hideAccount = false, bool $hideCategory = false, bool $hidePaymentMethods = false, bool $hideReference = false, bool $hideDescription = false,
bool $hideAmount = false,
string $textContentTitle = '', string $textPaidAt = '', string $textAccount = '', string $textCategory = '', string $textPaymentMethods = '', string $textReference = '', string $textDescription = '',
string $textAmount = '', string $textPaidBy = '',
string $textAmount = '', string $textPaidBy = '', string $textContactInfo = '',
bool $hideContact = false, bool $hideContactInfo = false, bool $hideContactName = false, bool $hideContactAddress = false, bool $hideContactTaxNumber = false,
bool $hideContactPhone = false, bool $hideContactEmail = false,
bool $hideRelated = false, bool $hideRelatedDocumentNumber = false, bool $hideRelatedContact = false, bool $hideRelatedDocumentDate = false, bool $hideRelatedDocumentAmount = false, bool $hideRelatedAmount = false,
@ -219,6 +222,7 @@ abstract class TransactionTemplate extends Base
$this->textDescription = $this->getTextDescription($type, $textDescription);
$this->textAmount = $this->getTextAmount($type, $textAmount);
$this->textPaidBy = $this->getTextPaidBy($type, $textPaidBy);
$this->textContactInfo = $this->getTextContactInfo($type, $textContactInfo);
// Contact Information Hide checker
$this->hideContact = $hideContact;
@ -248,6 +252,26 @@ abstract class TransactionTemplate extends Base
$this->routeDocumentShow = $this->routeDocumentShow($type, $routeDocumentShow);
}
protected function getTextContactInfo($type, $textContactInfo)
{
if (!empty($textContactInfo)) {
return $textContactInfo;
}
switch ($type) {
case 'bill':
case 'expense':
case 'purchase':
$textContactInfo = 'bills.bill_from';
break;
default:
$textContactInfo = 'invoices.bill_to';
break;
}
return $textContactInfo;
}
protected function getLogo($logo)
{
if (!empty($logo)) {