@@ -90,6 +90,25 @@ public function getValueForTargetText($richText) {
90
90
return $ this ->value ;
91
91
}
92
92
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
+
93
112
public function getDocumentsForTarget () {
94
113
return $ this ->uploadData ;
95
114
}
@@ -210,26 +229,6 @@ public function parseAnswerValues($input, $nonDestructive = false) {
210
229
return false ;
211
230
}
212
231
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
- }
233
232
if ($ this ->hasInput ($ input )) {
234
233
$ this ->value = __ ('Attached document ' , 'formcreator ' );
235
234
}
0 commit comments