当前位置: 首页>>代码示例>>PHP>>正文


PHP sql_query::trans_rollback方法代码示例

本文整理汇总了PHP中sql_query::trans_rollback方法的典型用法代码示例。如果您正苦于以下问题:PHP sql_query::trans_rollback方法的具体用法?PHP sql_query::trans_rollback怎么用?PHP sql_query::trans_rollback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sql_query的用法示例。


在下文中一共展示了sql_query::trans_rollback方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

 function action_delete()
 {
     log_debug("cdr_customers_services_ddi", "Executing action_delete()");
     /*
     	Start Transaction
     */
     $sql_obj = new sql_query();
     $sql_obj->trans_begin();
     /*
     	Delete DDI
     */
     $sql_obj->string = "DELETE FROM services_customers_ddi WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     /*
     	Commit
     */
     if (error_check()) {
         $sql_obj->trans_rollback();
         log_write("error", "cdr_customers_services_ddi", "An error occured whilst trying to delete the DDI.");
         return 0;
     } else {
         $sql_obj->trans_commit();
         log_write("notification", "cdr_customers_services_ddi", "DDI has been successfully deleted.");
         return 1;
     }
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:26,代码来源:inc_services_cdr.php

示例2: invoice_form_tax_override_process

function invoice_form_tax_override_process($returnpage)
{
    log_debug("inc_invoices_items", "Executing invoice_form_tax_override_process({$returnpage})");
    /*
    	Start invoice_items object
    */
    $item = new invoice_items();
    $item->id_invoice = @security_form_input_predefined("int", "invoiceid", 1, "");
    $item->id_item = @security_form_input_predefined("int", "itemid", 1, "");
    $item->type_invoice = "ap";
    // only AP invoices can have taxes overridden
    /*
    	Fetch all form data
    */
    $data["amount"] = @security_form_input_predefined("money", "amount", 0, "");
    //// ERROR CHECKING ///////////////////////
    /*
    	Verify invoice/form data
    */
    if ($item->verify_invoice()) {
        if (!$item->verify_item()) {
            $_SESSION["error"]["message"][] = "The provided tax does not exist.";
        }
    } else {
        $_SESSION["error"]["message"][] = "The provided invoice does not exist.";
    }
    /// if there was an error, go back to the entry page
    if ($_SESSION["error"]["message"]) {
        $_SESSION["error"]["form"]["ap_invoice_" . $mode . "_override"] = "failed";
        header("Location: ../../index.php?page={$returnpage}&id=" . $item->id_invoice);
        exit(0);
    } else {
        /*
        	Start SQL Transaction
        */
        $sql_obj = new sql_query();
        $sql_obj->trans_begin();
        /*
        	Depending on the amount, we either delete the tax item (if the amount is 0) or we
        	adjust the tax item.
        */
        if ($data["amount"] == 0) {
            // delete item
            $item->action_delete();
            // done
            $_SESSION["notification"]["message"] = array("Deleted unwanted tax.");
        } else {
            // load & update the tax item
            $item->load_data();
            $item->data["amount"] = $data["amount"];
            $item->action_update();
            // done
            $_SESSION["notification"]["message"] = array("Updated tax value with custom input.");
        }
        // update invoice summary
        $item->action_update_total();
        // update ledger
        $item->action_update_ledger();
        /*
        	Commit
        */
        if (error_check()) {
            $sql_obj->trans_rollback();
            log_write("error", "inc_invoice_items", "An error occured whilst overriding tax. No changes have been made");
        } else {
            $sql_obj->trans_commit();
        }
        // done
        header("Location: ../../index.php?page={$returnpage}&id=" . $item->id_invoice);
        exit(0);
    }
}
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:72,代码来源:inc_invoices_items.php

示例3: SoapFault

 function delete_invoice_item($itemid)
 {
     log_debug("accounts_invoices_manage", "Executing delete_invoice_itemid({$itemid})");
     // sanatise item ID
     $itemid = @security_script_input_predefined("any", $itemid);
     // fetch the invoice ID and type
     $sql_item_obj = new sql_query();
     $sql_item_obj->string = "SELECT invoiceid, invoicetype FROM account_items WHERE id='" . $itemid . "' LIMIT 1";
     $sql_item_obj->execute();
     if (!$sql_item_obj->num_rows()) {
         throw new SoapFault("Sender", "INVALID_ITEMID");
     }
     $sql_item_obj->fetch_array();
     if (user_permissions_get("accounts_" . $sql_item_obj->data[0]["invoicetype"] . "_write")) {
         $obj_invoice_item = new invoice_items();
         $obj_invoice_item->type_invoice = $sql_item_obj->data[0]["invoicetype"];
         $obj_invoice_item->id_invoice = $sql_item_obj->data[0]["invoiceid"];
         $obj_invoice_item->id_item = $itemid;
         // make sure invoice is not locked
         if ($obj_invoice_item->check_lock()) {
             throw new SoapFault("Sender", "LOCKED");
         }
         /*
         	Perform Changes
         */
         // start SQL transaction
         $sql_obj = new sql_query();
         $sql_obj->trans_begin();
         if (!$obj_invoice_item->action_delete()) {
             $sql_obj->trans_rollback();
             throw new SoapFault("Sender", "UNEXPECTED_ACTION_ERROR");
         }
         // re-calculate taxes, totals and ledgers as required
         $obj_invoice_item->action_update_tax();
         $obj_invoice_item->action_update_total();
         $obj_invoice_item->action_update_ledger();
         // commit
         if (error_check()) {
             $sql_obj->trans_rollback();
             throw new SoapFault("Sender", "UNEXPECTED_ACTION_ERROR");
         } else {
             $sql_obj->trans_commit();
             return 1;
         }
     } else {
         throw new SoapFault("Sender", "ACCESS DENIED");
     }
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:48,代码来源:invoices_manage.php

示例4: autopay

 function autopay()
 {
     log_write("debug", "invoice_autopay", "Executing autopay()");
     // check capabilities
     if (!$this->capable) {
         if (!$this->check_autopay_capable()) {
             return 0;
         }
     }
     /*
     	Start SQL Transaction
     */
     $sql_obj = new sql_query();
     $sql_obj->trans_begin();
     /*
     	Load Invoice Data
     */
     $this->obj_invoice = new invoice();
     $this->obj_invoice->id = $this->id_invoice;
     $this->obj_invoice->type = $this->type_invoice;
     if (!$this->obj_invoice->load_data()) {
         log_write("error", "invoice_autopay", "Unable to load invoice data for checking for autopayments");
         return -1;
     }
     /*
     	Make AutoPayments
     */
     // handle credit payments
     $this->autopay_credit();
     // future: credit card, direct debit?
     /*
     	Commit
     */
     if (error_check()) {
         $sql_obj->trans_rollback();
         log_write("error", "invoice_autopay", "An error occured whilst making an invoice autopayment");
         return 0;
     } else {
         $sql_obj->trans_commit();
         return 1;
     }
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:42,代码来源:inc_invoices.php

示例5: count

 function action_delete()
 {
     log_debug("service_groups", "Executing action_delete()");
     $id_parent = sql_get_singlevalue("SELECT id_parent AS value FROM service_groups WHERE id='{$this->id}' LIMIT 1");
     $child_groups = sql_get_singlecol("SELECT id AS col FROM service_groups WHERE id_parent='{$this->id}'");
     //exit("<pre>".print_r($child_groups,true)."</pre>");
     /*
     	Start Transaction
     */
     $sql_obj = new sql_query();
     $sql_obj->trans_begin();
     /*
     	Delete service group
     */
     $sql_obj->string = "DELETE FROM service_groups WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     $child_count = count($child_groups);
     if ($child_count > 0) {
         $sql_obj->string = "UPDATE `service_groups` SET `id_parent` = '{$id_parent}' WHERE `id` IN('" . implode("', '", $child_groups) . "') LIMIT {$child_count};";
         $sql_obj->execute();
     }
     /*
     	Commit
     */
     if (error_check()) {
         $sql_obj->trans_rollback();
         log_write("error", "service_groups", "An error occured whilst trying to delete the service group.");
         return 0;
     } else {
         $sql_obj->trans_commit();
         log_write("notification", "service_groups", "Service group has been successfully deleted.");
         return 1;
     }
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:34,代码来源:inc_services_groups.php

示例6: WHERE

 function action_delete()
 {
     log_debug("inc_credits_refund", "Executing action_delete()");
     // we must have an ID provided
     if (!$this->id) {
         log_debug("inc_credits_refund", "No credit refund ID to action_delete function");
         return 0;
     }
     /*
     	Start SQL Transaction
     */
     $sql_obj = new sql_query();
     $sql_obj->trans_begin();
     /*
     	Delete Credit Refund
     */
     $sql_obj->string = "DELETE FROM " . $this->type . "s_credits WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     /*
     	Delete Ledger Items
     */
     if ($this->type == "customer") {
         $sql_obj->string = "DELETE FROM account_trans WHERE (type='ar_refund') AND customid='" . $this->id . "'";
         $sql_obj->execute();
     } else {
         $sql_obj->string = "DELETE FROM account_trans WHERE (type='ap_refund') AND customid='" . $this->id . "'";
         $sql_obj->execute();
     }
     /*
     	Commit
     */
     if (error_check()) {
         $sql_obj->trans_rollback();
         log_write("error", "invoice", "An error occured whilst deleting the credit refund. No changes have been made.");
         return 0;
     } else {
         $sql_obj->trans_commit();
         return 1;
     }
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:40,代码来源:inc_credits.php

示例7: service_form_delete_process

function service_form_delete_process()
{
    log_debug("inc_services_process", "Executing service_form_delete_process()");
    /*
    	Fetch all form data
    */
    // get form data
    $id = @security_form_input_predefined("int", "id_service", 1, "");
    $data["delete_confirm"] = @security_form_input_predefined("any", "delete_confirm", 1, "You must confirm the deletion");
    //// ERROR CHECKING ///////////////////////
    // make sure the service actually exists
    $sql_obj = new sql_query();
    $sql_obj->string = "SELECT id FROM services WHERE id='{$id}' LIMIT 1";
    $sql_obj->execute();
    if (!$sql_obj->num_rows()) {
        log_write("error", "process", "The service you have attempted to edit - {$id} - does not exist in this system.");
    }
    // make sure the service is not active for any customers
    $sql_obj = new sql_query();
    $sql_obj->string = "SELECT id FROM services_customers WHERE serviceid='{$id}' LIMIT 1";
    $sql_obj->execute();
    if ($sql_obj->num_rows()) {
        log_write("error", "process", "Service is active for customers and can therefore not be deleted.");
    }
    /// if there was an error, go back to the entry page
    if ($_SESSION["error"]["message"]) {
        $_SESSION["error"]["form"]["service_delete"] = "failed";
        header("Location: ../index.php?page=services/delete.php&id={$id}");
        exit(0);
    } else {
        /*
        	Begin Transaction
        */
        $sql_obj = new sql_query();
        $sql_obj->trans_begin();
        /*
        	Delete the service data
        */
        $sql_obj->string = "DELETE FROM services WHERE id='{$id}' LIMIT 1";
        $sql_obj->execute();
        /*
        	Delete the service taxes
        */
        $sql_obj->string = "DELETE FROM services_taxes WHERE serviceid='{$id}'";
        $sql_obj->execute();
        /*
        	Delete the service bundle components (if any)
        */
        $sql_bundle_obj = new sql_query();
        $sql_bundle_obj->string = "SELECT id FROM services_bundles WHERE id_service='{$id}'";
        $sql_bundle_obj->execute();
        if ($sql_bundle_obj->num_rows()) {
            $sql_bundle_obj->fetch_array();
            foreach ($sql_bundle_obj->data as $data_bundle) {
                // delete any options for each bundle item
                $sql_obj->string = "DELETE FROM services_options WHERE option_type='service' AND option_type_id='" . $data_bundle["id"] . "'";
                $sql_obj->execute();
            }
        }
        $sql_obj->string = "DELETE FROM services_bundles WHERE id_service='{$id}'";
        $sql_obj->execute();
        /*
        	Delete the service cdr rate overrides (if any)
        */
        $sql_obj->string = "DELETE FROM cdr_rate_tables_overrides WHERE option_type='service' AND option_type_id='{$id}'";
        $sql_obj->execute();
        /*
        	Delete service journal data
        */
        journal_delete_entire("services", $id);
        /*
        	Commit
        */
        if (error_check()) {
            $sql_obj->trans_rollback();
            log_write("error", "process", "An error occured whilst attempting to delete the transaction. No changes have been made.");
            header("Location: ../index.php?page=services/view.php&id={$id}");
            exit(0);
        } else {
            $sql_obj->trans_commit();
            log_write("notification", "process", "Service successfully deleted");
            header("Location: ../index.php?page=services/services.php");
            exit(0);
        }
    }
    // end if passed tests
}
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:87,代码来源:inc_services_process.php

示例8:

 function action_delete()
 {
     log_debug("inc_staff", "Executing action_delete()");
     /*
     	Start Transaction
     */
     $sql_obj = new sql_query();
     $sql_obj->trans_begin();
     /*
     	Delete Employee
     */
     $sql_obj->string = "DELETE FROM staff WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     /*
     	Delete User <-> Employee permissions mappings
     */
     $sql_obj->string = "DELETE FROM users_permissions_staff WHERE staffid='{$this->id}'";
     $sql_obj->execute();
     /*
     	Delete Journal
     */
     journal_delete_entire("staff", $this->id);
     /*
     	Commit
     */
     if (error_check()) {
         $sql_obj->trans_rollback();
         log_write("error", "inc_staff", "An error occured whilst attempting to delete the employee. No changes have been made.");
         return 0;
     } else {
         $sql_obj->trans_commit();
         log_write("notification", "inc_staff", "Employee has been successfully deleted.");
         return 1;
     }
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:35,代码来源:inc_staff.php

示例9:

 function action_delete()
 {
     log_write("debug", "file_storage", "Executing action_delete()");
     /*
     	Start SQL Transaction
     */
     $sql_obj = new sql_query();
     $sql_obj->trans_begin();
     /*
     	Remove file data
     */
     if ($this->data["file_location"] == "db") {
         // delete file from the database
         $sql_obj->string = "DELETE FROM file_upload_data WHERE fileid='" . $this->id . "'";
         $sql_obj->execute();
     } else {
         // delete file from the filesystem
         $file_path = $this->config["data_storage_location"] . "/" . $this->id;
         @unlink($file_path);
     }
     /*
     	Remove metadata information from database
     */
     $sql_obj->string = "DELETE FROM file_uploads WHERE id='" . $this->id . "'";
     $sql_obj->execute();
     /*
     	Commit
     */
     if (error_check()) {
         $sql_obj->trans_rollback();
         log_write("error", "file_storage", "An error occured whilst attempting to upload the file, no changes have been made.");
         return 0;
     } else {
         $sql_obj->trans_commit();
         log_write("debug", "file_storage", "Successfully deleted file ID '" . $this->id . "'");
         return $this->id;
     }
 }
开发者ID:claybbs,项目名称:namedmanager,代码行数:38,代码来源:inc_file_uploads.php

示例10:

 function action_delete()
 {
     log_debug("name_server_group", "Executing action_delete()");
     /*
     	Start Transaction
     */
     $sql_obj = new sql_query();
     $sql_obj->trans_begin();
     /*
     	Delete Name Server Group
     
     	Note: no need to delete anything from dns_domains_groups, as the name server group
     	must be empty before it can be deleted.
     */
     $sql_obj->string = "DELETE FROM name_servers_groups WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     /*
     	Commit
     */
     if (error_check()) {
         $sql_obj->trans_rollback();
         log_write("error", "name_server_group", "An error occured whilst trying to delete the name server group.");
         return 0;
     } else {
         $sql_obj->trans_commit();
         log_write("notification", "name_server_group", "Name server group has been successfully deleted.");
         return 1;
     }
 }
开发者ID:claybbs,项目名称:namedmanager,代码行数:29,代码来源:inc_server_groups.php

示例11:

 function action_delete()
 {
     log_debug("inc_charts", "Executing action_delete()");
     /*
     	Start Transaction
     */
     $sql_obj = new sql_query();
     $sql_obj->trans_begin();
     /*
     	Delete chart
     */
     $sql_obj->string = "DELETE FROM account_charts WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     /*
     	Delete all chart menu options
     */
     $sql_obj->string = "DELETE FROM account_charts_menus WHERE chartid='" . $this->id . "'";
     $sql_obj->execute();
     /*
     	Commit
     */
     if (error_check()) {
         $sql_obj->trans_rollback();
         log_write("error", "inc_charts", "An error occured whilst attempting to delete account. No changes have been made.");
         return 0;
     } else {
         $sql_obj->trans_commit();
         log_write("notification", "inc_charts", "Account has been successfully deleted.");
         return 1;
     }
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:31,代码来源:inc_charts.php

示例12:

 function action_delete()
 {
     log_debug("attributes", "Executing action_delete()");
     // start transaction
     $sql_obj = new sql_query();
     $sql_obj->trans_begin();
     // delete the attribute
     $sql_obj->string = "DELETE FROM attributes WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     // commit
     if (error_check()) {
         $sql_obj->trans_rollback();
         log_write("error" . "inc_attributes" . "An error occured whilst attempting to delete the attribute. No changes have been made.");
     } else {
         $sql_obj->trans_commit();
         log_write("notification", "inc_attributes", "Attribute has been successfully deleted.");
     }
     return 1;
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:19,代码来源:inc_attributes.php

示例13:

 function action_delete()
 {
     log_debug("inc_gl", "Executing action_delete()");
     /*
     	Start Transaction
     */
     $sql_obj = new sql_query();
     $sql_obj->trans_begin();
     /*
     	Delete general ledger details
     */
     $sql_obj->string = "DELETE FROM account_gl WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     /*
     	Delete transaction items
     */
     $sql_obj->string = "DELETE FROM account_trans WHERE type='gl' AND customid='" . $this->id . "'";
     $sql_obj->execute();
     /*
     	Commit
     */
     if (error_check()) {
         $sql_obj->trans_rollback();
         log_write("error", "inc_gl", "An error occured whilst attempting to delete the transaction. No changes have been made.");
         return 0;
     } else {
         $sql_obj->trans_commit();
         log_write("notification", "inc_gl", "Transaction has been successfully deleted.");
         return 1;
     }
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:31,代码来源:inc_gl.php

示例14: domain

 function action_delete()
 {
     log_debug("name_server", "Executing action_delete()");
     /*
     	Start Transaction
     */
     $sql_obj = new sql_query();
     $sql_obj->trans_begin();
     /*
     	Delete Name Server
     */
     $sql_obj->string = "DELETE FROM name_servers WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     $sql_obj->string = "DELETE FROM cloud_zone_map WHERE id='" . $this->id . "'";
     $sql_obj->execute();
     /*
     	Un-associated any matched log entries
     */
     $sql_obj->string = "UPDATE logs SET id_server='0' WHERE id_server='" . $this->id . "'";
     $sql_obj->execute();
     /*
     	Update NS records
     
     	We need to run through all the domains and update the records - if the nameserver was an automated entry for all the domains,
     	after deleting the name server we should remove it from all the domains.
     */
     $obj_domain = new domain();
     $obj_domain->load_data_all();
     foreach ($obj_domain->data as $data_domain) {
         $obj_domain_sub = new domain();
         $obj_domain_sub->id = $data_domain["id"];
         $obj_domain_sub->load_data();
         $obj_domain_sub->action_update_ns();
         $obj_domain_sub->action_update_serial();
     }
     /*
     	Commit
     */
     if (error_check()) {
         $sql_obj->trans_rollback();
         log_write("error", "name_server", "An error occured whilst trying to delete the name server.");
         return 0;
     } else {
         $sql_obj->trans_commit();
         log_write("notification", "name_server", "Name server has been successfully deleted.");
         return 1;
     }
 }
开发者ID:claybbs,项目名称:namedmanager,代码行数:48,代码来源:inc_servers.php

示例15:

 function bundle_service_delete($id_service)
 {
     log_write("debug", "inc_services", "Executing bundle_service_delete({$id_service}))");
     /*
     	Begin Transaction
     */
     $sql_obj = new sql_query();
     $sql_obj->trans_begin();
     /*
     	Apply Changes
     */
     $sql_obj->string = "SELECT id FROM `services_bundles` WHERE id_bundle='" . $this->id . "' AND id_service='{$id_service}' LIMIT 1";
     $sql_obj->execute();
     $sql_obj->fetch_array();
     $option_id = $sql_obj->data[0]["id"];
     $sql_obj->string = "DELETE FROM `services_bundles` WHERE id='{$option_id}' LIMIT 1";
     $sql_obj->execute();
     $sql_obj->string = "DELETE FROM `services_options` WHERE option_type='bundle' AND option_type_id='{$option_id}'";
     $sql_obj->execute();
     /*
     	Update the Journal
     */
     journal_quickadd_event("services", $this->id, "Service component removed from bundle.");
     /*
     	Commit
     */
     if (error_check()) {
         $sql_obj->trans_rollback();
         log_write("error", "process", "An error occured whilst attempting to remove a service from the bundle. No changes have been made.");
     } else {
         $sql_obj->trans_commit();
         log_write("notification", "process", "Service successfully removed from bundle.");
     }
     return 0;
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:35,代码来源:inc_services.php


注:本文中的sql_query::trans_rollback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。