user: allow up to 40 characters for dect numbers

closes #309 (EPVPN number in DECT field is shortened)
closes #529 (For dect numbers are only 5 digits allowed)
main
Igor Scheller 6 years ago committed by msquare
parent 330356043d
commit b1d8fede46

@ -0,0 +1,47 @@
<?php
namespace Engelsystem\Migrations;
use Engelsystem\Database\Migration\Migration;
use Illuminate\Database\Schema\Blueprint;
class ChangeUsersContactDectFieldSize extends Migration
{
/** @var array */
protected $tables = [
'AngelTypes' => '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();
});
}
}
}

@ -55,7 +55,7 @@ function admin_user()
$html .= ' <tr><td>Name</td><td>' . '<input size="40" name="eName" value="' . $user_source->personalData->last_name . '" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>Vorname</td><td>' . '<input size="40" name="eVorname" value="' . $user_source->personalData->first_name . '" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>Handy</td><td>' . '<input type= "tel" size="40" name="eHandy" value="' . $user_source->contact->mobile . '" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>DECT</td><td>' . '<input size="4" name="eDECT" value="' . $user_source->contact->dect . '" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>DECT</td><td>' . '<input size="40" name="eDECT" value="' . $user_source->contact->dect . '" class="form-control"></td></tr>' . "\n";
if ($user_source->settings->email_human) {
$html .= " <tr><td>email</td><td>" . '<input type="email" size="40" name="eemail" value="' . $user_source->email . '" class="form-control"></td></tr>' . "\n";
}

@ -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')) {

@ -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']);

@ -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!"

@ -32,7 +32,7 @@ class UserTest extends TestCase
Contact::class,
'contact',
[
'dect' => '1234',
'dect' => '1234567',
'email' => 'foo@bar.batz',
'mobile' => '1234/12341234',
]

Loading…
Cancel
Save