mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 14:04:40 -04:00
Delete files when canceling import
This commit is contained in:
parent
bbdaeb05d2
commit
ebfb76bfac
@ -134,4 +134,19 @@ class ImportController extends BaseController
|
||||
return Redirect::to('/settings/' . ACCOUNT_IMPORT_EXPORT);
|
||||
}
|
||||
}
|
||||
|
||||
public function cancelImport()
|
||||
{
|
||||
try {
|
||||
$path = env('FILE_IMPORT_PATH') ?: storage_path() . '/import';
|
||||
foreach ([ENTITY_CLIENT, ENTITY_INVOICE, ENTITY_PAYMENT, ENTITY_QUOTE, ENTITY_PRODUCT] as $entityType) {
|
||||
$fileName = sprintf('%s/%s_%s_%s.csv', $path, Auth::user()->account_id, request()->timestamp, $entityType);
|
||||
\File::delete($fileName);
|
||||
}
|
||||
} catch (Exception $exception) {
|
||||
Utils::logError($exception);
|
||||
}
|
||||
|
||||
return Redirect::to('/settings/' . ACCOUNT_IMPORT_EXPORT);
|
||||
}
|
||||
}
|
||||
|
@ -281,6 +281,7 @@ Route::group([
|
||||
|
||||
Route::post('/export', 'ExportController@doExport');
|
||||
Route::post('/import', 'ImportController@doImport');
|
||||
Route::get('/cancel_import', 'ImportController@cancelImport');
|
||||
Route::post('/import_csv', 'ImportController@doImportCSV');
|
||||
|
||||
Route::get('gateways/create/{show_wepay?}', 'AccountGatewayController@create');
|
||||
|
@ -19,7 +19,7 @@
|
||||
@endforeach
|
||||
|
||||
{!! Former::actions(
|
||||
Button::normal(trans('texts.cancel'))->large()->asLinkTo(URL::to('/settings/import_export'))->appendIcon(Icon::create('remove-circle')),
|
||||
Button::normal(trans('texts.cancel'))->large()->asLinkTo(URL::to('/cancel_import?timestamp=' . $timestamp))->appendIcon(Icon::create('remove-circle')),
|
||||
Button::success(trans('texts.import'))->submit()->large()->appendIcon(Icon::create('floppy-disk'))) !!}
|
||||
|
||||
{!! Former::close() !!}
|
||||
|
Loading…
x
Reference in New Issue
Block a user