Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

5304 log report

  • Loading branch information...
commit f237ff904017b0970eae96dfae561273fb16dcd3 1 parent 845b9bf
@lcdservices lcdservices authored
View
41 civicrm/custom/php/CRM/Logging/Form/ProofingReport.php
@@ -43,6 +43,8 @@ public function buildQuickForm() {
$this->addElement( 'text', 'jobID', ts('Job ID') );
+ $this->addElement( 'text', 'alteredBy', ts('Altered By') );
+
$this->addDate( 'start_date', ts('Date from'), false, array( 'formatType' => 'custom') );
$this->addDate( 'end_date', ts('...to'), false, array( 'formatType' => 'custom') );
@@ -93,10 +95,11 @@ static function formRule( $fields, $files, $self )
$errors = array( );
if ( empty($fields['jobID']) &&
+ empty($fields['alteredBy']) &&
empty($fields['start_date']) &&
empty($fields['end_date']) ) {
- $errors['jobID'] = ts('You must select a Job ID or date field to run this report.');
+ $errors['jobID'] = ts('You must select a Job ID, Altered By value, or date field to run this report.');
}
return $errors;
@@ -121,10 +124,14 @@ public function postProcess() {
$sqlParams = array();
$sqlWhere = 1;
- $startDate = $endDate = '';
+ $startDate = $endDate = $alteredByFrom = '';
if ( $formParams['jobID'] ) {
$sqlParams[] = "log_job_id = '{$formParams['jobID']}'";
}
+ if ( $formParams['alteredBy'] ) {
+ $sqlParams[] = "ab.sort_name LIKE '%{$formParams['alteredBy']}%'";
+ $alteredByFrom = "LEFT JOIN $civiDB.civicrm_contact ab ON logTbl.log_user_id = ab.id ";
+ }
if ( $formParams['start_date'] ) {
$startDate = date( 'Y-m-d', strtotime($formParams['start_date']) );
$sqlParams[] = "log_date >= '{$startDate} 00:00:00'";
@@ -160,6 +167,9 @@ public function postProcess() {
if ( $formParams['jobID'] ) {
$html .= "<h3>Job ID: {$formParams['jobID']}</h3>";
}
+ if ( $formParams['alteredBy'] ) {
+ $html .= "<h3>Altered By Search: {$formParams['alteredBy']}</h3>";
+ }
$html .= "<table>
<tr>
@@ -173,19 +183,21 @@ public function postProcess() {
//get contacts with changes to either the contact object or tag
CRM_Core_DAO::executeQuery("SET SESSION group_concat_max_len = 100000;");
- $query = "SELECT id, DATE_FORMAT(log_date, '%m/%d/%Y') as logDate, null as tagList
- FROM {$logDB}.log_civicrm_contact
+ $query = "SELECT logTbl.id, DATE_FORMAT(log_date, '%m/%d/%Y') as logDate, null as tagList
+ FROM {$logDB}.log_civicrm_contact logTbl
+ $alteredByFrom
WHERE ( $sqlWhere )
AND log_action != 'Initialization'
UNION
- SELECT et.entity_id, DATE_FORMAT(log_date, '%m/%d/%Y') as logDate, GROUP_CONCAT(t.name ORDER BY t.name SEPARATOR ', ')
- FROM {$logDB}.log_civicrm_entity_tag et
+ SELECT logTbl.entity_id, DATE_FORMAT(log_date, '%m/%d/%Y') as logDate, GROUP_CONCAT(t.name ORDER BY t.name SEPARATOR ', ')
+ FROM {$logDB}.log_civicrm_entity_tag logTbl
JOIN {$civiDB}.civicrm_tag t
- ON et.tag_id = t.id
+ ON logTbl.tag_id = t.id
+ $alteredByFrom
WHERE ( $sqlWhere )
AND entity_table = 'civicrm_contact'
AND log_action != 'Initialization'
- GROUP BY et.entity_id;";
+ GROUP BY logTbl.entity_id;";
//CRM_Core_Error::debug_var('query',$query);
$dao = CRM_Core_DAO::executeQuery($query);
@@ -195,6 +207,12 @@ public function postProcess() {
'id' => $dao->id,
);
$cDetails = civicrm_api('contact','getsingle',$params);
+ //CRM_Core_Error::debug('cDetails',$cDetails);
+
+ $dob = '';
+ if ( isset($cDetails['birth_date']) && !empty($cDetails['birth_date']) ) {
+ $dob = date('m/d/Y', strtotime($cDetails['birth_date']));
+ }
$html .= "<tr>
<td>{$dao->logDate}</td>
@@ -204,11 +222,11 @@ public function postProcess() {
{$cDetails['city']}, {$cDetails['state_name']} {$cDetails['postal_code']}
</td>
<td>{$cDetails['gender']}<br />
- {$cDetails['date_of_birth']}<br />
+ {$dob}<br />
{$cDetails['phone']}
</td>
- <td>{$cDetails['email']}</td>
- <td>{$dao->tagList}</td>
+ <td>{$cDetails['email']}&nbsp;</td>
+ <td>{$dao->tagList}&nbsp;</td>
</tr>";
}
@@ -247,6 +265,7 @@ function _reportCSS() {
}
h3 {
font-weight: bold;
+ font-size: 16px;
}
table {
font-family: Arial, Helvetica, sans-serif;
View
10 civicrm/custom/templates/CRM/Logging/Form/ProofingReport.tpl
@@ -13,7 +13,15 @@
</div>
<div class="clear"></div>
</div>
-
+
+ <div class="crm-section">
+ <div class="label"><label>{$form.alteredBy.label}</label></div>
+ <div class="content">
+ {$form.alteredBy.html}
+ </div>
+ <div class="clear"></div>
+ </div>
+
<div class="crm-section">
<div class="label">{$form.start_date.label}</div>
<div class="content">
View
10 scripts/v136.sh
@@ -97,10 +97,18 @@ INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
VALUES
( 1, CONCAT('civicrm/report/instance/', @instanceID,'&reset=1'), 'Mass Email Detail Report', 'Mass Email Detail Report', 'administer CiviMail', 'OR', @reportlastID, '1', NULL, @nav_max_weight+1 );
-UPDATE civicrm_report_instance SET navigation_id = LAST_INSERT_ID() WHERE id = @instanceID;
+UPDATE civicrm_report_instance SET navigation_id = LAST_INSERT_ID() WHERE id = @instanceID;"
$execSql -i $instance -c "$maildetail"
+## 5304 pdf page option ##
+pdfpage="
+SELECT @optGroup := id FROM civicrm_option_group WHERE name = 'pdf_format';
+INSERT INTO civicrm_option_value (option_group_id, label, value, name, grouping, filter, is_default, weight, description, is_optgroup, is_reserved, is_active, component_id, domain_id, visibility_id)
+VALUES
+(@optGroup, 'Letter Landscape', '{\"paper_size\":\"letter\",\"orientation\":\"landscape\",\"metric\":\"in\",\"margin_top\":0.5,\"margin_bottom\":0.5,\"margin_left\":0.5,\"margin_right\":0.5}', 'Letter Landscape', NULL, NULL, NULL, 1, NULL, NULL, NULL, 1, NULL, NULL, NULL);"
+
+
### Cleanup ###
$script_dir/clearCache.sh $instance
Please sign in to comment.
Something went wrong with that request. Please try again.