Kimai_Database_Mysql::customer_create PHP Method

customer_create() public method

Add a new customer to the database.
Author: th
public customer_create ( array $data ) : integer
$data array name, address and other data of the new customer
return integer the customerID of the new customer, false on failure
    public function customer_create($data)
    {
        $data = $this->clean_data($data);
        $values['name'] = MySQL::SQLValue($data['name']);
        $values['comment'] = MySQL::SQLValue($data['comment']);
        if (isset($data['password'])) {
            $values['password'] = MySQL::SQLValue($data['password']);
        } else {
            $values['password'] = "''";
        }
        $values['company'] = MySQL::SQLValue($data['company']);
        $values['vat'] = MySQL::SQLValue($data['vat']);
        $values['contact'] = MySQL::SQLValue($data['contact']);
        $values['street'] = MySQL::SQLValue($data['street']);
        $values['zipcode'] = MySQL::SQLValue($data['zipcode']);
        $values['city'] = MySQL::SQLValue($data['city']);
        $values['country'] = MySQL::SQLValue($data['country']);
        $values['phone'] = MySQL::SQLValue($data['phone']);
        $values['fax'] = MySQL::SQLValue($data['fax']);
        $values['mobile'] = MySQL::SQLValue($data['mobile']);
        $values['mail'] = MySQL::SQLValue($data['mail']);
        $values['homepage'] = MySQL::SQLValue($data['homepage']);
        $values['timezone'] = MySQL::SQLValue($data['timezone']);
        $values['visible'] = MySQL::SQLValue($data['visible'], MySQL::SQLVALUE_NUMBER);
        $values['filter'] = MySQL::SQLValue($data['filter'], MySQL::SQLVALUE_NUMBER);
        $table = $this->getCustomerTable();
        $result = $this->conn->InsertRow($table, $values);
        if (!$result) {
            $this->logLastError('customer_create');
            return false;
        } else {
            return $this->conn->GetLastInsertID();
        }
    }
Kimai_Database_Mysql