@@ -90,6 +90,25 @@ public function getValueForTargetText($richText) {
9090 return $ this ->value ;
9191 }
9292
93+ public function moveUploads ()
94+ {
95+ $ key = 'formcreator_field_ ' . $ this ->question ->getID ();
96+ if (!is_array ($ this ->uploads ) || !isset ($ this ->uploads ["_ $ key " ])) {
97+ return ;
98+ }
99+ $ answer_value = [];
100+ $ index = 0 ;
101+ foreach ($ this ->uploads ["_ $ key " ] as $ document ) {
102+ $ document = Toolbox::stripslashes_deep ($ document );
103+ if (is_file (GLPI_TMP_DIR . '/ ' . $ document )) {
104+ $ prefix = $ this ->uploads ['_prefix_formcreator_field_ ' . $ this ->question ->getID ()][$ index ];
105+ $ answer_value [] = $ this ->saveDocument ($ document , $ prefix );
106+ }
107+ $ index ++;
108+ }
109+ $ this ->uploadData = $ answer_value ;
110+ }
111+
93112 public function getDocumentsForTarget () {
94113 return $ this ->uploadData ;
95114 }
@@ -210,26 +229,6 @@ public function parseAnswerValues($input, $nonDestructive = false) {
210229 return false ;
211230 }
212231
213- if (PLUGIN_FORMCREATOR_TEXTAREA_FIX && version_compare (GLPI_VERSION , '9.5.0-dev ' ) < 0 ) {
214- $ answer_value = [];
215- $ index = 0 ;
216- if ($ nonDestructive ) {
217- $ index = count ($ input ["_ $ key " ]);
218- } else {
219- foreach ($ input ["_ $ key " ] as $ document ) {
220- $ document = Toolbox::stripslashes_deep ($ document );
221- if (is_file (GLPI_TMP_DIR . '/ ' . $ document )) {
222- $ prefix = $ input ['_prefix_formcreator_field_ ' . $ this ->question ->getID ()][$ index ];
223- $ answer_value [] = $ this ->saveDocument ($ document , $ prefix );
224- }
225- $ index ++;
226- }
227- }
228- $ this ->uploadData = $ answer_value ;
229- $ this ->value = __ ('Attached document ' , 'formcreator ' );
230-
231- return true ;
232- }
233232 if ($ this ->hasInput ($ input )) {
234233 $ this ->value = __ ('Attached document ' , 'formcreator ' );
235234 }
0 commit comments