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


PHP invoice::delete方法代码示例

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


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

示例1: delete

    function delete($VAR)
    {
        $db =& DB();
        global $C_auth, $C_list;
        # set the id
        $id = $this->table . '_id';
        # generate the list of ID's
        $id_list = '';
        $account_id_list = '';
        $discount_id_list = '';
        $ii = 0;
        if (isset($VAR["delete_id"])) {
            $id = explode(',', $VAR["delete_id"]);
        } elseif (isset($VAR["id"])) {
            $id = explode(',', $VAR["id"]);
        }
        for ($i = 0; $i < count($id); $i++) {
            if ($id[$i] != '') {
                ### is current account auth to delete this account?
                ### Get any authorized groups:
                $db =& DB();
                $sql = 'SELECT group_id FROM ' . AGILE_DB_PREFIX . 'account_group WHERE
							site_id      = ' . $db->qstr(DEFAULT_SITE) . ' AND
							account_id   = ' . $db->qstr($id[$i]) . '
							ORDER BY group_id';
                $groups = $db->Execute($sql);
                while (!$groups->EOF) {
                    $group[] = $groups->fields['group_id'];
                    $groups->MoveNext();
                }
                ### Verify the user has access to view this account:
                $delete_this = true;
                if (!empty($group) && is_array($group)) {
                    for ($ix = 0; $ix < count($group); $ix++) {
                        if (!$C_auth->auth_group_by_id($group[$ix])) {
                            $delete_this = false;
                            $ix = count($group);
                        }
                    }
                }
                unset($group);
                ### Verify this is not the admin account or the current user's account:
                if (SESS_ACCOUNT == $id[$i] || $id[$i] == '1') {
                    $delete_this = false;
                }
                ### Generate the SQL
                if ($delete_this) {
                    if ($i == 0) {
                        $id_list .= " id = " . $db->qstr($id[$i], get_magic_quotes_gpc()) . " ";
                        $account_id_list .= " account_id = " . $db->qstr($id[$i], get_magic_quotes_gpc()) . " ";
                        $discount_id_list .= " account_id = " . $db->qstr($id[$i], get_magic_quotes_gpc()) . " ";
                        $ii++;
                    } else {
                        $id_list .= " OR id = " . $db->qstr($id[$i], get_magic_quotes_gpc()) . " ";
                        $account_id_list .= " OR account_id = " . $db->qstr($id[$i], get_magic_quotes_gpc()) . " ";
                        $discount_id_list .= " OR account_id = " . $db->qstr($id[$i], get_magic_quotes_gpc()) . " ";
                        $ii++;
                    }
                    ####################################################################
                    ### Do any db_mapping
                    ####################################################################
                    $dbsql = "SELECT username FROM " . AGILE_DB_PREFIX . "account WHERE\n\t\t\t\t\t\t\t  site_id = " . $db->qstr(DEFAULT_SITE) . " AND\n\t\t\t\t\t\t\t  id      = " . $db->qstr($id[$i]);
                    $resultdb = $db->Execute($dbsql);
                    $old_username = $resultdb->fields['username'];
                    if ($C_list->is_installed('db_mapping')) {
                        include_once PATH_MODULES . 'db_mapping/db_mapping.inc.php';
                        $db_map = new db_mapping();
                        $db_map->account_delete($id[$i], $old_username);
                    }
                }
            }
        }
        $db =& DB();
        if ($ii > 0) {
            # generate the full query (account)
            $q = "DELETE FROM  " . AGILE_DB_PREFIX . "account\n\t\t\t\t  WHERE {$id_list}  AND  site_id = " . $db->qstr(DEFAULT_SITE);
            $result = $db->Execute($q);
            # generate the full query (sessions)
            $q = "DELETE FROM  " . AGILE_DB_PREFIX . "session\n\t\t\t\t  WHERE {$account_id_list} AND site_id = " . $db->qstr(DEFAULT_SITE);
            $db->Execute($q);
            # generate the full query (account_billing)
            $q = "DELETE FROM  " . AGILE_DB_PREFIX . "account_billing\n\t\t\t\t  WHERE {$account_id_list}  AND  site_id = " . $db->qstr(DEFAULT_SITE);
            $db->Execute($q);
            # generate the full query (account_group)
            $q = "DELETE FROM  " . AGILE_DB_PREFIX . "account_group\n\t\t\t\t  WHERE {$account_id_list}  AND  site_id = " . $db->qstr(DEFAULT_SITE);
            $db->Execute($q);
            # generate the full query (cart)
            $q = "DELETE FROM  " . AGILE_DB_PREFIX . "cart\n\t\t\t\t  WHERE {$account_id_list}  AND  site_id = " . $db->qstr(DEFAULT_SITE);
            $db->Execute($q);
            # generate the full query (search)
            $q = "DELETE FROM  " . AGILE_DB_PREFIX . "search\n\t\t\t\t  WHERE {$account_id_list}  AND  site_id = " . $db->qstr(DEFAULT_SITE);
            $db->Execute($q);
            # generate the full query (staff)
            $q = "DELETE FROM  " . AGILE_DB_PREFIX . "staff\n\t\t\t\t  WHERE {$account_id_list}  AND  site_id = " . $db->qstr(DEFAULT_SITE);
            $db->Execute($q);
            # generate the full query (ticket)
            if ($C_list->is_installed('ticket')) {
                $q = "SELECT id FROM  " . AGILE_DB_PREFIX . "ticket\n\t\t\t\t\t  WHERE {$account_id_list} AND site_id = " . $db->qstr(DEFAULT_SITE);
                $ticket = $db->Execute($q);
                if ($ticket != false && $ticket->RecordCount() > 0) {
//.........这里部分代码省略.........
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:101,代码来源:account_admin.inc.php

示例2: invoice

 function invoice_cleanup($VAR)
 {
     # Load the account admin class
     include_once PATH_MODULES . 'invoice/invoice.inc.php';
     $invoice = new invoice();
     $exp = time() - 86400 * AGILE_INVOICE_CLEANUP_DAYS;
     # Get each account:
     $db =& DB();
     $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'invoice
                 WHERE
                 process_status  =  ' . $db->qstr(0) . '  AND
                 billing_status  =  ' . $db->qstr(0) . '  AND
                 billed_amt      <= ' . $db->qstr(0) . '  AND
                 date_last       <= ' . $db->qstr($exp) . '  AND
                 site_id         =  ' . $db->qstr(DEFAULT_SITE);
     $rs = $db->Execute($sql);
     while (!$rs->EOF) {
         $arr['id'] = $rs->fields['id'];
         $invoice->delete($arr, $invoice);
         $rs->MoveNext();
     }
 }
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:22,代码来源:core.inc.php

示例3: prepare

        $invoice->save();
        $invoiceID = $invoice->get_id();
        $TPL["message_good"][] = "Invoice saved.";
        alloc_redirect($TPL["url_alloc_invoice"] . "invoiceID=" . $invoiceID . $extra);
    }
} else {
    if ($_POST["delete"] && $invoice->get_value("invoiceStatus") == "edit") {
        if ($invoiceItemIDs) {
            $db = new db_alloc();
            $q = prepare("DELETE FROM transaction WHERE invoiceItemID in (%s)", $invoiceItemIDs);
            $db->query($q);
            $q = prepare("DELETE FROM invoiceItem WHERE invoiceItemID in (%s)", $invoiceItemIDs);
            $db->query($q);
        }
        // should probablg delete/unlink the pdf docs
        $invoice->delete();
        $TPL["message_good"][] = "Invoice deleted.";
        alloc_redirect($TPL["url_alloc_invoiceList"]);
        // Saving editing individual invoiceItems
    } else {
        if (($_POST["invoiceItem_save"] || $_POST["invoiceItem_edit"] || $_POST["invoiceItem_delete"]) && $invoice->get_value("invoiceStatus") == "edit") {
            is_array($_POST["invoiceItem_edit"]) and $invoiceItemID = key($_POST["invoiceItem_edit"]);
            is_array($_POST["invoiceItem_delete"]) and $invoiceItemID = key($_POST["invoiceItem_delete"]);
            $invoiceItem = new invoiceItem();
            $invoiceItem->currency = $invoice->get_value("currencyTypeID");
            $invoiceItem->set_id($invoiceItemID);
            #echo $invoiceItem->get_id();
            $invoice->set_id($invoiceID);
            $invoice->select();
            #echo "<pre>".print_r($_POST,1)."</pre>";
            $_POST["iiTax"] or $_POST["iiTax"] = '';
开发者ID:cjbayliss,项目名称:alloc,代码行数:31,代码来源:invoice.php


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