本文整理匯總了PHP中customer::action_update方法的典型用法代碼示例。如果您正苦於以下問題:PHP customer::action_update方法的具體用法?PHP customer::action_update怎麽用?PHP customer::action_update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類customer
的用法示例。
在下文中一共展示了customer::action_update方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: header
header("Location: ../index.php?page=customers/view.php&id=" . $obj_customer->id . "");
exit(0);
} else {
$_SESSION["error"]["form"]["customer_add"] = "failed";
header("Location: ../index.php?page=customers/add.php");
exit(0);
}
}
/*
Process Data
*/
// start transaction
$sql_obj = new sql_query();
$sql_obj->trans_begin();
// update customer
$obj_customer->action_update();
$obj_customer->action_update_taxes();
// commit
if (error_check()) {
$sql_obj->trans_rollback();
} else {
//if successful, change the number of contacts if there were some deleted
for ($i = 0; $i < $num_contacts; $i++) {
$_SESSION["error"]["num_records_{$i}"] = $_SESSION["error"]["num_records_{$i}"] - $num_del_records[$i];
}
$_SESSION["error"]["num_contacts"] = $_SESSION["error"]["num_contacts"] - $num_del_contacts;
$sql_obj->trans_commit();
}
// display updated details
header("Location: ../index.php?page=customers/view.php&id=" . $obj_customer->id);
exit(0);
示例2: customer
//.........這裏部分代碼省略.........
$obj_customer->data["contacts"][0]["contact"] = $obj_customer->data["name_contact"];
$set_email = 0;
$set_phone = 0;
$set_fax = 0;
// search and replace values for existing accounts records
for ($i = 0; $i < $obj_customer->data["contacts"][0]["num_records"]; $i++) {
if (!$set_email) {
if ($obj_customer->data["contacts"][0]["records"][$i]["type"] == "email") {
$obj_customer->data["contacts"][0]["records"][$i]["detail"] = $obj_customer->data["contact_email"];
$set_email = 1;
}
}
if (!$set_phone) {
if ($obj_customer->data["contacts"][0]["records"][$i]["type"] == "phone") {
$obj_customer->data["contacts"][0]["records"][$i]["detail"] = $obj_customer->data["contact_phone"];
$set_phone = 1;
}
}
if (!$set_fax) {
if ($obj_customer->data["contacts"][0]["records"][$i]["type"] == "fax") {
$obj_customer->data["contacts"][0]["records"][$i]["detail"] = $obj_customer->data["contact_fax"];
$set_fax = 1;
}
}
}
// no existing record existed, add a new one
if (!$set_email) {
$i = $obj_customer->data["contact"]["num_records"];
$obj_customer->data["contact"]["num_records"]++;
$obj_customer->data["contacts"][0]["records"][$i]["delete"] = "false";
$obj_customer->data["contacts"][0]["records"][$i]["type"] = "email";
$obj_customer->data["contacts"][0]["records"][$i]["label"] = "Email";
$obj_customer->data["contacts"][0]["records"][$i]["detail"] = $obj_customer->data["contact_email"];
}
if (!$set_phone) {
$i = $obj_customer->data["contact"]["num_records"];
$obj_customer->data["contact"]["num_records"]++;
$obj_customer->data["contacts"][0]["records"][$i]["delete"] = "false";
$obj_customer->data["contacts"][0]["records"][$i]["type"] = "phone";
$obj_customer->data["contacts"][0]["records"][$i]["label"] = "Phone";
$obj_customer->data["contacts"][0]["records"][$i]["detail"] = $obj_customer->data["contact_phone"];
}
if (!$set_fax) {
$i = $obj_customer->data["contact"]["num_records"];
$obj_customer->data["contact"]["num_records"]++;
$obj_customer->data["contacts"][0]["records"][$i]["delete"] = "false";
$obj_customer->data["contacts"][0]["records"][$i]["type"] = "fax";
$obj_customer->data["contacts"][0]["records"][$i]["label"] = "Fax";
$obj_customer->data["contacts"][0]["records"][$i]["detail"] = $obj_customer->data["contact_fax"];
}
} else {
// no valid contact records exist, re-define the entry
$obj_customer->data["contacts"][0]["contact"] = $obj_customer->data["name_contact"];
$obj_customer->data["contacts"][0]["role"] = "accounts";
$obj_customer->data["contacts"][0]["records"][0]["delete"] = "false";
$obj_customer->data["contacts"][0]["records"][0]["type"] = "email";
$obj_customer->data["contacts"][0]["records"][0]["label"] = "Email";
$obj_customer->data["contacts"][0]["records"][0]["detail"] = $obj_customer->data["contact_email"];
$obj_customer->data["contacts"][0]["records"][1]["delete"] = "false";
$obj_customer->data["contacts"][0]["records"][1]["type"] = "phone";
$obj_customer->data["contacts"][0]["records"][1]["label"] = "Phone";
$obj_customer->data["contacts"][0]["records"][1]["detail"] = $obj_customer->data["contact_phone"];
$obj_customer->data["contacts"][0]["records"][2]["delete"] = "false";
$obj_customer->data["contacts"][0]["records"][2]["type"] = "fax";
$obj_customer->data["contacts"][0]["records"][2]["label"] = "Fax";
$obj_customer->data["contacts"][0]["records"][2]["detail"] = $obj_customer->data["contact_fax"];
}
} else {
// new customer, easy for us to define a new structure.
$obj_customer->data["num_contacts"] = 1;
$obj_customer->data["contacts"][0]["contact_id"] = "";
$obj_customer->data["contacts"][0]["contact"] = $obj_customer->data["name_contact"];
$obj_customer->data["contacts"][0]["role"] = "accounts";
$obj_customer->data["contacts"][0]["delete_contact"] = "false";
$obj_customer->data["contacts"][0]["num_records"] = 3;
$obj_customer->data["contacts"][0]["records"][0]["delete"] = "false";
$obj_customer->data["contacts"][0]["records"][0]["type"] = "email";
$obj_customer->data["contacts"][0]["records"][0]["label"] = "Email";
$obj_customer->data["contacts"][0]["records"][0]["detail"] = $obj_customer->data["contact_email"];
$obj_customer->data["contacts"][0]["records"][1]["delete"] = "false";
$obj_customer->data["contacts"][0]["records"][1]["type"] = "phone";
$obj_customer->data["contacts"][0]["records"][1]["label"] = "Phone";
$obj_customer->data["contacts"][0]["records"][1]["detail"] = $obj_customer->data["contact_phone"];
$obj_customer->data["contacts"][0]["records"][2]["delete"] = "false";
$obj_customer->data["contacts"][0]["records"][2]["type"] = "fax";
$obj_customer->data["contacts"][0]["records"][2]["label"] = "Fax";
$obj_customer->data["contacts"][0]["records"][2]["detail"] = $obj_customer->data["contact_fax"];
}
/*
Perform Changes
*/
if ($obj_customer->action_update()) {
return $obj_customer->id;
} else {
throw new SoapFault("Sender", "UNEXPECTED_ACTION_ERROR");
}
} else {
throw new SoapFault("Sender", "ACCESS DENIED");
}
}