Code Duplication    Length = 13-14 lines in 5 locations

addTicket.php 1 location

@@ 293-305 (lines=13) @@
290
291
        $errors = array();
292
        $aElements = array();
293
        if($validateErrors =& $_xhelpSession->get('xhelp_validateError')){
294
            foreach($validateErrors as $fieldname=>$error){
295
                if(!empty($error['errors'])){
296
                    $aElements[] = $fieldname;
297
                    foreach($error['errors'] as $err){
298
                        $errors[$fieldname] = $err;
299
                    }
300
                }
301
            }
302
            $xoopsTpl->assign('xhelp_errors', $errors);
303
        } else {
304
            $xoopsTpl->assign('xhelp_errors', null);
305
        }
306
307
        $elements = array('subject', 'description');
308
        foreach($elements as $element){         // Foreach element in the predefined list

anon_addTicket.php 1 location

@@ 160-172 (lines=13) @@
157
158
    $errors = array();
159
    $aElements = array();
160
    if($validateErrors =& $_xhelpSession->get('xhelp_validateError')){
161
        foreach($validateErrors as $fieldname=>$error){
162
            if(!empty($error['errors'])){
163
                $aElements[] = $fieldname;
164
                foreach($error['errors'] as $err){
165
                    $errors[$fieldname] = $err;
166
                }
167
            }
168
        }
169
        $xoopsTpl->assign('xhelp_errors', $errors);
170
    } else {
171
        $xoopsTpl->assign('xhelp_errors', null);
172
    }
173
174
    $elements = array('subject', 'description', 'email');
175
    foreach($elements as $element){         // Foreach element in the predefined list

response.php 2 locations

@@ 243-256 (lines=14) @@
240
            $xoopsTpl->assign('xhelp_has_takeOwnership', $xhelp_staff->checkRoleRights(XHELP_SEC_TICKET_TAKE_OWNERSHIP, $ticketInfo->getVar('department')));
241
242
            $aElements = array();
243
            if($validateErrors =& $_xhelpSession->get('xhelp_validateError')){
244
                $errors = array();
245
                foreach($validateErrors as $fieldname=>$error){
246
                    if(!empty($error['errors'])){
247
                        $aElements[] = $fieldname;
248
                        foreach($error['errors'] as $err){
249
                            $errors[$fieldname] = $err;
250
                        }
251
                    }
252
                }
253
                $xoopsTpl->assign('xhelp_errors', $errors);
254
            } else {
255
                $xoopsTpl->assign('xhelp_errors', null);
256
            }
257
258
            $elements = array('response', 'timespent');
259
            foreach($elements as $element){         // Foreach element in the predefined list
@@ 361-373 (lines=13) @@
358
359
        $aElements = array();
360
        $errors = array();
361
        if($validateErrors =& $_xhelpSession->get('xhelp_validateError')){
362
            foreach($validateErrors as $fieldname=>$error){
363
                if(!empty($error['errors'])){
364
                    $aElements[] = $fieldname;
365
                    foreach($error['errors'] as $err){
366
                        $errors[$fieldname] = $err;
367
                    }
368
                }
369
            }
370
            $xoopsTpl->assign('xhelp_errors', $errors);
371
        } else {
372
            $xoopsTpl->assign('xhelp_errors', null);
373
        }
374
375
        $elements = array('response', 'timespent');
376
        foreach($elements as $element){         // Foreach element in the predefined list

ticket.php 1 location

@@ 318-330 (lines=13) @@
315
            // Form validation stuff
316
            $errors = array();
317
            $aElements = array();
318
            if($validateErrors =& $_xhelpSession->get('xhelp_validateError')){
319
                foreach($validateErrors as $fieldname=>$error){
320
                    if(!empty($error['errors'])){
321
                        $aElements[] = $fieldname;
322
                        foreach($error['errors'] as $err){
323
                            $errors[$fieldname] = $err;
324
                        }
325
                    }
326
                }
327
                $xoopsTpl->assign('xhelp_errors', $errors);
328
            } else {
329
                $xoopsTpl->assign('xhelp_errors', null);
330
            }
331
332
            $elements = array('subject', 'description');
333
            foreach($elements as $element){         // Foreach element in the predefined list