Go to the documentation of this file.00001 <?php
00002
00003
00004 require_once 'oxerptype.php';
00005
00006 $sArticleClass = oxUtilsObject::getInstance()->getClassName('oxarticle');
00007
00008
00009 eval("class oxErpArticle450_parent extends $sArticleClass {};");
00010
00015 class oxErpArticle450 extends oxErpArticle450_parent
00016 {
00025 public function __set($sName, $sValue)
00026 {
00027 if (strpos($sName, 'oxarticles__oxlongdesc') === 0) {
00028 if ($this->_blEmployMultilanguage) {
00029 return parent::__set($sName, $sValue);
00030 }
00031 $this->$sName = $sValue;
00032 } else {
00033 parent::__set($sName, $sValue);
00034 }
00035 }
00036
00042 protected function _saveArtLongDesc()
00043 {
00044 if ($this->_blEmployMultilanguage) {
00045 return parent::_saveArtLongDesc();
00046 }
00047
00048
00049 $oArtExt = oxNew('oxi18n');
00050 $oArtExt->setEnableMultilang(false);
00051 $oArtExt->init('oxartextends');
00052 $aObjFields = $oArtExt->_getAllFields(true);
00053 if (!$oArtExt->load($this->getId())) {
00054 $oArtExt->setId($this->getId());
00055 }
00056
00057 foreach ($aObjFields as $sKey => $sValue) {
00058 if (preg_match('/^oxlongdesc(_(\d{1,2}))?$/', $sKey)) {
00059 $sField = $this->_getFieldLongName($sKey);
00060 if (isset($this->$sField)) {
00061 $sLongDesc = null;
00062 if ($this->$sField instanceof oxField) {
00063 $sLongDesc = $this->$sField->getRawValue();
00064 } elseif (is_object($this->$sField)) {
00065 $sLongDesc = $this->$sField->value;
00066 }
00067 if (isset($sLongDesc)) {
00068 $sAEField = $oArtExt->_getFieldLongName($sKey);
00069 $oArtExt->$sAEField = new oxField($sLongDesc, oxField::T_RAW);
00070 }
00071 }
00072 }
00073 }
00074
00075 $oArtExt->save();
00076 }
00077
00078 }
00079
00080 $sArticleClass = 'oxErpArticle450';
00081
00082 eval("class oxErpArticle_parent extends $sArticleClass {};");
00083
00084
00085
00090 class oxErpArticle extends oxErpArticle_parent
00091 {
00097 protected $_blLoadVariants = false;
00098 }
00099
00100
00104 class oxERPType_Article extends oxERPType
00105 {
00111 public function __construct()
00112 {
00113 parent::__construct();
00114
00115 $this->_sTableName = 'oxarticles';
00116 $this->_sShopObjectName = 'oxErpArticle';
00117 }
00118
00128 protected function _preAssignObject($oShopObject, $aData, $blAllowCustomShopId)
00129 {
00130 if (!isset($aData['OXSTOCKFLAG'])) {
00131 if (!$aData['OXID'] || !$oShopObject->exists( $aData['OXID'] )) {
00132
00133 $aData['OXSTOCKFLAG'] = 1;
00134 }
00135 }
00136
00137 $aData = parent::_preAssignObject($oShopObject, $aData, $blAllowCustomShopId);
00138
00139 return $aData;
00140 }
00141
00150 protected function _postSaveObject($oShopObject, $aData)
00151 {
00152 $sOXID = $oShopObject->getId();
00153
00154 $oShopObject->onChange(null, $sOXID, $sOXID);
00155
00156
00157 return $sOXID;
00158 }
00159
00171 public function checkWriteAccess($oObj, $aData = null)
00172 {
00173 return;
00174
00175 }
00176
00177 }