idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
37,700 | private function applyModuleNameTranslateFunction ( $ moduleStateMap ) { return $ this -> applyModuleStateMapFilterFunction ( $ moduleStateMap , $ this -> moduleNameTranslateFunction , function ( $ moduleData , $ translateFunction ) { $ moduleId = $ moduleData [ self :: MODULE_ID_KEY ] ; $ moduleData [ self :: MODULE_NAME_KEY ] = $ translateFunction ( $ moduleId ) ; return $ moduleData ; } ) ; } | Apply function which translates module id into module name . |
37,701 | private function applyModuleGroupNameTranslateFunction ( $ moduleStateMap ) { $ moduleGroupNameTranslateFilterFunction = $ this -> moduleGroupNameTranslateFunction ; if ( ! $ moduleGroupNameTranslateFilterFunction ) { return $ moduleStateMap ; } $ translatedModuleStateMap = [ ] ; foreach ( $ this -> iterateThroughModuleStateMapByGroup ( $ moduleStateMap ) as list ( $ groupId , $ modules ) ) { $ groupName = $ moduleGroupNameTranslateFilterFunction ( $ groupId ) ; $ translatedModuleStateMap [ $ groupName ] = $ modules ; } return $ translatedModuleStateMap ; } | Apply function which translates module group id into module group name . |
37,702 | private function applyModuleStateMapFilterFunction ( $ moduleStateMap , $ helpFunction , $ moduleStateMapUpdateFunction ) { if ( ! $ helpFunction ) { return $ moduleStateMap ; } foreach ( $ this -> iterateThroughModuleStateMap ( $ moduleStateMap ) as list ( $ groupId , $ moduleIndex , $ moduleData ) ) { $ moduleStateMap [ $ groupId ] [ $ moduleIndex ] = $ moduleStateMapUpdateFunction ( $ moduleData , $ helpFunction ) ; } return $ moduleStateMap ; } | Apply filter function to update the contents of module state map . |
37,703 | protected function getDocumentationLanguageId ( ) { $ language = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ languageAbbr = $ language -> getLanguageAbbr ( $ language -> getTplLanguage ( ) ) ; return $ languageAbbr === "de" ? 0 : 1 ; } | Get language id for documentation by current language id . |
37,704 | protected function _getEditValue ( $ oObject , $ sField ) { $ sEditObjectValue = '' ; if ( $ oObject && $ sField && isset ( $ oObject -> $ sField ) ) { if ( $ oObject -> $ sField instanceof \ OxidEsales \ Eshop \ Core \ Field ) { $ sEditObjectValue = $ oObject -> $ sField -> getRawValue ( ) ; } else { $ sEditObjectValue = $ oObject -> $ sField -> value ; } $ sEditObjectValue = $ this -> _processEditValue ( $ sEditObjectValue ) ; $ oObject -> $ sField = new \ OxidEsales \ Eshop \ Core \ Field ( $ sEditObjectValue , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; } return $ sEditObjectValue ; } | Returns string which must be edited by editor . |
37,705 | protected function _processEditValue ( $ sValue ) { if ( ! \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'bl_perfParseLongDescinSmarty' ) ) { $ aReplace = [ '[{$shop->currenthomedir}]' , '[{$oViewConf->getCurrentHomeDir()}]' ] ; $ sValue = str_replace ( $ aReplace , \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getCurrentShopURL ( false ) , $ sValue ) ; } return $ sValue ; } | Processes edit value . |
37,706 | protected function _getPlainEditor ( $ width , $ height , $ object , $ field ) { $ objectValue = $ this -> _getEditValue ( $ object , $ field ) ; $ textEditor = oxNew ( \ OxidEsales \ Eshop \ Application \ Controller \ TextEditorHandler :: class ) ; return $ textEditor -> renderPlainTextEditor ( $ width , $ height , $ objectValue , $ field ) ; } | Returns textarea filled with text to edit . |
37,707 | protected function _createCategoryTree ( $ sTplVarName , $ sEditCatId = '' , $ blForceNonCache = false , $ iTreeShopId = null ) { if ( ! isset ( $ this -> oCatTree ) || $ blForceNonCache ) { $ this -> oCatTree = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ CategoryList :: class ) ; $ this -> oCatTree -> setShopID ( $ iTreeShopId ) ; $ oBase = $ this -> oCatTree -> getBaseObject ( ) ; $ oBase -> setLanguage ( $ this -> _iEditLang ) ; $ this -> oCatTree -> loadList ( ) ; } $ oCatTree = $ this -> oCatTree ; if ( $ sEditCatId && isset ( $ oCatTree [ $ sEditCatId ] ) ) { unset ( $ oCatTree [ $ sEditCatId ] ) ; } $ oRoot = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Category :: class ) ; $ oRoot -> oxcategories__oxtitle = new \ OxidEsales \ Eshop \ Core \ Field ( '--' ) ; $ oCatTree -> assign ( array_merge ( [ '' => $ oRoot ] , $ oCatTree -> getArray ( ) ) ) ; $ this -> _aViewData [ $ sTplVarName ] = $ oCatTree ; return $ oCatTree ; } | Function creates category tree for select list used in Category main Article extend etc . |
37,708 | protected function _getCategoryTree ( $ sTplVarName , $ sSelectedCatId , $ sEditCatId = '' , $ blForceNonCache = false , $ iTreeShopId = null ) { $ oCatTree = $ this -> _createCategoryTree ( $ sTplVarName , $ sEditCatId , $ blForceNonCache , $ iTreeShopId ) ; if ( $ sSelectedCatId ) { foreach ( $ oCatTree as $ oCategory ) { if ( strcmp ( $ oCategory -> getId ( ) , $ sSelectedCatId ) == 0 ) { $ oCategory -> selected = 1 ; break ; } } } else { $ oCatTree -> rewind ( ) ; if ( $ oCat = $ oCatTree -> current ( ) ) { $ oCat -> selected = 1 ; $ sSelectedCatId = $ oCat -> getId ( ) ; } } $ this -> _aViewData [ $ sTplVarName ] = $ oCatTree ; return $ sSelectedCatId ; } | Function creates category tree for select list used in Category main Article extend etc . Returns ID of selected category if available . |
37,709 | public function changeFolder ( ) { $ sFolder = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'setfolder' ) ; $ sFolderClass = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'folderclass' ) ; if ( $ sFolderClass == 'oxcontent' && $ sFolder == 'CMSFOLDER_NONE' ) { $ sFolder = '' ; } $ oObject = oxNew ( $ sFolderClass ) ; if ( $ oObject -> load ( $ this -> getEditObjectId ( ) ) ) { $ oObject -> { $ oObject -> getCoreTableName ( ) . '__oxfolder' } = new \ OxidEsales \ Eshop \ Core \ Field ( $ sFolder ) ; $ oObject -> save ( ) ; } } | Updates object folder parameters . |
37,710 | protected function _setupNavigation ( $ sNode ) { if ( $ sNode ) { $ myAdminNavig = $ this -> getNavigation ( ) ; $ this -> _aViewData [ 'default_edit' ] = $ myAdminNavig -> getActiveTab ( $ sNode , $ this -> _iDefEdit ) ; $ this -> _aViewData [ 'bottom_buttons' ] = $ myAdminNavig -> getBtn ( $ sNode ) ; } } | Sets - up navigation parameters . |
37,711 | protected function configureTextEditorHandler ( \ OxidEsales \ Eshop \ Application \ Controller \ TextEditorHandler $ textEditorHandler , $ editedObject , $ field , $ stylesheet ) { $ textEditorHandler -> setStyleSheet ( $ stylesheet ) ; } | Create the handler for the text editor . |
37,712 | public function getListFilter ( ) { if ( $ this -> _aListFilter === null ) { $ this -> _aListFilter = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "where" ) ; } return $ this -> _aListFilter ; } | Returns list filter array |
37,713 | protected function _getViewListSize ( ) { if ( ! $ this -> _iViewListSize ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( $ profile = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'profile' ) ) { if ( isset ( $ profile [ 1 ] ) ) { $ config -> setConfigParam ( 'iAdminListSize' , ( int ) $ profile [ 1 ] ) ; } } $ this -> _iViewListSize = ( int ) $ config -> getConfigParam ( 'iAdminListSize' ) ; if ( ! $ this -> _iViewListSize ) { $ this -> _iViewListSize = 10 ; $ config -> setConfigParam ( 'iAdminListSize' , $ this -> _iViewListSize ) ; } } return $ this -> _iViewListSize ; } | Viewable list size getter |
37,714 | public function deleteEntry ( ) { $ delete = oxNew ( $ this -> _sListClass ) ; if ( $ delete -> isDerived ( ) ) { return ; } $ blDelete = $ delete -> delete ( $ this -> getEditObjectId ( ) ) ; if ( $ blDelete && isset ( $ _POST [ 'oxid' ] ) ) { $ _POST [ 'oxid' ] = - 1 ; } $ this -> resetContentCache ( ) ; $ this -> init ( ) ; } | Deletes this entry from the database |
37,715 | protected function _calcListItemsCount ( $ sql ) { $ stringModifier = getStr ( ) ; $ sql = $ stringModifier -> preg_replace ( '/select .* from/i' , 'select count(*) from ' , $ sql ) ; $ sql = $ stringModifier -> preg_replace ( '/order by .*$/i' , '' , $ sql ) ; $ this -> _iListSize = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) -> getOne ( $ sql ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'iArtCnt' , $ this -> _iListSize ) ; } | Calculates list items count |
37,716 | protected function _setCurrentListPosition ( $ page = null ) { $ adminListSize = $ this -> _getViewListSize ( ) ; $ jumpToPage = $ page ? ( ( int ) $ page ) : ( ( int ) ( ( int ) \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'lstrt' ) ) / $ adminListSize ) ; $ jumpToPage = ( $ page && $ jumpToPage ) ? ( $ jumpToPage - 1 ) : $ jumpToPage ; $ jumpToPage = $ jumpToPage * $ adminListSize ; if ( $ jumpToPage < 1 ) { $ jumpToPage = 0 ; } elseif ( $ jumpToPage >= $ this -> _iListSize ) { $ jumpToPage = floor ( $ this -> _iListSize / $ adminListSize - 1 ) * $ adminListSize ; } $ this -> _iCurrListPos = $ this -> _iOverPos = ( int ) $ jumpToPage ; } | Set current list position |
37,717 | protected function _prepareOrderByQuery ( $ query = null ) { $ sortFields = $ this -> getListSorting ( ) ; if ( is_array ( $ sortFields ) && count ( $ sortFields ) ) { $ query .= ' order by ' ; $ addSeparator = false ; $ listItem = $ this -> getItemListBaseObject ( ) ; $ languageId = $ listItem -> isMultilang ( ) ? $ listItem -> getLanguage ( ) : \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ; $ descending = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'adminorder' ) ; $ descending = $ descending !== null ? ( bool ) $ descending : $ this -> _blDesc ; foreach ( $ sortFields as $ table => $ fieldData ) { $ table = $ table ? ( getViewName ( $ table , $ languageId ) . '.' ) : '' ; foreach ( $ fieldData as $ column => $ sortDirectory ) { $ field = $ table . $ column ; $ query .= ( ( ( $ addSeparator ) ? ', ' : '' ) ) . \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quoteIdentifier ( $ field ) ; if ( $ descending || $ column == "oxactive" || strcasecmp ( $ sortDirectory , 'desc' ) == 0 ) { $ query .= ' desc ' ; } $ addSeparator = true ; } } } return $ query ; } | Adds order by to SQL query string . |
37,718 | protected function _buildFilter ( $ value , $ isSearchValue ) { if ( $ isSearchValue ) { $ query = " like " . \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quote ( '%' . $ value . '%' ) . " " ; } else { $ query = " = " . \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quote ( $ value ) . " " ; } return $ query ; } | Builds part of SQL query |
37,719 | protected function _convertDate ( $ date ) { $ datePatterns = [ "/^([0-9]{2})\.([0-9]{4})/" => "EUR2" , "/^([0-9]{2})\.([0-9]{2})/" => "EUR1" , "/^([0-9]{2})\/([0-9]{4})/" => "USA2" , "/^([0-9]{2})\/([0-9]{2})/" => "USA1" ] ; $ dateFormats = [ "EUR1" => [ 2 , 1 ] , "EUR2" => [ 2 , 1 ] , "USA1" => [ 1 , 2 ] , "USA2" => [ 2 , 1 ] ] ; $ dateMatches = [ ] ; $ stringModifier = getStr ( ) ; foreach ( $ datePatterns as $ pattern => $ type ) { if ( $ stringModifier -> preg_match ( $ pattern , $ date , $ dateMatches ) ) { $ date = $ dateMatches [ $ dateFormats [ $ type ] [ 0 ] ] . "-" . $ dateMatches [ $ dateFormats [ $ type ] [ 1 ] ] ; break ; } } return $ date ; } | Converter for date field search . If not full date will be searched . |
37,720 | protected function _convertTime ( $ fullDate ) { $ date = substr ( $ fullDate , 0 , 10 ) ; $ convertedObject = new \ OxidEsales \ Eshop \ Core \ Field ( ) ; $ convertedObject -> setValue ( $ date ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> convertDBDate ( $ convertedObject , true ) ; $ stringModifier = getStr ( ) ; $ time = substr ( $ fullDate , 11 ) ; if ( $ stringModifier -> preg_match ( "/([0-9]{2}):([0-9]{2}) ([AP]{1}[M]{1})$/" , $ time , $ timeMatches ) ) { if ( $ timeMatches [ 3 ] == "PM" ) { $ intVal = ( int ) $ timeMatches [ 1 ] ; if ( $ intVal < 13 ) { $ time = ( $ intVal + 12 ) . ":" . $ timeMatches [ 2 ] ; } } else { $ time = $ timeMatches [ 1 ] . ":" . $ timeMatches [ 2 ] ; } } elseif ( $ stringModifier -> preg_match ( "/([0-9]{2}) ([AP]{1}[M]{1})$/" , $ time , $ timeMatches ) ) { if ( $ timeMatches [ 2 ] == "PM" ) { $ intVal = ( int ) $ timeMatches [ 1 ] ; if ( $ intVal < 13 ) { $ time = ( $ intVal + 12 ) ; } } else { $ time = $ timeMatches [ 1 ] ; } } else { $ time = str_replace ( "." , ":" , $ time ) ; } return $ convertedObject -> value . " " . $ time ; } | Converter for datetime field search . If not full time will be searched . |
37,721 | public function getItemList ( ) { if ( $ this -> _oList === null && $ this -> _sListClass ) { $ this -> _oList = oxNew ( $ this -> _sListType ) ; $ this -> _oList -> clear ( ) ; $ this -> _oList -> init ( $ this -> _sListClass ) ; $ where = $ this -> buildWhere ( ) ; $ listObject = $ this -> _oList -> getBaseObject ( ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'tabelle' , $ this -> _sListClass ) ; $ this -> _aViewData [ 'listTable' ] = getViewName ( $ listObject -> getCoreTableName ( ) ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> setGlobalParameter ( 'ListCoreTable' , $ listObject -> getCoreTableName ( ) ) ; if ( $ listObject -> isMultilang ( ) ) { $ listObject -> setLanguage ( \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ) ; if ( isset ( $ this -> _blEmployMultilanguage ) ) { $ listObject -> setEnableMultilang ( $ this -> _blEmployMultilanguage ) ; } } $ query = $ this -> _buildSelectString ( $ listObject ) ; $ query = $ this -> _prepareWhereQuery ( $ where , $ query ) ; $ query = $ this -> _prepareOrderByQuery ( $ query ) ; $ query = $ this -> _changeselect ( $ query ) ; $ this -> _calcListItemsCount ( $ query ) ; $ this -> _setCurrentListPosition ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'jumppage' ) ) ; $ this -> _oList -> setSqlLimit ( $ this -> _iCurrListPos , $ this -> _getViewListSize ( ) ) ; $ this -> _oList -> selectString ( $ query ) ; } return $ this -> _oList ; } | Returns items list |
37,722 | public function getItemListBaseObject ( ) { $ baseObject = null ; if ( ( $ itemsList = $ this -> getItemList ( ) ) ) { $ baseObject = $ itemsList -> getBaseObject ( ) ; } return $ baseObject ; } | Returns item list base object |
37,723 | protected function _getReservationsId ( ) { $ sId = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'basketReservationToken' ) ; if ( ! $ sId ) { $ utilsObject = $ this -> getUtilsObjectInstance ( ) ; $ sId = $ utilsObject -> generateUId ( ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'basketReservationToken' , $ sId ) ; } return $ sId ; } | return the ID of active resevations user basket |
37,724 | protected function _loadReservations ( $ sBasketId ) { $ oReservations = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ UserBasket :: class ) ; $ aWhere = [ 'oxuserbaskets.oxuserid' => $ sBasketId , 'oxuserbaskets.oxtitle' => 'reservations' ] ; if ( ! $ oReservations -> assignRecord ( $ oReservations -> buildSelectString ( $ aWhere ) ) ) { $ oReservations -> oxuserbaskets__oxtitle = new \ OxidEsales \ Eshop \ Core \ Field ( 'reservations' ) ; $ oReservations -> oxuserbaskets__oxuserid = new \ OxidEsales \ Eshop \ Core \ Field ( $ sBasketId ) ; $ oReservations -> setIsNewBasket ( ) ; } return $ oReservations ; } | load reservation or create new reservation user basket |
37,725 | public function getReservations ( ) { if ( $ this -> _oReservations ) { return $ this -> _oReservations ; } if ( ! $ sBasketId = $ this -> _getReservationsId ( ) ) { return null ; } $ this -> _oReservations = $ this -> _loadReservations ( $ sBasketId ) ; return $ this -> _oReservations ; } | get reservations collection |
37,726 | public function getReservedAmount ( $ sArticleId ) { $ aCurrentlyReserved = $ this -> _getReservedItems ( ) ; if ( isset ( $ aCurrentlyReserved [ $ sArticleId ] ) ) { return $ aCurrentlyReserved [ $ sArticleId ] ; } return 0 ; } | return currently reserved amount for an article |
37,727 | protected function _basketDifference ( \ OxidEsales \ Eshop \ Application \ Model \ Basket $ oBasket ) { $ aDiff = $ this -> _getReservedItems ( ) ; foreach ( $ oBasket -> getContents ( ) as $ oItem ) { $ sProdId = $ oItem -> getProductId ( ) ; if ( ! isset ( $ aDiff [ $ sProdId ] ) ) { $ aDiff [ $ sProdId ] = - $ oItem -> getAmount ( ) ; } else { $ aDiff [ $ sProdId ] -= $ oItem -> getAmount ( ) ; } } return $ aDiff ; } | compute difference of reserved amounts vs basket items |
37,728 | protected function _reserveArticles ( $ aBasketDiff ) { $ blAllowNegativeStock = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blAllowNegativeStock' ) ; $ oReserved = $ this -> getReservations ( ) ; foreach ( $ aBasketDiff as $ sId => $ dAmount ) { if ( $ dAmount != 0 ) { $ oArticle = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; if ( $ oArticle -> load ( $ sId ) ) { $ oArticle -> reduceStock ( - $ dAmount , $ blAllowNegativeStock ) ; $ oReserved -> addItemToBasket ( $ sId , - $ dAmount ) ; } } } $ this -> _aCurrentlyReserved = null ; } | reserve articles given the basket difference array |
37,729 | public function reserveBasket ( \ OxidEsales \ Eshop \ Application \ Model \ Basket $ oBasket ) { if ( ! $ this -> isAdmin ( ) ) { $ this -> _reserveArticles ( $ this -> _basketDifference ( $ oBasket ) ) ; } } | reserve given basket items only when not in admin mode |
37,730 | public function commitArticleReservation ( $ sArticleId , $ dAmount ) { $ dReserved = $ this -> getReservedAmount ( $ sArticleId ) ; if ( $ dReserved < $ dAmount ) { $ dAmount = $ dReserved ; } $ oArticle = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; $ oArticle -> load ( $ sArticleId ) ; $ this -> getReservations ( ) -> addItemToBasket ( $ sArticleId , - $ dAmount ) ; $ oArticle -> beforeUpdate ( ) ; $ oArticle -> updateSoldAmount ( $ dAmount ) ; $ this -> _aCurrentlyReserved = null ; } | commit reservation of given article amount deletes this amount from active reservations userBasket update sold amount |
37,731 | public function discardArticleReservation ( $ sArticleId ) { $ dReserved = $ this -> getReservedAmount ( $ sArticleId ) ; if ( $ dReserved ) { $ oArticle = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; if ( $ oArticle -> load ( $ sArticleId ) ) { $ oArticle -> reduceStock ( - $ dReserved , true ) ; $ this -> getReservations ( ) -> addItemToBasket ( $ sArticleId , 0 , null , true ) ; $ this -> _aCurrentlyReserved = null ; } } } | discard one article reservation return the reserved stock to article |
37,732 | public function discardReservations ( ) { foreach ( array_keys ( $ this -> _getReservedItems ( ) ) as $ sArticleId ) { $ this -> discardArticleReservation ( $ sArticleId ) ; } if ( $ this -> _oReservations ) { $ this -> _oReservations -> delete ( ) ; $ this -> _oReservations = null ; $ this -> _aCurrentlyReserved = null ; } } | discard all reserved articles |
37,733 | public function renewExpiration ( ) { if ( $ oReserved = $ this -> getReservations ( ) ) { $ iTime = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) ; $ oReserved -> oxuserbaskets__oxupdate = new \ OxidEsales \ Eshop \ Core \ Field ( $ iTime ) ; $ oReserved -> save ( ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> deleteVariable ( "iBasketReservationTimeout" ) ; } } | renews expiration timer to maximum value |
37,734 | public function getIndices ( $ tableName ) { $ result = [ ] ; if ( $ this -> tableExists ( $ tableName ) ) { $ result = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_ASSOC ) -> getAll ( "SHOW INDEX FROM $tableName" ) ; } return $ result ; } | Get the indices of a table |
37,735 | public function hasIndex ( $ indexName , $ tableName ) { $ result = false ; foreach ( $ this -> getIndices ( $ tableName ) as $ index ) { if ( $ indexName === $ index [ 'Column_name' ] ) { $ result = true ; } } return $ result ; } | Check if the table has an index with the given name |
37,736 | public function getIndexByName ( $ indexName , $ tableName ) { $ indices = $ this -> getIndices ( $ tableName ) ; $ result = null ; foreach ( $ indices as $ index ) { if ( $ indexName === $ index [ 'Column_name' ] ) { $ result = $ index ; } } return $ result ; } | Get the index of a given table by its name |
37,737 | public function getAllTables ( ) { if ( empty ( $ this -> _aTables ) ) { $ tables = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> getAll ( "show tables" ) ; foreach ( $ tables as $ tableInfo ) { if ( $ this -> validateTableName ( $ tableInfo [ 0 ] ) ) { $ this -> _aTables [ ] = $ tableInfo [ 0 ] ; } } } return $ this -> _aTables ; } | Get all tables names from db . Views tables are not included in this list . |
37,738 | public function getAllMultiTables ( $ table ) { $ mLTables = [ ] ; foreach ( array_keys ( \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getLanguageIds ( ) ) as $ langId ) { $ langTableName = getLangTableName ( $ table , $ langId ) ; if ( $ table != $ langTableName && ! in_array ( $ langTableName , $ mLTables ) ) { $ mLTables [ ] = $ langTableName ; } } return $ mLTables ; } | return all DB tables for the language sets |
37,739 | protected function _getCreateTableSetSql ( $ table , $ lang ) { $ tableSet = getLangTableName ( $ table , $ lang ) ; $ res = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> getAll ( "show create table {$table}" ) ; return "CREATE TABLE `{$tableSet}` (" . "`OXID` char(32) NOT NULL, " . "PRIMARY KEY (`OXID`)" . ") " . strstr ( $ res [ 0 ] [ 1 ] , 'ENGINE=' ) ; } | Get sql for new multi - language table set creation |
37,740 | public function getAddFieldSql ( $ table , $ field , $ newField , $ prevField , $ tableSet = null ) { if ( ! $ tableSet ) { $ tableSet = $ table ; } $ res = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> getAll ( "show create table {$table}" ) ; $ tableSql = $ res [ 0 ] [ 1 ] ; $ tableSql = preg_replace ( '/COMMENT \\\'.*?\\\'/' , '' , $ tableSql ) ; preg_match ( "/.*,\s+(['`]?" . preg_quote ( $ field , '/' ) . "['`]?\s+[^,]+),.*/" , $ tableSql , $ match ) ; $ fieldSql = $ match [ 1 ] ; $ sql = "" ; if ( ! empty ( $ fieldSql ) ) { $ fieldSql = preg_replace ( "/" . preg_quote ( $ field , '/' ) . "/" , $ newField , $ fieldSql ) ; $ sql = "ALTER TABLE `$tableSet` ADD " . $ fieldSql ; if ( $ this -> tableExists ( $ tableSet ) && $ this -> fieldExists ( $ prevField , $ tableSet ) ) { $ sql .= " AFTER `$prevField`" ; } } return $ sql ; } | Get sql for new multi - language field creation |
37,741 | public function getAddFieldIndexSql ( $ table , $ field , $ newField , $ tableSet = null ) { $ res = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> getAll ( "show create table {$table}" ) ; $ tableSql = $ res [ 0 ] [ 1 ] ; preg_match_all ( "/([\w]+\s+)?\bKEY\s+(`[^`]+`)?\s*\([^)]+(\(\d++\))*\)/iU" , $ tableSql , $ match ) ; $ index = $ match [ 0 ] ; $ usingTableSet = $ tableSet ? true : false ; if ( ! $ tableSet ) { $ tableSet = $ table ; } $ indexQueries = [ ] ; $ sql = [ ] ; if ( count ( $ index ) ) { foreach ( $ index as $ key => $ indexQuery ) { if ( preg_match ( "/\([^)]*\b" . $ field . "\b[^)]*\)/i" , $ indexQuery ) ) { $ indexQuery = preg_replace ( "/(.*\bKEY\s+)`[^`]+`/" , "$1" , $ indexQuery ) ; if ( $ usingTableSet ) { $ indexQuery = preg_replace ( "/\([^\)]+\)+/" , "(`$newField`{$match[3][$key]})" , $ indexQuery ) ; } else { $ indexQuery = preg_replace ( "/\b" . $ field . "\b/" , $ newField , $ indexQuery ) ; } $ indexQueries [ ] = "ADD " . $ indexQuery ; } } if ( count ( $ indexQueries ) ) { $ sql = [ "ALTER TABLE `$tableSet` " . implode ( ", " , $ indexQueries ) ] ; } } return $ sql ; } | Get sql for new multi - language field index creation |
37,742 | public function getCurrentMaxLangId ( ) { if ( isset ( $ this -> _iCurrentMaxLangId ) ) { return $ this -> _iCurrentMaxLangId ; } $ table = $ tableSet = "oxarticles" ; $ field = $ fieldSet = "oxtitle" ; $ lang = 0 ; while ( $ this -> tableExists ( $ tableSet ) && $ this -> fieldExists ( $ fieldSet , $ tableSet ) ) { $ lang ++ ; $ tableSet = getLangTableName ( $ table , $ lang ) ; $ fieldSet = $ field . '_' . $ lang ; } return $ this -> _iCurrentMaxLangId = -- $ lang ; } | Get max language ID used in shop . For checking is used table oxarticle field oxtitle |
37,743 | public function getMultilangFields ( $ table ) { $ fields = $ this -> getFields ( $ table ) ; $ multiLangFields = [ ] ; foreach ( $ fields as $ field ) { if ( preg_match ( "/({$table}\.)?(?<field>.+)_1$/" , $ field , $ matches ) ) { $ multiLangFields [ ] = $ matches [ 'field' ] ; } } return $ multiLangFields ; } | Get table multi - language fields |
37,744 | public function getSinglelangFields ( $ table , $ lang ) { $ langTable = getLangTableName ( $ table , $ lang ) ; $ baseFields = $ this -> getFields ( $ table ) ; $ langFields = $ this -> getFields ( $ langTable ) ; $ langFields = $ this -> filterCoreFields ( $ langFields ) ; $ fields = array_merge ( $ baseFields , $ langFields ) ; $ singleLangFields = [ ] ; foreach ( $ fields as $ fieldName => $ field ) { if ( preg_match ( "/(({$table}|{$langTable})\.)?(?<field>.+)_(?<lang>[0-9]+)$/" , $ field , $ matches ) ) { if ( $ matches [ 'lang' ] == $ lang ) { $ singleLangFields [ $ matches [ 'field' ] ] = $ field ; } } else { $ singleLangFields [ $ fieldName ] = $ field ; } } return $ singleLangFields ; } | Get single language fields |
37,745 | public function ensureAllMultiLanguageFields ( $ table ) { $ max = $ this -> getCurrentMaxLangId ( ) ; for ( $ index = 1 ; $ index <= $ max ; $ index ++ ) { $ this -> ensureMultiLanguageFields ( $ table , $ index ) ; } } | Ensure that all multi language fields of the given table are present . |
37,746 | public function resetMultilangFields ( $ langId , $ tableName ) { $ langId = ( int ) $ langId ; if ( $ langId === 0 ) { return ; } $ sql = [ ] ; $ fields = $ this -> getMultilangFields ( $ tableName ) ; if ( is_array ( $ fields ) && count ( $ fields ) > 0 ) { foreach ( $ fields as $ fieldName ) { $ fieldName = $ fieldName . "_" . $ langId ; if ( $ this -> fieldExists ( $ fieldName , $ tableName ) ) { $ sql [ ] = "UPDATE {$tableName} SET {$fieldName} = DEFAULT;" ; } } } if ( ! empty ( $ sql ) ) { $ this -> executeSql ( $ sql ) ; } } | Resetting all multi - language fields with specific language id to default value in selected table |
37,747 | public function addNewLangToDb ( ) { $ this -> _iCurrentMaxLangId = null ; $ table = $ this -> getAllTables ( ) ; foreach ( $ table as $ tableName ) { $ this -> addNewMultilangField ( $ tableName ) ; } $ this -> updateViews ( ) ; } | Add new language to database . Scans all tables and adds new multi - language fields |
37,748 | public function resetLanguage ( $ langId ) { if ( ( int ) $ langId === 0 ) { return ; } $ tables = $ this -> getAllTables ( ) ; foreach ( $ this -> _aSkipTablesOnReset as $ skipTable ) { if ( ( $ skipId = array_search ( $ skipTable , $ tables ) ) !== false ) { unset ( $ tables [ $ skipId ] ) ; } } foreach ( $ tables as $ tableName ) { $ this -> resetMultilangFields ( $ langId , $ tableName ) ; } } | Resetting all multi - language fields with specific language id to default value in all tables . Only if language ID > 0 . |
37,749 | public function executeSql ( $ queries ) { $ db = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; if ( is_array ( $ queries ) && ! empty ( $ queries ) ) { foreach ( $ queries as $ query ) { $ query = trim ( $ query ) ; if ( ! empty ( $ query ) ) { $ db -> execute ( $ query ) ; } } } } | Executes array of sql strings |
37,750 | public function updateViews ( $ tables = null ) { set_time_limit ( 0 ) ; $ db = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ configFile = \ OxidEsales \ Eshop \ Core \ Registry :: get ( \ OxidEsales \ Eshop \ Core \ ConfigFile :: class ) ; $ originalSkipViewUsageStatus = $ configFile -> getVar ( 'blSkipViewUsage' ) ; $ this -> setConfigToDoNotUseViews ( $ config ) ; $ this -> safeGuardAdditionalMultiLanguageTables ( ) ; $ shops = $ db -> getAll ( "select * from oxshops" ) ; $ tables = $ tables ? $ tables : $ config -> getConfigParam ( 'aMultiShopTables' ) ; $ success = true ; foreach ( $ shops as $ shopValues ) { $ shopId = $ shopValues [ 0 ] ; $ shop = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Shop :: class ) ; $ shop -> load ( $ shopId ) ; $ shop -> setMultiShopTables ( $ tables ) ; $ mallInherit = [ ] ; foreach ( $ tables as $ table ) { $ mallInherit [ $ table ] = $ config -> getShopConfVar ( 'blMallInherit_' . $ table , $ shopId ) ; } if ( ! $ shop -> generateViews ( false , $ mallInherit ) && $ success ) { $ success = false ; } } $ config -> setConfigParam ( 'blSkipViewUsage' , $ originalSkipViewUsageStatus ) ; return $ success ; } | Updates all views |
37,751 | public function trim ( EshopFormFields $ fields ) { $ updatableFields = $ fields -> getUpdatableFields ( ) ; array_walk_recursive ( $ updatableFields , function ( & $ value ) { $ value = $ this -> isTrimmableField ( $ value ) ? $ this -> trimField ( $ value ) : $ value ; } ) ; return $ updatableFields ; } | Returns trimmed fields . |
37,752 | private function setShopAwareCommands ( Command $ service ) { if ( $ service instanceof AbstractShopAwareCommand && $ service -> isActive ( ) ) { $ this -> commands [ ] = $ service ; } } | Set commands for modules . |
37,753 | private function setNonShopAwareCommands ( Command $ service ) { if ( ! $ service instanceof AbstractShopAwareCommand && $ service instanceof Command ) { $ this -> commands [ ] = $ service ; } } | Sets commands which should be shown independently from active shop . |
37,754 | public function load ( $ article ) { $ this -> setArticle ( $ article ) ; $ aData = $ this -> _loadFromDb ( ) ; $ this -> assignArray ( $ aData ) ; } | Load category list data |
37,755 | public function versionNotify ( ) { if ( true === \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'preventModuleVersionNotify' ) ) { return ; } $ oOMNCaller = $ this -> _getOnlineModuleNotifierCaller ( ) ; $ oOMNCaller -> doRequest ( $ this -> _formRequest ( ) ) ; } | Perform Online Module version Notification . Returns result |
37,756 | protected function _prepareModulesInformation ( ) { $ aPreparedModules = [ ] ; $ aModules = $ this -> _getModules ( ) ; foreach ( $ aModules as $ oModule ) { $ oPreparedModule = new stdClass ( ) ; $ oPreparedModule -> id = $ oModule -> getId ( ) ; $ oPreparedModule -> version = $ oModule -> getInfo ( 'version' ) ; $ oPreparedModule -> activeInShops = new stdClass ( ) ; $ oPreparedModule -> activeInShops -> activeInShop = [ ] ; if ( $ oModule -> isActive ( ) ) { $ oPreparedModule -> activeInShops -> activeInShop [ ] = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopUrl ( ) ; } $ aPreparedModules [ ] = $ oPreparedModule ; } return $ aPreparedModules ; } | Collects only required modules information and returns as array . |
37,757 | protected function _formRequest ( ) { $ oRequestParams = new \ OxidEsales \ Eshop \ Core \ OnlineModulesNotifierRequest ( ) ; $ oRequestParams -> modules = new stdClass ( ) ; $ oRequestParams -> modules -> module = $ this -> _prepareModulesInformation ( ) ; return $ oRequestParams ; } | Send request message to Online Module Version Notifier web service . |
37,758 | public function exportAppServerList ( ) { $ activeServerCollection = [ ] ; $ activeServers = $ this -> appServerService -> loadActiveAppServerList ( ) ; if ( is_array ( $ activeServers ) && ! empty ( $ activeServers ) ) { foreach ( $ activeServers as $ server ) { $ activeServerCollection [ ] = $ this -> convertToArray ( $ server ) ; } } return $ activeServerCollection ; } | Return an array of active application servers . |
37,759 | private function convertToArray ( $ server ) { $ activeServer = [ 'id' => $ server -> getId ( ) , 'ip' => $ server -> getIp ( ) , 'lastFrontendUsage' => $ server -> getLastFrontendUsage ( ) , 'lastAdminUsage' => $ server -> getLastAdminUsage ( ) ] ; return $ activeServer ; } | Converts ApplicationServer object into array for export . |
37,760 | public function validate ( \ OxidEsales \ Eshop \ Core \ Module \ Module $ module ) { return file_exists ( $ module -> getMetadataPath ( ) ) ; } | Validates module metadata . Return true if module metadata is valid . Return false if module metadata is not valid or if metadata file does not exist . |
37,761 | public function checkModuleExtensionsForIncorrectNamespaceClasses ( \ OxidEsales \ Eshop \ Core \ Module \ Module $ module ) { $ incorrect = $ this -> getIncorrectExtensions ( $ module ) ; if ( ! empty ( $ incorrect ) ) { $ message = $ this -> prepareMessage ( 'MODULE_METADATA_PROBLEMATIC_DATA_IN_EXTEND' , $ incorrect ) ; throw new \ OxidEsales \ Eshop \ Core \ Exception \ ModuleValidationException ( $ message ) ; } } | Check module metadata for incorrect namespace shop classes . Class might be misspelled or not found in Unified Namespace . |
37,762 | public function getIncorrectExtensions ( \ OxidEsales \ Eshop \ Core \ Module \ Module $ module ) { $ incorrect = [ ] ; $ rawExtensions = $ module -> getExtensions ( ) ; foreach ( $ rawExtensions as $ classToBePatched => $ moduleClass ) { if ( NamespaceInformationProvider :: isNamespacedClass ( $ classToBePatched ) && ( NamespaceInformationProvider :: classBelongsToShopEditionNamespace ( $ classToBePatched ) || ( NamespaceInformationProvider :: classBelongsToShopUnifiedNamespace ( $ classToBePatched ) && ! class_exists ( $ classToBePatched ) ) ) ) { $ incorrect [ $ classToBePatched ] = $ moduleClass ; } } return $ incorrect ; } | Getter for possible incorrect extension info in metadata . php . If the module patches a namespace class it must either belong to the shop Unified Namespace or to another module . |
37,763 | public function save ( ) { parent :: save ( ) ; $ soxId = $ this -> getEditObjectId ( ) ; $ aParams = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "editval" ) ; $ oDelSet = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ DeliverySet :: class ) ; if ( $ soxId != "-1" ) { $ oDelSet -> loadInLang ( $ this -> _iEditLang , $ soxId ) ; } else { $ aParams [ 'oxdeliveryset__oxid' ] = null ; } if ( ! isset ( $ aParams [ 'oxdeliveryset__oxactive' ] ) ) { $ aParams [ 'oxdeliveryset__oxactive' ] = 0 ; } if ( $ oDelSet -> isDerived ( ) ) { return ; } $ oDelSet -> setLanguage ( 0 ) ; $ oDelSet -> assign ( $ aParams ) ; $ oDelSet -> setLanguage ( $ this -> _iEditLang ) ; $ oDelSet = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsFile ( ) -> processFiles ( $ oDelSet ) ; $ oDelSet -> save ( ) ; $ this -> setEditObjectId ( $ oDelSet -> getId ( ) ) ; } | Saves deliveryset information changes . |
37,764 | public function validate ( \ OxidEsales \ Eshop \ Application \ Model \ CompanyVatIn $ companyVatNumber ) { $ result = false ; $ validators = $ this -> getCheckers ( ) ; foreach ( $ validators as $ validator ) { $ result = true ; if ( $ validator instanceof \ OxidEsales \ Eshop \ Core \ Contract \ ICountryAware ) { $ validator -> setCountry ( $ this -> getCountry ( ) ) ; } if ( ! $ validator -> validate ( $ companyVatNumber ) ) { $ result = false ; $ this -> setError ( $ validator -> getError ( ) ) ; break ; } } return $ result ; } | Validate company VAT identification number . |
37,765 | public function addArticleAcc ( ) { $ oArticle = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; $ aChosenArt = $ this -> _getActionIds ( 'oxarticles.oxid' ) ; $ soxId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'synchoxid' ) ; if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'all' ) ) { $ sArtTable = $ this -> _getViewName ( 'oxarticles' ) ; $ aChosenArt = $ this -> _getAll ( parent :: _addFilter ( "select $sArtTable.oxid " . $ this -> _getQuery ( ) ) ) ; } if ( $ oArticle -> load ( $ soxId ) && $ soxId && $ soxId != "-1" && is_array ( $ aChosenArt ) ) { foreach ( $ aChosenArt as $ sChosenArt ) { $ oNewGroup = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ BaseModel :: class ) ; $ oNewGroup -> init ( "oxaccessoire2article" ) ; $ oNewGroup -> oxaccessoire2article__oxobjectid = new \ OxidEsales \ Eshop \ Core \ Field ( $ sChosenArt ) ; $ oNewGroup -> oxaccessoire2article__oxarticlenid = new \ OxidEsales \ Eshop \ Core \ Field ( $ oArticle -> oxarticles__oxid -> value ) ; $ oNewGroup -> oxaccessoire2article__oxsort = new \ OxidEsales \ Eshop \ Core \ Field ( 0 ) ; $ oNewGroup -> save ( ) ; } $ this -> onArticleAccessoryRelationChange ( $ oArticle ) ; } } | Adding article to accessories article list |
37,766 | public function sortAccessoriesList ( ) { $ oxidRelationId = Registry :: getConfig ( ) -> getRequestEscapedParameter ( 'oxid' ) ; $ selectedIdForSort = Registry :: getConfig ( ) -> getRequestEscapedParameter ( 'sortoxid' ) ; $ sortDirection = Registry :: getConfig ( ) -> getRequestEscapedParameter ( 'direction' ) ; $ accessoriesList = oxNew ( ListModel :: class ) ; $ accessoriesList -> init ( "oxbase" , "oxaccessoire2article" ) ; $ sortQuery = "select * from oxaccessoire2article where OXARTICLENID= " . DatabaseProvider :: getDb ( ) -> quote ( $ oxidRelationId ) . " order by oxsort,oxid" ; $ accessoriesList -> selectString ( $ sortQuery ) ; $ rebuildList = $ this -> rebuildAccessoriesSortIndexes ( $ accessoriesList ) ; if ( ( $ selectedPosition = array_search ( $ selectedIdForSort , $ rebuildList ) ) !== false ) { $ selectedSortRecord = $ accessoriesList -> offsetGet ( $ rebuildList [ $ selectedPosition ] ) ; $ currentPosition = $ selectedSortRecord -> oxaccessoire2article__oxsort -> value ; if ( ( $ sortDirection == 'up' && $ currentPosition > 0 ) || ( $ sortDirection == 'down' && $ currentPosition < count ( $ rebuildList ) - 1 ) ) { $ newPosition = ( $ sortDirection == 'up' ) ? ( $ currentPosition - 1 ) : ( $ currentPosition + 1 ) ; $ currentRecord = $ accessoriesList -> offsetGet ( $ rebuildList [ $ currentPosition ] ) ; $ newRecord = $ accessoriesList -> offsetGet ( $ rebuildList [ $ newPosition ] ) ; $ currentRecord -> oxaccessoire2article__oxsort = new Field ( $ newPosition ) ; $ newRecord -> oxaccessoire2article__oxsort = new Field ( $ currentPosition ) ; $ currentRecord -> save ( ) ; $ newRecord -> save ( ) ; } } $ outputQuery = $ this -> _getQuery ( ) ; $ normalQuery = 'select ' . $ this -> _getQueryCols ( ) . $ outputQuery ; $ countQuery = 'select count( * ) ' . $ outputQuery ; $ this -> _outputResponse ( $ this -> _getData ( $ countQuery , $ normalQuery ) ) ; } | Applies sorting for Accessories list |
37,767 | private function rebuildAccessoriesSortIndexes ( ListModel $ inputList ) : array { $ counter = 0 ; $ outputList = [ ] ; foreach ( $ inputList as $ key => $ value ) { if ( isset ( $ value -> oxaccessoire2article__oxsort ) ) { if ( $ value -> oxaccessoire2article__oxsort -> value != $ counter ) { $ value -> oxaccessoire2article__oxsort = new Field ( $ counter ) ; $ value -> save ( ) ; } } $ outputList [ $ counter ] = $ key ; $ counter ++ ; } return $ outputList ; } | rebuild Accessories sort indexes |
37,768 | protected function _insert ( ) { $ this -> oxpricealarm__oxinsert = new \ OxidEsales \ Eshop \ Core \ Field ( date ( 'Y-m-d' , \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) ) ) ; return parent :: _insert ( ) ; } | Inserts object data into DB returns true on success . |
37,769 | public function getArticle ( ) { if ( $ this -> _oArticle == null ) { $ this -> _oArticle = false ; $ oArticle = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; if ( $ oArticle -> load ( $ this -> oxpricealarm__oxartid -> value ) ) { $ this -> _oArticle = $ oArticle ; } } return $ this -> _oArticle ; } | Loads pricealarm article |
37,770 | public function getFPrice ( ) { if ( $ this -> _fPrice == null ) { $ this -> _fPrice = false ; if ( $ dArtPrice = $ this -> getPrice ( ) ) { $ myLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ oThisCurr = $ this -> getPriceAlarmCurrency ( ) ; $ this -> _fPrice = $ myLang -> formatCurrency ( $ dArtPrice , $ oThisCurr ) ; } } return $ this -> _fPrice ; } | Returns formatted pricealarm article original price |
37,771 | public function getPrice ( ) { if ( $ this -> _dPrice == null ) { $ this -> _dPrice = false ; if ( $ oArticle = $ this -> getArticle ( ) ) { $ myUtils = \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) ; $ oThisCurr = $ this -> getPriceAlarmCurrency ( ) ; $ dArtPrice = $ oArticle -> getPrice ( ) -> getBruttoPrice ( ) * $ oThisCurr -> rate ; $ dArtPrice = $ myUtils -> fRound ( $ dArtPrice ) ; $ this -> _dPrice = $ dArtPrice ; } } return $ this -> _dPrice ; } | Returns pricealarm article original price |
37,772 | public function getTitle ( ) { if ( $ this -> _sTitle == null ) { $ this -> _sTitle = false ; if ( $ oArticle = $ this -> getArticle ( ) ) { $ this -> _sTitle = $ oArticle -> oxarticles__oxtitle -> value ; if ( $ oArticle -> oxarticles__oxparentid -> value && ! $ oArticle -> oxarticles__oxtitle -> value ) { $ oParent = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; $ oParent -> load ( $ oArticle -> oxarticles__oxparentid -> value ) ; $ this -> _sTitle = $ oParent -> oxarticles__oxtitle -> value . " " . $ oArticle -> oxarticles__oxvarselect -> value ; } } } return $ this -> _sTitle ; } | Returns pricealarm article full title |
37,773 | public function getPriceAlarmCurrency ( ) { if ( $ this -> _oCurrency == null ) { $ this -> _oCurrency = false ; $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ oThisCurr = $ myConfig -> getCurrencyObject ( $ this -> oxpricealarm__oxcurrency -> value ) ; if ( ! $ oThisCurr ) { $ oDefCurr = $ myConfig -> getActShopCurrencyObject ( ) ; $ oThisCurr = $ myConfig -> getCurrencyObject ( $ oDefCurr -> name ) ; $ this -> oxpricealarm__oxcurrency -> setValue ( $ oDefCurr -> name ) ; } $ this -> _oCurrency = $ oThisCurr ; } return $ this -> _oCurrency ; } | Returns pricealarm currency object |
37,774 | public function getFProposedPrice ( ) { if ( $ this -> _fProposedPrice == null ) { $ this -> _fProposedPrice = false ; if ( $ oThisCurr = $ this -> getPriceAlarmCurrency ( ) ) { $ myLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ this -> _fProposedPrice = $ myLang -> formatCurrency ( $ this -> oxpricealarm__oxprice -> value , $ oThisCurr ) ; } } return $ this -> _fProposedPrice ; } | Returns formatted proposed price |
37,775 | public function getPriceAlarmStatus ( ) { if ( $ this -> _iStatus == null ) { $ this -> _iStatus = 0 ; $ dArtPrice = $ this -> getPrice ( ) ; if ( $ this -> oxpricealarm__oxprice -> value >= $ dArtPrice ) { $ this -> _iStatus = 1 ; } if ( $ this -> oxpricealarm__oxsended -> value != "0000-00-00 00:00:00" ) { $ this -> _iStatus = 2 ; } } return $ this -> _iStatus ; } | Returns pricealarm status |
37,776 | public function loadActiveCountries ( $ iLang = null ) { $ sViewName = getViewName ( 'oxcountry' , $ iLang ) ; $ sSelect = "SELECT oxid, oxtitle, oxisoalpha2 FROM {$sViewName} WHERE oxactive = '1' ORDER BY oxorder, oxtitle " ; $ this -> selectString ( $ sSelect ) ; } | Selects and loads all active countries |
37,777 | public function validate ( ModuleSetting $ moduleSetting , string $ moduleId , int $ shopId ) { if ( ! $ this -> canValidate ( $ moduleSetting ) ) { throw new WrongModuleSettingException ( $ moduleSetting , self :: class ) ; } $ events = $ moduleSetting -> getValue ( ) ; foreach ( $ this -> validEvents as $ validEventName ) { if ( is_array ( $ events ) && array_key_exists ( $ validEventName , $ events ) ) { $ this -> checkIfMethodIsCallable ( $ events [ $ validEventName ] ) ; } } } | There is another service for syntax validation and we won t validate syntax in this method . |
37,778 | public function genVariantFromSell ( $ aSels , $ oArticle ) { $ oVariants = $ oArticle -> getAdminVariants ( ) ; $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ myUtils = \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) ; $ myLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ aConfLanguages = $ myLang -> getLanguageIds ( ) ; foreach ( $ aSels as $ sSelId ) { $ oSel = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ MultiLanguageModel :: class ) ; $ oSel -> setEnableMultilang ( false ) ; $ oSel -> init ( 'oxselectlist' ) ; $ oSel -> load ( $ sSelId ) ; $ sVarNameUpdate = "" ; foreach ( $ aConfLanguages as $ sKey => $ sLang ) { $ sPrefix = $ myLang -> getLanguageTag ( $ sKey ) ; $ aSelValues = $ myUtils -> assignValuesFromText ( $ oSel -> { "oxselectlist__oxvaldesc" . $ sPrefix } -> value ) ; foreach ( $ aSelValues as $ sI => $ oValue ) { $ aValues [ $ sI ] [ $ sKey ] = $ oValue ; } $ aSelTitle [ $ sKey ] = $ oSel -> { "oxselectlist__oxtitle" . $ sPrefix } -> value ; $ sMdSeparator = ( $ oArticle -> oxarticles__oxvarname -> value ) ? $ this -> _sMdSeparator : '' ; if ( $ sVarNameUpdate ) { $ sVarNameUpdate .= ", " ; } $ sVarName = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quote ( $ sMdSeparator . $ aSelTitle [ $ sKey ] ) ; $ sVarNameUpdate .= "oxvarname" . $ sPrefix . " = CONCAT(oxvarname" . $ sPrefix . ", " . $ sVarName . ")" ; } $ oMDVariants = $ this -> _assignValues ( $ aValues , $ oVariants , $ oArticle , $ aConfLanguages ) ; if ( $ myConfig -> getConfigParam ( 'blUseMultidimensionVariants' ) ) { $ oAttribute = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Attribute :: class ) ; $ oAttribute -> assignVarToAttribute ( $ oMDVariants , $ aSelTitle ) ; } $ this -> _updateArticleVarName ( $ sVarNameUpdate , $ oArticle -> oxarticles__oxid -> value ) ; } } | Generate variants from selection lists |
37,779 | protected function _getValuePrice ( $ oValue , $ dParentPrice ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ dPriceMod = 0 ; if ( $ myConfig -> getConfigParam ( 'bl_perfLoadSelectLists' ) && $ myConfig -> getConfigParam ( 'bl_perfUseSelectlistPrice' ) ) { if ( $ oValue -> priceUnit == 'abs' ) { $ dPriceMod = $ oValue -> price ; } elseif ( $ oValue -> priceUnit == '%' ) { $ dPriceModPerc = abs ( $ oValue -> price ) * $ dParentPrice / 100.0 ; if ( ( $ oValue -> price ) >= 0.0 ) { $ dPriceMod = $ dPriceModPerc ; } else { $ dPriceMod = - $ dPriceModPerc ; } } } return $ dPriceMod ; } | Returns article price |
37,780 | protected function _createNewVariant ( $ aParams = null , $ sParentId = null ) { $ aParams [ 'oxarticles__oxactive' ] = 0 ; $ sShopID = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( "actshop" ) ; $ aParams [ 'oxarticles__oxshopid' ] = $ sShopID ; $ aParams [ 'oxarticles__oxparentid' ] = $ sParentId ; $ oArticle = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; $ oArticle -> setEnableMultilang ( false ) ; $ oArticle -> assign ( $ aParams ) ; $ oArticle -> save ( ) ; return $ oArticle -> getId ( ) ; } | Creates new article variant . |
37,781 | protected function _updateArticleVarName ( $ sUpdate , $ sArtId ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sUpdate = "update oxarticles set " . $ sUpdate . " where oxid = " . $ oDb -> quote ( $ sArtId ) ; $ oDb -> Execute ( $ sUpdate ) ; } | Inserts article variant name for all languages |
37,782 | public function isMdVariant ( $ oArticle ) { if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blUseMultidimensionVariants' ) ) { if ( strpos ( $ oArticle -> oxarticles__oxvarselect -> value , trim ( $ this -> _sMdSeparator ) ) !== false ) { return true ; } } return false ; } | Check if variant is multidimensional |
37,783 | protected function _cleanFilter ( $ aFilter ) { $ aCleanFilter = false ; if ( is_array ( $ aFilter ) && count ( $ aFilter ) ) { foreach ( $ aFilter as $ iKey => $ sFilter ) { if ( $ sFilter ) { $ aCleanFilter [ $ iKey ] = $ sFilter ; } } } return $ aCleanFilter ; } | Cleans up user given filter . If filter was empty - returns false |
37,784 | protected function _applyVariantSelectionsFilter ( $ aSelections , $ aFilter ) { $ iMaxActiveCount = 0 ; $ sMostSuitableVariantId = null ; $ blPerfectFit = false ; if ( ( $ aFilter = $ this -> _cleanFilter ( $ aFilter ) ) ) { $ aFilterKeys = array_keys ( $ aFilter ) ; $ iFilterKeysCount = count ( $ aFilter ) ; foreach ( $ aSelections as $ sVariantId => & $ aLineSelections ) { $ iActive = 0 ; foreach ( $ aFilter as $ iKey => $ sVal ) { if ( strcmp ( $ aLineSelections [ $ iKey ] [ 'hash' ] , $ sVal ) === 0 ) { $ aLineSelections [ $ iKey ] [ 'active' ] = true ; $ iActive ++ ; } else { foreach ( $ aLineSelections as $ iOtherKey => & $ aLineOtherVariant ) { if ( $ iKey != $ iOtherKey ) { $ aLineOtherVariant [ 'disabled' ] = true ; } } } } foreach ( $ aLineSelections as $ iOtherKey => & $ aLineOtherVariant ) { if ( ! in_array ( $ iOtherKey , $ aFilterKeys ) ) { $ aLineOtherVariant [ 'disabled' ] = ! ( $ iFilterKeysCount == $ iActive ) ; } } $ blFitsAll = $ iActive && ( count ( $ aLineSelections ) == $ iActive ) && ( $ iFilterKeysCount == $ iActive ) ; if ( ( $ iActive > $ iMaxActiveCount ) || ( ! $ blPerfectFit && $ blFitsAll ) ) { $ blPerfectFit = $ blFitsAll ; $ sMostSuitableVariantId = $ sVariantId ; $ iMaxActiveCount = $ iActive ; } unset ( $ aLineSelections ) ; } } return [ $ aSelections , $ sMostSuitableVariantId , $ blPerfectFit ] ; } | Applies filter on variant selection array |
37,785 | protected function _buildVariantSelectionsList ( $ aVarSelects , $ aSelections ) { foreach ( $ aVarSelects as $ iKey => $ sLabel ) { $ aVariantSelections [ $ iKey ] = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ VariantSelectList :: class , $ sLabel , $ iKey ) ; } foreach ( $ aSelections as $ aLineSelections ) { foreach ( $ aLineSelections as $ oPos => $ aLine ) { $ aVariantSelections [ $ oPos ] -> addVariant ( $ aLine [ 'name' ] , $ aLine [ 'hash' ] , $ aLine [ 'disabled' ] , $ aLine [ 'active' ] ) ; } } return $ aVariantSelections ; } | Builds variant selections list - array containing oxVariantSelectList |
37,786 | protected function _getSelections ( $ sTitle ) { if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blUseMultidimensionVariants' ) ) { $ aSelections = explode ( $ this -> _sMdSeparator , $ sTitle ) ; } else { $ aSelections = [ $ sTitle ] ; } return $ aSelections ; } | In case multidimentional variants ON explodes title by _sMdSeparator and returns array else - returns array containing title |
37,787 | public function buildVariantSelections ( $ sVarName , $ oVariantList , $ aFilter , $ sActVariantId , $ iLimit = 0 ) { $ aVarSelects = $ this -> _getSelections ( $ sVarName ) ; if ( $ iLimit ) { $ aVarSelects = array_slice ( $ aVarSelects , 0 , $ iLimit ) ; } if ( ( $ iVarSelCnt = count ( $ aVarSelects ) ) ) { $ aRawVariantSelections = $ this -> _fillVariantSelections ( $ oVariantList , $ iVarSelCnt , $ aFilter , $ sActVariantId ) ; list ( $ aRawVariantSelections , $ sActVariantId , $ blPerfectFit ) = $ this -> _applyVariantSelectionsFilter ( $ aRawVariantSelections , $ aFilter ) ; $ aVariantSelections = $ this -> _buildVariantSelectionsList ( $ aVarSelects , $ aRawVariantSelections ) ; $ oCurrentVariant = null ; if ( $ sActVariantId ) { $ oCurrentVariant = $ oVariantList [ $ sActVariantId ] ; } return [ 'selections' => $ aVariantSelections , 'rawselections' => $ aRawVariantSelections , 'oActiveVariant' => $ oCurrentVariant , 'blPerfectFit' => $ blPerfectFit ] ; } return false ; } | Builds variant selection list |
37,788 | public function mergeReviewAndRating ( ArrayCollection $ reviews , ArrayCollection $ ratings ) { $ ratingAndReviewList = array_merge ( $ this -> getReviewDataWithRating ( $ reviews , $ ratings ) , $ this -> getRatingWithoutReviewData ( $ reviews , $ ratings ) ) ; return $ this -> mapReviewAndRatingList ( $ ratingAndReviewList ) ; } | Merges Reviews and Ratings to Collection of ReviewAndRating view objects . |
37,789 | private function isRatingWithoutReview ( Rating $ rating , ArrayCollection $ reviews ) { $ withoutReview = true ; foreach ( $ reviews as $ review ) { if ( $ this -> isReviewRating ( $ review , $ rating ) ) { $ withoutReview = false ; break ; } } return $ withoutReview ; } | Returns true if Rating doesn t belong to any review . |
37,790 | private function isReviewRating ( Review $ review , Rating $ rating ) { return $ rating -> getType ( ) === $ review -> getType ( ) && $ rating -> getObjectId ( ) === $ review -> getObjectId ( ) && $ rating -> getRating ( ) === $ review -> getRating ( ) && $ rating -> getUserId ( ) === $ review -> getUserId ( ) ; } | Returns true if Rating belongs to Review . |
37,791 | private function mapReviewAndRatingList ( $ reviewAndRatingDataList ) { $ mappedReviewAndRating = new ArrayCollection ( ) ; foreach ( $ reviewAndRatingDataList as $ reviewAndRatingData ) { $ mappedReviewAndRating [ ] = $ this -> mapReviewAndRating ( $ reviewAndRatingData ) ; } return $ mappedReviewAndRating ; } | Maps Reviews and Ratings data to Collection of ReviewAndRating view objects . |
37,792 | private function mapReviewAndRating ( $ reviewAndRatingData ) { $ reviewAndRating = new ReviewAndRating ( ) ; $ reviewAndRating -> setReviewId ( $ reviewAndRatingData [ 'reviewId' ] ) -> setRatingId ( $ reviewAndRatingData [ 'ratingId' ] ) -> setRating ( $ reviewAndRatingData [ 'rating' ] ) -> setReviewText ( $ reviewAndRatingData [ 'text' ] ) -> setObjectId ( $ reviewAndRatingData [ 'objectId' ] ) -> setObjectType ( $ reviewAndRatingData [ 'objectType' ] ) -> setCreatedAt ( $ reviewAndRatingData [ 'createdAt' ] ) ; return $ reviewAndRating ; } | Maps Review and Rating data to ReviewAndRating view object . |
37,793 | public function removeVendor ( ) { $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ aRemoveArt = $ this -> _getActionIds ( 'oxarticles.oxid' ) ; if ( $ oConfig -> getRequestParameter ( 'all' ) ) { $ sArtTable = $ this -> _getViewName ( 'oxarticles' ) ; $ aRemoveArt = $ this -> _getAll ( $ this -> _addFilter ( "select $sArtTable.oxid " . $ this -> _getQuery ( ) ) ) ; } if ( is_array ( $ aRemoveArt ) ) { $ sSelect = "update oxarticles set oxvendorid = null where " . $ this -> onVendorActionArticleUpdateConditions ( $ aRemoveArt ) ; \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> Execute ( $ sSelect ) ; $ this -> resetCounter ( "vendorArticle" , $ oConfig -> getRequestParameter ( 'oxid' ) ) ; $ this -> onVendorAction ( $ oConfig -> getRequestParameter ( 'oxid' ) ) ; } } | Removes article from Vendor |
37,794 | public function addVendor ( ) { $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ aAddArticle = $ this -> _getActionIds ( 'oxarticles.oxid' ) ; $ soxId = $ oConfig -> getRequestParameter ( 'synchoxid' ) ; if ( $ oConfig -> getRequestParameter ( 'all' ) ) { $ sArtTable = $ this -> _getViewName ( 'oxarticles' ) ; $ aAddArticle = $ this -> _getAll ( $ this -> _addFilter ( "select $sArtTable.oxid " . $ this -> _getQuery ( ) ) ) ; } if ( $ soxId && $ soxId != "-1" && is_array ( $ aAddArticle ) ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sSelect = "update oxarticles set oxvendorid = " . $ oDb -> quote ( $ soxId ) . " where " . $ this -> onVendorActionArticleUpdateConditions ( $ aAddArticle ) ; $ oDb -> Execute ( $ sSelect ) ; $ this -> resetCounter ( "vendorArticle" , $ soxId ) ; $ this -> onVendorAction ( $ soxId ) ; } } | Adds article to Vendor config |
37,795 | public function copyDir ( $ sSourceDir , $ sTargetDir ) { $ oStr = getStr ( ) ; $ handle = opendir ( $ sSourceDir ) ; while ( false !== ( $ file = readdir ( $ handle ) ) ) { if ( $ file != '.' && $ file != '..' ) { if ( is_dir ( $ sSourceDir . '/' . $ file ) ) { $ sNewSourceDir = $ sSourceDir . '/' . $ file ; $ sNewTargetDir = $ sTargetDir . '/' . $ file ; if ( strcasecmp ( $ file , 'CVS' ) && strcasecmp ( $ file , '.svn' ) ) { @ mkdir ( $ sNewTargetDir , 0777 ) ; $ this -> copyDir ( $ sNewSourceDir , $ sNewTargetDir ) ; } } else { $ sSourceFile = $ sSourceDir . '/' . $ file ; $ sTargetFile = $ sTargetDir . '/' . $ file ; if ( ! $ oStr -> strstr ( $ sSourceDir , 'dyn_images' ) || $ file == 'nopic.jpg' || $ file == 'nopic_ico.jpg' ) { @ copy ( $ sSourceFile , $ sTargetFile ) ; } } } } closedir ( $ handle ) ; } | Copies directory tree for creating a new shop . |
37,796 | public function deleteDir ( $ sSourceDir ) { if ( is_dir ( $ sSourceDir ) ) { if ( $ oDir = dir ( $ sSourceDir ) ) { while ( false !== $ sFile = $ oDir -> read ( ) ) { if ( $ sFile == '.' || $ sFile == '..' ) { continue ; } if ( ! $ this -> deleteDir ( $ oDir -> path . DIRECTORY_SEPARATOR . $ sFile ) ) { $ oDir -> close ( ) ; return false ; } } $ oDir -> close ( ) ; return rmdir ( $ sSourceDir ) ; } } elseif ( file_exists ( $ sSourceDir ) ) { return unlink ( $ sSourceDir ) ; } } | Deletes directory tree . |
37,797 | public function readRemoteFileAsString ( $ sPath ) { $ sRet = '' ; $ hFile = @ fopen ( $ sPath , 'r' ) ; if ( $ hFile ) { socket_set_timeout ( $ hFile , 2 ) ; while ( ! feof ( $ hFile ) ) { $ sLine = fgets ( $ hFile , 4096 ) ; $ sRet .= $ sLine ; } fclose ( $ hFile ) ; } return $ sRet ; } | Reads remote stored file . Returns contents of file . |
37,798 | protected function _prepareImageName ( $ sValue , $ sType , $ blDemo , $ sImagePath , $ blUnique = true ) { if ( $ sValue ) { $ aFilename = explode ( "." , $ sValue ) ; $ sFileType = trim ( $ aFilename [ count ( $ aFilename ) - 1 ] ) ; if ( isset ( $ sFileType ) ) { $ oStr = getStr ( ) ; if ( in_array ( $ sFileType , $ this -> _aBadFiles ) || ( $ blDemo && ! in_array ( $ sFileType , $ this -> _aAllowedFiles ) ) ) { \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> showMessageAndExit ( "File didn't pass our allowed files filter." ) ; } if ( count ( $ aFilename ) > 0 ) { unset ( $ aFilename [ count ( $ aFilename ) - 1 ] ) ; } $ sFName = '' ; if ( isset ( $ aFilename [ 0 ] ) ) { $ sFName = $ oStr -> preg_replace ( '/[^a-zA-Z0-9()_\.-]/' , '' , implode ( '.' , $ aFilename ) ) ; } $ sValue = $ this -> _getUniqueFileName ( $ sImagePath , "{$sFName}" , $ sFileType , "" , $ blUnique ) ; } } return $ sValue ; } | Prepares image file name |
37,799 | protected function _getImageSize ( $ sImgType , $ iImgNum , $ sImgConf ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; switch ( $ sImgConf ) { case 'aDetailImageSizes' : $ aDetailImageSizes = $ myConfig -> getConfigParam ( $ sImgConf ) ; $ sSize = $ myConfig -> getConfigParam ( 'sDetailImageSize' ) ; if ( isset ( $ aDetailImageSizes [ 'oxpic' . $ iImgNum ] ) ) { $ sSize = $ aDetailImageSizes [ 'oxpic' . $ iImgNum ] ; } break ; default : $ sSize = $ myConfig -> getConfigParam ( $ sImgConf ) ; break ; } if ( $ sSize ) { return explode ( '*' , $ sSize ) ; } } | Returns array of sizes which are used to resize images . If size is not defined - NULL will be returned |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.