コード例 #1
0
 function execute($process, $event)
 {
     $parameters = $process->attribute('parameter_list');
     $http = eZHTTPTool::instance();
     eZDebug::writeNotice($parameters, "parameters");
     $orderID = $parameters['order_id'];
     $order = eZOrder::fetch($orderID);
     if (empty($orderID) || get_class($order) != 'ezorder') {
         eZDebug::writeWarning("Can't proceed without a Order ID.", "SimpleStockCheck");
         return eZWorkflowEventType::STATUS_FETCH_TEMPLATE_REPEAT;
     }
     // Decrement the quantitity field
     $order = eZOrder::fetch($orderID);
     $productCollection = $order->productCollection();
     $ordereditems = $productCollection->itemList();
     foreach ($ordereditems as $item) {
         $contentObject = $item->contentObject();
         $contentObjectVersion = $contentObject->version($contentObject->attribute('current_version'));
         $contentObjectAttributes = $contentObjectVersion->contentObjectAttributes();
         foreach (array_keys($contentObjectAttributes) as $key) {
             $contentObjectAttribute = $contentObjectAttributes[$key];
             $contentClassAttribute = $contentObjectAttribute->contentClassAttribute();
             // Each attribute has an attribute identifier called 'quantity' that identifies it.
             if ($contentClassAttribute->attribute("identifier") == "quantity") {
                 $contentObjectAttribute->setAttribute("data_int", $contentObjectAttribute->attribute("value") - $item->ItemCount);
                 $contentObjectAttribute->store();
             }
         }
     }
     return eZWorkflowEventType::STATUS_ACCEPTED;
 }
コード例 #2
0
 function execute($process, $event)
 {
     $ini = eZINI::instance('workflow.ini');
     $cost = $ini->variable("SimpleShippingWorkflow", "ShippingCost");
     $description = $ini->variable("SimpleShippingWorkflow", "ShippingDescription");
     $parameters = $process->attribute('parameter_list');
     if (isset($parameters['order_id'])) {
         $orderID = $parameters['order_id'];
         $order = eZOrder::fetch($orderID);
         $orderItems = $order->attribute('order_items');
         $addShipping = true;
         foreach ($orderItems as $orderItem) {
             if ($orderItem->attribute('type') == 'ezsimpleshipping') {
                 $addShipping = false;
                 break;
             }
         }
         if ($addShipping) {
             $productCollection = $order->attribute('productcollection');
             $orderCurrency = $productCollection->attribute('currency_code');
             $cost = eZShopFunctions::convertAdditionalPrice($orderCurrency, $cost);
             $orderItem = new eZOrderItem(array('order_id' => $orderID, 'description' => $description, 'price' => $cost, 'type' => 'ezsimpleshipping'));
             $orderItem->store();
         }
     }
     return eZWorkflowType::STATUS_ACCEPTED;
 }
コード例 #3
0
 public static function custom_error_handling()
 {
     $http = eZHTTPTool::instance();
     $order_id = $http->postVariable('order_id');
     $order = eZOrder::fetch($order_id);
     $response = $http->postVariable('response');
     //write error to log file
     self::write_invalid_checkcreditcard_log($order_id, $response);
     //generate the string and return it back to the template full translated
     return xrowPayoneHelper::generateCustomErrorString($order, $response);
 }
コード例 #4
0
ファイル: ezpaypalgateway.php プロジェクト: mugoweb/ezpaypal
 function createRedirectionUrl($process)
 {
     //__DEBUG__
     $this->logger->writeTimedString("createRedirectionUrl");
     //___end____
     $paypalINI = eZINI::instance('paypal.ini');
     $paypalServer = $paypalINI->variable('ServerSettings', 'ServerName');
     $requestURI = $paypalINI->variable('ServerSettings', 'RequestURI');
     $business = urlencode($paypalINI->variable('PaypalSettings', 'Business'));
     $processParams = $process->attribute('parameter_list');
     $orderID = $processParams['order_id'];
     $indexDir = eZSys::indexDir();
     $localHost = eZSys::serverURL();
     $localURI = eZSys::serverVariable('REQUEST_URI');
     $order = eZOrder::fetch($orderID);
     $amount = urlencode($order->attribute('total_inc_vat'));
     $currency = urlencode($order->currencyCode());
     //        include_once( 'lib/ezlocale/classes/ezlocale.php' );
     $locale = eZLocale::instance();
     $countryCode = urlencode($locale->countryCode());
     $maxDescLen = $paypalINI->variable('PaypalSettings', 'MaxDescriptionLength');
     $itemName = urlencode($this->createShortDescription($order, $maxDescLen));
     $accountInfo = $order->attribute('account_information');
     $first_name = urlencode($accountInfo['first_name']);
     $last_name = urlencode($accountInfo['last_name']);
     $street = urlencode($accountInfo['street2']);
     $zip = urlencode($accountInfo['zip']);
     $state = urlencode($accountInfo['state']);
     $place = urlencode($accountInfo['place']);
     $image_url = "{$localHost}" . urlencode($paypalINI->variable('PaypalSettings', 'LogoURI'));
     $background = urlencode($paypalINI->variable('PaypalSettings', 'BackgroundColor'));
     $pageStyle = urlencode($paypalINI->variable('PaypalSettings', 'PageStyle'));
     $noNote = urlencode($paypalINI->variable('PaypalSettings', 'NoNote'));
     $noteLabel = $noNote == 1 ? '' : urlencode($paypalINI->variable('PaypalSettings', 'NoteLabel'));
     $noShipping = 1;
     $url = $paypalServer . $requestURI . "?cmd=_ext-enter" . "&redirect_cmd=_xclick" . "&business={$business}" . "&item_name={$itemName}" . "&custom={$orderID}" . "&amount={$amount}" . "&currency_code={$currency}" . "&first_name={$first_name}" . "&last_name={$last_name}" . "&address1={$street}" . "&zip={$zip}" . "&state={$state}" . "&city={$place}" . "&image_url={$image_url}" . "&cs={$background}" . "&page_style={$pageStyle}" . "&no_shipping={$noShipping}" . "&cn={$noteLabel}" . "&no_note={$noNote}" . "&lc={$countryCode}" . "&notify_url={$localHost}" . $indexDir . "/paypal/notify_url/" . "&return={$localHost}" . $indexDir . "/shop/checkout/" . "&cancel_return={$localHost}" . $indexDir . "/shop/basket/";
     //__DEBUG__
     $this->logger->writeTimedString("business       = {$business}");
     $this->logger->writeTimedString("item_name      = {$itemName}");
     $this->logger->writeTimedString("custom         = {$orderID}");
     $this->logger->writeTimedString("no_shipping    = {$noShipping}");
     $this->logger->writeTimedString("localHost      = {$localHost}");
     $this->logger->writeTimedString("amount         = {$amount}");
     $this->logger->writeTimedString("currency_code  = {$currency}");
     $this->logger->writeTimedString("notify_url     = {$localHost}" . $indexDir . "/paypal/notify_url/");
     $this->logger->writeTimedString("return         = {$localHost}" . $indexDir . "/shop/checkout/");
     $this->logger->writeTimedString("cancel_return  = {$localHost}" . $indexDir . "/shop/basket/");
     //___end____
     return $url;
 }
コード例 #5
0
ファイル: ezorder_regression.php プロジェクト: nfrp/ezpublish
 public function testIssue18233()
 {
     // insert orders
     $orderData = array('account_identifier' => 'ez', 'created' => 130252369, 'data_text_1' => '\\<?xml ?\\>', 'email' => '*****@*****.**', 'productcollection_id' => '5', 'status_modifier_id' => '14', 'user_id' => 14);
     $order = new eZOrder($orderData);
     $order->store();
     $oldOrderNR = $order->attribute('order_nr');
     $order->activate();
     $this->assertEquals($oldOrderNR + 1, $order->attribute('id'));
     $this->assertEquals(0, $order->attribute('is_temporary'));
 }
コード例 #6
0
 function execute($process, $event)
 {
     $http = eZHTTPTool::instance();
     $siteINI = eZINI::instance('site.ini');
     $shopINI = eZINI::instance('shop.ini');
     $payoneINI = eZINI::instance('xrowpayone.ini');
     $processParams = $process->attribute('parameter_list');
     $errors = array();
     $process_id = $process->ID;
     //get the current order
     $order_id = $processParams['order_id'];
     $order = eZOrder::fetch($order_id);
     //checking if its only a redirect and so the preauthorisation is already finished
     $paymentObj = xrowPaymentObject::fetchByOrderID($order_id);
     if (is_object($paymentObj) && $paymentObj->approved()) {
         //now disapprove again because its 3d CC payment and its only paid when capture is successful
         $paymentObj->reject();
         xrowPayoneCreditCardGateway::setPaymentMethod($order);
         eZLog::write("SUCCESS in step 2 ('preauthorisation') ::3D Secure Card detected - FINISHED :: for order ID " . $order_id, $logName = 'xrowpayone.log', $dir = 'var/log');
         return eZWorkflowType::STATUS_ACCEPTED;
     }
     //STEP 2: preauthorisation
     if ($http->hasPostVariable('pseudocardpan')) {
         //fetching settings
         $pseudocardpan = $http->postVariable('pseudocardpan');
         $site_url = $siteINI->variable('SiteSettings', 'SiteURL');
         $aid = $payoneINI->variable('GeneralSettings', 'AID');
         $mid = $payoneINI->variable('GeneralSettings', 'MID');
         $portal_id = $payoneINI->variable('GeneralSettings', 'PortalID');
         $mode = $payoneINI->variable('GeneralSettings', 'Mode');
         $key = $payoneINI->variable('GeneralSettings', 'Key');
         $algorithm = $payoneINI->variable('GeneralSettings', 'Algorithm');
         $api_version = $payoneINI->variable('GeneralSettings', 'APIVersion');
         $response_type = $payoneINI->variable('GeneralSettings', 'ResponseType');
         $cc_3d_secure_enabled = $payoneINI->variable('CC3DSecure', 'Enabled');
         $error_url = $payoneINI->variable('CC3DSecure', 'ErrorURL');
         $success_url = $payoneINI->variable('CC3DSecure', 'SuccessURL');
         $siteaccess = $GLOBALS['eZCurrentAccess'];
         $siteaccess = $siteaccess["name"];
         //prepare some parameter values
         $error_url = "https://" . $site_url . "/" . $siteaccess . "/" . $error_url . "/orderID/" . $order_id;
         $success_url = "https://" . $site_url . "/" . $siteaccess . "/" . $success_url . "/orderID/" . $order_id;
         $order_total_in_cent = (string) $order->totalIncVAT() * 100;
         $currency_code = $order->currencyCode();
         $order_xml = simplexml_load_string($order->DataText1);
         $country_alpha3 = (string) $order_xml->country;
         $country = eZCountryType::fetchCountry($country_alpha3, "Alpha3");
         $country_alpha2 = $country["Alpha2"];
         $last_name = (string) $order_xml->last_name;
         //create hash array
         $hash_array["aid"] = $aid;
         $hash_array["mid"] = $mid;
         $hash_array["portalid"] = $portal_id;
         $hash_array["api_version"] = $api_version;
         $hash_array["mode"] = $mode;
         $hash_array["request"] = "preauthorization";
         $hash_array["responsetype"] = $response_type;
         $hash_array["clearingtype"] = "cc";
         $hash_array["reference"] = $order_id;
         $hash_array["amount"] = $order_total_in_cent;
         $hash_array["currency"] = $currency_code;
         if ($cc_3d_secure_enabled == "true") {
             $hash_array["successurl"] = $success_url;
             $hash_array["errorurl"] = $error_url;
         }
         //please note: country, lastname and pseudocardpan are not needed to be added to the hash because they are not allwoed (p.25 client doc)
         //create param array
         $param_array["aid"] = $aid;
         $param_array["mid"] = $mid;
         $param_array["portalid"] = $portal_id;
         $param_array["api_version"] = $api_version;
         $param_array["mode"] = $mode;
         $param_array["request"] = "preauthorization";
         $param_array["responsetype"] = $response_type;
         $param_array["hash"] = xrowPayoneHelper::generate_hash($algorithm, $hash_array, $key);
         $param_array["clearingtype"] = "cc";
         $param_array["reference"] = $order_id;
         $param_array["amount"] = $order_total_in_cent;
         $param_array["currency"] = $currency_code;
         $param_array["lastname"] = urlencode($last_name);
         $param_array["country"] = $country_alpha2;
         $param_array["pseudocardpan"] = $pseudocardpan;
         if ($cc_3d_secure_enabled == "true") {
             $param_array["successurl"] = $success_url;
             $param_array["errorurl"] = $error_url;
         }
         //sort params in alphabetic order
         ksort($param_array);
         $parameter_string = "?";
         foreach ($param_array as $key => $parameter) {
             $parameter_string .= $key . "=" . $parameter . "&";
         }
         $url = "https://secure.pay1.de/client-api" . $parameter_string;
         if ($siteINI->hasVariable('ProxySettings', 'ProxyServer') && $siteINI->variable('ProxySettings', 'ProxyServer') != "") {
             $proxyserver = $siteINI->variable('ProxySettings', 'ProxyServer');
             //now get the proxy url
             if (strpos($proxyserver, "://") !== false) {
                 $proxy_parts = explode("://", $proxyserver);
                 $proxyserver = $proxy_parts[1];
             }
             $context_array = array('http' => array('method' => 'GET', 'proxy' => $proxyserver));
             $context = stream_context_create($context_array);
             $json_response = file_get_contents($url, false, $context);
         } else {
             $json_response = file_get_contents($url);
         }
         if ($json_response) {
             $json_response = json_decode($json_response);
             if ($json_response->status != "ERROR" and isset($json_response->txid)) {
                 //get 'txid' from response and keep it
                 $txid = $json_response->txid;
                 //get 'userid' from response and keep it
                 $userid = $json_response->userid;
                 //now store it into the order
                 $db = eZDB::instance();
                 $db->begin();
                 $doc = new DOMDocument('1.0', 'utf-8');
                 $doc->loadXML($order->DataText1);
                 $shop_account_element = $doc->getElementsByTagName('shop_account');
                 $shop_account_element = $shop_account_element->item(0);
                 //handle and store the TXID
                 //remove first if exists
                 $txid_elements = $doc->getElementsByTagName('txid');
                 if ($txid_elements->length >= 1) {
                     $txid_element = $txid_elements->item(0);
                     $txid_element->parentNode->removeChild($txid_element);
                 }
                 //then create
                 $txidNode = $doc->createElement("txid", $txid);
                 $shop_account_element->appendChild($txidNode);
                 //handle and store the userid
                 //remove first if exists
                 $userid_elements = $doc->getElementsByTagName('userid');
                 if ($userid_elements->length >= 1) {
                     $userid_element = $userid_elements->item(0);
                     $userid_element->parentNode->removeChild($userid_element);
                 }
                 //then create
                 $useridNode = $doc->createElement("userid", $userid);
                 $shop_account_element->appendChild($useridNode);
                 //handle and store the pseudocardpan
                 if ($http->hasPostVariable('truncatedcardpan')) {
                     //remove first if exists
                     $tpan_elements = $doc->getElementsByTagName('truncatedcardpan');
                     if ($tpan_elements->length >= 1) {
                         $tpan_element = $tpan_elements->item(0);
                         $tpan_element->parentNode->removeChild($tpan_element);
                     }
                     //then create
                     $truncatedcardpan_node = $doc->createElement("truncatedcardpan", $http->postVariable('truncatedcardpan'));
                     $shop_account_element->appendChild($truncatedcardpan_node);
                 }
                 if ($json_response->status === "REDIRECT") {
                     //remove first if exists
                     $cc3d_sec_elements = $doc->getElementsByTagName('cc3d_reserved');
                     if ($cc3d_sec_elements->length >= 1) {
                         $cc3d_sec_element = $cc3d_sec_elements->item(0);
                         $cc3d_sec_element->parentNode->removeChild($cc3d_sec_element);
                     }
                     //save reserved flag false for now
                     $reservedFlag = $doc->createElement("cc3d_reserved", "false");
                     $shop_account_element->appendChild($reservedFlag);
                 } else {
                     //remove cc3d_reserved if exists. this case could occure if someone changed from 3d CC to normal CC.
                     $cc3d_sec_elements = $doc->getElementsByTagName('cc3d_reserved');
                     if ($cc3d_sec_elements->length >= 1) {
                         $cc3d_sec_element = $cc3d_sec_elements->item(0);
                         $cc3d_sec_element->parentNode->removeChild($cc3d_sec_element);
                     }
                 }
                 //i must store here redundant otherwise the order will not be stored since its stuck in a transaction
                 $db->commit();
                 //store it
                 $order->setAttribute('data_text_1', $doc->saveXML());
                 $order->store();
                 $db->commit();
                 if ($json_response->status === "REDIRECT") {
                     eZLog::write("PENDING in step 2 ('preauthorisation') ::3D Secure Card detected - REDIRECTING to creditcard institute check :: for order ID " . $order_id, $logName = 'xrowpayone.log', $dir = 'var/log');
                     //do redirect to 3d secure password confirm page
                     http_redirect($json_response->redirecturl);
                     exit;
                 } else {
                     xrowPayoneCreditCardGateway::setPaymentMethod($order);
                     eZLog::write("SUCCESS in step 2 ('preauthorisation') for order ID " . $order_id, $logName = 'xrowpayone.log', $dir = 'var/log');
                     return eZWorkflowType::STATUS_ACCEPTED;
                 }
             } else {
                 eZLog::write("FAILED in step 2 ('preauthorisation') for order ID " . $order_id . " with ERRORCODE " . $json_response->errorcode . " Message: " . $json_response->errormessage, $logName = 'xrowpayone.log', $dir = 'var/log');
                 if ($payoneINI->variable('GeneralSettings', 'CustomErrorNode') === "disabled") {
                     //use default error of payone
                     $errors = array($json_response->customermessage);
                 } else {
                     //use customized errors
                     $response["errorcode"] = $json_response->errorcode;
                     $response["errormessage"] = $json_response->errormessage;
                     $errors = array(xrowPayoneHelper::generateCustomErrorString($order, $response));
                 }
             }
         } else {
             eZLog::write("ERROR: Remote content not found in file " . __FILE__ . " on line " . __LINE__, $logName = 'xrowpayone.log', $dir = 'var/log');
         }
     } else {
         if (is_object($paymentObj)) {
             //that means, that we have a paymentobject which is not approved. its not approved because the payment has failed so we return a array
             $errors = array(ezpI18n::tr('extension/xrowpayone', 'Error occured during payment process. Please choose your payment option again.'));
             $paymentObj->remove();
         }
     }
     $process->Template = array();
     $process->Template['templateName'] = xrowPayoneCreditCardGateway::TEMPLATE;
     $process->Template['path'] = array(array('url' => false, 'text' => ezpI18n::tr('extension/xrowpayone', 'Payment Information')));
     $process->Template['templateVars'] = array('errors' => $errors, 'order' => $order, 'event' => $event);
     // return eZWorkflowType::STATUS_REJECTED;
     return eZWorkflowType::STATUS_FETCH_TEMPLATE_REPEAT;
 }
コード例 #7
0
ファイル: archiveorder.php プロジェクト: nfrp/ezpublish
<?php

/**
 * @copyright Copyright (C) 1999-2013 eZ Systems AS. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
 * @version //autogentag//
 * @package kernel
 */
$Module = $Params['Module'];
$http = eZHTTPTool::instance();
$archiveIDArray = $http->sessionVariable("OrderIDArray");
$db = eZDB::instance();
$db->begin();
foreach ($archiveIDArray as $archiveID) {
    eZOrder::archiveOrder($archiveID);
}
$db->commit();
$Module->redirectTo('/shop/orderlist/');
コード例 #8
0
ファイル: ezbasket.php プロジェクト: rmiguel/ezpublish
 function createOrder()
 {
     // Make order
     $productCollectionID = $this->attribute('productcollection_id');
     $user = eZUser::currentUser();
     $userID = $user->attribute('contentobject_id');
     $time = time();
     $order = new eZOrder(array('productcollection_id' => $productCollectionID, 'user_id' => $userID, 'is_temporary' => 1, 'created' => $time, 'status_id' => eZOrderStatus::PENDING, 'status_modified' => $time, 'status_modifier_id' => $userID));
     $db = eZDB::instance();
     $db->begin();
     $order->store();
     $orderID = $order->attribute('id');
     $this->setAttribute('order_id', $orderID);
     $this->store();
     $db->commit();
     return $order;
 }
コード例 #9
0
}

if ( $clean['tipafriend'] )
{
    $cli->output( "Removing all counters for tip-a-friend" );
    eZTipafriendCounter::cleanup();
}

if ( $clean['shop'] )
{
    $cli->output( "Removing all baskets" );
    eZBasket::cleanup();
    $cli->output( "Removing all wishlists" );
    eZWishList::cleanup();
    $cli->output( "Removing all orders" );
    eZOrder::cleanup();
    $productCount = eZPersistentObject::count( eZProductCollection::definition() );
    if ( $productCount > 0 )
    {
        $cli->warning( "$productCount product collections still exists, must be a leak" );
    }
}

if ( $clean['forgotpassword'] )
{
    $cli->output( "Removing all forgot password requests" );
    eZForgotPassword::cleanup();
}

if ( $clean['workflow'] )
{
コード例 #10
0
<?php

/**
 * @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
 * @version  2012.8
 * @package kernel
 */
$module = $Params['Module'];
$http = eZHTTPTool::instance();
$user = eZUser::currentUser();
$order = eZOrder::fetch($OrderID);
if (!$order) {
    return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if ($http->hasPostVariable("OrderID") && $http->hasPostVariable("StatusID") && $http->hasPostVariable("SetOrderStatusButton")) {
    $access = $order->canModifyStatus($StatusID);
    if ($access) {
        if ($order->attribute('status_id') != $StatusID) {
            $order->modifyStatus($StatusID);
        }
        if ($http->hasPostVariable('RedirectURI')) {
            $uri = $http->postVariable('RedirectURI');
            $module->redirectTo($uri);
            return;
        } else {
            $module->redirectTo('/shop/orderview/' . $orderID);
            return;
        }
    } else {
        return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
コード例 #11
0
//   This program is free software; you can redistribute it and/or
//   modify it under the terms of version 2.0  of the GNU General
//   Public License as published by the Free Software Foundation.
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of version 2.0 of the GNU General
//   Public License along with this program; if not, write to the Free
//   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
//   MA 02110-1301, USA.
//
//
//
include_once 'autoload.php';
include_once 'kernel/common/template.php';
$offset = 0;
$limit = 10;
$sortField = 'created';
$sortOrder = 'asc';
$orderArray = eZOrder::active(true, $offset, $limit, $sortField, $sortOrder);
$http = eZHTTPTool::instance();
$user = eZUser::currentUser();
$tpl = templateInit();
$Result = array();
$tpl->setVariable('order_list', $orderArray);
$Result['content'] = $tpl->fetch('design:portal/widgets/latestorders.tpl');
$Result['path'] = array();
$Result['pagelayout'] = false;
コード例 #12
0
 function checkCurrency($orderID)
 {
     $returnStatus = array('status' => eZModuleOperationInfo::STATUS_CONTINUE);
     $order = eZOrder::fetch($orderID);
     $productCollection = $order->attribute('productcollection');
     $currencyCode = $productCollection->attribute('currency_code');
     $currencyCode = trim($currencyCode);
     if ($currencyCode == '') {
         $returnStatus = array('status' => eZModuleOperationInfo::STATUS_CANCELLED);
     }
     $locale = eZLocale::instance();
     $localeCurrencyCode = $locale->currencyShortName();
     // Reverse logic to avoid calling eZCurrencyData::currencyExists() if the first expression is true.
     if (!($currencyCode == $localeCurrencyCode or eZCurrencyData::currencyExists($currencyCode))) {
         $returnStatus = array('status' => eZModuleOperationInfo::STATUS_CANCELLED);
     }
     return $returnStatus;
 }
コード例 #13
0
ファイル: userregister.php プロジェクト: stevoland/ez_patch
}
$user = eZUser::currentUser();
$firstName = '';
$lastName = '';
$email = '';
if ($user->isLoggedIn()) {
    $userObject = $user->attribute('contentobject');
    $userMap = $userObject->dataMap();
    $firstName = $userMap['first_name']->content();
    $lastName = $userMap['last_name']->content();
    $email = $user->attribute('email');
}
// Initialize variables
$street1 = $street2 = $zip = $place = $state = $country = $comment = $collect = '';
// Check if user has an earlier order, copy order info from that one
$orderList = eZOrder::activeByUserID($user->attribute('contentobject_id'));
if (count($orderList) > 0 and $user->isLoggedIn()) {
    $accountInfo = $orderList[0]->accountInformation();
    if ($accountInfo['collect']) {
        $collect = $accountInfo['collect'];
    } else {
        if ($accountInfo['street1']) {
            $street1 = $accountInfo['street1'];
        } else {
            if ($accountInfo['d_address1']) {
                $street1 = $accountInfo['d_address1'];
            } else {
                if ($accountInfo['address1']) {
                    $street1 = $accountInfo['address1'];
                }
            }
コード例 #14
0
ファイル: orderlist.php プロジェクト: runelangseid/ezpublish
    if ($http->hasPostVariable('OrderIDArray')) {
        $orderIDArray = $http->postVariable('OrderIDArray');
        if ($orderIDArray !== null) {
            $http->setSessionVariable('OrderIDArray', $orderIDArray);
            $Module->redirectTo($Module->functionURI('archiveorder') . '/');
        }
    }
}
if ($http->hasPostVariable('SaveOrderStatusButton')) {
    if ($http->hasPostVariable('StatusList')) {
        foreach ($http->postVariable('StatusList') as $orderID => $statusID) {
            $order = eZOrder::fetch($orderID);
            $access = $order->canModifyStatus($statusID);
            if ($access and $order->attribute('status_id') != $statusID) {
                $order->modifyStatus($statusID);
            }
        }
    }
}
$orderArray = eZOrder::active(true, $offset, $limit, $sortField, $sortOrder);
$orderCount = eZOrder::activeCount();
$tpl->setVariable('order_list', $orderArray);
$tpl->setVariable('order_list_count', $orderCount);
$tpl->setVariable('limit', $limit);
$viewParameters = array('offset' => $offset);
$tpl->setVariable('view_parameters', $viewParameters);
$tpl->setVariable('sort_field', $sortField);
$tpl->setVariable('sort_order', $sortOrder);
$Result = array();
$Result['path'] = array(array('text' => ezpI18n::tr('kernel/shop', 'Order list'), 'url' => false));
$Result['content'] = $tpl->fetch('design:shop/orderlist.tpl');
コード例 #15
0
 public function execute($process, $event)
 {
     $parameters = $process->attribute('parameter_list');
     $order = eZOrder::fetch($parameters['order_id']);
     $filter = self::filterOrderPayment($order);
     $process->Template = array();
     $process->Template['templateName'] = 'design:workflow/ezpaymentselect.tpl';
     $process->Template['templateVars'] = array('order' => $order, 'filter' => $filter);
     if (!$this->checkPayment()) {
         return eZWorkflowType::STATUS_FETCH_TEMPLATE_REPEAT;
     } else {
         eZPaymentSelectType::storeOrderData($order, $_POST['payment'], serialize($_POST));
         return eZWorkflowType::STATUS_ACCEPTED;
     }
 }
コード例 #16
0
ファイル: ezorder.php プロジェクト: CG77/ezpublish-legacy
 function currencyCode($collection = false)
 {
     if (is_string($collection) and $collection != '') {
         $currencyCode = $collection;
     } else {
         if ($collection instanceof eZProductCollection === false) {
             $collection = eZProductCollection::fetch($this->attribute('productcollection_id'));
         }
         $currencyCode = $collection->attribute('currency_code');
     }
     // Backwards compability for orders done with the price datatype.
     if ($currencyCode == '') {
         $currencyCode = eZOrder::fetchLocaleCurrencyCode();
     }
     return $currencyCode;
 }
コード例 #17
0
ファイル: ezpaypalchecker.php プロジェクト: mugoweb/ezpaypal
 function updateStatus()
 {
     //refetch the $this->order - it's an old object, just the order ID is good
     //Changing the status with an old version for $this->order will write old
     //values to the order
     $this->logger->writeTimedString('ReFetch Order ID: ' . $this->order->ID);
     $order = eZOrder::fetch($this->order->ID);
     $this->order = $order;
     $this->order->modifyStatus(1000);
 }
コード例 #18
0
// SOFTWARE LICENSE: GNU General Public License v2.0
// NOTICE: >
//   This program is free software; you can redistribute it and/or
//   modify it under the terms of version 2.0  of the GNU General
//   Public License as published by the Free Software Foundation.
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of version 2.0 of the GNU General
//   Public License along with this program; if not, write to the Free
//   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
//   MA 02110-1301, USA.
//
//
// ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
//
/*! \file
*/
$Module = $Params['Module'];
$http = eZHTTPTool::instance();
$orderIDArray = $http->sessionVariable("OrderIDArray");
$db = eZDB::instance();
$db->begin();
foreach ($orderIDArray as $archiveID) {
    eZOrder::unarchiveOrder($archiveID);
}
$db->commit();
$Module->redirectTo('/shop/archivelist/');
コード例 #19
0
 function fetchOrder( $orderID )
 {
     $order = eZOrder::fetch( $orderID );
     return array( 'result' => $order );
 }
コード例 #20
0
    $sortField = 'created';
}
if (eZPreferences::value('admin_archivelist_sortorder')) {
    $sortOrder = eZPreferences::value('admin_archivelist_sortorder');
}
if (!isset($sortOrder) || $sortOrder != 'asc' && $sortOrder != 'desc') {
    $sortOrder = 'asc';
}
$http = eZHTTPTool::instance();
// Unarchive options.
if ($http->hasPostVariable('UnarchiveButton')) {
    if ($http->hasPostVariable('OrderIDArray')) {
        $orderIDArray = $http->postVariable('OrderIDArray');
        if ($orderIDArray !== null) {
            $http->setSessionVariable('OrderIDArray', $orderIDArray);
            $Module->redirectTo($Module->functionURI('unarchiveorder') . '/');
        }
    }
}
$archiveArray = eZOrder::active(true, $offset, $limit, $sortField, $sortOrder, eZOrder::SHOW_ARCHIVED);
$archiveCount = eZOrder::activeCount(eZOrder::SHOW_ARCHIVED);
$tpl->setVariable('archive_list', $archiveArray);
$tpl->setVariable('archive_list_count', $archiveCount);
$tpl->setVariable('limit', $limit);
$viewParameters = array('offset' => $offset);
$tpl->setVariable('view_parameters', $viewParameters);
$tpl->setVariable('sort_field', $sortField);
$tpl->setVariable('sort_order', $sortOrder);
$Result = array();
$Result['path'] = array(array('text' => ezpI18n::tr('kernel/shop', 'Order list'), 'url' => false));
$Result['content'] = $tpl->fetch('design:shop/archivelist.tpl');
コード例 #21
0
ファイル: confirmorder.php プロジェクト: nfrp/ezpublish
        return;
    }
    if ($http->hasPostVariable("CancelButton")) {
        $order->purge(false);
        $module->redirectTo('/shop/basket/');
        return;
    }
    $tpl->setVariable("order", $order);
}
$basket = eZBasket::currentBasket();
$basket->updatePrices();
$operationResult = eZOperationHandler::execute('shop', 'confirmorder', array('order_id' => $order->attribute('id')));
switch ($operationResult['status']) {
    case eZModuleOperationInfo::STATUS_CONTINUE:
        if ($operationResult != null && !isset($operationResult['result']) && (!isset($operationResult['redirect_url']) || $operationResult['redirect_url'] == null)) {
            $order = eZOrder::fetch($order->attribute('id'));
            $tpl->setVariable("order", $order);
            $Result = array();
            $Result['content'] = $tpl->fetch("design:shop/confirmorder.tpl");
            $Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/shop', 'Confirm order')));
        }
        break;
    case eZModuleOperationInfo::STATUS_HALTED:
    case eZModuleOperationInfo::STATUS_REPEAT:
        if (isset($operationResult['redirect_url'])) {
            $module->redirectTo($operationResult['redirect_url']);
            return;
        } else {
            if (isset($operationResult['result'])) {
                $result = $operationResult['result'];
                $resultContent = false;
コード例 #22
0
/*! \file
*/
$module = $Params['Module'];
$year = $Params['Year'];
$month = $Params['Month'];
$http = eZHTTPTool::instance();
if ($http->hasPostVariable("Year")) {
    $year = $http->postVariable("Year");
}
if ($http->hasPostVariable("Month")) {
    $month = $http->postVariable("Month");
}
if ($http->hasPostVariable("View")) {
    $module->redirectTo("/shop/statistics/" . $year . '/' . $month);
}
$statisticArray = eZOrder::orderStatistics($year, $month);
$yearList = array();
$currentDate = new eZDate();
$currentYear = $currentDate->attribute('year');
for ($index = 0; $index < 10; $index++) {
    $yearList[] = $currentYear - $index;
}
$locale = eZLocale::instance();
$monthList = array();
for ($monthIndex = 1; $monthIndex <= 12; $monthIndex++) {
    $monthList[] = array('value' => $monthIndex, 'name' => $locale->longMonthName($monthIndex));
}
$tpl = eZTemplate::factory();
$tpl->setVariable("year", $year);
$tpl->setVariable("month", $month);
$tpl->setVariable("year_list", $yearList);
コード例 #23
0
<?php

/**
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
 * @license For full copyright and license information view LICENSE file distributed with this source code.
 * @version //autogentag//
 * @package kernel
 */
$CustomerID = $Params['CustomerID'];
$Email = $Params['Email'];
$module = $Params['Module'];
$http = eZHTTPTool::instance();
$tpl = eZTemplate::factory();
$Email = urldecode($Email);
$productList = eZOrder::productList($CustomerID, $Email);
$orderList = eZOrder::orderList($CustomerID, $Email);
$tpl->setVariable("product_list", $productList);
$tpl->setVariable("order_list", $orderList);
$Result = array();
$Result['content'] = $tpl->fetch("design:shop/customerorderview.tpl");
$path = array();
$path[] = array('url' => '/shop/orderlist', 'text' => ezpI18n::tr('kernel/shop', 'Order list'));
$path[] = array('url' => false, 'text' => ezpI18n::tr('kernel/shop', 'Customer order view'));
$Result['path'] = $path;
コード例 #24
0
ファイル: customerlist.php プロジェクト: legende91/ez
<?php

/**
 * @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
 * @version  2012.6
 * @package kernel
 */
$module = $Params["Module"];
$offset = $Params['Offset'];
$limit = 15;
$tpl = eZTemplate::factory();
$http = eZHTTPTool::instance();
$customerArray = eZOrder::customerList($offset, $limit);
$customerCount = eZOrder::customerCount();
$tpl->setVariable("customer_list", $customerArray);
$tpl->setVariable("customer_list_count", $customerCount);
$tpl->setVariable("limit", $limit);
$viewParameters = array('offset' => $offset);
$tpl->setVariable("module", $module);
$tpl->setVariable('view_parameters', $viewParameters);
$path = array();
$path[] = array('text' => ezpI18n::tr('kernel/shop', 'Customer list'), 'url' => false);
$Result = array();
$Result['path'] = $path;
$Result['content'] = $tpl->fetch("design:shop/customerlist.tpl");
コード例 #25
0
 function setupOrderAndPaymentObject($orderID)
 {
     if (isset($orderID) && $orderID > 0) {
         $this->paymentObject = eZPaymentObject::fetchByOrderID($orderID);
         if (isset($this->paymentObject)) {
             $this->order = eZOrder::fetch($orderID);
             if (isset($this->order)) {
                 return true;
             }
             $this->logger->writeTimedString("Unable to fetch order object with orderID={$orderID}", 'setupOrderAndPaymentObject failed');
             return false;
         }
         $this->logger->writeTimedString("Unable to fetch payment object with orderID={$orderID}", 'setupOrderAndPaymentObject failed');
         return false;
     }
     $this->logger->writeTimedString("Invalid orderID={$orderID}", 'setupOrderAndPaymentObject failed');
     return false;
 }
コード例 #26
0
ファイル: statuscheck.php プロジェクト: xrowgmbh/xrowpayone
<?php

$Module =& $Params['Module'];
$http = eZHTTPTool::instance();
$tpl = eZTemplate::factory();
if ($http->hasPostVariable('txid')) {
    $txid = $http->PostVariable('txid');
    $txaction = $http->PostVariable('txaction');
    if ($txaction === "appointed") {
        eZLog::write("PENDING in step 2 ('preauthorisation') ::transaction module call:: for txid " . $txid . " :::::status:::: " . $txaction, $logName = 'xrowpayone.log', $dir = 'var/log');
        $db = eZDB::instance();
        $relevant_order = $db->arrayQuery("SELECT * FROM ezorder where data_text_1 LIKE '%<txid>{$txid}</txid>%';");
        if (count($relevant_order) == 1) {
            $order = eZOrder::fetch($relevant_order[0]["id"]);
            $doc = new DOMDocument('1.0', 'utf-8');
            $doc->loadXML($order->DataText1);
            $shop_account_element = $doc->getElementsByTagName('shop_account');
            $cc3d_sec_elements = $doc->getElementsByTagName('cc3d_reserved');
            //detecting if its a 3d secure CC so we need to do something if its normal CC transaction then we just do nothing
            if ($cc3d_sec_elements->length >= 1) {
                $db->begin();
                $cc3d_sec_element = $cc3d_sec_elements->item(0);
                //change value
                $cc3d_sec_element->nodeValue = "true";
                $order->setAttribute('data_text_1', $doc->saveXML());
                $order->store();
                $db->commit();
            }
        } else {
            eZLog::write("PENDING in step 2 ('preauthorisation') ::transaction module call:: for txid " . $txid . " specific order could not be determined (this is normal if the action was caused by a normal credit card without 3d secure protection!)", $logName = 'xrowpayone.log', $dir = 'var/log');
        }