better support for entries without keys
This commit is contained in:
@@ -598,6 +598,20 @@ class BTBTest extends PHPUnit_Framework_TestCase {
|
|||||||
$this->assertFalse($first_entry->hasField('author'));
|
$this->assertFalse($first_entry->hasField('author'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testdefaultkey() {
|
||||||
|
bibtexbrowser_configure('BIBTEXBROWSER_BIBTEX_VIEW', 'original');
|
||||||
|
$bibtex = "@article{title={An article Book},author = {Martin Monperrus and Foo Ac\'e and Monperrus, Martin}}";
|
||||||
|
$key = md5($bibtex);
|
||||||
|
$test_data = fopen('php://memory','x+');
|
||||||
|
fwrite($test_data, $bibtex);
|
||||||
|
fseek($test_data,0);
|
||||||
|
$db = new BibDataBase();
|
||||||
|
$db->update_internal("inline", $test_data);
|
||||||
|
$entry=$db->getEntryByKey($key);
|
||||||
|
$this->assertEquals($bibtex, $entry->getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // end class
|
} // end class
|
||||||
|
|
||||||
@copy('bibtexbrowser.local.php.bak','bibtexbrowser.local.php');
|
@copy('bibtexbrowser.local.php.bak','bibtexbrowser.local.php');
|
||||||
|
|||||||
+1
-1
@@ -911,7 +911,7 @@ class BibDBBuilder extends ParserDelegate {
|
|||||||
|
|
||||||
// we add a key if there is no key
|
// we add a key if there is no key
|
||||||
if (!$this->currentEntry->hasField(Q_KEY) && $this->currentEntry->getType()!='string') {
|
if (!$this->currentEntry->hasField(Q_KEY) && $this->currentEntry->getType()!='string') {
|
||||||
$this->currentEntry->setField(Q_KEY,md5($this->currentEntry->getTitle().implode('',$this->currentEntry->getRawAuthors())));
|
$this->currentEntry->setField(Q_KEY,md5($entrysource));
|
||||||
}
|
}
|
||||||
|
|
||||||
// we set the fulltext
|
// we set the fulltext
|
||||||
|
|||||||
Reference in New Issue
Block a user