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?>">
|
<input type="email" class="form-control" name="email" id="email" value="<?=$address->email?>">
|
||||||
</div>
|
</div>
|
||||||
</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>
|
||||||
</div>
|
</div>
|
||||||
@@ -445,6 +450,15 @@
|
|||||||
todayBtn: 'linked',
|
todayBtn: 'linked',
|
||||||
autoclose: true
|
autoclose: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#birthdate').datepicker({
|
||||||
|
language: 'de',
|
||||||
|
format: "dd.mm.yyyy",
|
||||||
|
showWeekDays: true,
|
||||||
|
todayBtn: 'linked',
|
||||||
|
autoclose: true
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
var bankdata_valid = false;
|
var bankdata_valid = false;
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,9 @@
|
|||||||
</tr><tr>
|
</tr><tr>
|
||||||
<th>Email</th>
|
<th>Email</th>
|
||||||
<td><?=$address->email?></td>
|
<td><?=$address->email?></td>
|
||||||
|
</tr><tr>
|
||||||
|
<th>Geburtsdatum</th>
|
||||||
|
<td><?=($address->birthdate) ? (new DateTime($address->birthdate))->format("d.m.Y") : ""?></td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<th></th>
|
<th></th>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
|||||||
@@ -266,7 +266,17 @@ class AddressController extends mfBaseController {
|
|||||||
$data['email'] = trim($r->email);
|
$data['email'] = trim($r->email);
|
||||||
$data['note'] = trim($r->note);
|
$data['note'] = trim($r->note);
|
||||||
$data['uid'] = trim($r->uid);
|
$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")) {
|
if($this->me->can("Fibu")) {
|
||||||
$data["sepa_date"] = ($r->sepa_date) ? Layout::dateToInt($r->sepa_date) : null;
|
$data["sepa_date"] = ($r->sepa_date) ? Layout::dateToInt($r->sepa_date) : null;
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class AddressModel {
|
|||||||
public $fax;
|
public $fax;
|
||||||
public $mobile;
|
public $mobile;
|
||||||
public $email;
|
public $email;
|
||||||
|
public $birthday;
|
||||||
public $uid;
|
public $uid;
|
||||||
public $billing_type;
|
public $billing_type;
|
||||||
public $billing_delivery;
|
public $billing_delivery;
|
||||||
|
|||||||
@@ -90,8 +90,6 @@ class Preorder extends mfBaseModel {
|
|||||||
]);
|
]);
|
||||||
$history->save();
|
$history->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function runStatusTrigger() {
|
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