diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php
index 40ef7aef..5a4fc2f4 100644
--- a/Web/Models/Entities/User.php
+++ b/Web/Models/Entities/User.php
@@ -348,10 +348,11 @@ class User extends RowModel
return $this->getRecord()->marital_status;
}
- function getLocalizedMaritalStatus(): string
+ function getLocalizedMaritalStatus(?bool $prefix = false): string
{
$status = $this->getMaritalStatus();
$string = "relationship_$status";
+ if ($prefix) $string .= "_prefix";
if($this->isFemale()) {
$res = tr($string . "_fem");
if($res != ("@" . $string . "_fem"))
@@ -361,6 +362,17 @@ class User extends RowModel
return tr($string);
}
+ function getMaritalStatusUser(): ?User
+ {
+ if (!$this->getRecord()->marital_status_user) return NULL;
+ return (new Users)->get($this->getRecord()->marital_status_user);
+ }
+
+ function getMaritalStatusUserPrefix(): ?string
+ {
+ return $this->getLocalizedMaritalStatus(true);
+ }
+
function getContactEmail(): ?string
{
return $this->getRecord()->email_contact;
diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php
index 56d5685b..3097115f 100644
--- a/Web/Presenters/UserPresenter.php
+++ b/Web/Presenters/UserPresenter.php
@@ -166,6 +166,19 @@ final class UserPresenter extends OpenVKPresenter
if ($this->postParam("marialstatus") <= 8 && $this->postParam("marialstatus") >= 0)
$user->setMarital_Status($this->postParam("marialstatus"));
+
+ if ($this->postParam("maritalstatus-user")) {
+ if (in_array((int) $this->postParam("marialstatus"), [0, 1, 8])) {
+ $user->setMarital_Status_User(NULL);
+ } else {
+ $mUser = (new Users)->getByAddress($this->postParam("maritalstatus-user"));
+ if ($mUser) {
+ if ($mUser->getId() !== $this->user->id) {
+ $user->setMarital_Status_User($mUser->getId());
+ }
+ }
+ }
+ }
if ($this->postParam("politViews") <= 9 && $this->postParam("politViews") >= 0)
$user->setPolit_Views($this->postParam("politViews"));
diff --git a/Web/Presenters/templates/User/Edit.xml b/Web/Presenters/templates/User/Edit.xml
index 0a28b879..fef8a109 100644
--- a/Web/Presenters/templates/User/Edit.xml
+++ b/Web/Presenters/templates/User/Edit.xml
@@ -101,7 +101,7 @@
{_relationship}:
- |
+
+ |
+
+
+ |
+
{_politViews}:
|
-
-
-
-
-
-
-
-
-
-
-
+
|
@@ -178,6 +178,17 @@
+
{elseif $isContacts}
diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml
index f5cb6176..cb35102a 100644
--- a/Web/Presenters/templates/User/View.xml
+++ b/Web/Presenters/templates/User/View.xml
@@ -456,7 +456,15 @@
{_relationship}: |
- {$user->getLocalizedMaritalStatus()} |
+
+ {$user->getLocalizedMaritalStatus()}
+ {if $user->getMaritalStatusUser()}
+ {$user->getMaritalStatusUserPrefix()}
+
+ {$user->getMaritalStatusUser()->getCanonicalName()}
+
+ {/if}
+ |
{_registration_date}: |
diff --git a/install/sqls/00038-marital-status-user.sql b/install/sqls/00038-marital-status-user.sql
new file mode 100644
index 00000000..f512ebc3
--- /dev/null
+++ b/install/sqls/00038-marital-status-user.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `profiles`
+ ADD `marital_status_user` BIGINT UNSIGNED NULL DEFAULT NULL AFTER `marital_status`;
diff --git a/locales/en.strings b/locales/en.strings
index ce4e53a2..69eeb3b0 100644
--- a/locales/en.strings
+++ b/locales/en.strings
@@ -113,6 +113,14 @@
"relationship_7" = "Everything is complicated";
"relationship_8" = "Actively searching";
+/* xd */
+"relationship_2_prefix" = "with";
+"relationship_3_prefix" = "with";
+"relationship_4_prefix" = "with";
+"relationship_5_prefix" = "with";
+"relationship_6_prefix" = "with";
+"relationship_7_prefix" = "with";
+
"politViews" = "Polit. Views";
"politViews_0" = "Not Selected";
diff --git a/locales/ru.strings b/locales/ru.strings
index 63f40462..42eadc6f 100644
--- a/locales/ru.strings
+++ b/locales/ru.strings
@@ -103,6 +103,13 @@
"relationship_3_fem" = "Помолвлена";
"relationship_4_fem" = "Замужем";
"relationship_6_fem" = "Влюблена";
+"relationship_2_prefix" = "с";
+"relationship_3_prefix" = "с";
+"relationship_4_prefix" = "на";
+"relationship_4_prefix_fem" = "за";
+"relationship_5_prefix" = "с";
+"relationship_6_prefix" = "в";
+"relationship_7_prefix" = "с";
"politViews" = "Полит. взгляды";
"politViews_0" = "Не выбраны";
"politViews_1" = "Индифферентные";