예제 #1
0
 /**
  * Adds active promotion check
  *
  * @param array  $aWhere  SQL condition array
  * @param string $sqlFull SQL query string
  *
  * @return $sQ
  */
 protected function _prepareWhereQuery($aWhere, $sqlFull)
 {
     $sQ = parent::_prepareWhereQuery($aWhere, $sqlFull);
     $sDisplayType = (int) oxRegistry::getConfig()->getRequestParameter('displaytype');
     $sTable = getViewName("oxactions");
     //searchong for empty oxfolder fields
     if ($sDisplayType) {
         $sNow = date('Y-m-d H:i:s', oxRegistry::get("oxUtilsDate")->getTime());
         switch ($sDisplayType) {
             case 1:
                 // active
                 $sQ .= " and {$sTable}.oxactivefrom < '{$sNow}' and {$sTable}.oxactiveto > '{$sNow}' ";
                 break;
             case 2:
                 // upcoming
                 $sQ .= " and {$sTable}.oxactivefrom > '{$sNow}' ";
                 break;
             case 3:
                 // expired
                 $sQ .= " and {$sTable}.oxactiveto < '{$sNow}' and {$sTable}.oxactiveto != '0000-00-00 00:00:00' ";
                 break;
         }
     }
     return $sQ;
 }
예제 #2
0
 /**
  * Adding folder check and empty folder field check.
  *
  * @param array  $aWhere  SQL condition array
  * @param string $sqlFull SQL query string
  *
  * @return string
  */
 protected function _prepareWhereQuery($aWhere, $sqlFull)
 {
     $sQ = parent::_prepareWhereQuery($aWhere, $sqlFull);
     $sFolder = oxRegistry::getConfig()->getRequestParameter('folder');
     $sViewName = getviewName("oxcontents");
     //searchong for empty oxfolder fields
     if ($sFolder == 'CMSFOLDER_NONE' || $sFolder == 'CMSFOLDER_NONE_RR') {
         $sQ .= " and {$sViewName}.oxfolder = '' ";
     } elseif ($sFolder && $sFolder != '-1') {
         $sFolder = oxDb::getDb()->quote($sFolder);
         $sQ .= " and {$sViewName}.oxfolder = {$sFolder}";
     }
     return $sQ;
 }
예제 #3
0
 /**
  * Adding folder check
  *
  * @param array  $aWhere  SQL condition array
  * @param string $sqlFull SQL query string
  *
  * @return $sQ
  */
 protected function _prepareWhereQuery($aWhere, $sqlFull)
 {
     $oDb = oxDb::getDb();
     $sQ = parent::_prepareWhereQuery($aWhere, $sqlFull);
     $myConfig = $this->getConfig();
     $aFolders = $myConfig->getConfigParam('aOrderfolder');
     $sFolder = oxRegistry::getConfig()->getRequestParameter('folder');
     //searchong for empty oxfolder fields
     if ($sFolder && $sFolder != '-1') {
         $sQ .= " and ( oxorder.oxfolder = " . $oDb->quote($sFolder) . " )";
     } elseif (!$sFolder && is_array($aFolders)) {
         $aFolderNames = array_keys($aFolders);
         $sQ .= " and ( oxorder.oxfolder = " . $oDb->quote($aFolderNames[0]) . " )";
     }
     return $sQ;
 }
예제 #4
0
 /**
  * Adding folder check
  *
  * @param array  $whereQuery SQL condition array
  * @param string $fullQuery  SQL query string
  *
  * @return string
  */
 protected function _prepareWhereQuery($whereQuery, $fullQuery)
 {
     $database = oxDb::getDb();
     $query = parent::_prepareWhereQuery($whereQuery, $fullQuery);
     $config = $this->getConfig();
     $folders = $config->getConfigParam('aOrderfolder');
     $folder = oxRegistry::getConfig()->getRequestParameter('folder');
     // Searching for empty oxfolder fields
     if ($folder && $folder != '-1') {
         $query .= " and ( oxorder.oxfolder = " . $database->quote($folder) . " )";
     } elseif (!$folder && is_array($folders)) {
         $folderNames = array_keys($folders);
         $query .= " and ( oxorder.oxfolder = " . $database->quote($folderNames[0]) . " )";
     }
     return $query;
 }
예제 #5
0
 /**
  * Prepares SQL where query according SQL condition array and attaches it to SQL end.
  * For each search value if german umlauts exist, adds them
  * and replaced by spec. char to query
  *
  * @param array  $whereQuery SQL condition array
  * @param string $fullQuery  SQL query string
  *
  * @return string
  */
 public function _prepareWhereQuery($whereQuery, $fullQuery)
 {
     $nameWhere = null;
     if (isset($whereQuery['oxuser.oxlname']) && ($name = $whereQuery['oxuser.oxlname'])) {
         // check if this is search string (contains % sign at begining and end of string)
         $isSearchValue = $this->_isSearchValue($name);
         $name = $this->_processFilter($name);
         $nameWhere['oxuser.oxfname'] = $nameWhere['oxuser.oxlname'] = $name;
         unset($whereQuery['oxuser.oxlname']);
     }
     $query = parent::_prepareWhereQuery($whereQuery, $fullQuery);
     if ($nameWhere) {
         $values = explode(' ', $name);
         $query .= ' and (';
         $queryBoolAction = '';
         $utilsString = oxRegistry::get("oxUtilsString");
         foreach ($nameWhere as $fieldName => $fieldValue) {
             //for each search field using AND action
             foreach ($values as $value) {
                 $query .= " {$queryBoolAction} {$fieldName} ";
                 //for search in same field for different values using AND
                 $queryBoolAction = ' or ';
                 $query .= $this->_buildFilter($value, $isSearchValue);
                 // trying to search spec chars in search value
                 // if found, add cleaned search value to search sql
                 $uml = $utilsString->prepareStrForSearch($value);
                 if ($uml) {
                     $query .= " or {$fieldName} ";
                     $query .= $this->_buildFilter($uml, $isSearchValue);
                 }
             }
         }
         // end for AND action
         $query .= ' ) ';
     }
     return $query;
 }
예제 #6
0
 /**
  * Prepares SQL where query according SQL condition array and attaches it to SQL end.
  * For each search value if german umlauts exist, adds them
  * and replaced by spec. char to query
  *
  * @param array  $aWhere     SQL condition array
  * @param string $sQueryFull SQL query string
  *
  * @return string
  */
 public function _prepareWhereQuery($aWhere, $sQueryFull)
 {
     $aNameWhere = null;
     if (isset($aWhere['oxuser.oxlname']) && ($sName = $aWhere['oxuser.oxlname'])) {
         // check if this is search string (contains % sign at begining and end of string)
         $blIsSearchValue = $this->_isSearchValue($sName);
         $sName = $this->_processFilter($sName);
         $aNameWhere['oxuser.oxfname'] = $aNameWhere['oxuser.oxlname'] = $sName;
         // unsetting..
         unset($aWhere['oxuser.oxlname']);
     }
     $sQ = parent::_prepareWhereQuery($aWhere, $sQueryFull);
     if ($aNameWhere) {
         $aVal = explode(' ', $sName);
         $sQ .= ' and (';
         $sSqlBoolAction = '';
         $myUtilsString = oxRegistry::get("oxUtilsString");
         foreach ($aNameWhere as $sFieldName => $sValue) {
             //for each search field using AND anction
             foreach ($aVal as $sVal) {
                 $sQ .= " {$sSqlBoolAction} {$sFieldName} ";
                 //for search in same field for different values using AND
                 $sSqlBoolAction = ' or ';
                 $sQ .= $this->_buildFilter($sVal, $blIsSearchValue);
                 // trying to search spec chars in search value
                 // if found, add cleaned search value to search sql
                 $sUml = $myUtilsString->prepareStrForSearch($sVal);
                 if ($sUml) {
                     $sQ .= " or {$sFieldName} ";
                     $sQ .= $this->_buildFilter($sUml, $blIsSearchValue);
                 }
             }
         }
         // end for AND action
         $sQ .= ' ) ';
     }
     return $sQ;
 }
예제 #7
0
 /**
  * Adding folder check
  *
  * @param array  $aWhere  SQL condition array
  * @param string $sqlFull SQL query string
  *
  * @return $sQ
  */
 public function _prepareWhereQuery($aWhere, $sqlFull)
 {
     $sQ = oxAdminList::_prepareWhereQuery($aWhere, $sqlFull);
     $sQ .= " group by oxorderarticles.oxartnum";
     return $sQ;
 }
예제 #8
0
 /**
  * Adding folder check
  *
  * @param array  $aWhere  SQL condition array
  * @param string $sqlFull SQL query string
  *
  * @return $sQ
  */
 protected function _prepareWhereQuery($aWhere, $sqlFull)
 {
     $oDb = oxDb::getDb();
     $sQ = parent::_prepareWhereQuery($aWhere, $sqlFull);
     $myConfig = $this->getConfig();
     $aFolders = $myConfig->getConfigParam('aOrderfolder');
     $sFolder = oxConfig::getParameter('folder');
     //searchong for empty oxfolder fields
     if ($sFolder && $sFolder != '-1') {
         $sQ .= " and ( oxorder.oxfolder = " . $oDb->quote($sFolder) . " ";
         //deprecated check for old orders
         $sQ .= "or oxorder.oxfolder = " . $oDb->quote(oxLang::getInstance()->translateString($sFolder)) . " )";
     } elseif (!$sFolder && is_array($aFolders)) {
         $aFolderNames = array_keys($aFolders);
         $sQ .= " and ( oxorder.oxfolder = " . $oDb->quote($aFolderNames[0]) . " ";
         //deprecated check for old orders
         $sQ .= "or oxorder.oxfolder = " . $oDb->quote(oxLang::getInstance()->translateString($aFolderNames[0])) . " )";
     }
     return $sQ;
 }