diff --git a/Controller/ApiBillController.php b/Controller/ApiBillController.php index db8fe09..51e2345 100755 --- a/Controller/ApiBillController.php +++ b/Controller/ApiBillController.php @@ -674,7 +674,7 @@ final class ApiBillController extends Controller ->where('id', $billTypeId) ->execute(); - $templateId = $billType->defaultTemplate->getId(); + $templateId = $billType->defaultTemplate?->getId(); } /** @var \Modules\Media\Models\Collection $template */ @@ -806,7 +806,7 @@ final class ApiBillController extends Controller ->where('id', $billTypeId) ->execute(); - $templateId = $billType->defaultTemplate->getId(); + $templateId = $billType->defaultTemplate?->getId(); } /** @var \Modules\Media\Models\Collection $template */ diff --git a/Models/BillElement.php b/Models/BillElement.php index dca2117..89ef0f8 100755 --- a/Models/BillElement.php +++ b/Models/BillElement.php @@ -274,12 +274,12 @@ class BillElement implements \JsonSerializable if (!empty($element->bill) && $item->getAttribute('subscription')?->value->getValue() === 1 ) { - $element->subscription = new Subscription(); - $element->subscription->bill = $element->bill; - $element->subscription->item = $element->item; - $element->subscription->start = $element->quantity; - $element->subscription->end = $element->quantity; - $element->subscription->quantity = $element->quantity; + $element->subscription = new Subscription(); + $element->subscription->bill = $element->bill; + $element->subscription->item = $element->item; + $element->subscription->start = $element->quantity; + $element->subscription->end = $element->quantity; + $element->subscription->quantity = $element->quantity; $element->subscription->autoRenew = $item->getAttribute('subscription_renewal_type')->value->getValue() === 1; }