mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #3977 from turbo124/v2
Fix for regression on refresh route
This commit is contained in:
commit
049b778d5f
@ -20,9 +20,7 @@ class NinjaTranslator extends Translator
|
|||||||
list($namespace, $group, $item) = $this->parseKey($key);
|
list($namespace, $group, $item) = $this->parseKey($key);
|
||||||
|
|
||||||
if(null === $locale)
|
if(null === $locale)
|
||||||
{
|
|
||||||
$locale = $this->locale;
|
$locale = $this->locale;
|
||||||
}
|
|
||||||
|
|
||||||
// Load given group defaults if exists
|
// Load given group defaults if exists
|
||||||
$this->load($namespace, $group, $locale);
|
$this->load($namespace, $group, $locale);
|
||||||
|
@ -242,11 +242,14 @@ class LoginController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function refresh(Request $request)
|
public function refresh(Request $request)
|
||||||
{
|
{
|
||||||
$company_token = CompanyToken::whereRaw("BINARY `token`= ?", [$request->header('X-API-TOKEN')])
|
$company_token = CompanyToken::whereRaw("BINARY `token`= ?", [$request->header('X-API-TOKEN')])->first();
|
||||||
->first();
|
|
||||||
|
$cu = CompanyUser::query()
|
||||||
|
->where('user_id', $company_token->user_id)
|
||||||
|
->where('company_id', $company_token->company_id);
|
||||||
|
|
||||||
//$ct = CompanyUser::whereUserId(auth()->user()->id);
|
//$ct = CompanyUser::whereUserId(auth()->user()->id);
|
||||||
return $this->refreshResponse($company_token->company_user());
|
return $this->refreshResponse($cu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,6 +34,8 @@ class DocumentController extends BaseController
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
|
$this->middleware('password_protected', ['only' => ['destroy']]);
|
||||||
|
|
||||||
$this->document_repo = $document_repo;
|
$this->document_repo = $document_repo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,6 +119,7 @@ class DocumentController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function destroy(DestroyDocumentRequest $request, Document $document)
|
public function destroy(DestroyDocumentRequest $request, Document $document)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->document_repo->delete($document);
|
$this->document_repo->delete($document);
|
||||||
|
|
||||||
return response()->json(['message'=>'success']);
|
return response()->json(['message'=>'success']);
|
||||||
|
@ -50,8 +50,8 @@ class QueryLogging
|
|||||||
|
|
||||||
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
|
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
|
||||||
|
|
||||||
// if($count > 700)
|
// if($count > 100)
|
||||||
// Log::info($queries);
|
// Log::info($queries);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,28 +64,17 @@ class ActivityRepository extends BaseRepository
|
|||||||
{
|
{
|
||||||
$backup = new Backup();
|
$backup = new Backup();
|
||||||
|
|
||||||
// if(get_class($entity) == Client::class)
|
// if (get_class($entity) == Client::class) {
|
||||||
// $settings = $entity->getMergedSettings();
|
// $entity->load('company');
|
||||||
// else
|
// } elseif (get_class($entity) == User::class) {
|
||||||
// $settings = $entity->client->getMergedSettings();
|
// } else {
|
||||||
// $entity->clientMergedDettings = $settings;
|
// $entity->load('company', 'client');
|
||||||
|
// }
|
||||||
if (get_class($entity) == Client::class) {
|
|
||||||
$entity->load('company');
|
|
||||||
} elseif (get_class($entity) == User::class) {
|
|
||||||
} else {
|
|
||||||
$entity->load('company', 'client');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (get_class($entity) == Invoice::class && ($activity->activity_type_id == Activity::MARK_SENT_INVOICE || $activity->activity_type_id == Activity::PAID_INVOICE)) {
|
|
||||||
//$backup->html_backup = $this->generateInvoiceHtml($entity->design(), $entity);
|
|
||||||
$backup->html_backup = $this->generateEntityHtml($entity->getEntityDesigner(), $entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
$backup->html_backup = $this->generateEntityHtml($entity->getEntityDesigner(), $entity);
|
||||||
$backup->activity_id = $activity->id;
|
$backup->activity_id = $activity->id;
|
||||||
$backup->json_backup = $entity->toJson();
|
$backup->json_backup = '';
|
||||||
|
//$backup->json_backup = $entity->toJson();
|
||||||
$backup->save();
|
$backup->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +252,6 @@ class BaseRepository
|
|||||||
|
|
||||||
/* Get array of Keys which have been removed from the invitations array and soft delete each invitation */
|
/* Get array of Keys which have been removed from the invitations array and soft delete each invitation */
|
||||||
$model->invitations->pluck('key')->diff($invitations->pluck('key'))->each(function ($invitation) use($resource){
|
$model->invitations->pluck('key')->diff($invitations->pluck('key'))->each(function ($invitation) use($resource){
|
||||||
// $this->getInvitation($invitation, $resource)->delete();
|
|
||||||
|
|
||||||
$invitation_class = sprintf("App\\Models\\%sInvitation", $resource);
|
$invitation_class = sprintf("App\\Models\\%sInvitation", $resource);
|
||||||
$invitation = $invitation_class::whereRaw("BINARY `key`= ?", [$invitation])->first();
|
$invitation = $invitation_class::whereRaw("BINARY `key`= ?", [$invitation])->first();
|
||||||
|
@ -102,6 +102,9 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a
|
|||||||
|
|
||||||
Route::post('migration/purge/{company}', 'MigrationController@purgeCompany')->middleware('password_protected');
|
Route::post('migration/purge/{company}', 'MigrationController@purgeCompany')->middleware('password_protected');
|
||||||
Route::post('migration/purge_save_settings/{company}', 'MigrationController@purgeCompanySaveSettings')->middleware('password_protected');
|
Route::post('migration/purge_save_settings/{company}', 'MigrationController@purgeCompanySaveSettings')->middleware('password_protected');
|
||||||
|
Route::post('companies/purge/{company}', 'MigrationController@purgeCompany')->middleware('password_protected');
|
||||||
|
Route::post('companies/purge_save_settings/{company}', 'MigrationController@purgeCompanySaveSettings')->middleware('password_protected');
|
||||||
|
|
||||||
Route::post('migration/start/{company}', 'MigrationController@startMigration');
|
Route::post('migration/start/{company}', 'MigrationController@startMigration');
|
||||||
|
|
||||||
Route::resource('companies', 'CompanyController');// name = (companies. index / create / show / update / destroy / edit
|
Route::resource('companies', 'CompanyController');// name = (companies. index / create / show / update / destroy / edit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user