예제 #1
0
 /**
  * Transfer data from one version to another
  *
  * @return  boolean
  */
 public function transferData($manifest, $pub, $oldVersion, $newVersion)
 {
     // Get authors
     if (!isset($pub->_authors)) {
         $pAuthors = new \Components\Publications\Tables\Author($this->_parent->_db);
         $pub->_authors = $pAuthors->getAuthors($pub->version_id);
         $pub->_submitter = $pAuthors->getSubmitter($pub->version_id, $pub->created_by);
     }
     if (!$pub->_authors) {
         return false;
     }
     foreach ($pub->_authors as $author) {
         $pAuthor = new \Components\Publications\Tables\Author($this->_parent->_db);
         $pAuthor->user_id = $author->user_id;
         $pAuthor->ordering = $author->ordering;
         $pAuthor->credit = $author->credit;
         $pAuthor->role = $author->role;
         $pAuthor->status = $author->status;
         $pAuthor->organization = $author->organization;
         $pAuthor->name = $author->name;
         $pAuthor->project_owner_id = $author->project_owner_id;
         $pAuthor->publication_version_id = $newVersion->id;
         $pAuthor->created = Date::toSql();
         $pAuthor->created_by = User::get('id');
         if (!$pAuthor->createAssociation()) {
             continue;
         }
     }
     return true;
 }