Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezpreorder.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezpreorder.php 6414 2001-08-10 12:15:27Z jhe $
5 //
6 // Definition of eZPreOrder class
7 //
8 // Created on: <15-Mar-2001 18:11:55 bf>
9 //
10 // This source file is part of Exponential Basic, publishing software.
11 //
12 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
27 //
28
31
40 // include_once( "classes/ezdb.php" );
41
42
43 class eZPreOrder
44 {
51 function __construct( $id="" )
52 {
53 $this->OrderID = 0;
54
55 if ( $id != "" )
56 {
57 $this->ID = $id;
58 $this->get( $this->ID );
59 }
60 }
61
65 function store()
66 {
67 $db =& eZDB::globaldatabase();
68 $db->begin();
69 if ( !isset( $this->ID ) )
70 {
71 $db->lock( "eZTrade_PreOrder" );
72 $nextID = $db->nextID( "eZTrade_PreOrder", "ID" );
73 $timeStamp =& (new eZDateTime())->timeStamp( true );
74 $ret[] = $db->query( "INSERT INTO eZTrade_PreOrder
75 ( ID,
76 OrderID,
77 Created )
78 VALUES
79 ( '$nextID',
80 '$this->OrderID',
81 '$timeStamp' )" );
82 $db->unlock();
83 $this->ID = $nextID;
84 }
85 else
86 {
87 $ret[] = $db->query( "UPDATE eZTrade_PreOrder SET
88 Created=Created,
89 OrderID='$this->OrderID'
90 WHERE ID='$this->ID'
91 " );
92 }
93 eZDB::finish( $ret, $db );
94 return true;
95 }
96
100 function delete()
101 {
102 $db =& eZDB::globaldatabase();
103 $db->begin();
104
105 $ret[] = $db->query( "DELETE FROM eZTrade_PreOrder WHERE ID='$this->ID'" );
106
107 eZDB::finish( $ret, $db );
108
109 return true;
110 }
111
112
116 function get( $id="" )
117 {
118 $db =& eZDB::globaldatabase();
119 $ret = false;
120
121 if ( $id != "" )
122 {
123 $db->array_query( $cart_array, "SELECT * FROM eZTrade_PreOrder WHERE ID='$id'" );
124 if ( count( $cart_array ) > 1 )
125 {
126 die( "Error: Pre order's with the same ID was found in the database. This shouldent happen." );
127 }
128 else if( count( $cart_array ) == 1 )
129 {
130 $this->ID = $cart_array[0][$db->fieldName("ID")];
131 $this->OrderID = $cart_array[0][$db->fieldName("OrderID")];
132 $this->Created = $cart_array[0][$db->fieldName("Created")];
133 $ret = true;
134 }
135 }
136 return $ret;
137 }
138
144 function getByOrderID( $orderID )
145 {
146 $db =& eZDB::globaldatabase();
147 $ret = false;
148
149 if ( $orderID != "" )
150 {
151 $db->array_query( $cart_array, "SELECT * FROM eZTrade_PreOrder WHERE OrderID='$orderID'" );
152 if ( count( $cart_array ) > 1 )
153 {
154 die( "Error: Pre order's with the same ID was found in the database. This shouldent happen." );
155 }
156 else if( count( $cart_array ) == 1 )
157 {
158 $this->ID = $cart_array[0][$db->fieldName("ID")];
159 $this->OrderID = $cart_array[0][$db->fieldName("OrderID")];
160 $this->Created = $cart_array[0][$db->fieldName("Created")];
161 $ret = true;
162 }
163 }
164
165 return $ret;
166 }
167
171 function date()
172 {
173 $dateTime = new eZDateTime();
174 $dateTime->setTimeStamp( $this->Date );
175
176 return $dateTime;
177 }
178
182 function id()
183 {
184 return $this->ID;
185 }
186
191 function orderID()
192 {
193 return $this->OrderID;
194 }
195
199 function setOrderID( $value )
200 {
201 $this->OrderID = $value;
202 }
203
204
205 var $ID;
206 var $Created;
207 var $OrderID;
208
209 }
210
211 ?>
$dateTime
$dateTime
Definition: authorview.php:77
eZDB\finish
static finish(&$resultArray, &$db)
Definition: ezdb.php:204
eZDateTime
Definition: ezdatetime.php:55
eZPreOrder
Definition: ezpreorder.php:44
eZPreOrder\getByOrderID
getByOrderID( $orderID)
Definition: ezpreorder.php:144
eZPreOrder\$Created
$Created
Definition: ezpreorder.php:206
eZPreOrder\$OrderID
$OrderID
Definition: ezpreorder.php:207
eZPreOrder\setOrderID
setOrderID( $value)
Definition: ezpreorder.php:199
eZPreOrder\date
date()
Definition: ezpreorder.php:171
eZPreOrder\id
id()
Definition: ezpreorder.php:182
eZPreOrder\orderID
orderID()
Definition: ezpreorder.php:191
eZPreOrder\__construct
__construct( $id="")
Definition: ezpreorder.php:51
eZPreOrder\store
store()
Definition: ezpreorder.php:65
eZPreOrder\$ID
$ID
Definition: ezpreorder.php:205
$id
$id
Definition: companytypelist.php:193
$orderID
$orderID
Definition: confirmation.php:34
$db
$db
Definition: ezarticle/user/authorlist.php:53
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.