@@ -92,6 +92,25 @@ public function getValueForTargetText($richText) {
9292 return $ this ->value ;
9393 }
9494
95+ public function moveUploads ()
96+ {
97+ $ key = 'formcreator_field_ ' . $ this ->question ->getID ();
98+ if (!is_array ($ this ->uploads ) || !isset ($ this ->uploads ["_ $ key " ])) {
99+ return ;
100+ }
101+ $ answer_value = [];
102+ $ index = 0 ;
103+ foreach ($ this ->uploads ["_ $ key " ] as $ document ) {
104+ $ document = Toolbox::stripslashes_deep ($ document );
105+ if (is_file (GLPI_TMP_DIR . '/ ' . $ document )) {
106+ $ prefix = $ this ->uploads ['_prefix_formcreator_field_ ' . $ this ->question ->getID ()][$ index ];
107+ $ answer_value [] = $ this ->saveDocument ($ document , $ prefix );
108+ }
109+ $ index ++;
110+ }
111+ $ this ->uploadData = $ answer_value ;
112+ }
113+
95114 public function getDocumentsForTarget () {
96115 return $ this ->uploadData ;
97116 }
@@ -215,26 +234,6 @@ public function parseAnswerValues($input, $nonDestructive = false) {
215234 return false ;
216235 }
217236
218- if (PLUGIN_FORMCREATOR_TEXTAREA_FIX && version_compare (GLPI_VERSION , '9.5.0-dev ' ) < 0 ) {
219- $ answer_value = [];
220- $ index = 0 ;
221- if ($ nonDestructive ) {
222- $ index = count ($ input ["_ $ key " ]);
223- } else {
224- foreach ($ input ["_ $ key " ] as $ document ) {
225- $ document = Toolbox::stripslashes_deep ($ document );
226- if (is_file (GLPI_TMP_DIR . '/ ' . $ document )) {
227- $ prefix = $ input ['_prefix_formcreator_field_ ' . $ this ->question ->getID ()][$ index ];
228- $ answer_value [] = $ this ->saveDocument ($ document , $ prefix );
229- }
230- $ index ++;
231- }
232- }
233- $ this ->uploadData = $ answer_value ;
234- $ this ->value = __ ('Attached document ' , 'formcreator ' );
235-
236- return true ;
237- }
238237 if ($ this ->hasInput ($ input )) {
239238 $ this ->value = __ ('Attached document ' , 'formcreator ' );
240239 }
0 commit comments