Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

admin/orderlist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: orderlist.php 8562 2001-11-21 16:10:04Z br $
5 //
6 // Created on: <30-Sep-2000 13:03:13 bf>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 //
10 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 // include_once( "classes/INIFile.php" );
28 // include_once( "classes/eztemplate.php" );
29 // include_once( "classes/ezlocale.php" );
30 // include_once( "classes/ezcurrency.php" );
31 // include_once( "classes/ezlist.php" );
32
33 $ini =& eZINI::instance( 'site.ini' );
34 $Language = $ini->variable( "eZTradeMain", "Language" );
35
36 // include_once( "eztrade/classes/ezproductcategory.php" );
37 // include_once( "eztrade/classes/ezproduct.php" );
38 // include_once( "eztrade/classes/ezorder.php" );
39 // include_once( "eztrade/classes/ezpreorder.php" );
40
41 // include_once( "eztrade/classes/ezorderstatustype.php" );
42
43 //echo $HideFollowup;
44 //print_r($HTTP_POST_VARS);
45 //exit();
46
47
48
49 if ( isset( $Hide ) )
50 {
51 $session =& eZSession::globalSession();
52 $session->setVariable( "OrderList", "Hide" );
53 }
54
55 if ( isset( $Show ) )
56 {
57 $session =& eZSession::globalSession();
58 $session->setVariable( "OrderList", "Show" );
59 }
60
61 $checkMode =& eZSession::globalSession();
62 if ( $checkMode->variable( "OrderList" ) == "Hide" )
63 $HideFollowup = "on";
64 else
65 $HideFollowup = "";
66
67 if( isset( $Delete ) && count( $OrderArrayID ) > 0 )
68 {
69 foreach( $OrderArrayID as $orderid )
70 {
71 $order = new eZOrder( $orderid );
72 $order->delete();
73 $preOrder = new eZPreOrder();
74 $preOrder->getByOrderID( $orderid );
75 $preOrder->setOrderID( 0 );
76 $preOrder->store();
77 }
78 }
79
80 $t = new eZTemplate( "kernel/eztrade/admin/" . $ini->variable( "eZTradeMain", "AdminTemplateDir" ),
81 "kernel/eztrade/admin/intl/", $Language, "orderlist.php" );
82
83 $languageINI = new eZINI( "kernel/eztrade/admin/intl/" . $Language . "/orderlist.php.ini", false );
84
85 $PricesIncludeVAT = $ini->variable( "eZTradeMain", "AdminShowIncTaxColumn" ) == "enabled" ? true : false;
86
87
88 $t->setAllStrings();
89
90 $t->set_file( "order_list_tpl", "orderlist.tpl" );
91
92 $t->set_block( "order_list_tpl", "order_item_list_tpl", "order_item_list" );
93 $t->set_block( "order_item_list_tpl", "order_item_tpl", "order_item" );
94
95 // next prvious
96 $t->set_block( "order_list_tpl", "previous_tpl", "previous" );
97 $t->set_block( "order_list_tpl", "next_tpl", "next" );
98
99 $t->set_var( "site_style", $SiteDesign );
100
101 if ( isset( $URLQueryText ) )
102 {
103 $QueryText = urldecode( $URLQueryText );
104 }
105 else
106 {
107 $QueryText = "";
108 }
109
110 $t->set_var( "query_string", $QueryText );
111
112 if ( $HideFollowup = "on" )
113 $t->set_var( "followup_checked", "checked" );
114 else
115 $t->set_var( "followup_checked", "" );
116
117 $t->set_var( "previous", "" );
118 $t->set_var( "next", "" );
119
120 if ( !isset( $OrderBy ) )
121 $OrderBy = "Date";
122
123 if ( !isset( $Offset ) )
124 $Offset = 0;
125
126 if ( !isset( $Limit ) )
127 $Limit = 15;
128
129 $t->set_var( "current_offset", $Offset );
130
131 $order = new eZOrder();
132
133 // perform search
134 if ( isset( $QueryText ) && $QueryText != "" )
135 {
136 $orderArray = $order->search( $QueryText, $Offset, $Limit );
137 $total_count = $order->getSearchCount( $QueryText );
138 }
139 else
140 {
141 $orderArray = $order->getAll( $Offset, $Limit, $OrderBy );
142 $total_count = $order->getTotalCount( );
143 }
144
145 if ( !$orderArray )
146 $t->set_var( "order_item", "" );
147
148 $locale = new eZLocale( $Language );
149 $currency = new eZCurrency();
150 $i = 0;
151
152 foreach ( $orderArray as $order )
153 {
154 if ( ( $i % 2 ) == 0 )
155 $t->set_var( "td_class", "bgdark" );
156 else
157 $t->set_var( "td_class", "bglight" );
158
159 $t->set_var( "order_id", $order->id() );
160
161 /*
162 echo "<pre>";
163 print_r($status);
164 $dateTime = $status->altered();
165
166 echo $locale->format( $dateTime )."<br>";
167 $dateTime = $status->altered();
168
169 // echo $locale->format( $dateTime )."<br>";
170 print_r( $order->lastStatus() );
171 echo "</pre>";
172 exit(); */
173 $status = $order->initialStatus();
174 $dateTime = $status->altered();
175 $t->set_var( "order_date", $locale->format( $dateTime ) );
176 $dateTime = $status->rawAltered();
177
178 $status = $order->lastStatus();
179 $lastDateTime = $status->altered();
180 $t->set_var( "altered_date", $locale->format( $lastDateTime ) );
181 $lastDateTime = $status->rawAltered();
182
183 // if ($dateTime == $lastDateTime)
184 // $lastDateTime = time();
185
186 $statusAge = ( round( (( time()-$lastDateTime )/86400),0 ) );
187
188 $t->set_var( "age_color", "smallgreen" ); //age since last status change - green
189
190 if ( $statusAge > 7 ) //turns amber after one week
191 $t->set_var( "age_color", "smallamber" );
192
193 if ( $statusAge > 42 ) //turns red after six weeks
194 $t->set_var( "age_color", "smallred" );
195
196 $t->set_var( "status_age", $statusAge );
197
198
199 $statusType = $status->type();
200 $statusTypeName = !is_null( $statusType->name() ) ? $statusType->name() : false;
201 $statusName = preg_replace( "#intl-#", "", $statusTypeName );
202 // $statusName = $languageINI->variable( "strings", $statusName );
203 $t->set_var( "order_status", $statusName );
204
205 $user = $order->user();
206
207 if ( $user )
208 {
209 if ( $order->personID() == 0 && $order->companyID() == 0 )
210 {
211 $t->set_var( "customer_email", $user->email() );
212 $t->set_var( "customer_first_name", $user->firstName() );
213 $t->set_var( "customer_last_name", $user->lastName() );
214 }
215 else
216 {
217 if ( $order->personID() > 0 )
218 {
219 $customer = new eZPerson( $order->personID() );
220 $t->set_var( "customer_first_name", $customer->firstName() );
221 $t->set_var( "customer_last_name", $customer->lastName() );
222 }
223 else
224 {
225 $customer = new eZCompany( $order->companyID() );
226 $t->set_var( "customer_first_name", $customer->name() );
227 $t->set_var( "customer_last_name", "" );
228 }
229 $emailList = $customer->emailAddress();
230 $t->set_var( "customer_email", $emailList[0] );
231 }
232 }
233
234 $order->orderTotals( $tax, $total );
235
236 if ( $PricesIncludeVAT == true )
237 $currency->setValue( $total["inctax"] );
238 else
239 $currency->setValue( $total["extax"] );
240
241 // if ( $order->isVATInc() == true )
242 // $currency->setValue( $order->totalPriceIncVAT() + $order->shippingCharge());
243 // else
244 // $currency->setValue( $order->totalPrice() + $order->shippingCharge() );
245
246 $t->set_var( "order_price", $locale->format( $currency ) );
247
248 $t->parse( "order_item", "order_item_tpl", true );
249 $i++;
250 }
251
252 eZList::drawNavigator( $t, $total_count, $Limit, $Offset, "order_list_tpl" );
253
254
255 $t->set_var( "url_query_string", isset( $QueryText ) ? urlencode( $QueryText ) : '' );
256 $t->parse( "order_item_list", "order_item_list_tpl" );
257 $t->pparse( "output", "order_list_tpl" );
258
259 ?>
$session
$session
Definition: admin/articlelist.php:44
$HideFollowup
else $HideFollowup
Definition: admin/orderlist.php:65
$order
$order
Definition: admin/orderlist.php:131
$t
if(isset( $Delete) &&count( $OrderArrayID) > 0) $t
Definition: admin/orderlist.php:80
$currency
$currency
Definition: admin/orderlist.php:149
$locale
$locale
Definition: admin/orderlist.php:148
$checkMode
if(isset( $Hide)) if(isset( $Show)) $checkMode
Definition: admin/orderlist.php:61
$languageINI
$languageINI
Definition: admin/orderlist.php:83
$PricesIncludeVAT
$PricesIncludeVAT
Definition: admin/orderlist.php:85
$i
$i
Definition: admin/orderlist.php:150
$Language
$Language
Definition: admin/orderlist.php:34
$ini
$ini
Definition: admin/orderlist.php:33
$total_count
$total_count
Definition: admin/orderlist.php:142
$dateTime
$dateTime
Definition: authorview.php:77
$status
$status
Definition: bugedit.php:473
$total
else $total["inctax"]
Definition: checkout.php:1359
eZCompany
Definition: ezcompany.php:54
eZCurrency
Definition: ezcurrency.php:46
eZINI
Reads and writes .ini style configuration files.
eZList\drawNavigator
static drawNavigator(&$t, $total_types, $max_types, $index, $parent=false, $variables=false)
Definition: ezlist.php:401
eZLocale
Definition: ezlocale.php:119
eZOrder
Definition: ezorder.php:52
eZPerson
Definition: ezperson.php:43
eZPreOrder
Definition: ezpreorder.php:44
eZSession\globalSession
static & globalSession( $id="", $fetch=true)
Definition: kernel/ezsession/classes/ezsession.php:614
eZTemplate
Definition: eztemplate.php:107
$customer
$customer
Definition: customerview.php:72
$Limit
$Limit
Definition: ezarticle/admin/categorylist.php:66
$Offset
$Offset
Definition: ezarticle/user/search.php:110
$SiteDesign
$SiteDesign
Definition: ezbulkmail/user/datasupplier.php:31
$statusType
if(count( $usedVouchers) > 0) $statusType
Definition: orderedit.php:620
$statusAge
$statusAge
Definition: orderedit.php:741
$lastDateTime
$lastDateTime
Definition: orderedit.php:738
$OrderBy
$OrderBy
Definition: reciverpopup.php:21
$user
$user
Definition: user/adlist.php:39
$orderArray
if(! $user) $orderArray
Definition: user/orderlist.php:79
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.