Skip to content

Patent changes #63

@khuffman

Description

@khuffman

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:

  • we are making the Filing Date ('field_er_filing_date') field mandatory
  • our PA suggested that the field Disclosure Date(field_er_disclosure_date) is unnecessary/not needed, so we may remove it.
  • in outputs.inc https://github.com/EPSCoR/ERCore/blob/7.x-3.2/pages/outputs.inc#L62
    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
  • then in outputs.inc I rewrote function generate_patent_data() so if a patent node has award and/or license dates set, then the Pending row query excludes those nodes from being shown under Pending. Below is my new generate_patent_data() function, let me know if it works/doesn't work on your site.

` private function generate_patent_data($count, $period){
$data = array();

    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;

}

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions