Ejemplo n.º 1
0
 private static function saveRecord($data)
 {
     try {
         $org = new Default_Model_Organization();
         $org->identifier = $data["appdb_identifier"];
         $org->extIdentifier = $data["external_identifier"];
         $org->name = $data["legalname"];
         $org->shortname = $data["legalshortname"];
         $org->websiteurl = $data["websiteurl"];
         if (isset($data["country"]) && isset($data["country"]["id"]) && $data["country"]["id"] !== null) {
             $org->countryid = $data["country"]["id"];
         }
         if (isset($data["userid"])) {
             $org->addedbyID = $data["userid"];
         }
         $org->sourceid = 2;
         //OpenAire source
         $org->save();
     } catch (Exception $ex) {
         return $ex->getMessage();
     }
     return self::isRecordImported($org->identifier);
 }
Ejemplo n.º 2
0
 public function save(Default_Model_Organization $value)
 {
     global $application;
     $data = array();
     if (!isnull($value->getId())) {
         $data['id'] = $value->getId();
     }
     if (!isnull($value->getName())) {
         $data['name'] = $value->getName();
     }
     if (!isnull($value->getShortName())) {
         $data['shortname'] = $value->getShortName();
     }
     if (!isnull($value->getWebsiteURL())) {
         $data['websiteurl'] = $value->getWebsiteURL();
     }
     if (!isnull($value->getCountryID())) {
         $data['countryid'] = $value->getCountryID();
     }
     if (!isnull($value->getAddedOn())) {
         $data['addedon'] = $value->getAddedOn();
     }
     if (!isnull($value->getAddedByID())) {
         $data['addedby'] = $value->getAddedByID();
     }
     if (!isnull($value->getGuid())) {
         $data['guid'] = $value->getGuid();
     }
     if (!isnull($value->getIdentifier())) {
         $data['identifier'] = $value->getIdentifier();
     }
     if (!isnull($value->getSourceID())) {
         $data['sourceid'] = $value->getSourceID();
     }
     if (!isnull($value->getDeletedon())) {
         $data['deletedon'] = $value->getDeletedon();
     }
     if (!isnull($value->getDeletedByID())) {
         $data['deletedby'] = $value->getDeletedByID();
     }
     if (!isnull($value->getExtIdentifier())) {
         $data['ext_identifier'] = $value->getExtIdentifier();
     }
     if (!isnull($value->getModerated())) {
         $data['moderated'] = $this->pgBool($value->getModerated());
     }
     if (!isnull($value->getDeleted())) {
         $data['deleted'] = $this->pgBool($value->getDeleted());
     }
     $q1 = 'id = ?';
     $q2 = $value->id;
     if (null === ($id = $value->id)) {
         unset($data['id']);
         $value->id = $this->getDbTable()->insert($data);
     } else {
         $s = $this->getDbTable()->getAdapter()->quoteInto($q1, $q2);
         $this->getDbTable()->update($data, $s);
     }
 }