Code Duplication    Length = 9-9 lines in 8 locations

plugin/sepe/ws/Sepe.php 8 locations

@@ 271-279 (lines=9) @@
268
                VALUES ('".$actionOrigin."','".$actionCode."','".$situation."','".$specialtyOrigin."','".$professionalArea."','".$specialtyCode."','".$duration."','".$startDate."','".$endDate."','".$fullItineraryIndicator."','".$financingType."','".$attendeesCount."','".$actionName."','".$globalInfo."','".$schedule."','".$requerements."','".$contactAction."')";
269
270
        $rs = Database::query($sql);
271
        if (!$rs) {
272
            return array(
273
                "RESPUESTA_OBT_ACCION" => array(
274
                    "CODIGO_RETORNO"=>"-1",
275
                    "ETIQUETA_ERROR"=>"Problema base de datos - insertando acciones formativas",
276
                    "ACCION_FORMATIVA"=>$crearAccionInputArray['ACCION_FORMATIVA']
277
                )
278
            );
279
        }
280
        $actionId = Database::insert_id();
281
282
        // DATOS ESPECIALIDADES DE LA ACCION
@@ 379-387 (lines=9) @@
376
377
                $specialtyId = Database::insert($table, $params);
378
379
                if (empty($specialtyId)) {
380
                    return array(
381
                        "RESPUESTA_OBT_ACCION" => array(
382
                            "CODIGO_RETORNO" => "-1",
383
                            "ETIQUETA_ERROR" => "Problema base de datos - insertando datos de especialidad de la accion",
384
                            "ACCION_FORMATIVA" => $crearAccionInputArray['ACCION_FORMATIVA']
385
                        )
386
                    );
387
                }
388
389
                
390
                if ($specialtyId) {
@@ 418-426 (lines=9) @@
415
                            Database::query($sql);
416
                            $id = Database::insert_id();
417
                                
418
                            if (empty($id)) {
419
                                return array(
420
                                    "RESPUESTA_OBT_ACCION" => array(
421
                                        "CODIGO_RETORNO" => "-1",
422
                                        "ETIQUETA_ERROR" => "Problema base de datos - insertando centro presenciales",
423
                                        "ACCION_FORMATIVA" => $crearAccionInputArray['ACCION_FORMATIVA']
424
                                    )
425
                                );
426
                            }
427
                        }
428
                    }
429
@@ 463-471 (lines=9) @@
460
                                    Database::query($sql);
461
                                    $tutorId = Database::insert_id();
462
                                }
463
                                if (empty($tutorId)) {
464
                                    return array(
465
                                        "RESPUESTA_OBT_ACCION" => array(
466
                                            "CODIGO_RETORNO" => "-1",
467
                                            "ETIQUETA_ERROR" => "Problema base de datos - insertando tutores",
468
                                            "ACCION_FORMATIVA" => $crearAccionInputArray['ACCION_FORMATIVA']
469
                                        )
470
                                    );
471
                                }
472
                                $sql = "INSERT INTO $tableSpecialityTutors (specialty_id, tutor_id, tutor_accreditation, professional_experience, teaching_competence, experience_teleforming, training_teleforming)
473
                                        VALUES ('" . $specialtyId . "','" . $tutorId . "','" . $tutorAccreditation . "','" . $professionalExperience . "','" . $teachingCompetence . "','" . $experienceTeleforming . "','" . $trainingTeleforming . "');";
474
                                Database::query($sql);
@@ 563-571 (lines=9) @@
560
                    'training_tutor_id' => $tutorIdTraining
561
                );
562
                $participantId = Database::insert($tableParticipants, $params);
563
                if (empty($participantId)) {
564
                    return array(
565
                        "RESPUESTA_OBT_ACCION" => array(
566
                            "CODIGO_RETORNO" => "-1",
567
                            "ETIQUETA_ERROR" => "Problema base de datos - insertando participantes",
568
                            "ACCION_FORMATIVA" => $crearAccionInputArray['ACCION_FORMATIVA']
569
                        )
570
                    );
571
                }
572
573
                $participantId = Database::insert_id();
574
                
@@ 630-638 (lines=9) @@
627
                                VALUES ('" . $participantId . "','" . $specialtyOrigin . "','" . $professionalArea . "','" . $specialtyCode . "','" . $registrationDate . "','" . $leavingDate . "','" . $centerOrigin . "','" . $centerCode . "','" . $startDate . "','" . $endDate . "','" . $finalResult . "','" . $finalQualification . "','" . $finalScore . "');";
628
                        Database::query($sql);
629
                        $participantSpecialtyId = Database::insert_id();
630
                        if (empty($participantSpecialtyId)) {
631
                            return array(
632
                                "RESPUESTA_OBT_ACCION" => array(
633
                                    "CODIGO_RETORNO" => "-1",
634
                                    "ETIQUETA_ERROR" => "Problema base de datos - insertando especialidad participante",
635
                                    "ACCION_FORMATIVA" => $crearAccionInputArray['ACCION_FORMATIVA']
636
                                )
637
                            );
638
                        }
639
640
                        foreach ($value->TUTORIAS_PRESENCIALES as $tutorialList) {
641
                            if (!is_array($tutorialList)) {
@@ 659-667 (lines=9) @@
656
                                $sql = "INSERT INTO $table_aux2 (participant_specialty_id,center_origin,center_code,start_date,end_date)
657
                                        VALUES ('" . $participantSpecialtyId . "','" . $centerOrigin . "','" . $centerCode . "','" . $startDate . "','" . $endDate . "');";
658
                                $rs = Database::query($sql);
659
                                if (!$rs) {
660
                                    return array(
661
                                        "RESPUESTA_OBT_ACCION" => array(
662
                                            "CODIGO_RETORNO" => "-1",
663
                                            "ETIQUETA_ERROR" => "Problema base de datos - insertando tutorias presenciales participante",
664
                                            "ACCION_FORMATIVA" => $crearAccionInputArray['ACCION_FORMATIVA']
665
                                        )
666
                                    );
667
                                }
668
                            }
669
                        }
670
                    }
@@ 753-761 (lines=9) @@
750
                    $sql = "SELECT * FROM $classRoomTable
751
                            WHERE specialty_id='" . $specialtyId . "'";
752
                    $resultClassroom = Database::query($sql);
753
                    if (Database::num_rows($resultClassroom) === 0) {
754
                        return array(
755
                            "RESPUESTA_OBT_ACCION" => array(
756
                                "CODIGO_RETORNO" => "-1",
757
                                "ETIQUETA_ERROR" => "Problema base de datos - consulta de centros presenciales",
758
                                "ACCION_FORMATIVA" => ''
759
                            )
760
                        );
761
                    }
762
763
                    $classroomCenterList = new ArrayObject();
764
                    while ($tmp = Database::fetch_assoc($resultClassroom)) {