diff --git a/migration/20.03/2003.sql b/migration/20.03/2003.sql index 48fff5a64b89d756e4771bffc28c9607502acdf7..1d239a975b1155e1c6b2e250583df88c028292fd 100755 --- a/migration/20.03/2003.sql +++ b/migration/20.03/2003.sql @@ -378,6 +378,11 @@ DO $$ BEGIN END IF; END$$; +UPDATE res_letterbox SET exp_user_id = NULL WHERE exp_user_id = '0'; +UPDATE res_letterbox SET exp_contact_id = NULL WHERE exp_contact_id = 0; +UPDATE res_letterbox SET dest_user_id = NULL WHERE dest_user_id = '0'; +UPDATE res_letterbox SET dest_contact_id = NULL WHERE dest_contact_id = 0; + DO $$ BEGIN IF (SELECT count(attname) FROM pg_attribute WHERE attrelid = (SELECT oid FROM pg_class WHERE relname = 'res_letterbox') AND attname = 'external_signatory_book_id') = 1 THEN UPDATE res_letterbox SET external_id = jsonb_set(external_id, '{signatureBookId}', external_signatory_book_id::text::jsonb) WHERE external_signatory_book_id IS NOT NULL; diff --git a/migration/20.03/migrateContacts.php b/migration/20.03/migrateContacts.php index fa85fb3202522bac6caa8ff552a8aade07b107a1..06a5d27a7fe294c47097015242cc1ef0dd9e7730 100644 --- a/migration/20.03/migrateContacts.php +++ b/migration/20.03/migrateContacts.php @@ -592,6 +592,9 @@ function migrateResletterbox_Users($args = []) $login = $value['dest_user_id']; $mode = 'recipient'; } + if (empty($login)) { + continue; + } $user = \User\models\UserModel::getByLogin(['login' => $login, 'select' => ['id']]); if (empty($user)) { $user = $args['firstManId'];