/**
  * Get the filter to use with the model for searching including model sorts, etc..
  *
  * @param boolean $useRequest Use the request as source (when false, the session is used)
  * @return array or false
  */
 public function getSearchFilter($useRequest = false)
 {
     $this->_searchFilter = array();
     $this->_searchFilter = parent::getSearchFilter($useRequest);
     $this->_searchFilter[] = 'gto_start_time IS NOT NULL';
     $this->_searchFilter['gco_code'] = 'consent given';
     $this->_searchFilter['gr2o_reception_code'] = 'OK';
     $this->_searchFilter['grc_success'] = 1;
     return $this->_searchFilter;
 }
Exemplo n.º 2
0
 /**
  * Get the filter to use with the model for searching
  *
  * @param boolean $useRequest Use the request as source (when false, the session is used)
  * @return array or false
  */
 public function getSearchFilter($useRequest = true)
 {
     $filter = parent::getSearchFilter($useRequest);
     $where = \Gems_Snippets_AutosearchFormSnippet::getPeriodFilter($filter, $this->db);
     if ($where) {
         $filter[] = $where;
     }
     return $filter;
 }
 /**
  * Get the filter to use with the model for searching including model sorts, etc..
  *
  * @param boolean $useRequest Use the request as source (when false, the session is used)
  * @return array or false
  */
 public function getSearchFilter($useRequest = true)
 {
     $filter = parent::getSearchFilter($useRequest);
     if (array_key_exists('status', $filter)) {
         switch ($filter['status']) {
             case 'sok':
                 $filter['gsu_active'] = 0;
                 $filter[] = "(gsu_status IS NULL OR LENGTH(gsu_status) = 0)";
                 break;
             case 'nok':
                 $filter[] = "(gsu_status IS NOT NULL AND gsu_status NOT IN ('', 'OK'))";
                 break;
             case 'act':
                 $filter['gsu_active'] = 1;
                 // default:
         }
         unset($filter['status']);
     }
     return $filter;
 }
 /**
  * Get the filter to use with the model for searching including model sorts, etc..
  *
  * @param boolean $useRequest Use the request as source (when false, the session is used)
  * @return array or false
  */
 public function getSearchFilter($useRequest = true)
 {
     $filter = parent::getSearchFilter($useRequest);
     if (!(isset($filter['gsf_id_organization']) && $filter['gsf_id_organization'])) {
         $filter['gsf_id_organization'] = array_keys($this->currentUser->getAllowedOrganizations());
     }
     return $filter;
 }
 /**
  * Get the filter to use with the model for searching
  *
  * @param boolean $useRequest Use the request as source (when false, the session is used)
  * @return array or false
  */
 public function getSearchFilter($useRequest = true)
 {
     $filter = parent::getSearchFilter($useRequest);
     unset($filter['AUTO_SEARCH_TEXT_BUTTON']);
     $where = \Gems_Snippets_AutosearchFormSnippet::getPeriodFilter($filter, $this->db, null, 'yyyy-MM-dd HH:mm:ss');
     if ($where) {
         $filter[] = $where;
     }
     if (!isset($filter['gto_id_organization'])) {
         $filter['gto_id_organization'] = $this->currentUser->getRespondentOrgFilter();
     }
     $filter['gsu_active'] = 1;
     $filter['grc_success'] = 1;
     // Overruled with success
     if (isset($filter['main_filter'])) {
         switch ($filter['main_filter']) {
             case 'answered':
                 $filter[] = 'gto_completion_time IS NOT NULL';
                 break;
             case 'hasnomail':
                 $filter[] = sprintf("(grs_email IS NULL OR grs_email = '' OR grs_email NOT RLIKE '%s') AND\n                                ggp_respondent_members = 1", str_replace('\'', '\\\'', trim(\MUtil_Validate_SimpleEmail::EMAIL_REGEX, '/')));
                 $filter[] = '(gto_valid_until IS NULL OR gto_valid_until >= CURRENT_TIMESTAMP)';
                 $filter['gto_completion_time'] = null;
                 break;
             case 'missed':
                 $filter[] = 'gto_valid_from <= CURRENT_TIMESTAMP';
                 $filter[] = 'gto_valid_until < CURRENT_TIMESTAMP';
                 $filter['gto_completion_time'] = null;
                 break;
             case 'notmailed':
                 $filter['gto_mail_sent_date'] = null;
                 $filter[] = '(gto_valid_until IS NULL OR gto_valid_until >= CURRENT_TIMESTAMP)';
                 $filter['gto_completion_time'] = null;
                 break;
             case 'open':
                 $filter['gto_completion_time'] = null;
                 $filter[] = 'gto_valid_from <= CURRENT_TIMESTAMP';
                 $filter[] = '(gto_valid_until >= CURRENT_TIMESTAMP OR gto_valid_until IS NULL)';
                 break;
                 // case 'other':
                 //    $filter[] = "grs_email IS NULL OR grs_email = '' OR ggp_respondent_members = 0";
                 //    $filter['can_email'] = 0;
                 //    $filter[] = '(gto_valid_until IS NULL OR gto_valid_until >= CURRENT_TIMESTAMP)';
                 //    break;
             // case 'other':
             //    $filter[] = "grs_email IS NULL OR grs_email = '' OR ggp_respondent_members = 0";
             //    $filter['can_email'] = 0;
             //    $filter[] = '(gto_valid_until IS NULL OR gto_valid_until >= CURRENT_TIMESTAMP)';
             //    break;
             case 'removed':
                 $filter['grc_success'] = 0;
                 break;
             case 'toanswer':
                 $filter[] = 'gto_completion_time IS NULL';
                 break;
             case 'tomail':
                 $filter[] = sprintf("grs_email IS NOT NULL AND\n                                grs_email != '' AND\n                                grs_email RLIKE '%s' AND\n                                ggp_respondent_members = 1", str_replace('\'', '\\\'', trim(\MUtil_Validate_SimpleEmail::EMAIL_REGEX, '/')));
                 //$filter[] = "grs_email IS NOT NULL AND grs_email != '' AND ggp_respondent_members = 1";
                 $filter['gto_mail_sent_date'] = null;
                 $filter[] = '(gto_valid_until IS NULL OR gto_valid_until >= CURRENT_TIMESTAMP)';
                 $filter['gto_completion_time'] = null;
                 break;
             case 'toremind':
                 // $filter['can_email'] = 1;
                 $filter[] = 'gto_mail_sent_date < CURRENT_TIMESTAMP';
                 $filter[] = '(gto_valid_until IS NULL OR gto_valid_until >= CURRENT_TIMESTAMP)';
                 $filter['gto_completion_time'] = null;
                 break;
             default:
                 break;
         }
         unset($filter['main_filter']);
     }
     return $filter;
 }
 /**
  * Get the filter to use with the model for searching
  *
  * @param boolean $useRequest Use the request as source (when false, the session is used)
  * @return array or false
  */
 public function getSearchFilter($useRequest = true)
 {
     $filter = parent::getSearchFilter($useRequest);
     $where = \Gems_Snippets_AutosearchFormSnippet::getPeriodFilter($filter, $this->db, $this->getDateFormat(), 'yyyy-MM-dd HH:mm:ss');
     if ($where) {
         $filter[] = $where;
     }
     return $filter;
 }