Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezorderstatus.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezorderstatus.php 6394 2001-08-08 12:34:57Z jhe $
5 //
6 // Definition of eZOrderStatus class
7 //
8 // Created on: <02-Oct-2000 15:06:32 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 //
30
39 // include_once( "classes/ezdb.php" );
40
41 // include_once( "classes/ezdatetime.php" );
42
43 class eZOrderStatus
44 {
51 function __construct( $id="" )
52 {
53 $this->StatusID = 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
70 $this->Comment = $db->escapeString( $this->Comment );
71 $timestamp = (new eZDateTime())->timeStamp( true );
72 if ( !isset( $this->ID ) )
73 {
74 $db->lock( "eZTrade_OrderStatus" );
75 $nextID = $db->nextID( "eZTrade_OrderStatus", "ID" );
76 $query = "INSERT INTO eZTrade_OrderStatus
77 (ID,
78 StatusID,
79 Altered,
80 AdminID,
81 Comment,
82 OrderID)
83 VALUES
84 ('$nextID',
85 '$this->StatusID',
86 '$timestamp',
87 '$this->AdminID',
88 '$this->Comment',
89 '$this->OrderID')";
90
91 $ret[] = $db->query( $query );
92 $db->unlock();
93 $this->ID = $nextID;
94 }
95 else
96 {
97 $ret[] = $db->query( "UPDATE eZTrade_OrderStatus SET
98 StatusID='$this->StatusID',
99 Altered='$timestamp',
100 AdminID='$this->AdminID',
101 Comment='$this->Comment',
102 OrderID='$this->OrderID'
103 WHERE ID='$this->ID'
104 " );
105 }
106 eZDB::finish( $ret, $db );
107 return true;
108 }
109
113 function get( $id="" )
114 {
115 $db =& eZDB::globalDatabase();
116 $ret = false;
117
118 if ( $id != "" )
119 {
120 $db->array_query( $order_array, "SELECT * FROM eZTrade_OrderStatus WHERE ID='$id'" );
121 if ( count( $order_array ) > 1 )
122 {
123 die( "Error: Order's with the same ID was found in the database. This shouldent happen." );
124 }
125 else if( count( $order_array ) == 1 )
126 {
127 $this->ID =& $order_array[0][$db->fieldName("ID")];
128 $this->StatusID =& $order_array[0][$db->fieldName("StatusID")];
129 $this->Altered =& $order_array[0][$db->fieldName("Altered")];
130 $this->AdminID =& $order_array[0][$db->fieldName("AdminID")];
131 $this->OrderID =& $order_array[0][$db->fieldName("OrderID")];
132 $this->Comment =& $order_array[0][$db->fieldName("Comment")];
133
134 $ret = true;
135 }
136 }
137 return $ret;
138 }
139
143 function id()
144 {
145 return $this->ID;
146 }
147
151 function altered( )
152 {
153 $dateTime = new eZDateTime();
154
155 $dateTime->setTimeStamp( $this->Altered );
156
157 return $dateTime;
158 }
159
163 function rawAltered()
164 {
165 return $this->Altered;
166 }
167
168
172 function type( )
173 {
174 $ret = new eZOrderStatusType( $this->StatusID );
175
176 return $ret;
177 }
178
182 function comment()
183 {
184 return $this->Comment;
185 }
186
190 function admin()
191 {
192 $ret = new eZUser( $this->AdminID );
193 return $ret;
194 }
195
196
200 function setType( $type )
201 {
202 if ( is_a( $type, "eZOrderStatusType" ) )
203 {
204 $this->StatusID = $type->id();
205 }
206 }
207
211 function setAdmin( $user )
212 {
213 if ( is_a( $user, "eZUser" ) )
214 {
215 $this->AdminID = $user->id();
216 }
217 }
218
222 function setOrderID( $order )
223 {
224 $this->OrderID = $order;
225 }
226
230 function setComment( $value )
231 {
232 $this->Comment = $value;
233 }
234
235 var $ID;
236 var $StatusID;
237 var $Altered;
238 var $AdminID;
239 var $OrderID;
240 var $Comment;
241
242 }
243
244 ?>
$dateTime
$dateTime
Definition: authorview.php:77
eZDB\finish
static finish(&$resultArray, &$db)
Definition: ezdb.php:204
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZDateTime
Definition: ezdatetime.php:55
eZOrderStatusType
Definition: ezorderstatustype.php:44
eZOrderStatus
Definition: ezorderstatus.php:44
eZOrderStatus\setComment
setComment( $value)
Definition: ezorderstatus.php:230
eZOrderStatus\comment
comment()
Definition: ezorderstatus.php:182
eZOrderStatus\store
store()
Definition: ezorderstatus.php:65
eZOrderStatus\admin
admin()
Definition: ezorderstatus.php:190
eZOrderStatus\type
type()
Definition: ezorderstatus.php:172
eZOrderStatus\$OrderID
$OrderID
Definition: ezorderstatus.php:239
eZOrderStatus\altered
altered()
Definition: ezorderstatus.php:151
eZOrderStatus\$Comment
$Comment
Definition: ezorderstatus.php:240
eZOrderStatus\$AdminID
$AdminID
Definition: ezorderstatus.php:238
eZOrderStatus\__construct
__construct( $id="")
Definition: ezorderstatus.php:51
eZOrderStatus\$StatusID
$StatusID
Definition: ezorderstatus.php:236
eZOrderStatus\$ID
$ID
Definition: ezorderstatus.php:235
eZOrderStatus\$Altered
$Altered
Definition: ezorderstatus.php:237
eZOrderStatus\rawAltered
rawAltered()
Definition: ezorderstatus.php:163
eZOrderStatus\id
id()
Definition: ezorderstatus.php:143
eZOrderStatus\setOrderID
setOrderID( $order)
Definition: ezorderstatus.php:222
eZOrderStatus\setType
setType( $type)
Definition: ezorderstatus.php:200
eZOrderStatus\setAdmin
setAdmin( $user)
Definition: ezorderstatus.php:211
eZUser
Definition: ezuser.php:76
$type
$type
Definition: classes/admin/linkselect.php:220
$id
$id
Definition: companytypelist.php:193
$query
if(isset( $Year) &&!is_numeric( $Year)||isset( $Month) &&!is_numeric( $Month)) $query
Definition: entryexitpages.php:65
$db
$db
Definition: ezarticle/user/authorlist.php:53
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
$timestamp
$timestamp
Definition: ezstats/admin/cron.php:35
$order
$order
Definition: productreport.php:182
$user
$user
Definition: user/adlist.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.