@@ -169,24 +169,26 @@ private function ValidateRequest($request)
169169 $ errors [] = 'label is required ' ;
170170 }
171171
172- if ($ request ->type != CustomAttributeTypes::CHECKBOX &&
173- $ request ->type != CustomAttributeTypes::MULTI_LINE_TEXTBOX &&
174- $ request ->type != CustomAttributeTypes::SELECT_LIST &&
175- $ request ->type != CustomAttributeTypes::SINGLE_LINE_TEXTBOX
172+ if ((int )$ request ->type !== CustomAttributeTypes::CHECKBOX &&
173+ (int )$ request ->type !== CustomAttributeTypes::MULTI_LINE_TEXTBOX &&
174+ (int )$ request ->type !== CustomAttributeTypes::SELECT_LIST &&
175+ (int )$ request ->type !== CustomAttributeTypes::SINGLE_LINE_TEXTBOX &&
176+ (int )$ request ->type !== CustomAttributeTypes::DATETIME
176177 ) {
177178 $ errors [] = sprintf (
178- 'type is invalid. Allowed values for type: %s (checkbox), %s (multi line), %s (select list), %s (single line) ' ,
179+ 'type is invalid. Allowed values for type: %s (checkbox), %s (multi line), %s (select list), %s (single line), %s (datetime) ' ,
179180 CustomAttributeTypes::CHECKBOX ,
180181 CustomAttributeTypes::MULTI_LINE_TEXTBOX ,
181182 CustomAttributeTypes::SELECT_LIST ,
182- CustomAttributeTypes::SINGLE_LINE_TEXTBOX
183+ CustomAttributeTypes::SINGLE_LINE_TEXTBOX ,
184+ CustomAttributeTypes::DATETIME
183185 );
184186 }
185187
186- if ($ request ->categoryId != CustomAttributeCategory::RESERVATION &&
187- $ request ->categoryId != CustomAttributeCategory::RESOURCE &&
188- $ request ->categoryId != CustomAttributeCategory::RESOURCE_TYPE &&
189- $ request ->categoryId != CustomAttributeCategory::USER
188+ if (( int ) $ request ->categoryId != = CustomAttributeCategory::RESERVATION &&
189+ ( int ) $ request ->categoryId != = CustomAttributeCategory::RESOURCE &&
190+ ( int ) $ request ->categoryId != = CustomAttributeCategory::RESOURCE_TYPE &&
191+ ( int ) $ request ->categoryId != = CustomAttributeCategory::USER
190192 ) {
191193 $ errors [] = sprintf (
192194 'categoryId is invalid. Allowed values for category: %s (reservation), %s (resource), %s (resource type), %s (user) ' ,
@@ -197,15 +199,15 @@ private function ValidateRequest($request)
197199 );
198200 }
199201
200- if ($ request ->type == CustomAttributeTypes::SELECT_LIST && empty ($ request ->possibleValues )) {
202+ if (( int ) $ request ->type = == CustomAttributeTypes::SELECT_LIST && empty ($ request ->possibleValues )) {
201203 $ errors [] = 'possibleValues is required when the type is a select list ' ;
202204 }
203205
204- if ($ request ->type != CustomAttributeTypes::SELECT_LIST && !empty ($ request ->possibleValues )) {
206+ if (( int ) $ request ->type != = CustomAttributeTypes::SELECT_LIST && !empty ($ request ->possibleValues )) {
205207 $ errors [] = 'possibleValues is only valid when the type is a select list ' ;
206208 }
207209
208- if ($ request ->categoryId == CustomAttributeCategory::RESERVATION && !empty ($ request ->appliesToIds )) {
210+ if (( int ) $ request ->categoryId = == CustomAttributeCategory::RESERVATION && !empty ($ request ->appliesToIds )) {
209211 $ errors [] = 'appliesToId is not valid when the type is reservation ' ;
210212 }
211213
0 commit comments