Code Duplication    Length = 22-23 lines in 2 locations

main/inc/lib/thematic.lib.php 2 locations

@@ 997-1018 (lines=22) @@
994
                    $user_id
995
                );
996
997
            } else {
998
                // insert
999
                $params = [
1000
                    'c_id' => $this->course_int_id,
1001
                    'thematic_id' => $thematic_id,
1002
                    'title' => $title,
1003
                    'description' => $description,
1004
                    'description_type' => $description_type
1005
                ];
1006
                $last_id = Database::insert($tbl_thematic_plan, $params);
1007
                if ($last_id) {
1008
                    $sql = "UPDATE $tbl_thematic_plan SET id = iid WHERE iid = $last_id";
1009
                    Database::query($sql);
1010
                    api_item_property_update(
1011
                        $_course,
1012
                        'thematic_plan',
1013
                        $last_id,
1014
                        "ThematicPlanAdded",
1015
                        $user_id
1016
                    );
1017
                }
1018
            }
1019
        } else {
1020
            // insert
1021
            $params = [
@@ 1019-1041 (lines=23) @@
1016
                    );
1017
                }
1018
            }
1019
        } else {
1020
            // insert
1021
            $params = [
1022
                'c_id' => $this->course_int_id,
1023
                'thematic_id' => $thematic_id,
1024
                'title' => $title,
1025
                'description' => $description,
1026
                'description_type' => $description_type
1027
            ];
1028
            $last_id = Database::insert($tbl_thematic_plan, $params);
1029
1030
            if ($last_id) {
1031
                $sql = "UPDATE $tbl_thematic_plan SET id = iid WHERE iid = $last_id";
1032
                Database::query($sql);
1033
                api_item_property_update(
1034
                    $_course,
1035
                    'thematic_plan',
1036
                    $last_id,
1037
                    "ThematicPlanAdded",
1038
                    $user_id
1039
                );
1040
            }
1041
        }
1042
1043
        return $affected_rows;
1044
    }