Code Duplication    Length = 26-26 lines in 2 locations

dashboard/application/controllers/computing-support/Disposals.php 1 location

@@ 139-164 (lines=26) @@
136
    
137
    // If changed are made, duplicate in New_staff_export.php controller.
138
     
139
    function export_current() {
140
        
141
        if (in_array('CN=DG06,OU=Distribution Groups,OU=Email Groups,OU=Accounts,DC=cant-col,DC=ac,DC=uk', $_SESSION['ldap']['groups'])) {
142
            
143
            $function = 'export current_disposals';
144
            $this->user_model->function_log($function);
145
        
146
            $this->load->dbutil();
147
            //MySQL View - only export incomplete
148
            $query = $this->db->query("SELECT * FROM disposals WHERE completed IS NULL");
149
            $delimiter = ",";
150
            $newline = "\n";
151
            $output = $this->dbutil->csv_from_result($query, $delimiter, $newline);
152
153
            function clean_export($string) {
154
                $string = str_replace('"', '', $string); // Replaces all spaces with hyphens - Required by SAD02-46 script.
155
                return $string;
156
            }
157
158
            $output = clean_export($output);
159
            force_download("current_disposals.csv", $output);
160
            
161
        } else {
162
            redirect('permissions');
163
        }
164
    }
165
}

dashboard/application/controllers/computing-support/New_account.php 1 location

@@ 192-217 (lines=26) @@
189
    
190
    // If changed are made, duplicate in New_staff_export.php controller.
191
     
192
    function export() {
193
        
194
        if (in_array('CN=DG06,OU=Distribution Groups,OU=Email Groups,OU=Accounts,DC=cant-col,DC=ac,DC=uk', $_SESSION['ldap']['groups'])) {
195
            
196
            $function = 'export_staff_account_manual';
197
            $this->user_model->function_log($function);
198
        
199
            $this->load->dbutil();
200
            //MySQL View - only export incomplete
201
            $query = $this->db->query("SELECT * FROM new_account_export");
202
            $delimiter = ",";
203
            $newline = "\n";
204
            $output = $this->dbutil->csv_from_result($query, $delimiter, $newline);
205
206
            function clean_export($string) {
207
                $string = str_replace('"', '', $string); // Replaces all spaces with hyphens - Required by SAD02-46 script.
208
                return $string;
209
            }
210
211
            $output = clean_export($output);
212
            force_download("newstaff.csv", $output);
213
            
214
        } else {
215
            redirect('permissions');
216
        }
217
    }
218
    
219
    public function disable_account() {
220