Skip to content

Commit

Permalink
Maps: 39144, check for input
Browse files Browse the repository at this point in the history
  • Loading branch information
nhaagen committed Dec 12, 2023
1 parent b79c24f commit fd39be4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Services/Form/classes/class.ilLocationInputGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ public function checkInput(): bool
$lng = $this->lng;

$val = $this->strArray($this->getPostVar());
if ($this->getRequired() &&
(trim($val["latitude"]) == "" || trim($val["longitude"]) == "")) {
if ($this->getRequired() && (
!isset($val["latitude"]) || trim($val["latitude"]) == "" ||
!isset($val["longitude"]) || trim($val["longitude"]) == ""
)) {
$this->setAlert($lng->txt("msg_input_is_required"));
return false;
}
Expand All @@ -113,8 +115,8 @@ public function getInput(): array
{
$val = $this->strArray($this->getPostVar());
return [
"latitude" => (float) $val["latitude"],
"longitude" => (float) $val["longitude"],
"latitude" => (float) ($val["latitude"] ?? 0),
"longitude" => (float) ($val["longitude"] ?? 0),
"zoom" => (int) ($val["zoom"] ?? 0),
"address" => ($val["address"] ?? "")
];
Expand Down

0 comments on commit fd39be4

Please sign in to comment.