コード例 #1
0
ファイル: HRDetail.php プロジェクト: JoeMurray/civihr
 function where()
 {
     parent::where();
     $params = array('name' => 'HRJobContract_Summary');
     CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomGroup', $params, $cGrp);
     $params = array('name' => 'Final_Termination_Date', 'custom_group_id' => $cGrp['id']);
     CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $params, $cField);
     $dbAlias = $this->_columns[$cGrp['table_name']]['fields']["custom_{$cField['id']}"]['dbAlias'];
     if (!$this->isFieldSelected($this->_columns[$cGrp['table_name']])) {
         $whereClauses[] = "({$dbAlias} >= CURDATE() OR {$dbAlias} IS NULL)";
     }
     $params = array('name' => 'Initial_Join_Date', 'custom_group_id' => $cGrp['id']);
     CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $params, $cField);
     $dbAlias = $this->_columns[$cGrp['table_name']]['fields']["custom_{$cField['id']}"]['dbAlias'];
     $addWhereClauses = "({$this->_aliases['civicrm_hrjobcontract']}.is_primary IS NULL AND {$dbAlias} IS NOT NULL AND {$dbAlias} <= CURDATE())";
     if (!empty($this->_params['current_employee_value'])) {
         $whereClauses[] = "(({$this->_aliases['civicrm_hrjobcontract']}.is_primary = 1 OR {$this->_aliases['civicrm_hrjobcontract']}.is_primary IS NULL) AND ({$this->_aliases['civicrm_hrjobcontract_details']}.period_start_date IS NOT NULL AND {$this->_aliases['civicrm_hrjobcontract_details']}.period_start_date <= CURDATE()))";
         $this->_where = str_replace("AND ( hrjobcontract_civireport.current_employee = 1 )", '', $this->_where);
     }
     $whereClauses[] = "{$this->_aliases['civicrm_contact']}.contact_type = 'Individual'";
     $where = implode(' AND ', $whereClauses);
     if ($this->_where == "WHERE ( 1 )") {
         $this->_where = $where;
     } else {
         $this->_where .= " AND {$where}";
     }
 }
コード例 #2
0
 function where()
 {
     parent::where();
     list($offset, $rowCount) = $this->limit();
     $this->_limit = NULL;
     $tempClause = $offset && $rowCount ? "AND temp.id BETWEEN {$offset} AND {$rowCount}" : null;
     $this->_where .= " AND (log_action != 'Initialization') {$tempClause}";
 }
コード例 #3
0
 function where($includeTemp = TRUE)
 {
     parent::where();
     $this->_where .= "\n    AND cdntax_c.id IS NULL AND {$this->_aliases['civicrm_contact']}.is_deleted = 0\n    ";
     if ($includeTemp && $this->_useEligibilityHooks) {
         $this->_where .= "\n      AND cdntax_t.contribution_id IS NOT NULL\n      ";
     } else {
         $this->_where .= "\n      AND {$this->_aliases['civicrm_contribution']}.contribution_status_id = 1\n      AND {$this->_aliases['civicrm_financial_type']}.is_deductible = 1\n      AND ({$this->_aliases['civicrm_contribution']}.total_amount - COALESCE({$this->_aliases['civicrm_contribution']}.non_deductible_amount,0)) > 0\n      ";
     }
 }
コード例 #4
0
 public function where()
 {
     parent::where();
     // Handle calculated end date. This can come from one of two sources:
     // Either there is a specified end date for the end_date field
     // Or, we calculate the end date based on the start date +
     // installments * intervals using the mysql date_add function, along
     // with the interval unit (e.g. DATE_ADD(start_date, INTERVAL 12 * 1 MONTH)
     $date_suffixes = array('relative', 'from', 'to');
     while (list(, $suffix) = each($date_suffixes)) {
         $isBreak = FALSE;
         // Check to see if the user wants to search by calculated date.
         if (!empty($this->_params['calculated_end_date_' . $suffix])) {
             // The calculated date field is in use - spring into action
             // Gather values
             $relative = CRM_Utils_Array::value("calculated_end_date_relative", $this->_params);
             $from = CRM_Utils_Array::value("calculated_end_date_from", $this->_params);
             $to = CRM_Utils_Array::value("calculated_end_date_to", $this->_params);
             $end_date_db_alias = $this->_columns['civicrm_contribution_recur']['filters']['end_date']['dbAlias'];
             $end_date_type = $this->_columns['civicrm_contribution_recur']['filters']['end_date']['type'];
             $start_date_type = $this->_columns['civicrm_contribution_recur']['filters']['start_date']['type'];
             $frequency_unit_db_alias = $this->_columns['civicrm_contribution_recur']['filters']['frequency_unit']['dbAlias'];
             $frequency_interval_db_alias = $this->_columns['civicrm_contribution_recur']['filters']['frequency_interval']['dbAlias'];
             $installments_db_alias = $this->_columns['civicrm_contribution_recur']['filters']['installments']['dbAlias'];
             $start_date_db_alias = $this->_columns['civicrm_contribution_recur']['filters']['start_date']['dbAlias'];
             // The end date clause is simple to construct
             $end_date_clause = $this->dateClause($end_date_db_alias, $relative, $from, $to, $end_date_type, NULL, NULL);
             // NOTE: For the calculation based on installment, there doesn't
             // seem to be a way to include the interval unit (e.g. month,
             // date, etc) as a field name - so we have to build a complex
             // OR statement instead.
             $this->_where .= 'AND (' . $this->dateClause("DATE_ADD({$start_date_db_alias}, INTERVAL {$installments_db_alias} * COALESCE({$frequency_interval_db_alias},1) month)", $relative, $from, $to, $start_date_type, NULL, NULL);
             $this->_where .= " AND {$frequency_unit_db_alias} = 'month' ) OR \n";
             $this->_where .= '(' . $this->dateClause("DATE_ADD({$start_date_db_alias}, INTERVAL {$installments_db_alias} * COALESCE({$frequency_interval_db_alias},1) day)", $relative, $from, $to, $start_date_type, NULL, NULL);
             $this->_where .= " AND {$frequency_unit_db_alias} = 'day' ) OR \n";
             $this->_where .= '(' . $this->dateClause("DATE_ADD({$start_date_db_alias}, INTERVAL {$installments_db_alias} * COALESCE({$frequency_interval_db_alias}, 1) week)", $relative, $from, $to, $start_date_type, NULL, NULL);
             $this->_where .= " AND {$frequency_unit_db_alias} = 'week' ) OR \n";
             $this->_where .= '(' . $this->dateClause("DATE_ADD({$start_date_db_alias}, INTERVAL {$installments_db_alias} * COALESCE({$frequency_interval_db_alias}, 1) year)", $relative, $from, $to, $start_date_type, NULL, NULL);
             $this->_where .= " AND {$frequency_unit_db_alias} = 'year' )\n   AND (({$end_date_db_alias} IS NOT NULL AND {$end_date_clause})\n    OR ({$installments_db_alias} IS NOT NULL))\n";
             $isBreak = TRUE;
         }
         if (!empty($this->_params['contribution_processed_date_' . $suffix])) {
             $relative = CRM_Utils_Array::value("contribution_processed_date_relative", $this->_params);
             $from = CRM_Utils_Array::value("contribution_processed_date_from", $this->_params);
             $to = CRM_Utils_Array::value("contribution_processed_date_to", $this->_params);
             $this->_where .= " AND contribution_civireport.id IN (SELECT MAX(cc.id) FROM civicrm_contribution cc WHERE cc.contribution_status_id = 1 AND (" . $this->dateClause("DATE(cc.receive_date)", $relative, $from, $to, CRM_Utils_Type::T_DATE, NULL, NULL) . " ) GROUP BY cc.contribution_recur_id)";
             $isBreak = TRUE;
         }
         if (!empty($isBreak)) {
             break;
         }
     }
 }
コード例 #5
0
 public function where()
 {
     // reset where clause as its called multiple times, every time insert sql is built.
     $this->_whereClauses = array();
     parent::where();
     $this->_where .= " AND (entity_log_civireport.log_action != 'Initialization')";
 }
コード例 #6
0
 function where()
 {
     parent::where();
     $this->_where .= " AND {$this->_aliases['civicrm_contribution']}.is_test = 0 ";
 }
コード例 #7
0
ファイル: ReportSummary.php プロジェクト: hguru/224Civi
 function where()
 {
     parent::where();
     $this->_where .= " AND (entity_log_civireport.log_action != 'Initialization')";
 }
コード例 #8
0
 function where()
 {
     parent::where();
     if (empty($this->_where)) {
         //$this->_where = "WHERE (value_direct_debit_details_civireport.amount IS NOT NULL)";
     } else {
         //$this->_where .= " AND (value_direct_debit_details_civireport.amount IS NOT NULL)";
     }
 }
コード例 #9
0
 function where()
 {
     parent::where();
     $this->_where .= " AND {$this->_aliases['civicrm_mailing']}.sms_provider_id IS NULL";
 }
コード例 #10
0
 function where()
 {
     parent::where();
     if (empty($this->_where)) {
         $this->_where = "WHERE value_gift_aid_submission_civireport.amount IS NOT NULL";
     } else {
         $this->_where .= " AND value_gift_aid_submission_civireport.amount IS NOT NULL";
     }
 }
コード例 #11
0
ファイル: Summary.php プロジェクト: kcristiano/civicrm-core
 public function where()
 {
     $this->_whereClauses[] = "{$this->_aliases['civicrm_membership']}.is_test = 0 AND\n                              {$this->_aliases['civicrm_contact']}.is_deleted = 0";
     parent::where();
 }
コード例 #12
0
 function where()
 {
     parent::where();
     $op = CRM_Utils_Array::value("sector_op", $this->_params);
     if ($op) {
         $field['dbAlias'] = "`civicrm_entity_tag`.`tag_id`";
         $clause = $this->whereClause($field, $op, CRM_Utils_Array::value("sector_value", $this->_params), CRM_Utils_Array::value("sector_min", $this->_params), CRM_Utils_Array::value("sector_max", $this->_params));
         if ($clause) {
             $this->_where .= " AND " . $clause;
         }
     }
     $activity_type = CRM_Core_OptionGroup::getValue('activity_type', 'Business Programme', 'name');
     $this->_where .= " AND {$this->_aliases['civicrm_activity']}.activity_type_id = '" . $activity_type . "'";
     $this->_where .= " AND {$this->_aliases['civicrm_activity']}.is_deleted = 0 AND {$this->_aliases['civicrm_activity']}.is_current_revision = 1";
 }
コード例 #13
0
 function where()
 {
     $this->_whereClauses[] = "{$this->_aliases['civicrm_membership']}.is_test = 0";
     parent::where();
 }
コード例 #14
0
 /**
  * The WHERE of the report query.
  */
 public function where()
 {
     if (!count($this->_params['gid_value'])) {
         $this->_whereClauses[] = "({$this->_aliases['civicrm_event']}.id IS NOT NULL OR {$this->_aliases['civicrm_event2']}.id is not null)";
     }
     parent::where();
 }
コード例 #15
0
 function where()
 {
     parent::where();
     $this->_where .= " AND (log_action != 'Initialization')";
     $clauses = array();
     foreach ($this->_columns as $tableName => $table) {
         if (array_key_exists('filters', $table)) {
             foreach ($table['filters'] as $fieldName => $field) {
                 $clause = null;
                 if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
                     $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
                     $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
                     $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
                     if ($relative || $from || $to) {
                         $clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
                     }
                 } else {
                     $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
                     if ($op) {
                         $clause = $this->whereClause($field, $op, CRM_Utils_Array::value("{$fieldName}_value", $this->_params), CRM_Utils_Array::value("{$fieldName}_min", $this->_params), CRM_Utils_Array::value("{$fieldName}_max", $this->_params));
                     }
                 }
                 if (!empty($clause)) {
                     $clauses[] = $clause;
                     $this->_where = "WHERE " . implode(' AND ', $clauses);
                 }
             }
         }
     }
 }