3232 *
3333 * ---------------------------------------------------------------------
3434 */
35+
3536use Glpi \Application \View \TemplateRenderer ;
3637use Glpi \ContentTemplates \Parameters \CommonITILObjectParameters ;
3738use Glpi \DBAL \QueryExpression ;
5253use Glpi \RichText \UserMention ;
5354use Glpi \Search \Output \HTMLSearchOutput ;
5455use Glpi \Team \Team ;
56+ use Glpi \Urgency ;
5557use Safe \Exceptions \DatetimeException ;
5658
5759use function Safe \getimagesize ;
@@ -2333,6 +2335,8 @@ public function prepareInputForUpdate($input)
23332335 private function handleReadonlyFields (array $ input , bool $ isAdd = false ): array
23342336 {
23352337 $ tt = $ this ->getITILTemplateFromInput ($ input );
2338+ $ tt ->getFromDBWithData ($ tt ->getID ()); // We load the fields (predefined and readonly)
2339+
23362340 foreach (array_keys ($ tt ->readonly ) as $ read_only_field ) {
23372341 if ($ isAdd && array_key_exists ($ read_only_field , $ tt ->predefined )) {
23382342 $ input [$ read_only_field ] = $ tt ->predefined [$ read_only_field ];
@@ -2832,7 +2836,7 @@ public function prepareInputForAdd($input)
28322836 }
28332837
28342838 // save value before clean;
2835- $ title = ltrim ($ input ['name ' ]);
2839+ $ title = ltrim ($ input ['name ' ] ?? '' );
28362840
28372841 // Set default status to avoid notice
28382842 if (!isset ($ input ["status " ])) {
@@ -2843,7 +2847,7 @@ public function prepareInputForAdd($input)
28432847 !isset ($ input ["urgency " ])
28442848 || !($ CFG_GLPI ['urgency_mask ' ] & (1 << $ input ["urgency " ]))
28452849 ) {
2846- $ input ["urgency " ] = 3 ;
2850+ $ input ["urgency " ] = Urgency:: MEDIUM -> value ;
28472851 }
28482852 if (
28492853 !isset ($ input ["impact " ])
@@ -2894,8 +2898,8 @@ public function prepareInputForAdd($input)
28942898 }
28952899
28962900 // No name set name
2897- $ input ["name " ] = ltrim ($ input ["name " ]);
2898- $ input ['content ' ] = ltrim ($ input ['content ' ]);
2901+ $ input ["name " ] = ltrim ($ input ["name " ] ?? '' );
2902+ $ input ['content ' ] = ltrim ($ input ['content ' ] ?? '' );
28992903 if (empty ($ input ["name " ])) {
29002904 // Build name based on content
29012905
0 commit comments