Code Duplication    Length = 5-5 lines in 7 locations

class/bbctypes.class.php 4 locations

@@ 129-133 (lines=5) @@
126
        $this->db->begin();
127
128
        $resql = $this->db->query($sql);
129
        if (!$resql) {
130
            $error++;
131
            $this->errors[] = 'Error ' . $this->db->lasterror();
132
            dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
133
        }
134
135
        if (!$notrigger) {
136
            $this->call_trigger('BBC_FLIGHT_TYPE_CREATE', $user);
@@ 353-357 (lines=5) @@
350
        $this->db->begin();
351
352
        $resql = $this->db->query($sql);
353
        if (!$resql) {
354
            $error++;
355
            $this->errors[] = 'Error ' . $this->db->lasterror();
356
            dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
357
        }
358
359
        if (!$error && !$notrigger) {
360
            $this->call_trigger('BBC_FLIGHT_TYPE_MODIFY', $user);
@@ 402-406 (lines=5) @@
399
            $sql .= ' WHERE idType=' . $this->id;
400
401
            $resql = $this->db->query($sql);
402
            if (!$resql) {
403
                $error++;
404
                $this->errors[] = 'Error ' . $this->db->lasterror();
405
                dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
406
            }
407
        }
408
409
        // Commit or rollback
@@ 445-449 (lines=5) @@
442
        $result = $object->create($user);
443
444
        // Other options
445
        if ($result < 0) {
446
            $error++;
447
            $this->errors = $object->errors;
448
            dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
449
        }
450
451
        // End
452
        if (!$error) {

class/bbcvols.class.php 3 locations

@@ 256-260 (lines=5) @@
253
        $this->db->begin();
254
255
        $resql = $this->db->query($sql);
256
        if (!$resql) {
257
            $error++;
258
            $this->errors[] = 'Error ' . $this->db->lasterror();
259
            dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
260
        }
261
262
        if (!$error) {
263
            $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
@@ 475-479 (lines=5) @@
472
        $this->db->begin();
473
474
        $resql = $this->db->query($sql);
475
        if (!$resql) {
476
            $error++;
477
            $this->errors[] = 'Error ' . $this->db->lasterror();
478
            dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
479
        }
480
481
        if (!$error && !$notrigger) {
482
            $result = $this->call_trigger('BBC_FLIGHT_UPDATED', $user);
@@ 529-533 (lines=5) @@
526
            $sql .= ' WHERE idBBC_vols=' . $this->idBBC_vols;
527
528
            $resql = $this->db->query($sql);
529
            if (!$resql) {
530
                $error++;
531
                $this->errors[] = 'Error ' . $this->db->lasterror();
532
                dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
533
            }
534
        }
535
536
        // Commit or rollback