Merge branch 'fronkdev' into 'master'
added empty check for address in PUT /preorder/{id}
See merge request fronk/thetool!1782
This commit is contained in:
@@ -65,7 +65,10 @@ class ADBHausnummer extends mfBaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$update_data = [];
|
$update_data = [];
|
||||||
if($this->strasse_id && $this->getProperty("strasse")->name) $update_data["address"] = $this->getProperty("strasse")->name;
|
if($this->strasse_id && $this->getProperty("strasse")->name) {
|
||||||
|
$update_data["address"] = $this->getProperty("strasse")->name;
|
||||||
|
if(strlen($this->hausnummer)) $update_data["address"] .= " ".$this->hausnummer;
|
||||||
|
}
|
||||||
if($this->ortschaft_id && $this->getProperty("ortschaft")->name) $update_data["city"] = $this->getProperty("ortschaft")->name;
|
if($this->ortschaft_id && $this->getProperty("ortschaft")->name) $update_data["city"] = $this->getProperty("ortschaft")->name;
|
||||||
if($this->plz_id && $this->getProperty("plz")->plz) $update_data["zipCode"] = $this->getProperty("plz")->plz;
|
if($this->plz_id && $this->getProperty("plz")->plz) $update_data["zipCode"] = $this->getProperty("plz")->plz;
|
||||||
if($this->strasse_id && $this->getProperty("strasse")->gemeinde_id && $this->getProperty("strasse")->gemeinde->name) $update_data["district"] = $this->getProperty("strasse")->gemeinde->name;
|
if($this->strasse_id && $this->getProperty("strasse")->gemeinde_id && $this->getProperty("strasse")->gemeinde->name) $update_data["district"] = $this->getProperty("strasse")->gemeinde->name;
|
||||||
|
|||||||
@@ -384,6 +384,9 @@ class PreorderApicontroller extends mfBaseApicontroller {
|
|||||||
if(!$preorder->email) {
|
if(!$preorder->email) {
|
||||||
return mfResponse::BadRequest(["message" => "Cannot leave email empty"]);
|
return mfResponse::BadRequest(["message" => "Cannot leave email empty"]);
|
||||||
}
|
}
|
||||||
|
if(!$preorder->street || !$preorder->zip || !$preorder->city) {
|
||||||
|
return mfResponse::BadRequest(["message" => "Cannot leave address fields empty"]);
|
||||||
|
}
|
||||||
|
|
||||||
if(!$preorder->save()) {
|
if(!$preorder->save()) {
|
||||||
return mfResponse::InternalServerError();
|
return mfResponse::InternalServerError();
|
||||||
|
|||||||
Reference in New Issue
Block a user