$obj_attribute->id = $attribute["id"]; //if attribute is to be deleted, call delete action if (isset($attribute["mode"]) && $attribute["mode"] == "delete") { $obj_attribute->action_delete(); } elseif (empty($attribute["mode"])) { $obj_attribute->id_owner = $obj_customer->id; $obj_attribute->type = "customer"; $obj_attribute->id_group = $attribute["id_group"]; $obj_attribute->data["key"] = $attribute["key"]; $obj_attribute->data["value"] = $attribute["value"]; //if id doesn't exist, create new if (!$obj_attribute->verify_id()) { $obj_attribute->action_create(); } elseif ($obj_attribute->data["value"] != $attribute["value"] || $obj_attribute->data["key"] != $attribute["key"] || isset($attribute["id_group"]) && $obj_attribute->data["id_group"] != $attribute["id_group"]) { log_write("debug", "process", "Updating attribute " . $attribute["id"] . " due to changed details"); $obj_attribute->action_update(); } } } //check for errors if (!error_check()) { $sql_obj->trans_commit(); } else { // error encountered log_write("error", "process", "An unexpected error occured, the attributes remain unchanged"); $sql_obj->trans_rollback(); } /* * If no attributes exist for any of the groups in the database, delete the group */ $group_ids = new sql_query();