Very interesting, thanks for the
feedback.
For the "
last digit as a checksum" part I found this implementation:
http://wiki.postgresql.org/wiki/Luhn_algorithm
With those functions in postgresql you can define the default for
the SKU column:
For example:
- to generate SKU on saving
ALTER TABLE m_product ALTER sku SET DEFAULT
ltrim(to_char(luhn_generate(round(random()*10000)::int), '00000'))
- to generate SKY as default on product window, define the default
for column SKU as:
@SQL=select
ltrim(to_char(luhn_generate(round(random()*10000)::int), '00000'))
Regards,
Carlos Ruiz