Skip to content

Commit 634fcb1

Browse files
committed
Added new fields to payment_order creation form
1 parent 2f37af9 commit 634fcb1

File tree

6 files changed

+218
-97
lines changed

6 files changed

+218
-97
lines changed

src/Entity/PaymentOrder.php

Lines changed: 61 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#[ORM\Entity(repositoryClass: PaymentOrderRepository::class)]
4747
#[ORM\HasLifecycleCallbacks]
4848
#[ORM\Table('payment_orders')]
49-
#[Vich\Uploadable()]
49+
#[Vich\Uploadable]
5050
class PaymentOrder implements DBElementInterface, TimestampedElementInterface, \Serializable
5151
{
5252
use TimestampTrait;
@@ -145,7 +145,7 @@ class PaymentOrder implements DBElementInterface, TimestampedElementInterface, \
145145
*/
146146
#[ORM\Column(type: Types::INTEGER, nullable: true)]
147147
#[Assert\Positive]
148-
#[Assert\LessThan(propertyPath: 'amount')]
148+
#[Assert\LessThanOrEqual(propertyPath: 'amount')]
149149
#[Assert\Expression("value === null || this.getSupportingFundingId() !== null", message: 'validator.supporting_amount.needed_for_supporting_funding_id')]
150150
private ?int $supporting_amount = null;
151151

@@ -305,61 +305,66 @@ public function setBankInfo(PayeeInfo $bank_info): PaymentOrder
305305
return $this;
306306
}
307307

308-
/**
309-
* Returns the full name of person which has submitted this payment order.
310-
*/
311-
public function getFullName(): string
308+
public function getSubmitterName(): string
312309
{
313-
if ($this->getFirstName() === '' || $this->getFirstName() === '0') {
314-
return $this->getLastName();
315-
}
316-
if ($this->getLastName() === '' || $this->getLastName() === '0') {
317-
return $this->getFirstName();
318-
}
310+
return $this->submitter_name;
311+
}
319312

320-
return $this->getFirstName().' '.$this->getLastName();
313+
public function setSubmitterName(string $submitter_name): PaymentOrder
314+
{
315+
$this->submitter_name = $submitter_name;
316+
return $this;
321317
}
322318

323-
/**
324-
* Returns the first name of the person which has submitted this payment order.
325-
*/
326-
public function getFirstName(): string
319+
public function getSupportingFundingId(): ?string
327320
{
328-
return $this->first_name;
321+
return $this->supporting_funding_id;
329322
}
330323

331-
/**
332-
* Sets the first name of the person which has submitted this payment order.
333-
*/
334-
public function setFirstName(string $first_name): PaymentOrder
324+
public function setSupportingFundingId(?string $supporting_funding_id): PaymentOrder
335325
{
336-
$this->first_name = $first_name;
326+
$this->supporting_funding_id = $supporting_funding_id;
327+
return $this;
328+
}
337329

330+
public function getSupportingAmount(): ?int
331+
{
332+
return $this->supporting_amount;
333+
}
334+
335+
public function setSupportingAmount(?int $supporting_amount): PaymentOrder
336+
{
337+
$this->supporting_amount = $supporting_amount;
338338
return $this;
339339
}
340340

341-
/**
342-
* Returns the last name of the person which has submitted this payment order.
343-
*/
344-
public function getLastName(): string
341+
public function getInvoiceNumber(): ?string
345342
{
346-
return $this->last_name;
343+
return $this->invoice_number;
347344
}
348345

349-
/**
350-
* Sets the last name of the person which has submitted this payment order.
351-
*/
352-
public function setLastName(string $last_name): PaymentOrder
346+
public function setInvoiceNumber(?string $invoice_number): PaymentOrder
353347
{
354-
$this->last_name = $last_name;
348+
$this->invoice_number = $invoice_number;
349+
return $this;
350+
}
355351

352+
public function getCustomerNumber(): ?string
353+
{
354+
return $this->customer_number;
355+
}
356+
357+
public function setCustomerNumber(?string $customer_number): PaymentOrder
358+
{
359+
$this->customer_number = $customer_number;
356360
return $this;
357361
}
358362

363+
359364
/**
360365
* Returns the department for which this payment order was submitted.
361366
*
362-
* @return Department
367+
* @return Department|null
363368
*/
364369
public function getDepartment(): ?Department
365370
{
@@ -786,17 +791,6 @@ public function setRequiredConfirmations(int $requiredConfirmations): PaymentOrd
786791
}
787792

788793

789-
790-
public function serialize()
791-
{
792-
return serialize($this->getId());
793-
}
794-
795-
public function unserialize($serialized): void
796-
{
797-
$this->id = unserialize($serialized);
798-
}
799-
800794
/**
801795
* Get the ID as string like ZA0005.
802796
*/
@@ -826,4 +820,26 @@ public function removeConfirmationToken(ConfirmationToken $confirmationToken): s
826820

827821
return $this;
828822
}
823+
824+
public function serialize(): ?string
825+
{
826+
return serialize($this->getId());
827+
}
828+
829+
public function unserialize($data): void
830+
{
831+
$this->id = unserialize($data, ['allowed_classes' => false]);
832+
}
833+
834+
public function __serialize(): array
835+
{
836+
return [
837+
'id' => $this->id,
838+
];
839+
}
840+
841+
public function __unserialize(array $data): void
842+
{
843+
$this->id = $data['id'];
844+
}
829845
}

src/Form/PayeeInfoType.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,15 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
7272
],
7373
]);
7474

75-
$builder->add('bic', TextType::class, [
75+
//Hide BIC field on frontend
76+
/*$builder->add('bic', TextType::class, [
7677
'label' => 'bank_info.bic.label',
7778
'required' => false,
7879
'empty_data' => '',
7980
'attr' => [
8081
'placeholder' => 'bank_info.bic.placeholder',
8182
],
82-
]);
83+
]);*/
8384

8485
$builder->add('bank_name', TextType::class, [
8586
'label' => 'bank_info.bank_name.label',

src/Form/PaymentOrderType.php

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -36,49 +36,59 @@ class PaymentOrderType extends AbstractType
3636
{
3737
public function buildForm(FormBuilderInterface $builder, array $options): void
3838
{
39-
$builder->add('first_name', TextType::class, [
40-
'label' => 'payment_order.first_name.label',
39+
$builder->add('submitter_name', TextType::class, [
40+
'label' => 'payment_order.submitter_name.label',
4141
'empty_data' => '',
4242
'attr' => [
43-
'placeholder' => 'payment_order.first_name.placeholder',
43+
'placeholder' => 'payment_order.submitter_name.placeholder',
4444
'autocomplete' => 'given_name',
4545
],
4646
]);
4747

48-
$builder->add('last_name', TextType::class, [
49-
'label' => 'payment_order.last_name.label',
48+
$builder->add('submitter_email', EmailType::class, [
49+
'label' => 'payment_order.contact_email.label',
5050
'empty_data' => '',
5151
'attr' => [
52-
'placeholder' => 'payment_order.last_name.placeholder',
53-
'autocomplete' => 'family_name',
52+
'placeholder' => 'payment_order.contact_email.placeholder',
53+
'autocomplete' => 'email',
5454
],
5555
]);
5656

57-
$builder->add('contact_email', EmailType::class, [
58-
'label' => 'payment_order.contact_email.label',
59-
'empty_data' => '',
57+
$builder->add('department', DepartmentChoiceType::class, [
58+
'label' => 'payment_order.department.label',
59+
]);
60+
61+
$builder->add('funding_id', TextType::class, [
62+
'label' => 'payment_order.funding_id.label',
6063
'attr' => [
61-
'placeholder' => 'payment_order.contact_email.placeholder',
62-
'autocomplete' => 'email',
64+
'placeholder' => 'payment_order.funding_id.placeholder',
6365
],
6466
]);
6567

66-
$builder->add('project_name', TextType::class, [
67-
'label' => 'payment_order.project_name.label',
68-
'help' => 'payment_order.project_name.help',
69-
'empty_data' => '',
68+
$builder->add('amount', MoneyType::class, [
69+
'label' => 'payment_order.amount.label',
70+
'divisor' => 100,
71+
'currency' => 'EUR',
7072
'attr' => [
71-
'placeholder' => 'payment_order.project_name.placeholder',
73+
'placeholder' => 'payment_order.amount.placeholder',
7274
],
7375
]);
7476

75-
$builder->add('funding_id', TextType::class, [
76-
'label' => 'payment_order.funding_id.label',
77-
'help' => 'payment_order.funding_id.help',
77+
$builder->add('supporting_amount', MoneyType::class, [
78+
'label' => 'payment_order.supporting_amount.label',
79+
'divisor' => 100,
80+
'currency' => 'EUR',
7881
'required' => false,
79-
'empty_data' => '',
8082
'attr' => [
81-
'placeholder' => 'payment_order.funding_id.placeholder',
83+
'placeholder' => 'payment_order.amount.placeholder',
84+
],
85+
]);
86+
87+
$builder->add('supporting_funding_id', TextType::class, [
88+
'label' => 'payment_order.supporting_funding_id.label',
89+
'required' => false,
90+
'attr' => [
91+
'placeholder' => 'payment_order.supporting_funding_id.placeholder',
8292
],
8393
]);
8494

@@ -87,26 +97,31 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
8797
'required' => false,
8898
]);
8999

100+
90101
$builder->add('resolution_date', DateType::class, [
91102
'label' => 'payment_order.resolution_date.label',
92103
'required' => false,
93104
'html5' => true,
94105
'widget' => 'single_text',
95106
]);
96107

97-
$builder->add('department', DepartmentChoiceType::class, [
98-
'label' => 'payment_order.department.label',
99-
]);
100-
101-
$builder->add('amount', MoneyType::class, [
102-
'label' => 'payment_order.amount.label',
103-
'divisor' => 100,
104-
'currency' => 'EUR',
108+
$builder->add('project_name', TextType::class, [
109+
'label' => 'payment_order.project_name.label',
105110
'attr' => [
106-
'placeholder' => 'payment_order.amount.placeholder',
111+
'placeholder' => 'payment_order.project_name.placeholder',
107112
],
108113
]);
109114

115+
116+
$builder->add('invoice_number', TextType::class, [
117+
'label' => 'payment_order.invoice_number.label',
118+
'required' => false,
119+
]);
120+
$builder->add('customer_number', TextType::class, [
121+
'label' => 'payment_order.customer_number.label',
122+
'required' => false
123+
]);
124+
110125
$builder->add('bank_info', PayeeInfoType::class, [
111126
'label' => false,
112127
]);
@@ -120,7 +135,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
120135

121136
$builder->add('references_file', VichFileType::class, [
122137
'label' => 'payment_order.references.label',
123-
'help' => 'payment_order.references.help',
124138
]);
125139

126140
$builder->add('comment', TextareaType::class, [

templates/PaymentOrder/form.html.twig

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -156,32 +156,46 @@
156156
<div class="row">
157157

158158
<div class="col-sm-6">
159+
{# "Auftraggeberin" section #}
159160
<fieldset>
160-
<legend>{% trans %}payment_order.new.general{% endtrans %}</legend>
161+
<legend>{% trans %}payment_order.new.submitter_info{% endtrans %}</legend>
161162
<small class="text-muted">{% trans %}payment_order.new.name_hint{% endtrans %}</small>
162163

163-
<div class="row">
164-
<div class="col-sm-6">
165-
{{ form_row(form.first_name, {'attr': {'data-json': 'first_name'}}) }}
166-
</div>
167-
<div class="col-sm-6">
168-
{{ form_row(form.last_name, {'attr': {'data-json': 'last_name'}}) }}
169-
</div>
170-
</div>
171-
172-
{{ form_row(form.contact_email, {'attr': {'data-json': 'contact_email'}}) }}
164+
{{ form_row(form.submitter_name, {'attr': {'data-json': 'submitter_name'}}) }}
165+
{{ form_row(form.submitter_email, {'attr': {'data-json': 'contact_email'}}) }}
173166
{{ form_row(form.department, {'attr': {'data-json': 'department'}}) }}
174-
{{ form_row(form.project_name) }}
167+
</fieldset>
168+
169+
{# "Mittelfreigabe" section #}
170+
<fieldset class="mt-2">
171+
<legend>{% trans %}payment_order.new.payment_info{% endtrans %}</legend>
175172
{{ form_row(form.amount) }}
176173
{{ form_row(form.funding_id) }}
177-
{{ form_row(form.fsr_kom_resolution) }}
178174
{{ form_row(form.resolution_date) }}
175+
176+
{{ form_row(form.fsr_kom_resolution) }}
177+
178+
{{ form_row(form.supporting_amount) }}
179+
{{ form_row(form.supporting_funding_id) }}
180+
179181
</fieldset>
180182

181183
{{ form_row(form.references_file) }}
184+
182185
</div>
183186

184187
<div class="col-sm-6">
188+
189+
{# "Verwendungszweck" #}
190+
<fieldset>
191+
<legend>{% trans %}payment_order.new.reference_line{% endtrans %}</legend>
192+
{{ form_row(form.project_name) }}
193+
194+
<small class="text-muted">{% trans %}payment_order.new.invoice_and_customer_number_hint{% endtrans %}</small>
195+
{{ form_row(form.invoice_number) }}
196+
{{ form_row(form.customer_number) }}
197+
</fieldset>
198+
185199
<fieldset>
186200
<legend>{% trans %}payment_order.new.account_info{% endtrans %}</legend>
187201
{{ form_row(form.bank_info.account_owner, {'attr': {'data-json': 'account_owner'}}) }}
@@ -195,7 +209,6 @@
195209
</div>
196210
</div>
197211
{{ form_row(form.bank_info.iban, {'attr': {'data-json': 'iban'}}) }}
198-
{{ form_row(form.bank_info.bic, {'attr': {'data-json': 'bic'}}) }}
199212
{{ form_row(form.bank_info.bank_name, {'attr': {'data-json': 'bank_name'}}) }}
200213
</fieldset>
201214

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="de" trgLang="de">
3+
<file id="AutocompleteBundle.de">
4+
<unit id="EsVvJyQ" name="Add %placeholder%...">
5+
<segment>
6+
<source>Add %placeholder%...</source>
7+
<target>Max Musterfrau</target>
8+
</segment>
9+
</unit>
10+
</file>
11+
</xliff>

0 commit comments

Comments
 (0)