本文整理汇总了PHP中customer::check_delete_lock方法的典型用法代码示例。如果您正苦于以下问题:PHP customer::check_delete_lock方法的具体用法?PHP customer::check_delete_lock怎么用?PHP customer::check_delete_lock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类customer
的用法示例。
在下文中一共展示了customer::check_delete_lock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
Load POST data
*/
$obj_customer->id = @security_form_input_predefined("int", "id_customer", 1, "");
// these exist to make error handling work right
$data["name_customer"] = @security_form_input_predefined("any", "name_customer", 0, "");
// confirm deletion
$data["delete_confirm"] = @security_form_input_predefined("any", "delete_confirm", 1, "You must confirm the deletion");
/*
Error Handling
*/
// make sure the customer actually exists
if (!$obj_customer->verify_id()) {
log_write("error", "process", "The customer you have attempted to edit - " . $obj_customer->id . " - does not exist in this system.");
}
// check if the customer can be safely deleted
if ($obj_customer->check_delete_lock()) {
log_write("error", "process", "This customer can not be removed because their account has invoices or time groups belonging to it.");
}
// return to the input page in the event of an error
if ($_SESSION["error"]["message"]) {
$_SESSION["error"]["form"]["customer_delete"] = "failed";
header("Location: ../index.php?page=customers/delete.php&id=" . $obj_customer->id);
exit(0);
}
/*
Delete Customer
*/
// delete customer
$obj_customer->action_delete();
// return to customers list
header("Location: ../index.php?page=customers/customers.php");
示例2: customer
function delete_customer($id)
{
log_debug("customers", "Executing delete_customer_details({$id}, values...)");
if (user_permissions_get("customers_write")) {
$obj_customer = new customer();
/*
Load SOAP Data
*/
$obj_customer->id = @security_script_input_predefined("int", $id);
if (!$obj_customer->id || $obj_customer->id == "error") {
throw new SoapFault("Sender", "INVALID_INPUT");
}
/*
Error Handling
*/
// verify customer ID
if (!$obj_customer->verify_id()) {
throw new SoapFault("Sender", "INVALID_ID");
}
// check that the customer can be safely deleted
if ($obj_customer->check_delete_lock()) {
throw new SoapFault("Sender", "LOCKED");
}
/*
Perform Changes
*/
if ($obj_customer->action_delete()) {
return 1;
} else {
throw new SoapFault("Sender", "UNEXPECTED_ACTION_ERROR");
}
} else {
throw new SoapFault("Sender", "ACCESS DENIED");
}
}