コード例 #1
0
/**
 * Delete AccountDBO from database
 *
 * @param AccountDBO &$dbo Account DBO to delete
 * @return boolean True on success
 */
function delete_AccountDBO(&$dbo)
{
    $DB = DBConnection::getDBConnection();
    $id = intval($dbo->getID());
    // Delete any HostingSericePurchases assigned to this account
    try {
        $hosting_array = load_array_HostingServicePurchaseDBO("accountid=" . $id);
        foreach ($hosting_array as $hosting_dbo) {
            delete_HostingServicePurchaseDBO($hosting_dbo);
        }
    } catch (DBNoRowsFoundException $e) {
    }
    // Delete any DomainSericePurchases assigned to this account
    try {
        $domain_array = load_array_DomainServicePurchaseDBO("accountid=" . $id);
        foreach ($domain_array as $domain_dbo) {
            delete_DomainServicePurchaseDBO($domain_dbo);
        }
    } catch (DBNoRowsFoundException $e) {
    }
    // Delete any ProductPurchases assigned to this account
    try {
        $product_array = load_array_ProductPurchaseDBO("accountid=" . $id);
        foreach ($product_array as $product_dbo) {
            delete_ProductPurchaseDBO($product_dbo);
        }
    } catch (DBNoRowsFoundException $e) {
    }
    // Delete any Invoices assigned to this account
    try {
        $invoice_array = load_array_InvoiceDBO("accountid=" . $id);
        foreach ($invoice_array as $invoice_dbo) {
            delete_InvoiceDBO($invoice_dbo);
        }
    } catch (DBNoRowsFoundException $e) {
    }
    // Delete any Orders assigned to this account
    try {
        $orders = load_array_OrderDBO("accountid=" . $id);
        foreach ($orders as $orderDBO) {
            delete_OrderDBO($orderDBO);
        }
    } catch (DBNoRowsFoundException $e) {
    }
    // Delete the account's user
    delete_UserDBO($dbo->getUserDBO());
    // Build SQL
    $sql = $DB->build_delete_sql("account", "id = " . $id);
    // Delete the AccountDBO
    if (!mysql_query($sql, $DB->handle())) {
        throw new DBException(mysql_error($DB->handle()));
    }
}
コード例 #2
0
 /**
  * Delete Product Purchase
  *
  * Remove a produt purchase from this account.
  */
 function deleteProduct()
 {
     // Delete the product purchases
     foreach ($this->post['products'] as $dbo) {
         delete_ProductPurchaseDBO($dbo);
     }
     // Success
     $this->setMessage(array("type" => "[PRODUCT_PURCHASE_DELETED]"));
     $this->setURLField("action", "products");
     $this->reload();
 }