bug fixes and subscription improvements

This commit is contained in:
Dennis Eichhorn 2023-04-25 01:51:27 +00:00
parent 63cf7e8c3b
commit 2eacbaadc0
2 changed files with 8 additions and 8 deletions

View File

@ -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 */

View File

@ -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;
}