Fixed exception when the calculated minimum_order_price is null

This fixes issue #311
This commit is contained in:
Jan Böhmer 2023-07-03 23:41:39 +02:00
parent f98e20aa84
commit 15e072a2ff

View file

@ -70,14 +70,15 @@
{% set min_order_amount = pricedetail_helper.minOrderAmount(part) %} {% set min_order_amount = pricedetail_helper.minOrderAmount(part) %}
{% set max_order_amount = pricedetail_helper.maxDiscountAmount(part) %} {% set max_order_amount = pricedetail_helper.maxDiscountAmount(part) %}
{% set max_order_price = pricedetail_helper.calculateAvgPrice(part, max_order_amount, app.user.currency ?? null) %} {% set max_order_price = pricedetail_helper.calculateAvgPrice(part, max_order_amount, app.user.currency ?? null) %}
{% set min_order_price = pricedetail_helper.calculateAvgPrice(part, min_order_amount, app.user.currency ?? null ) %}
{% if max_order_price is not null %} {% if max_order_price is not null %}
<h6> <h6>
<i class="fas fa-money-bill-alt fa-fw"></i> <i class="fas fa-money-bill-alt fa-fw"></i>
<span class="text-muted"> <span class="text-muted">
<span title="{% trans %}part.avg_price.label{% endtrans %} {{ max_order_amount | format_amount(part.partUnit) }}">{{ max_order_price | format_money(app.user.currency ?? null) }}</span> <span title="{% trans %}part.avg_price.label{% endtrans %} {{ max_order_amount | format_amount(part.partUnit) }}">{{ max_order_price | format_money(app.user.currency ?? null) }}</span>
{% if min_order_amount < max_order_amount %} {% if min_order_price is not null and min_order_amount < max_order_amount %}
<span> - </span> <span> - </span>
<span title="{% trans %}part.avg_price.label{% endtrans %} {{ min_order_amount | format_amount(part.partUnit) }}">{{pricedetail_helper.calculateAvgPrice(part, min_order_amount, app.user.currency ?? null ) | format_money(app.user.currency ?? null) }}</span> <span title="{% trans %}part.avg_price.label{% endtrans %} {{ min_order_amount | format_amount(part.partUnit) }}">{% if max_order_price is not null %}{{ min_order_price | format_money(app.user.currency ?? null) }}{% else %}???{% endif %}</span>
{% endif %} {% endif %}
</span> </span>
</h6> </h6>