Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

eztrade/admin/cron.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: cron.php 6378 2001-08-03 14:08:19Z jhe $
5 //
6 // Created on: <03-Aug-2001 11:33:51 jhe>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 // Copyright (C) 1999-2001 eZ systems as
10 //
11 // This program is free software; you can redistribute it and/or
12 // modify it under the terms of the GNU General Public License
13 // as published by the Free Software Foundation; either version 2
14 // of the License, or (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
24 //
25
26 // include_once( "classes/ezdate.php" );
27 // include_once( "classes/ezdatetime.php" );
28 // include_once( "classes/ezdb.php" );
29 // include_once( "classes/INIFile.php" );
30 // include_once( "classes/ezlocale.php" );
31 // include_once( "classes/eztemplate.php" );
32 // include_once( "eztrade/classes/ezorder.php" );
33
34 // include_once( "ezmail/classes/ezmail.php" );
35
36 $ini =& eZINI::instance( 'site.ini' );
37
38 $Language = $ini->variable( "eZTradeMain", "Language" );
39
40 $expireTime = $ini->variable( "eZTradeMain", "EmailBeforeExpire" );
41
42 $locale = new eZLocale();
43
44 if ( $expireTime > -1 )
45 {
46 $date = new eZDate();
47 $dateTimestampe = $date->timestamp( true );
48 $orders = eZOrder::expiringOrders( $dateTimestampe + ( $expireTime * 86400 ) );
49 foreach ( $orders as $orderID )
50 {
51 $orderItem = new eZOrderItem( $orderID );
52 $order = $orderItem->order();
53 $user = $order->user();
54
55 $mail = new eZMail();
56
57 // Setup the template for email
58 $mailTemplate = new eZTemplate( "kernel/eztrade/admin/" . $ini->variable( "eZTradeMain", "TemplateDir" ),
59 "kernel/eztrade/admin/intl", $Language, "productexpire.php" );
60
61 $mailTemplate->set_file( "product_expires_tpl", "productexpire.tpl" );
62 $mailTemplate->setAllStrings();
63
64 $product = $orderItem->product();
65 $mailTemplate->set_var( "product", $product->name() );
66
67 if ( $order->personID > 0 )
68 $customer = new eZPerson( $order->personID() );
69 else if ( $order->companyID > 0 )
70 $customer = new eZCompany( $order->companyID() );
71 else
72 $customer = $user;
73 $mailTemplate->set_var( "customer", $customer->name() );
74
75 $saleDate = $order->date();
76 $mailTemplate->set_var( "sale_date", $locale->format( $saleDate ) );
77
78 $expiryObject = new eZDateTime();
79 $expiryObject->setTimeStamp( $orderItem->expiryDate() );
80 $mailTemplate->set_var( "expire_date", $locale->format( $expiryObject ) );
81
82 $mailBody = $mailTemplate->parse( "dummy", "product_expires_tpl" );
83 $mail->setFrom( $OrderSenderEmail );
84
85 $mail->setTo( $user->email() );
86 $mail->setSubject( "Product expires" );
87 $mail->setBody( $mailBody );
88 $mail->send();
89 }
90 }
91
92 ?>
$date
$date
Definition: bugpreview.php:66
$OrderSenderEmail
$OrderSenderEmail
Definition: checkout.php:41
eZCompany
Definition: ezcompany.php:54
eZDateTime
Definition: ezdatetime.php:55
eZDate
Definition: ezdate.php:46
eZLocale
Definition: ezlocale.php:119
eZMail
Definition: ezmail.php:57
eZOrderItem
Definition: ezorderitem.php:48
eZOrder\expiringOrders
& expiringOrders( $startdate, $time=86400)
Definition: ezorder.php:1126
eZPerson
Definition: ezperson.php:43
eZTemplate
Definition: eztemplate.php:107
$orderID
$orderID
Definition: confirmation.php:34
$customer
$customer
Definition: customerview.php:72
$orders
$orders
Definition: customerview.php:87
$mail
$mail
Definition: ezbulkmail/admin/maillist.php:61
$locale
$locale
Definition: eztrade/admin/cron.php:42
$Language
$Language
Definition: eztrade/admin/cron.php:38
$ini
$ini
Definition: eztrade/admin/cron.php:36
$expireTime
$expireTime
Definition: eztrade/admin/cron.php:40
$product
$product
Definition: homepage.php:202
$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+.