mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Make Codacy happy by reversing the signature params
This commit is contained in:
parent
684a892e8b
commit
7a9a78ec53
|
@ -600,25 +600,25 @@ class AssetsController extends Controller
|
|||
if ($asset = Asset::where('asset_tag', '=', $asset_tag)->first()) {
|
||||
$item[$asset_tag][$batch_counter]['asset_id'] = $asset->id;
|
||||
|
||||
$base_username = User::generateFormattedNameFromFullName(Setting::getSettings()->username_format, $item[$asset_tag][$batch_counter]['name']);
|
||||
$base_username = User::generateFormattedNameFromFullName($item[$asset_tag][$batch_counter]['name'], Setting::getSettings()->username_format);
|
||||
$user = User::where('username', '=', $base_username['username']);
|
||||
$user_query = ' on username '.$base_username['username'];
|
||||
|
||||
if ($request->input('match_firstnamelastname')=='1') {
|
||||
$firstnamedotlastname = User::generateFormattedNameFromFullName('firstname.lastname', $item[$asset_tag][$batch_counter]['name']);
|
||||
$firstnamedotlastname = User::generateFormattedNameFromFullName($item[$asset_tag][$batch_counter]['name'], 'firstname.lastname');
|
||||
$item[$asset_tag][$batch_counter]['username'][] = $firstnamedotlastname['username'];
|
||||
$user->orWhere('username', '=', $firstnamedotlastname['username']);
|
||||
$user_query .= ', or on username '.$firstnamedotlastname['username'];
|
||||
}
|
||||
|
||||
if ($request->input('match_flastname')=='1') {
|
||||
$flastname = User::generateFormattedNameFromFullName('filastname', $item[$asset_tag][$batch_counter]['name']);
|
||||
$flastname = User::generateFormattedNameFromFullName( $item[$asset_tag][$batch_counter]['name'], 'filastname');
|
||||
$item[$asset_tag][$batch_counter]['username'][] = $flastname['username'];
|
||||
$user->orWhere('username', '=', $flastname['username']);
|
||||
$user_query .= ', or on username '.$flastname['username'];
|
||||
}
|
||||
if ($request->input('match_firstname')=='1') {
|
||||
$firstname = User::generateFormattedNameFromFullName('firstname', $item[$asset_tag][$batch_counter]['name']);
|
||||
$firstname = User::generateFormattedNameFromFullName( $item[$asset_tag][$batch_counter]['name'], 'firstname');
|
||||
$item[$asset_tag][$batch_counter]['username'][] = $firstname['username'];
|
||||
$user->orWhere('username', '=', $firstname['username']);
|
||||
$user_query .= ', or on username '.$firstname['username'];
|
||||
|
|
|
@ -281,7 +281,7 @@ abstract class Importer
|
|||
$user_array['email'] = User::generateEmailFromFullName($user_array['full_name']);
|
||||
}
|
||||
|
||||
$user_formatted_array = User::generateFormattedNameFromFullName(Setting::getSettings()->username_format, $user_array['full_name']);
|
||||
$user_formatted_array = User::generateFormattedNameFromFullName($user_array['full_name'], Setting::getSettings()->username_format);
|
||||
$user_array['first_name'] = $user_formatted_array['first_name'];
|
||||
$user_array['last_name'] = $user_formatted_array['last_name'];
|
||||
if (empty($user_array['username'])) {
|
||||
|
|
|
@ -352,11 +352,11 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
|||
|
||||
public static function generateEmailFromFullName($name)
|
||||
{
|
||||
$username = User::generateFormattedNameFromFullName(Setting::getSettings()->email_format, $name);
|
||||
$username = User::generateFormattedNameFromFullName($name, Setting::getSettings()->email_format);
|
||||
return $username['username'].'@'.Setting::getSettings()->email_domain;
|
||||
}
|
||||
|
||||
public static function generateFormattedNameFromFullName($format = 'filastname', $users_name)
|
||||
public static function generateFormattedNameFromFullName($users_name, $format = 'filastname')
|
||||
{
|
||||
|
||||
// If there was only one name given
|
||||
|
|
|
@ -33,7 +33,7 @@ class UserTest extends BaseTest
|
|||
$fullname = "Natalia Allanovna Romanova-O'Shostakova";
|
||||
$expected_firstname = 'Natalia';
|
||||
$expected_lastname = "Allanovna Romanova-O'Shostakova";
|
||||
$user = User::generateFormattedNameFromFullName('firstname', $fullname);
|
||||
$user = User::generateFormattedNameFromFullName($fullname, 'firstname');
|
||||
$this->assertEquals($expected_firstname, $user['first_name']);
|
||||
$this->assertEquals($expected_lastname, $user['last_name']);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class UserTest extends BaseTest
|
|||
{
|
||||
$fullname = "Natalia Allanovna Romanova-O'Shostakova";
|
||||
$expected_username = 'natalia';
|
||||
$user = User::generateFormattedNameFromFullName('firstname', $fullname);
|
||||
$user = User::generateFormattedNameFromFullName($fullname, 'firstname');
|
||||
$this->assertEquals($expected_username, $user['username']);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ class UserTest extends BaseTest
|
|||
{
|
||||
$fullname = "Natalia Allanovna Romanova-O'Shostakova";
|
||||
$expected_username = 'natalia.allanovna-romanova-oshostakova';
|
||||
$user = User::generateFormattedNameFromFullName('firstname.lastname', $fullname);
|
||||
$user = User::generateFormattedNameFromFullName($fullname, 'firstname.lastname');
|
||||
$this->assertEquals($expected_username, $user['username']);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ class UserTest extends BaseTest
|
|||
{
|
||||
$fullname = "Natalia Allanovna Romanova-O'Shostakova";
|
||||
$expected_username = 'allanovna-romanova-oshostakovan';
|
||||
$user = User::generateFormattedNameFromFullName('lastnamefirstinitial', $fullname);
|
||||
$user = User::generateFormattedNameFromFullName($fullname, 'lastnamefirstinitial');
|
||||
$this->assertEquals($expected_username, $user['username']);
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ class UserTest extends BaseTest
|
|||
{
|
||||
$fullname = "Natalia Allanovna Romanova-O'Shostakova";
|
||||
$expected_username = 'nallanovna-romanova-oshostakova';
|
||||
$user = User::generateFormattedNameFromFullName('filastname', $fullname);
|
||||
$user = User::generateFormattedNameFromFullName($fullname, 'filastname');
|
||||
$this->assertEquals($expected_username, $user['username']);
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ class UserTest extends BaseTest
|
|||
{
|
||||
$fullname = "Natalia Allanovna Romanova-O'Shostakova";
|
||||
$expected_username = 'natalia_allanovna-romanova-oshostakova';
|
||||
$user = User::generateFormattedNameFromFullName('firstname_lastname', $fullname);
|
||||
$user = User::generateFormattedNameFromFullName($fullname, 'firstname_lastname');
|
||||
$this->assertEquals($expected_username, $user['username']);
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ class UserTest extends BaseTest
|
|||
{
|
||||
$fullname = "Natalia";
|
||||
$expected_username = 'natalia';
|
||||
$user = User::generateFormattedNameFromFullName('firstname_lastname', $fullname);
|
||||
$user = User::generateFormattedNameFromFullName($fullname, 'firstname_lastname');
|
||||
$this->assertEquals($expected_username, $user['username']);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue