diff --git a/lib/models/resources/Resource.class.php b/lib/models/resources/Resource.class.php index c7c5b77a4c23860119bce227186813fbea3a28cb..0cdd517a060ee1301d03d93839f597ffd7215d7f 100644 --- a/lib/models/resources/Resource.class.php +++ b/lib/models/resources/Resource.class.php @@ -1581,7 +1581,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) { @@ -1638,6 +1638,8 @@ class Resource extends SimpleORMap implements StudipItem } return true; } + + return false; } /** @@ -2395,7 +2397,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 58c8ecb09c34eebc959d24d5f85aa6e97507bb4d..7f1fe03b8bc63cb3eb1b3c7100f3b005e6c6e898 100644 --- a/lib/models/resources/ResourceBooking.class.php +++ b/lib/models/resources/ResourceBooking.class.php @@ -1816,6 +1816,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 0f7fae1e51d3977b510cfff353f72c156b206473..2961ca2afba060aa65bc608e110a6daa765779a4 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 1d5833026aa5a28e9ef58c85e9c80f5f43688569..b7d6b6eaa0ad3e6e0affd0ee79cf748b9dad9abc 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 f539d646bdadd9d5aa70d75b78c31e01b8890506..1a1dbaaa19435a44c141666491f8c7ffdc95dc8d 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');