本文整理汇总了PHP中invoice::check_delete_lock方法的典型用法代码示例。如果您正苦于以下问题:PHP invoice::check_delete_lock方法的具体用法?PHP invoice::check_delete_lock怎么用?PHP invoice::check_delete_lock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类invoice
的用法示例。
在下文中一共展示了invoice::check_delete_lock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: invoice_form_delete_process
function invoice_form_delete_process($type, $returnpage_error, $returnpage_success)
{
log_debug("inc_invoices_forms", "Executing invoice_form_delete_process({$type}, {$mode}, {$returnpage_error}, {$returnpage_success})");
$invoice = new invoice();
$invoice->type = $type;
/*
Import POST Data
*/
$invoice->id = @security_form_input_predefined("int", "id_invoice", 1, "");
$data["delete_confirm"] = @security_form_input_predefined("any", "delete_confirm", 1, "You must confirm the deletion");
// we don't use this value (since we can't trust it) but we need to read it
// in here to work around a limitation in the Amberphplib framework
$data["code_invoice"] = @security_form_input_predefined("any", "code_invoice", 1, "");
/*
Error Handling
*/
// make sure the invoice actually exists
if (!$invoice->verify_invoice()) {
log_write("error", "process", "The invoice you have attempted to delete - " . $invoice->id . " - does not exist in this system.");
}
// check if invoice is locked or not
if ($invoice->check_delete_lock()) {
log_write("error", "process", "The invoice can not be deleted because it is locked.");
}
// return to input page in event of an error
if ($_SESSION["error"]["message"]) {
$_SESSION["error"]["form"][$type . "_invoice_delete"] = "failed";
header("Location: ../../index.php?page={$returnpage_error}&id=" . $invoice->id);
exit(0);
}
/*
Delete Invoice
*/
if ($invoice->action_delete()) {
$_SESSION["notification"]["message"] = array("Invoice has been successfully deleted.");
} else {
$_SESSION["error"]["message"][] = "Some problems were experienced while deleting the invoice.";
}
// display updated details
header("Location: ../../index.php?page={$returnpage_success}&id={$id}");
exit(0);
}
示例2: SoapFault
function delete_invoice($id, $invoicetype)
{
log_debug("accounts_invoices_manage", "Executing delete_invoice({$id}, {$invoicetype})");
// check the invoicetype
if ($invoicetype != "ar" && $invoicetype != "ap") {
throw new SoapFault("Sender", "INVALID_INVOICE_TYPE");
}
if (user_permissions_get("accounts_" . $invoicetype . "_write")) {
$obj_invoice = new invoice();
/*
Load SOAP Data
*/
$obj_invoice->id = @security_script_input_predefined("int", $id);
$obj_invoice->type = $invoicetype;
/*
Error Handling
*/
// verify invoice existance
if (!$obj_invoice->verify_invoice()) {
throw new SoapFault("Sender", "INVALID_INVOICE");
}
// make sure invoice is safe to delete
if ($obj_invoice->check_delete_lock()) {
throw new SoapFault("Sender", "LOCKED");
}
/*
Perform Changes
*/
if ($obj_invoice->action_delete()) {
return 1;
} else {
throw new SoapFault("Sender", "UNEXPECTED_ACTION_ERROR");
}
} else {
throw new SoapFault("Sender", "ACCESS DENIED");
}
}