3
* ExecuteOrderPage.class.php
5
* This file contains the definition for the Execute Order Page class
8
* @author John Diamond <jdiamond@solid-state.org>
9
* @copyright John Diamond <jdiamond@solid-state.org>
10
* @license http://www.opensource.org/licenses/gpl-license.php GNU Public License
13
// Include the parent class
14
require_once BASE_PATH . "solidworks/Page.class.php";
17
require_once BASE_PATH . "DBO/OrderDBO.class.php";
25
* @author John Diamond <jdiamond@solid-state.org>
27
class ExecuteOrderPage extends Page
30
* @var OrderDBO The order
37
* Actions handled by this page:
38
* browse_accounts_action (form)
40
* @param string $action_name Action
42
function action( $action_name )
44
switch( $action_name )
47
if( isset( $this->session['execute_order']['cancel'] ) )
51
elseif( isset( $this->session['execute_order']['continue'] ) )
58
// No matching action, refer to base class
59
parent::action( $action_name );
68
$this->goto( "view_order", null, sprintf( "id=%d", $this->orderDBO->getID() ) );
77
switch( $this->orderDBO->getAccountType() )
80
if( !$this->orderDBO->executeNewAccount( $this->session['execute_order']['type'],
81
$this->session['execute_order']['status'],
82
$this->session['execute_order']['billingstatus'],
83
$this->session['execute_order']['billingday'] ) )
85
fatal_error( "ExecuteOrderPage::execut()",
86
"Failed to execute Order. ID=" . $this->orderDBO->getID() );
90
case "Existing Account":
91
if( !$this->orderDBO->execute() )
93
fatal_error( "ExecuteOrderPage::execut()",
94
"Failed to execute Order. ID=" . $this->orderDBO->getID() );
99
fatal_error( "ExecuteOrderPage::execute()",
100
"Failed to execute order: invalid account type." );
103
// Jump to the view account page
104
$this->goto( "accounts_view_account",
106
sprintf( "id=%d", $this->orderDBO->getAccountID() ) );
110
* Initialize the Execute Order Page
114
$this->orderDBO =& $this->session['orderdbo'];
115
if( isset( $_GET['id'] ) )
117
// Retrieve the Order from the database
118
$this->orderDBO = load_OrderDBO( intval( $_GET['id'] ) );
121
if( !isset( $this->orderDBO ) )
123
// Could not find the Order
124
fatal_error( "ExecuteOrderPage::init()",
125
"Could not load Order. ID = " . $_GET['id'] );
129
$this->setNavVar( "order_id", $this->orderDBO->getID() );
131
// Go ahead and execute if this is an existing customer
132
if( $this->orderDBO->getAccountType() == "Existing Account" )
139
* Populate the Order Item's Table
141
* @return array An array of all OrderItemDBO's for this Order
143
function populateItemTable()
145
return $this->orderDBO->getAcceptedItems();
b'\\ No newline at end of file'