diff --git a/db/migrations/2018_12_21_000000_change_users_contact_dect_field_size.php b/db/migrations/2018_12_21_000000_change_users_contact_dect_field_size.php new file mode 100644 index 00000000..0478b138 --- /dev/null +++ b/db/migrations/2018_12_21_000000_change_users_contact_dect_field_size.php @@ -0,0 +1,47 @@ + 'contact_dect', + 'users_contact' => 'dect', + ]; + + /** + * Run the migration + */ + public function up() + { + $this->changeDectTo(40); + } + + /** + * Reverse the migration + */ + public function down() + { + $this->changeDectTo(5); + } + + /** + * @param int $length + */ + protected function changeDectTo(int $length) + { + foreach ($this->tables as $table => $column) { + if (!$this->schema->hasTable($table)) { + continue; + } + + $this->schema->table($table, function (Blueprint $table) use ($column, $length) { + $table->string($column, $length)->change(); + }); + } + } +} diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index 63993fc9..4e0fd24b 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -55,7 +55,7 @@ function admin_user() $html .= ' Name' . '' . "\n"; $html .= ' Vorname' . '' . "\n"; $html .= ' Handy' . '' . "\n"; - $html .= ' DECT' . '' . "\n"; + $html .= ' DECT' . '' . "\n"; if ($user_source->settings->email_human) { $html .= " email" . '' . "\n"; } diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php index 2df09d79..1b16333f 100644 --- a/includes/pages/guest_login.php +++ b/includes/pages/guest_login.php @@ -168,11 +168,11 @@ function guest_register() $preName = strip_request_item('prename'); } if ($request->has('dect')) { - if (strlen(strip_request_item('dect')) <= 5) { + if (strlen(strip_request_item('dect')) <= 40) { $dect = strip_request_item('dect'); } else { $valid = false; - error(__('For dect numbers are only 5 digits allowed.')); + error(__('For dect numbers are only 40 digits allowed.')); } } if ($request->has('mobile')) { diff --git a/includes/pages/user_settings.php b/includes/pages/user_settings.php index c39c0ef7..9099f658 100644 --- a/includes/pages/user_settings.php +++ b/includes/pages/user_settings.php @@ -72,11 +72,11 @@ function user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes) // Trivia $user_source->personalData->last_name = strip_request_item('lastname', $user_source['Name']); $user_source->personalData->first_name = strip_request_item('prename', $user_source['Vorname']); - if (strlen(strip_request_item('dect')) <= 5) { + if (strlen(strip_request_item('dect')) <= 40) { $user_source->contact->dect = strip_request_item('dect', $user_source['DECT']); } else { $valid = false; - error(__('For dect numbers are only 5 digits allowed.')); + error(__('For dect numbers are only 40 digits allowed.')); } $user_source->contact->mobile = strip_request_item('mobile', $user_source['Handy']); diff --git a/resources/lang/de_DE.UTF-8/LC_MESSAGES/default.mo b/resources/lang/de_DE.UTF-8/LC_MESSAGES/default.mo index a1765a6b..7411a1be 100644 Binary files a/resources/lang/de_DE.UTF-8/LC_MESSAGES/default.mo and b/resources/lang/de_DE.UTF-8/LC_MESSAGES/default.mo differ diff --git a/resources/lang/de_DE.UTF-8/LC_MESSAGES/default.po b/resources/lang/de_DE.UTF-8/LC_MESSAGES/default.po index 263d1641..3f54c381 100644 --- a/resources/lang/de_DE.UTF-8/LC_MESSAGES/default.po +++ b/resources/lang/de_DE.UTF-8/LC_MESSAGES/default.po @@ -1577,8 +1577,8 @@ msgstr "" #: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:190 #: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_settings.php:85 -msgid "For dect numbers are only 5 digits allowed." -msgstr "Die DECT Nummer darf nur 5 Zeichen lang sein." +msgid "For dect numbers are only 40 digits allowed." +msgstr "Die DECT Nummer darf nur 40 Zeichen lang sein." #: /Users/msquare/workspace/projects/engelsystem/includes/pages/guest_login.php:274 msgid "Angel registration successful!" diff --git a/tests/Unit/Models/User/UserTest.php b/tests/Unit/Models/User/UserTest.php index c30f7761..9e967892 100644 --- a/tests/Unit/Models/User/UserTest.php +++ b/tests/Unit/Models/User/UserTest.php @@ -32,7 +32,7 @@ class UserTest extends TestCase Contact::class, 'contact', [ - 'dect' => '1234', + 'dect' => '1234567', 'email' => 'foo@bar.batz', 'mobile' => '1234/12341234', ]