In a BEFORE trigger, the NEW value for an AUTO_INCREMENT column is 0,
not the sequence number that is generated automatically when the new row
actually is inserted.

We replace those values with "IFNULL(value, 0);"
Merge branch 'master' of git@github.com:Tesora/tesora-dve-pub.git