diff --git a/lib/models/resources/Resource.class.php b/lib/models/resources/Resource.class.php index 172ea29f61eba7d6bcbdd88e90c6725a3fe8507f..5d16856b709190b13c59b907540d8ae33206ea8e 100644 --- a/lib/models/resources/Resource.class.php +++ b/lib/models/resources/Resource.class.php @@ -1577,7 +1577,7 @@ class Resource extends SimpleORMap implements StudipItem * @param mixed $state The state of the resource property. * @param User|null $user The user who wishes to set the property. * - * @return True, if the property state could be set, false otherwise. + * @return bool True, if the property state could be set, false otherwise. */ public function setProperty(string $name, $state = '', $user = null) { @@ -1634,6 +1634,8 @@ class Resource extends SimpleORMap implements StudipItem } return true; } + + return false; } /** @@ -2391,7 +2393,7 @@ class Resource extends SimpleORMap implements StudipItem return $perm_string; } - + return ''; } /** diff --git a/lib/models/resources/ResourceBooking.class.php b/lib/models/resources/ResourceBooking.class.php index 5f3dd5e0f3272c5a54edc5bcbfd3b1e0afb0d6c9..2a500b0c1813a2e5fc4a7f84fe6bf684d8cb9852 100644 --- a/lib/models/resources/ResourceBooking.class.php +++ b/lib/models/resources/ResourceBooking.class.php @@ -1817,6 +1817,8 @@ class ResourceBooking extends SimpleORMap implements PrivacyObject, Studip\Calen return 'daily'; } } + + return ''; } diff --git a/lib/models/resources/ResourceCategory.class.php b/lib/models/resources/ResourceCategory.class.php index 00465cd28cecd8b4cf012dc0885289a66fbd65bd..995c5e60a580cfc5ab9981cac4e2a271d8f5ecd6 100644 --- a/lib/models/resources/ResourceCategory.class.php +++ b/lib/models/resources/ResourceCategory.class.php @@ -339,19 +339,16 @@ class ResourceCategory extends SimpleORMap if ($existing_property) { $existing_property->requestable = $requestable ? '1' : '0'; $existing_property->protected = $protected ? '1' : '0'; - if ($existing_property->isDirty()) { - if ($existing_property->store()) { - return $existing_property; - } else { - throw new ResourcePropertyException( - sprintf( - _('Fehler beim Aktualisieren der Eigenschaft %1$s (vom Typ %2$s)!'), - $name, - $type - ) - ); - } + if ($existing_property->isDirty() && !$existing_property->store()) { + throw new ResourcePropertyException( + sprintf( + _('Fehler beim Aktualisieren der Eigenschaft %1$s (vom Typ %2$s)!'), + $name, + $type + ) + ); } + return $existing_property; } else { $definition = ResourcePropertyDefinition::findOneBySql( 'name = :name AND type = :type', diff --git a/lib/models/resources/ResourcePropertyDefinition.class.php b/lib/models/resources/ResourcePropertyDefinition.class.php index 6643b5f9b6655127bc2b135c91469317af93990b..27ac05c5188c550338f5f80438c1ae2fb3654d29 100644 --- a/lib/models/resources/ResourcePropertyDefinition.class.php +++ b/lib/models/resources/ResourcePropertyDefinition.class.php @@ -298,7 +298,7 @@ class ResourcePropertyDefinition extends SimpleORMap $invalid_state = true; } } elseif ($this->type == 'num') { - if (!preg_match('[0-9.]+', $state)) { + if (!preg_match('/[0-9.]+/', $state)) { //not a number $invalid_state = true; } @@ -375,6 +375,8 @@ class ResourcePropertyDefinition extends SimpleORMap $property->state = $state; return $property; } + + throw new Exception('Could not validate state'); } public function __toString() diff --git a/lib/models/resources/ResourceRequest.class.php b/lib/models/resources/ResourceRequest.class.php index 571381cceb80c58578da3837b9c69cfd1869fa2e..68f95b6f73556f135bcc36973aaa92156adaf76b 100644 --- a/lib/models/resources/ResourceRequest.class.php +++ b/lib/models/resources/ResourceRequest.class.php @@ -1365,7 +1365,7 @@ class ResourceRequest extends SimpleORMap implements PrivacyObject, Studip\Calen $parts[] = $rra->appointment->getFullname('include-room'); } } - $strings[] .= implode('; ', $parts); + $strings[] = implode('; ', $parts); } elseif ($this->termin_id) { if ($this->date) { $strings[] = $this->date->getFullname('include-room');