'migrationpro_process', 'primary' => 'id_process', 'fields' => array( 'type' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true), 'total' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true), 'imported' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true), 'id_source' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true), 'error' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true), 'point' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true), 'time_start' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'required' => true), 'finish' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true) ), ); public static function getActiveProcessObject() { $query = new DbQuery(); $query->select('p.id_process'); $query->from('migrationpro_process', 'p'); $query->where('p.finish = 0'); $query->orderBy('p.id_process ASC'); $result = Db::getInstance()->getValue($query); if (!$result) { return false; } return new MigrationProProcess($result); } public static function calculateImportedDataPercent() { $query = 'SELECT SUM(imported) / SUM(total) * 100 AS percent FROM ' . _DB_PREFIX_ . 'migrationpro_process'; $result = Db::getInstance()->getValue($query); if (!$result) { return 0; } else { return (int)$result; } } public static function getAll() { $query = new DbQuery(); $query->select('p.*'); $query->from('migrationpro_process', 'p'); $query->orderBy('p.id_process ASC'); $result = Db::getInstance()->executeS($query); return $result; } }