修改RIS中导入处格式处理的bug

This commit is contained in:
Li Jianxuan 2013-10-24 09:54:24 +00:00
parent dacbff71c5
commit a83c3ee18f
1 changed files with 7 additions and 9 deletions

View File

@ -140,7 +140,7 @@ class Ris
}
//将解析好的ris数据写入数据库
public function pushToDataTable($data,$create_ref=false){
public function pushToDataTable($data){
if(!is_array($data) || count($data) < 1)
{
@ -162,13 +162,6 @@ class Ris
$ref['ris'] = $this->makeRisData(array(0=>$this->ris_records[$k]));
$reference = $this->makeReferenceFlag($ref);
if ($create_ref)
{
$ref['reference'] = $reference;
}else{
$ref['reference'] = $ref['title'].'---'.date("Y-m-d H:i:s").".".microtime().rand();
}
$results = $this->events()->trigger('checkLoad', $this, compact('ref'));
$id = $results->bottom();
@ -179,8 +172,13 @@ class Ris
$this->events()->trigger('deleteAuthor', $this, compact('id'));
$this->events()->trigger('deleteTag', $this, compact('id'));
unset($ref['reference']);
$dbh->update($this->table->reference,$ref," id=$id ");
} else {
$ref['reference'] = $reference;
$id = $dbh->insert($this->table->reference,$ref,true);
}
@ -231,7 +229,7 @@ class Ris
//创建reference 字段
public function makeReferenceFlag($ref){
$str = array();
isset($ref['author']) ? $str[] = $ref['author']:"";
isset($ref['author']) ? $str[] = join(",",$ref['author']):"";
isset($ref['title']) ? $str[] = $ref['title']:"";
isset($ref['year']) ? $str[] = $ref['year']:"";
isset($ref['volume']) ? $str[] = $ref['volume']:"";