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