diff --git a/application/classes/modules/property/entity/Property.entity.class.php b/application/classes/modules/property/entity/Property.entity.class.php index 6eb4a6a4..b1f93ffa 100644 --- a/application/classes/modules/property/entity/Property.entity.class.php +++ b/application/classes/modules/property/entity/Property.entity.class.php @@ -100,11 +100,11 @@ class ModuleProperty_EntityProperty extends EntityORM * Валидация зависит от типа */ $oValue = Engine::GetEntity('ModuleProperty_EntityValue', array( - 'property_type' => $this->getType(), - 'property_id' => $this->getId(), - 'target_type' => $this->getTargetType(), - 'target_id' => $this->getId() - )); + 'property_type' => $this->getType(), + 'property_id' => $this->getId(), + 'target_type' => $this->getTargetType(), + 'target_id' => $this->getId() + )); $oValueType = $oValue->getValueTypeObject(); $aRules = $oValueType->prepareValidateRulesRaw($aRulesRaw); $this->setValidateRules($aRules); @@ -118,11 +118,11 @@ class ModuleProperty_EntityProperty extends EntityORM * Валидация зависит от типа */ $oValue = Engine::GetEntity('ModuleProperty_EntityValue', array( - 'property_type' => $this->getType(), - 'property_id' => $this->getId(), - 'target_type' => $this->getTargetType(), - 'target_id' => $this->getId() - )); + 'property_type' => $this->getType(), + 'property_id' => $this->getId(), + 'target_type' => $this->getTargetType(), + 'target_id' => $this->getId() + )); $oValueType = $oValue->getValueTypeObject(); $aParams = $oValueType->prepareParamsRaw($aParamsRaw); $this->setParams($aParams); @@ -141,11 +141,11 @@ class ModuleProperty_EntityProperty extends EntityORM $this->setDateCreate(date("Y-m-d H:i:s")); $oValue = Engine::GetEntity('ModuleProperty_EntityValue', array( - 'property_type' => $this->getType(), - 'property_id' => $this->getId(), - 'target_type' => $this->getTargetType(), - 'target_id' => $this->getId() - )); + 'property_type' => $this->getType(), + 'property_id' => $this->getId(), + 'target_type' => $this->getTargetType(), + 'target_id' => $this->getId() + )); $oValueType = $oValue->getValueTypeObject(); /** * Выставляем дефолтные значения параметров @@ -328,4 +328,11 @@ class ModuleProperty_EntityProperty extends EntityORM return Config::Get('path.uploads.base') . '/property/' . $this->getTargetType() . '/' . $this->getType() . '/' . date('Y/m/d/H/') . ($sPostfix ? "{$sPostfix}/" : ''); } + public function isEmpty() + { + if (!$oValue = $this->getValue()) { + return true; + } + return $oValue->isEmpty(); + } } \ No newline at end of file diff --git a/application/classes/modules/property/entity/Value.entity.class.php b/application/classes/modules/property/entity/Value.entity.class.php index 6b675047..551c82bd 100644 --- a/application/classes/modules/property/entity/Value.entity.class.php +++ b/application/classes/modules/property/entity/Value.entity.class.php @@ -47,6 +47,12 @@ class ModuleProperty_EntityValue extends EntityORM return $oValueType->getValueForDisplay(); } + public function isEmpty() + { + $oValueType = $this->getValueTypeObject(); + return $oValueType->isEmpty(); + } + public function getValueForForm() { $oValueType = $this->getValueTypeObject(); diff --git a/application/classes/modules/property/entity/ValueType.entity.class.php b/application/classes/modules/property/entity/ValueType.entity.class.php index 3ab7d709..8ad3dc51 100644 --- a/application/classes/modules/property/entity/ValueType.entity.class.php +++ b/application/classes/modules/property/entity/ValueType.entity.class.php @@ -41,6 +41,11 @@ class ModuleProperty_EntityValueType extends Entity return htmlspecialchars($this->getValueObject()->getValue()); } + public function isEmpty() + { + return $this->getValueObject()->getValueVarchar() ? false : true; + } + public function validate() { return 'Неверное значение'; diff --git a/application/classes/modules/property/entity/ValueTypeCheckbox.entity.class.php b/application/classes/modules/property/entity/ValueTypeCheckbox.entity.class.php index b2ad8594..04abfe4b 100644 --- a/application/classes/modules/property/entity/ValueTypeCheckbox.entity.class.php +++ b/application/classes/modules/property/entity/ValueTypeCheckbox.entity.class.php @@ -40,6 +40,11 @@ class ModuleProperty_EntityValueTypeCheckbox extends ModuleProperty_EntityValueT return $oValue->_isNew() ? $oProperty->getParam('default') : $oValue->getValueInt(); } + public function isEmpty() + { + return false; + } + public function validate() { $sValue = $this->getValueForValidate(); diff --git a/application/classes/modules/property/entity/ValueTypeDate.entity.class.php b/application/classes/modules/property/entity/ValueTypeDate.entity.class.php index 713d73f3..ae06976c 100644 --- a/application/classes/modules/property/entity/ValueTypeDate.entity.class.php +++ b/application/classes/modules/property/entity/ValueTypeDate.entity.class.php @@ -40,6 +40,11 @@ class ModuleProperty_EntityValueTypeDate extends ModuleProperty_EntityValueType strtotime($oValue->getValueDate())) : ''; } + public function isEmpty() + { + return $this->getValueObject()->getValueDate() ? false : true; + } + public function getValueForForm() { $oValue = $this->getValueObject(); diff --git a/application/classes/modules/property/entity/ValueTypeFile.entity.class.php b/application/classes/modules/property/entity/ValueTypeFile.entity.class.php index aecabbda..e3fd4950 100644 --- a/application/classes/modules/property/entity/ValueTypeFile.entity.class.php +++ b/application/classes/modules/property/entity/ValueTypeFile.entity.class.php @@ -33,6 +33,11 @@ class ModuleProperty_EntityValueTypeFile extends ModuleProperty_EntityValueType return $this->getFileFullName(); } + public function isEmpty() + { + return $this->getFileFullName() ? false : true; + } + public function validate() { $oValue = $this->getValueObject(); diff --git a/application/classes/modules/property/entity/ValueTypeFloat.entity.class.php b/application/classes/modules/property/entity/ValueTypeFloat.entity.class.php index 325cdc0a..1ff536e2 100644 --- a/application/classes/modules/property/entity/ValueTypeFloat.entity.class.php +++ b/application/classes/modules/property/entity/ValueTypeFloat.entity.class.php @@ -33,6 +33,11 @@ class ModuleProperty_EntityValueTypeFloat extends ModuleProperty_EntityValueType return $this->getValueObject()->getValueFloat(); } + public function isEmpty() + { + return is_null($this->getValueObject()->getValueFloat()) ? true : false; + } + public function getValueForForm() { $oValue = $this->getValueObject(); diff --git a/application/classes/modules/property/entity/ValueTypeInt.entity.class.php b/application/classes/modules/property/entity/ValueTypeInt.entity.class.php index acabb1a0..016668a3 100644 --- a/application/classes/modules/property/entity/ValueTypeInt.entity.class.php +++ b/application/classes/modules/property/entity/ValueTypeInt.entity.class.php @@ -33,6 +33,11 @@ class ModuleProperty_EntityValueTypeInt extends ModuleProperty_EntityValueType return $this->getValueObject()->getValueInt(); } + public function isEmpty() + { + return is_null($this->getValueObject()->getValueInt()) ? true : false; + } + public function getValueForForm() { $oValue = $this->getValueObject(); diff --git a/application/classes/modules/property/entity/ValueTypeSelect.entity.class.php b/application/classes/modules/property/entity/ValueTypeSelect.entity.class.php index 803290d7..9e1e4b94 100644 --- a/application/classes/modules/property/entity/ValueTypeSelect.entity.class.php +++ b/application/classes/modules/property/entity/ValueTypeSelect.entity.class.php @@ -35,6 +35,13 @@ class ModuleProperty_EntityValueTypeSelect extends ModuleProperty_EntityValueTyp return is_array($aValues) ? join(', ', $aValues) : ''; } + public function isEmpty() + { + $oValue = $this->getValueObject(); + $aValues = $oValue->getDataOne('values'); + return $aValues ? false : true; + } + public function getValueForForm() { $oValue = $this->getValueObject(); diff --git a/application/classes/modules/property/entity/ValueTypeText.entity.class.php b/application/classes/modules/property/entity/ValueTypeText.entity.class.php index 15750982..5f571d6a 100644 --- a/application/classes/modules/property/entity/ValueTypeText.entity.class.php +++ b/application/classes/modules/property/entity/ValueTypeText.entity.class.php @@ -33,6 +33,11 @@ class ModuleProperty_EntityValueTypeText extends ModuleProperty_EntityValueType return $this->getValueObject()->getValueText(); } + public function isEmpty() + { + return $this->getValueObject()->getValueText() ? false : true; + } + public function getValueForForm() { $oValue = $this->getValueObject();