mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Hints for imports
This commit is contained in:
parent
be22f4bde9
commit
628f63ffb2
@ -115,7 +115,7 @@ class CompanyUserController extends BaseController
|
||||
$auth_user = auth()->user();
|
||||
$company = $auth_user->company();
|
||||
|
||||
$company_user = CompanyUser::whereUserId($user->id)->whereCompanyId($company->id)->first();
|
||||
$company_user = CompanyUser::query()->where('user_id', $user->id)->where('company_id',$company->id)->first();
|
||||
|
||||
if (! $company_user) {
|
||||
throw new ModelNotFoundException(ctrans('texts.company_user_not_found'));
|
||||
@ -128,6 +128,11 @@ class CompanyUserController extends BaseController
|
||||
} else {
|
||||
$company_user->settings = $request->input('company_user')['settings'];
|
||||
$company_user->notifications = $request->input('company_user')['notifications'];
|
||||
|
||||
if(isset($request->input('company_user')['react_settings'])) {
|
||||
$company_user->react_settings = $request->input('company_user')['react_settings'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$company_user->save();
|
||||
|
@ -120,36 +120,49 @@ class ImportController extends Controller
|
||||
|
||||
|
||||
foreach($headers as $key => $value) {
|
||||
|
||||
$hit = false;
|
||||
$unsetKey = false;
|
||||
// array_multisort(array_column($translated_keys, 'label'), SORT_ASC, $translated_keys);
|
||||
|
||||
foreach($translated_keys as $tkey => $tvalue)
|
||||
{
|
||||
|
||||
if($this->testMatch($value, $tvalue['label'])) {
|
||||
$hit = $available_keys[$tvalue['key']];
|
||||
$unsetKey = $tkey;
|
||||
$hit = $tvalue['key'];
|
||||
$hints[$key] = $hit;
|
||||
unset($translated_keys[$tkey]);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
$hints[$key] = null;
|
||||
}
|
||||
// elseif($this->testMatch($value, $tvalue['index'])) {
|
||||
// $hit = $available_keys[$tvalue['key']];
|
||||
// $unsetKey = $tkey;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
if($hit) {
|
||||
$hints[$key] = $hit;
|
||||
unset($translated_keys[$unsetKey]);
|
||||
} else {
|
||||
$hints[$key] = null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
nlog($translated_keys);
|
||||
//second pass using the index of the translation here
|
||||
foreach($headers as $key => $value)
|
||||
{
|
||||
if(isset($hints[$key])) {
|
||||
nlog($hints[$key]);
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach($translated_keys as $tkey => $tvalue)
|
||||
{
|
||||
if($this->testMatch($value, $tvalue['index'])) {
|
||||
$hit = $tvalue['key'];
|
||||
$hints[$key] = $hit;
|
||||
unset($translated_keys[$tkey]);
|
||||
break;
|
||||
} else {
|
||||
$hints[$key] = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// nlog($translated_keys);
|
||||
|
||||
return $hints;
|
||||
}
|
||||
|
@ -25,7 +25,10 @@ class UpdateCompanyUserRequest extends Request
|
||||
*/
|
||||
public function authorize() : bool
|
||||
{
|
||||
return auth()->user()->isAdmin() || (auth()->user()->id == $this->user->id);
|
||||
/** @var \App\Models\User $auth_user */
|
||||
$auth_user = auth()->user();
|
||||
|
||||
return $auth_user->isAdmin() || ($auth_user->id == $this->user->id);
|
||||
}
|
||||
|
||||
public function rules()
|
||||
|
Loading…
x
Reference in New Issue
Block a user