Revision 2057
Added by sgarg over 20 years ago
register-dataset.cgi | ||
---|---|---|
300 | 300 |
my $userPass = $FORM::password; |
301 | 301 |
my $dname = "uid=$userDN,o=$userOrg,dc=ecoinformatics,dc=org"; |
302 | 302 |
|
303 |
my $xmldocWithDocID = $xmldoc; |
|
304 |
|
|
303 | 305 |
my $errorMessage = ""; |
304 | 306 |
my $response = $metacat->login($dname, $userPass); |
305 | 307 |
if (! $response) { |
... | ... | |
315 | 317 |
while ($notunique eq "NOT_UNIQUE") { |
316 | 318 |
$docid = newAccessionNumber($defaultScope); |
317 | 319 |
|
318 |
$xmldoc =~ s/docid/$docid/; |
|
319 |
|
|
320 |
$xmldocWithDocID = $xmldoc; |
|
321 |
$xmldocWithDocID =~ s/docid/$docid/; |
|
322 |
|
|
320 | 323 |
#my $testFile = "/tmp/test.xml"; |
321 | 324 |
#open (TFILE,">$testFile") || die ("Cant open xml file...\n"); |
322 | 325 |
#print TFILE $xmldoc; |
323 | 326 |
#close(TFILE); |
324 | 327 |
|
325 |
$notunique = insertMetadata($xmldoc, $docid); |
|
328 |
$notunique = insertMetadata($xmldocWithDocID, $docid);
|
|
326 | 329 |
# if (!$notunique) { |
327 | 330 |
# Write out the XML file for debugging purposes |
328 | 331 |
#my $testFile = $tmpdir . "/test-new.xml"; |
Also available in: Unified diff
Fixed a bug which doesn't occur everytime. The bug occurs when lastid in (cfg).lastid is not unique. i.e. there is already a document in the server which has same docid. The earlier algorithm was:
while(not unique){
get accession number;
update accession number written in document; (BUG)
insertDocument;
if error do update last id and then do again.
}
The bug was that the statement replaced the docid in the xml document only the first time - not every time the loop was executed.
Hence it resulted in documents which had docid written inside them different then the docid with which they were inserted into the system.
This is fixed now.