/** * Load Order from database * * @param integer $id * @return Order */ public static function Load($id) { $db = Core::GetDBInstance(); $dborder = $db->GetRow("SELECT * FROM orders WHERE id=?", array($id)); if (!$dborder) { throw new ApplicationException(sprintf(_("Order with id = '%s' not found in database"), $id)); } $Order = new Order($dborder["userid"]); $Order->Description = sprintf(_("%s Order #%s"), CONFIG::$COMPANY_NAME, $id); $Order->ID = $id; $invoices = $db->Execute("SELECT id FROM invoices WHERE orderid=?", array($id)); while ($invoice = $invoices->FetchRow()) { $Order->Invoices[] = Invoice::Load($invoice['id']); } return $Order; }
{ $okmsg = sprintf(_("%d invoices rejected"), $i); CoreUtils::Redirect($_SERVER["HTTP_REFERER"]); } } elseif ($post_action == "del") { // // Delete invoices // $i = 0; foreach ((array)$post_id as $k=>$invoiceid) { try { Invoice::Load($invoiceid)->Delete(); $i++; } catch(Exception $e) { if (preg_match('/Domain ID=\d+ not found in database/i', $e->getMessage())) { $db->Execute('DELETE FROM invoices WHERE id=?', array($invoiceid)); $i++; } } } $okmsg = sprintf(_("%d invoices deleted."), $i); CoreUtils::Redirect($_SERVER["HTTP_REFERER"]); }
<? require_once('src/prepend.inc.php'); if (!$get_id) { echo _("Cannot find invoice with this ID!"); exit(); } try { $Invoice = Invoice::Load($req_id); if ($Invoice->UserID != $_SESSION["userid"]) { $errmsg = "You don't have permissions to manage this invoice"; CoreUtils::Redirect("inv_view.php"); } if ($Invoice->OrderID) $Order = Order::Load($Invoice->OrderID); } catch(Exception $e) { } if (!$Order && !$Invoice) { $errmsg = _("No payable invoices found"); CoreUtils::Redirect("index.php");
$invoiceid = $Invoice->ID; } catch(Exception $e) { $errmsg = $e->getMessage(); } }// if check inf if ($invoiceid) { $userinfo = $db->GetRow("SELECT * FROM users WHERE id=?", array($Domain->UserID)); $args = array( "domain_name" => $Domain->Name, "extension" => $Domain->Extension, "Invoice" => Invoice::Load($invoiceid), "expDays" => $Domain->DaysBeforeExpiration, "client" => $userinfo ); mailer_send("renew_notice.eml", $args, $userinfo["email"], $userinfo["name"]); $okmsg = _("Notification successfully sent"); CoreUtils::Redirect("domains_view.php"); } break; } } } $display["title"] = _("Domains » View");
<? require_once('src/prepend.inc.php'); include_once("src/class.activecalendar.php"); set_time_limit(99999999); if ($get_task == "delete" && $get_id) { try { $Invoice = Invoice::Load($get_id); if ($Invoice->UserID == $_SESSION["userid"] && $Invoice->Cancellable && $Invoice->Status == INVOICE_STATUS::PENDING) { $Invoice->Delete(); $okmsg = _("Invoice rejected"); CoreUtils::Redirect("inv_view.php"); } else throw new Exception("invoice cannot be deleted"); } catch (Exception $e) { $errmsg = $e->getMessage(); } } // Delete if ($_POST) { if ($post_action == "pay")
} $invoices = array(); $total = 0; $display["rows"] = array(); try { if (!($_SESSION['orderid'] || $_REQUEST["orderid"]) || ($_REQUEST["invoices"] && md5(implode($_REQUEST["invoices"])) != $_SESSION["inv_md5"])) { $_SESSION["inv_md5"] = md5(implode($_REQUEST["invoices"])); $Order = new Order($_SESSION["userid"]); foreach ((array)$_REQUEST["invoices"] as $invoiceid) { $Invoice = Invoice::Load($invoiceid); if ($Invoice->Status != INVOICE_STATUS::PAID) $Order->AddInvoice($Invoice); } $Order->Save(); $_SESSION['orderid'] = $Order->ID; } else { $Order = Order::Load($req_orderid ? $req_orderid : $_SESSION['orderid']); } } catch (Exception $e) { $errmsg = $e->getMessage();
<?php include 'src/prepend.inc.php'; $invoices = array(); if (isset($req_orderid)) { $Order = Order::Load($req_orderid); $invoices = $Order->GetInvoiceList(); } else { if (isset($req_invoiceid)) { $invoices[] = Invoice::Load($req_invoiceid); } } $table = array(); foreach ($invoices as $Invoice) { $table[] = array('id' => $Invoice->ID, 'description' => $Invoice->Description, 'inv_status' => $Invoice->Status, 'action_status' => $Invoice->ActionStatus, 'action_fail_reason' => $Invoice->ActionFailReason); } $display['table'] = $table; /* $display['table'] = array( array( 'id' => '23', 'purpose' => 'dicsydel01x0154.gr domain name registration for 2 year(s)', 'inv_status' => '1', 'action_status' => '2', 'action_fail_reason'=> 'Registry returns mailformed XML' ), array( 'id' => '5545', 'purpose' => '1983.ch domain name transfer.', 'inv_status' => '1', 'action_status' => '1',