Beispiel #1
0
 public function getGiftPreparations($giftid)
 {
     $this->db->select('gp.GiftPreparationID, p.PreparationID, co.CollectionObjectID, co.CatalogNumber,
         pt.Name AS PrepType, p.CountAmt AS Quantity, pa.Text1 AS DuplicateString');
     $this->db->from('giftpreparation gp');
     $this->db->join('preparation p', 'gp.PreparationID=p.PreparationID');
     $this->db->join('preptype pt', 'p.PrepTypeID=pt.PrepTypeID');
     $this->db->join('preparationattribute pa', 'p.PreparationAttributeID=pa.PreparationAttributeID');
     $this->db->join('collectionobject co', 'p.CollectionObjectID=co.CollectionObjectID');
     $this->db->where('gp.giftID', $giftid);
     $query = $this->db->get();
     if ($query->num_rows()) {
         $giftpreps = array();
         foreach ($query->result() as $row) {
             $giftprep = new GiftPreparation();
             $giftprep->GiftPreparationID = $row->GiftPreparationID;
             $giftprep->PreparationID = $row->PreparationID;
             $giftprep->CatalogNumber = $row->CatalogNumber;
             $giftprep->PrepType = $row->PrepType;
             $giftprep->Quantity = $row->Quantity;
             $giftprep->DuplicateString = $row->DuplicateString;
             $giftprep->TaxonName = parent::getFormattedNameString($row->CollectionObjectID);
             if ($other = $this->getOtherGiftInfo($row->PreparationID)) {
                 $giftprep->QuantitySent = $other->QuantitySent;
                 $giftprep->DuplicatesSentTo = $other->DuplicatesSentTo;
             }
             $giftpreps[] = $giftprep;
         }
         return $giftpreps;
     } else {
         return FALSE;
     }
 }