Code Duplication    Length = 18-18 lines in 2 locations

class/dbupdater.php 1 location

@@ 365-382 (lines=18) @@
362
     * @return bool true if success, false if an error occured
363
     *
364
     */
365
    public function updateFieldsValues()
366
    {
367
        global $xoopsDB;
368
369
        $ret = true;
370
371
        foreach ($this->getUpdatedFields() as $updatedField) {
372
            $query = sprintf('UPDATE %s SET %s = %s', $this->name(), $updatedField['name'], $updatedField['value']);
373
            $ret   = $ret && $xoopsDB->query($query);
374
            if (!$ret) {
375
                echo "<li class='err'>" . sprintf(_AM_SPARTNER_DB_MSG_UPDATE_TABLE_ERR, $this->name()) . '</li>';
376
            } else {
377
                echo "<li class='ok'>" . sprintf(_AM_SPARTNER_DB_MSG_UPDATE_TABLE, $this->name()) . '</li>';
378
            }
379
        }
380
381
        return $ret;
382
    }
383
384
    /**
385
     * Use to drop fields

class/smartdbupdater.php 1 location

@@ 486-503 (lines=18) @@
483
     * @return bool true if success, false if an error occured
484
     *
485
     */
486
    public function updateFieldsValues()
487
    {
488
        global $xoopsDB;
489
490
        $ret = true;
491
492
        foreach ($this->getUpdatedFields() as $updatedField) {
493
            $query = sprintf('UPDATE %s SET %s = %s', $this->name(), $updatedField['name'], $updatedField['value']);
494
            $ret   = $ret && $xoopsDB->query($query);
495
            if (!$ret) {
496
                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()) . '<br>';
497
            } else {
498
                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . '<br>';
499
            }
500
        }
501
502
        return $ret;
503
    }
504
505
    /**
506
     * Use to update fields values