/** * Initialize the Table * * @param array $params Parameters from the {form_table} tag */ public function init($params) { parent::init($params); // Build an order filter $where = isset($this->statusFilter) ? sprintf("status='%s'", $this->statusFilter) : null; // Load the Order Table try { // Build the table $orders = load_array_OrderDBO($where); foreach ($orders as $dbo) { // Put the row into the table $this->data[] = array("id" => $dbo->getID(), "datecreated" => $dbo->getDateCreated(), "datecompleted" => $dbo->getDateCompleted(), "datefulfilled" => $dbo->getDateFulfilled(), "remoteip" => $dbo->getRemoteIP(), "remoteipstring" => $dbo->getRemoteIPString(), "businessname" => $dbo->getBusinessName(), "contactname" => $dbo->getContactName(), "contactemail" => $dbo->getContactEmail(), "status" => $dbo->getStatus(), "accountid" => $dbo->getAccountID(), "accounttype" => $dbo->getAccountType(), "accountname" => $dbo->getAccountName(), "total" => $dbo->getTotal()); } } catch (DBNoRowsFoundException $e) { } }
/** * 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())); } }