예제 #1
0
 /**
  * Restores the module state.
  * IMPORTANT:                         LoadState               -            ,
  *               SaveState -                                                 .
  */
 function loadState()
 {
     global $application;
     if (modApiFunc('Session', 'is_Set', 'currentStepID')) {
         $this->setCurrentStepID(modApiFunc('Session', 'get', 'currentStepID'));
     } else {
         //. Is it at all correct to SET currentStepID, if its value is not even defined?
         $this->currentStepID = 1;
     }
     if (modApiFunc('Session', 'is_Set', 'currentOrderID')) {
         $this->currentOrderID = modApiFunc('Session', 'get', 'currentOrderID');
     }
     if (modApiFunc('Session', 'is_Set', 'currentOrderCurrencyID')) {
         $this->currentOrderCurrencyID = modApiFunc('Session', 'get', 'currentOrderCurrencyID');
     } else {
         $this->currentOrderCurrencyID = NULL;
     }
     if (modApiFunc('Session', 'is_Set', 'lastPlacedOrderID')) {
         $this->lastPlacedOrderID = modApiFunc('Session', 'get', 'lastPlacedOrderID');
     }
     if (modApiFunc('Session', 'is_Set', 'currentCustomerID')) {
         $this->currentCustomerID = modApiFunc('Session', 'get', 'currentCustomerID');
     }
     if (modApiFunc('Session', 'is_Set', 'PrerequisitesValidationResults')) {
         $this->setPrerequisitesValidationResults(modApiFunc('Session', 'get', 'PrerequisitesValidationResults'));
         /*
         // saved for testing or emergency purposes
         if (is_array($this->PrerequisitesValidationResults))
             foreach($this->PrerequisitesValidationResults as $k => $v)
                 if (isset($v['validatedData']) && is_array($v['validatedData']))
                     foreach($v['validatedData'] as $kk => $vv)
                     {
                         $new_data = execQuery('SELECT_VALIDATED_DATA_VISIBLE_LABELS', array('vid' => @$v['id'], 'aid' => @$vv['id']));
                         if ($new_data)
                         {
                             if (isset($vv['attribute_visible_name']))
                                 $this->PrerequisitesValidationResults[$k]['validatedData'][$kk]['attribute_visible_name'] = $new_data[0]['attribute_visible_name'];
                             if (isset($vv['attribute_description']))
                                 $this->PrerequisitesValidationResults[$k]['validatedData'][$kk]['attribute_description'] = $new_data[0]['attribute_description'];
                         }
                     }
         */
         if (is_array($this->PrerequisitesValidationResults)) {
             $labels = $this->getValidatedDataVisibleLabels();
             foreach ($this->PrerequisitesValidationResults as $k => $v) {
                 if (isset($v['validatedData']) && is_array($v['validatedData'])) {
                     foreach ($v['validatedData'] as $kk => $vv) {
                         if (@$labels[$v['id']][$vv['id']]) {
                             if (isset($vv['attribute_visible_name'])) {
                                 $this->PrerequisitesValidationResults[$k]['validatedData'][$kk]['attribute_visible_name'] = @$labels[$v['id']][$vv['id']]['attribute_visible_name'];
                             }
                             if (isset($vv['attribute_description'])) {
                                 $this->PrerequisitesValidationResults[$k]['validatedData'][$kk]['attribute_description'] = @$labels[$v['id']][$vv['id']]['attribute_description'];
                             }
                         }
                     }
                 }
             }
         }
     } else {
         //	        if(!modApiFunc('Session', 'is_Set', 'PrerequisitesValidationResults'))
         //	        {
         //: ERROR arises if not installed
         Checkout::initPrerequisitesValidationResults();
         //                                ,
         // $this->initStoreOwnerInfo();
         //           LoadState
         //	        }
         //            $err_params = array(
         //                                "CODE"    => "CHECKOUT_011"
         //                               );
         //            _fatal($err_params);
         //$this->initPrerequisitesValidationResults();
     }
     Checkout::initAdditionalPrerequisitesValidationResults("creditCardInfo", false);
     Checkout::initAdditionalPrerequisitesValidationResults("bankAccountInfo", false);
     if (modApiFunc('Session', 'is_Set', 'CheckoutOrderSearch')) {
         $this->order_search_filter = modApiFunc('Session', 'get', 'CheckoutOrderSearch');
     } else {
         $this->order_search_filter = array('filter_status_id' => '1', 'status_id' => null, 'payment_status_id' => null, 'from_day' => null, 'from_month' => null, 'from_year' => null, 'to_day' => null, 'to_month' => null, 'to_year' => null, 'order_id' => null, 'search_by' => 'status');
         modApiFunc('Session', 'set', 'CheckoutOrderSearch', $this->order_search_filter);
     }
     if (modApiFunc('Session', 'is_Set', 'CheckoutCustomerSearch')) {
         $this->customer_search_filter = modApiFunc('Session', 'get', 'CheckoutCustomerSearch');
     } else {
         $this->customer_search_filter = array('search_by' => 'letter', 'letter' => null, 'field_name' => null, 'field_value' => null);
         modApiFunc('Session', 'set', 'CheckoutCustomerSearch', $this->customer_search_filter);
     }
     if (modApiFunc('Session', 'is_Set', 'CurrentPaymentModuleSettingsViewName')) {
         $this->setCurrentPaymentModuleSettingsViewName(modApiFunc('Session', 'get', 'CurrentPaymentModuleSettingsViewName'));
     } else {
         $this->CurrentPaymentModuleSettingsViewName = NULL;
     }
     if (modApiFunc('Session', 'is_Set', 'CurrentPaymentShippingModuleSettingsUID')) {
         $this->setCurrentPaymentShippingModuleSettingsUID(modApiFunc('Session', 'get', 'CurrentPaymentShippingModuleSettingsUID'));
     } else {
         $this->CurrentPaymentShippingModuleSettingsUID = NULL;
     }
     if (modApiFunc('Session', 'is_Set', 'CustomPaymentGatewayPageContents')) {
         $this->setCustomPaymentGatewayPageContents(modApiFunc('Session', 'get', 'CustomPaymentGatewayPageContents'));
     } else {
         $this->CustomPaymentGatewayPageContents = NULL;
     }
     if (modApiFunc('Session', 'is_Set', 'CurrentShippingModuleSettingsViewName')) {
         $this->setCurrentShippingModuleSettingsViewName(modApiFunc('Session', 'get', 'CurrentShippingModuleSettingsViewName'));
     } else {
         $this->CurrentShippingModuleSettingsViewName = NULL;
     }
     if (modApiFunc('Session', 'is_Set', 'OrdersForDelete')) {
         $this->ordersId = modApiFunc('Session', 'get', 'OrdersForDelete');
     } else {
         $this->ordersId = array();
     }
     if (modApiFunc('Session', 'is_Set', 'DeleteOrdersFlag')) {
         $this->DeleteOrdersFlag = modApiFunc('Session', 'get', 'DeleteOrdersFlag');
         modApiFunc('Session', 'un_Set', 'DeleteOrdersFlag');
     } else {
         $this->DeleteOrdersFlag = 'false';
     }
     if (modApiFunc('Session', 'is_Set', 'CHECKOUT_CZ_BLOWFISH_KEY_IS_ALREADY_DEFINED')) {
         $this->CHECKOUT_CZ_BLOWFISH_KEY_IS_ALREADY_DEFINED = modApiFunc('Session', 'get', 'CHECKOUT_CZ_BLOWFISH_KEY_IS_ALREADY_DEFINED');
     }
     $request = $application->getInstance('Request');
     $checkout_cz_blowfish_key = $request->getValueByKey("CHECKOUT_CZ_BLOWFISH_KEY");
     $this->initCheckoutCZBlowfishKey($checkout_cz_blowfish_key);
     //        //:                                         ,                         ,
     //        //                                          -                    .
     //        //                          .                   prerequisite.
     //        $this->initStoreOwnerInfo();
 }