File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -446,10 +446,28 @@ function duplicateSurvey($ID, $entities_id) {
446446 $ questions = toolbox::addslashes_deep ($ questions );
447447 foreach ($ questions as $ question ) {
448448 $ question ['plugin_satisfaction_surveys_id ' ] = $ newID ;
449+ $ question_id = $ question ['id ' ];
449450 unset($ question ['id ' ]);
450- if (!$ question_obj ->add ($ question )) {
451+ if (!$ new_question_id = $ question_obj ->add ($ question )) {
451452 return false ;
452453 }
454+ //find and duplicate translations
455+ $ translation_obj = new PluginSatisfactionSurveyTranslation ();
456+ $ translations = $ translation_obj ->find ([
457+ 'plugin_satisfaction_surveys_id ' => $ ID ,
458+ 'glpi_plugin_satisfaction_surveyquestions_id ' => $ question_id
459+ ]);
460+ $ translations = toolbox::addslashes_deep ($ translations );
461+ foreach ($ translations as $ translation ) {
462+ if (!$ translation_obj ->newSurveyTranslation ([
463+ 'survey_id ' => $ newID ,
464+ 'question_id ' => $ new_question_id ,
465+ 'language ' => $ translation ['language ' ],
466+ 'value ' => $ translation ['value ' ]
467+ ])) {
468+ return false ;
469+ }
470+ }
453471 }
454472
455473 return true ;
You can’t perform that action at this time.
0 commit comments