Exemplo n.º 1
0
 static function getCoupleDonationData($id, $start_cycle, $end_cycle)
 {
     list($id1, $id2) = EntityTable::getPartnerIds($id);
     $db = Doctrine_Manager::connection();
     $select = "SELECT e.id as donor_id, e.name as donor_name, e.primary_ext as donor_ext, " . "e2.id as recipient_id, e2.name as recipient_name, e2.primary_ext as recipient_ext, " . "f.amount as amt, f.crp_cycle, p2.party_id ";
     $from = "FROM entity e LEFT JOIN relationship r ON r.entity1_id = e.id " . "LEFT JOIN fec_filing f ON f.relationship_id = r.id " . "LEFT JOIN entity e2 ON e2.id = r.entity2_id " . "LEFT JOIN person p2 ON p2.entity_id = e2.id ";
     $where = "WHERE r.category_id = 5 AND r.is_deleted=0 AND f.crp_cycle IS NOT NULL " . "AND e.id IN (?, ?) AND e2.id NOT IN (?, ?) AND f.crp_cycle >= ? AND f.crp_cycle <= ? ";
     $sql = $select . $from . $where . "GROUP BY f.id";
     $stmt = $db->execute($sql, array($id1, $id2, $id1, $id2, $start_cycle, $end_cycle));
     return $stmt->fetchAll();
 }
Exemplo n.º 2
0
 public function executeView($request)
 {
     $this->checkEntity($request);
     if ($this->entity['primary_ext'] == 'Couple') {
         list($partner1_id, $partner2_id) = EntityTable::getPartnerIds($this->entity['id']);
         $this->entity['partner1'] = Doctrine::getTable('Entity')->find($partner1_id);
         $this->entity['partner2'] = Doctrine::getTable('Entity')->find($partner2_id);
     }
     $this->logRecentView();
     $this->tab_name = 'relationships';
 }