Address maintain_control_numbers() database function bug #677160
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 20 Nov 2010 19:56:10 +0000 (19:56 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 20 Nov 2010 19:56:10 +0000 (19:56 +0000)
commitbfd937f915a266f42754db7791c0a39d14cf254a
treedda489b3848d8c32a9e08596f893679344a9cf63
parentcdf58458fe7549fb3b4e9e23841551ea8fa0e5c9
Address maintain_control_numbers() database function bug #677160

Jason Stephenson reported a bug handling records with multiple
001 or 003 fields, and supplied a set of test records to
reproduce the condition. The bug caused the ingest process
to throw a database error, rolling back the transaction and
preventing the actual ingest of those records.

The solution was to simplify the logic in maintain_control_numbers().
Now, in the case that there are either multiple 001s or 003s in the
incoming record, we simply delete all of the 003s and 001s and
create the desired 001 and 003. Also, if there are not exactly one
001 and one 003 in the incoming record, we do not try to preserve
one of those values in the 035 as it would be close to meaningless.

Many thanks to Jason for the clear bug report and test cases!

git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_2_0@18811 dcc99617-32d9-48b4-a31d-7c20da2025e4
Open-ILS/src/sql/Pg/002.functions.config.sql
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql
Open-ILS/src/sql/Pg/upgrade/0465.function.maintain_control_numbers.sql [new file with mode: 0644]