mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 09:27:19 +02:00
108624154-func_modification
This commit is contained in:
parent
5f7e4bc77e
commit
7ae2adbb5e
1 changed files with 12 additions and 5 deletions
|
@ -45,12 +45,15 @@ class AddIdentAutofill < ActiveRecord::Migration
|
|||
END LOOP;
|
||||
mod := (total % 11);
|
||||
END IF;
|
||||
|
||||
IF (mod < 10 AND substring(r.ident, 11, 1) = to_char(mod, 'FM999MI'))
|
||||
IF (mod = 10)
|
||||
THEN
|
||||
mod := 0;
|
||||
END IF;
|
||||
IF (substring(r.ident, 11, 1) = to_char(mod, 'FM999MI'))
|
||||
THEN
|
||||
UPDATE contacts SET ident_country_code = 'EE' WHERE id = r.id;
|
||||
END IF;
|
||||
total = 0;
|
||||
total := 0;
|
||||
END IF;
|
||||
END LOOP;
|
||||
|
||||
|
@ -66,7 +69,7 @@ class AddIdentAutofill < ActiveRecord::Migration
|
|||
counter := (counter + 1);
|
||||
END LOOP;
|
||||
mod := total % 11;
|
||||
total = 0;
|
||||
total := 0;
|
||||
counter := 1;
|
||||
IF (mod >= 10)
|
||||
THEN
|
||||
|
@ -78,7 +81,11 @@ class AddIdentAutofill < ActiveRecord::Migration
|
|||
END LOOP;
|
||||
mod := (total % 11);
|
||||
END IF;
|
||||
IF (mod < 10 AND (substring(r.ident, 8, 1) = to_char(mod, 'FM999MI')))
|
||||
IF (mod = 10)
|
||||
THEN
|
||||
mod := 0;
|
||||
END IF;
|
||||
IF (substring(r.ident, 8, 1) = to_char(mod, 'FM999MI'))
|
||||
THEN
|
||||
UPDATE contacts SET ident_country_code = 'EE' WHERE id = r.id;
|
||||
END IF;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue