I was working on Table E issues and started looking on the first item: Patents, which on our site had the following problem described here:
#15 (comment) so if a patent has the date fields Provisional Date, Award Date and License Date all filled, it would show up in all three rows in Table E, which is not correct. The correct is it should show up in "Awarded" and "Licensed" rows only (if those date fields have values in them). Here are the changes we are doing to our Patent content type and our outputs.inc file to solve this issue:
foreach (array("Awarded"=>'field_er_patent_award_date', "Pending"=>'field_er_filing_date', "Licensed"=>'field_er_patent_date') as $label=>$date_field){
$query = db_select('node', 'node');
$query->condition("node.type", 'er_patent', '=');
$query->innerJoin("field_data_{$date_field}", 'date', 'node.nid = date.entity_id');
$this->applyDateRange($query, $date_field, $period);
if ($label == "Pending") { //go through Pending and strip out nid's that also in Awarded or Licenced
//Query for nid of patents that are awarded
$queryaward = db_select('node', 'node');
$queryaward->addField('node', 'nid');
$queryaward->condition("node.type", 'er_patent', '=');
$queryaward->innerJoin("field_data_field_er_patent_award_date", 'date', 'node.nid = date.entity_id');
$this->applyDateRange($queryaward, 'field_er_patent_award_date', $period);
//Query for nid of patents that are licensed
$querylicensed = db_select('node', 'node');
$querylicensed->addField('node', 'nid');
$querylicensed->condition("node.type", 'er_patent', '=');
$querylicensed->innerJoin("field_data_field_er_patent_date", 'date', 'node.nid = date.entity_id');
$this->applyDateRange($querylicensed, 'field_er_patent_date', $period);
//Do a union of above: this will return all patents that are either awarded or licensed
$mergedquery = $queryaward->union($querylicensed);
$result = $mergedquery->execute();
while ($tempvar = $result->fetchAssoc()){
$nidawardlicense[] = $tempvar;
}
if (!empty($nidawardlicense)){
//Now append a "NOT IN" to the query, so under section "Pending" only show patents that are not awarded or licensed
$query->condition('node.nid', $nidawardlicense , 'NOT IN');
}
}
$data[$label] = $this->generate_node_output($count, $query);
}
return $data;
I was working on Table E issues and started looking on the first item: Patents, which on our site had the following problem described here:
#15 (comment) so if a patent has the date fields Provisional Date, Award Date and License Date all filled, it would show up in all three rows in Table E, which is not correct. The correct is it should show up in "Awarded" and "Licensed" rows only (if those date fields have values in them). Here are the changes we are doing to our Patent content type and our outputs.inc file to solve this issue:
it currently labels Pending"=>'field_er_provisional_date' . Our PA says this is not right, the Pending status for a patent corresponds best to 'field_er_filing_date', so I changed that in our outputs.inc
` private function generate_patent_data($count, $period){
$data = array();
}
`