Пример #1
0
 public function registerClass($className, $id)
 {
     self::getEavClasses();
     self::$eavClasses[$className] = $id;
     $schema = self::getSchemaInstance('EavObject');
     $schema->registerField(new ARForeignKeyField(EavObject::getClassField($className), $className, "ID", null, ARInteger::instance()), false);
 }
Пример #2
0
 public function testCreatingObject()
 {
     $field = EavField::getNewInstance('Manufacturer');
     $field->save();
     $manufacturer = Manufacturer::getNewInstance('Dummy Manufacturer');
     $manufacturer->save();
     $object = EavObject::getInstance($manufacturer);
     $object->save();
     $this->assertEqual($object->manufacturer->get(), $manufacturer);
     $this->assertEqual($object, EavObject::getInstance($manufacturer));
 }
Пример #3
0
 public function process()
 {
     static $beenHere = null;
     if (!$beenHere) {
         EavObject::defineSchema();
         $schema = EavField::getSchemaInstance('EavObject');
         $schema->registerField(new ARForeignKeyField("eyeExamRequestID", "EyeExamRequest", "ID", null, ARInteger::instance()), false);
         $eafFieldInst = EavField::getNewInstance('EavField');
         $eafFieldInst->registerClass('EyeExamRequest', 8);
     }
     $beenHere = true;
 }
Пример #4
0
 private function buildCreditCardValidator(CreditCardPayment $ccHandler = null)
 {
     $validator = $this->getValidator("creditCard", $this->request);
     $validator->addCheck('ccName', new IsNotEmptyCheck($this->translate('_err_enter_cc_name')));
     $validator->addCheck('ccNum', new IsNotEmptyCheck($this->translate('_err_enter_cc_num')));
     $validator->addCheck('ccExpiryMonth', new IsNotEmptyCheck($this->translate('_err_select_cc_expiry_month')));
     $validator->addCheck('ccExpiryYear', new IsNotEmptyCheck($this->translate('_err_select_cc_expiry_year')));
     if ($ccHandler) {
         if ($ccHandler->isCardTypeNeeded()) {
             $validator->addCheck('ccType', new IsNotEmptyCheck($this->translate('_err_select_cc_type')));
         }
         if ($this->config->get('REQUIRE_CVV') && $ccHandler->isCvvRequired()) {
             $validator->addCheck('ccCVV', new IsNotEmptyCheck($this->translate('_err_enter_cc_cvv')));
         }
     }
     $validator->addFilter('ccCVV', new RegexFilter('[^0-9]'));
     $validator->addFilter('ccNum', new RegexFilter('[^ 0-9]'));
     $eavManager = new EavSpecificationManager(EavObject::getInstanceByIdentifier('creditcard'));
     $eavManager->setValidation($validator);
     return $validator;
 }
Пример #5
0
 /**
  *	Assign an entirely new specification (custom field) container. Usually necessary after cloning, etc.
  */
 public function setSpecification(EavSpecificationManager $specificationInstance)
 {
     $this->eavObject->set(null);
     $this->specificationInstance = $specificationInstance;
     $this->specificationInstance->setOwner(EavObject::getInstance($this));
 }
Пример #6
0
 /**
  *	@role login
  */
 public function payOffline()
 {
     ActiveRecordModel::beginTransaction();
     $method = $this->request->get('id');
     if (!OfflineTransactionHandler::isMethodEnabled($method) || !$this->getOfflinePaymentValidator($method)->isValid()) {
         return new ActionRedirectResponse('checkout', 'pay');
     }
     $order = $this->order;
     $this->order->setPaymentMethod($method);
     $response = $this->finalizeOrder();
     $transaction = Transaction::getNewOfflineTransactionInstance($order, 0);
     $transaction->setOfflineHandler($method);
     $transaction->save();
     $eavObject = EavObject::getInstance($transaction);
     $eavObject->setStringIdentifier($method);
     $eavObject->save();
     $transaction->getSpecification()->loadRequestData($this->request);
     $transaction->save();
     ActiveRecordModel::commit();
     return $response;
 }