Added birthday to Address

This commit is contained in:
Frank Schubert
2024-07-18 15:05:24 +02:00
parent d54673289f
commit 724e2eccee
6 changed files with 61 additions and 4 deletions

View File

@@ -120,7 +120,12 @@
<input type="email" class="form-control" name="email" id="email" value="<?=$address->email?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="birthdate">Geburtsdatum</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="birthdate" id="birthdate" value="<?=($address->birthdate) ? (new DateTime($address->birthdate))->format("d.m.Y") : ""?>">
</div>
</div>
</div>
</div>
@@ -446,6 +451,15 @@
autoclose: true
});
$('#birthdate').datepicker({
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
var bankdata_valid = false;
$("#parent_id").select2({

View File

@@ -73,6 +73,9 @@
</tr><tr>
<th>Email</th>
<td><?=$address->email?></td>
</tr><tr>
<th>Geburtsdatum</th>
<td><?=($address->birthdate) ? (new DateTime($address->birthdate))->format("d.m.Y") : ""?></td>
</tr><tr>
<th></th>
<td></td>

View File

@@ -267,6 +267,16 @@ class AddressController extends mfBaseController {
$data['note'] = trim($r->note);
$data['uid'] = trim($r->uid);
if(trim($r->birthdate)) {
try {
$data["birthdate"] = (DateTime::createFromFormat("d.m.Y", trim($r->birthdate)))->format("Y-m-d");
} catch(Exception $e) {
$this->layout()->setFlash("Ungültiges Geburtsdaum", "warning");
}
}
if($this->me->can("Fibu")) {
$data["sepa_date"] = ($r->sepa_date) ? Layout::dateToInt($r->sepa_date) : null;

View File

@@ -22,6 +22,7 @@ class AddressModel {
public $fax;
public $mobile;
public $email;
public $birthday;
public $uid;
public $billing_type;
public $billing_delivery;

View File

@@ -90,8 +90,6 @@ class Preorder extends mfBaseModel {
]);
$history->save();
}
}
public function runStatusTrigger() {

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class AddressAddBirthdate extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Address");
$table->addColumn("birthdate", "date", ["null" => true, "default" => null, "after" => "uid"]);
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$this->table("Address")->removeColumn("birthdate")->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
}