Added birthday to Address
This commit is contained in:
@@ -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>
|
||||
@@ -445,6 +450,15 @@
|
||||
todayBtn: 'linked',
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
$('#birthdate').datepicker({
|
||||
language: 'de',
|
||||
format: "dd.mm.yyyy",
|
||||
showWeekDays: true,
|
||||
todayBtn: 'linked',
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
|
||||
var bankdata_valid = false;
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -266,7 +266,17 @@ class AddressController extends mfBaseController {
|
||||
$data['email'] = trim($r->email);
|
||||
$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;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ class AddressModel {
|
||||
public $fax;
|
||||
public $mobile;
|
||||
public $email;
|
||||
public $birthday;
|
||||
public $uid;
|
||||
public $billing_type;
|
||||
public $billing_delivery;
|
||||
|
||||
@@ -90,8 +90,6 @@ class Preorder extends mfBaseModel {
|
||||
]);
|
||||
$history->save();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function runStatusTrigger() {
|
||||
|
||||
31
db/migrations/20240718123809_address_add_birthdate.php
Normal file
31
db/migrations/20240718123809_address_add_birthdate.php
Normal 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") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user