Fixed error mapping for orderdetails edit page.

This commit is contained in:
Jan Böhmer 2019-08-30 16:47:21 +02:00
parent d47e482b3c
commit 6e34cc3633
5 changed files with 15 additions and 12 deletions

View file

@ -53,7 +53,7 @@ class OrderdetailType extends AbstractType
$builder->add('supplier', StructuralEntityType::class, ['class' => Supplier::class, 'disable_not_selectable' => true]);
$builder->add('supplierProductUrl', UrlType::class, [
$builder->add('supplier_product_url', UrlType::class, [
'required' => false,
'empty_data' => ""
]);
@ -64,7 +64,7 @@ class OrderdetailType extends AbstractType
]);
//Attachment section
$builder->add('priceDetails', CollectionType::class, [
$builder->add('pricedetails', CollectionType::class, [
'entry_type' => PricedetailType::class,
'allow_add' => true, 'allow_delete' => true,
'label' => false,

View file

@ -145,7 +145,7 @@ class PartBaseType extends AbstractType
]);
//Attachment section
$builder->add('orderDetails', CollectionType::class, [
$builder->add('orderdetails', CollectionType::class, [
'entry_type' => OrderdetailType::class,
'allow_add' => true, 'allow_delete' => true,
'label' => false,

View file

@ -47,8 +47,8 @@ class PricedetailType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add("minDiscountQuantity", IntegerType::class);
$builder->add("priceRelatedQuantity", IntegerType::class);
$builder->add("min_discount_quantity", IntegerType::class);
$builder->add("price_related_quantity", IntegerType::class);
$builder->add("price", NumberType::class);
$builder->add("currency", CurrencyEntityType::class, ['required' => false]);
}
@ -57,6 +57,7 @@ class PricedetailType extends AbstractType
{
$resolver->setDefaults([
'data_class' => Pricedetail::class,
'error_bubbling' => false
]);
}
}

View file

@ -1,8 +1,8 @@
{% form_theme form with ['Parts/edit/edit_form_styles.html.twig', "bootstrap_4_layout.html.twig"] %}
<table class="table table-striped" id="orderdetails_table" data-prototype="{{ form_widget(form.orderDetails.vars.prototype)|e('html_attr') }}">
<table class="table table-striped" id="orderdetails_table" data-prototype="{{ form_widget(form.orderdetails.vars.prototype)|e('html_attr') }}">
<tbody>
{% for detail in form.orderDetails %}
{% for detail in form.orderdetails %}
{{ form_widget(detail) }}
{% endfor %}
</tbody>

View file

@ -2,7 +2,7 @@
{% form_theme form.currency 'Form/extendedBootstrap4_layout.html.twig' %}
<tr>
<td>{{ form_widget(form.minDiscountQuantity, {'attr': {'class': 'form-control-sm'}}) }} {{ form_errors(form.minDiscountQuantity) }}</td>
<td>{{ form_widget(form.min_discount_quantity, {'attr': {'class': 'form-control-sm'}}) }} {{ form_errors(form.min_discount_quantity) }}</td>
<td>
<div class="input-group input-group-sm">
{{ form_widget(form.price) }}
@ -13,10 +13,11 @@
{{ form_errors(form.price) }}
{{ form_errors(form.currency) }}
</td>
<td>{{ form_widget(form.priceRelatedQuantity, {'attr': {'class': 'form-control-sm'}}) }} {{ form_errors(form.price) }}</td>
<td>{{ form_widget(form.price_related_quantity, {'attr': {'class': 'form-control-sm'}}) }} {{ form_errors(form.price_related_quantity) }}</td>
<td><button type="button" class="btn btn-danger order_btn_delete btn-sm" title="{% trans %}orderdetail.delete{% endtrans %}" onclick="delete_pricedetail_entry(this);">
<i class="fas fa-trash-alt fa-fw"></i>
</button>
{{ form_errors(form) }}
</td>
</tr>
{% endblock %}
@ -26,11 +27,11 @@
<td>
{{ form_row(form.supplier, {'attr': {'class': 'form-control-sm'}}) }}
{{ form_row(form.supplierpartnr, {'attr': {'class': 'form-control-sm'}}) }}
{{ form_row(form.supplierProductUrl, {'attr': {'class': 'form-control-sm'}}) }}
{{ form_row(form.supplier_product_url, {'attr': {'class': 'form-control-sm'}}) }}
{{ form_widget(form.obsolete) }}
</td>
<td>
<table class="table table-sm table-bordered" data-prototype="{{ form_widget(form.priceDetails.vars.prototype)|e('html_attr') }}">
<table class="table table-sm table-bordered" data-prototype="{{ form_widget(form.pricedetails.vars.prototype)|e('html_attr') }}">
<thead>
<tr>
<th>Min Qty.</th>
@ -40,7 +41,7 @@
</tr>
</thead>
<tbody>
{% for price in form.priceDetails %}
{% for price in form.pricedetails %}
{{ form_widget(price) }}
{% endfor %}
</tbody>
@ -55,6 +56,7 @@
<button type="button" class="btn btn-danger order_btn_delete" onclick="delete_orderdetail_entry(this);" title="{% trans %}orderdetail.delete{% endtrans %}">
<i class="fas fa-trash-alt fa-fw"></i>
</button>
{{ form_errors(form) }}
</td>
</tr>
{% endblock %}