/** * * * @ * @param * @return */ function addAdmin($firs_name, $last_name, $e_mail, $password, $options, $need_update) { global $application; $tables = $this->getTables(); $a = $tables['admin']['columns']; $query = new DB_Insert('admin'); $query->addInsertValue($firs_name, $a['firstname']); $query->addInsertValue($last_name, $a['lastname']); $query->addInsertValue($e_mail, $a['email']); $query->addInsertValue($password, $a['password']); if ($need_update) { $query->addInsertValue(md5(""), $a['old_pass']); } else { $query->addInsertValue($password, $a['old_pass']); } $query->addInsertExpression($query->fNow(), $a['created']); // $query->addInsertValue('0000-00-00', $a['modified']); // $query->addInsertValue('0000-00-00', $a['logdate']); $query->addInsertValue('0', $a['lognum']); $query->addInsertValue('false', $a['remember_email']); $admin_options = 0; for ($i = 1; $i <= sizeof($options); $i++) { $admin_options += $options[$i] ? pow(2, $i - 1) : 0; } $query->addInsertValue($admin_options, $a['options']); $application->db->getDB_Result($query); return $application->db->DB_Insert_Id(); }
/** * adds new rates set to DB * set is created as inactive * * @param char[] $descr */ function addSetToDB($descr, $filename) { global $application; $tables = TaxRateByZip::getTables(); $table = "tax_zip_sets"; $columns = $tables[$table]['columns']; $query = new DB_Insert($table); $query->addInsertValue($descr, $columns['name']); $query->addInsertExpression($query->fNow(), $columns['dt']); $query->addInsertValue("0", $columns['isActive']); $query->addInsertValue($filename, $columns["filecaption"]); $application->db->getDB_Result($query); $rlt = $application->db->DB_Insert_Id(); return $rlt; }