mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
commit
c2344f142a
@ -26,7 +26,7 @@ BROADCAST_DRIVER=log
|
||||
LOG_CHANNEL=stack
|
||||
CACHE_DRIVER=file
|
||||
QUEUE_CONNECTION=database
|
||||
SESSION_DRIVER=file
|
||||
SESSION_DRIVER=cookie
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
@ -46,7 +46,6 @@ POSTMARK_API_TOKEN=
|
||||
REQUIRE_HTTPS=false
|
||||
|
||||
GOOGLE_MAPS_API_KEY=
|
||||
API_SECRET=superdoopersecrethere
|
||||
ERROR_EMAIL=
|
||||
TRUSTED_PROXIES=
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteRule "^.env" - [F,L]
|
||||
RewriteRule "^storage" - [F,L]
|
||||
# RewriteRule "^storage" - [F,L]
|
||||
RewriteRule ^(.well-known)($|/) - [L]
|
||||
|
||||
RewriteRule ^(.*)$ public/$1 [L]
|
||||
|
@ -12,7 +12,15 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\Exceptions\MigrationValidatorFailed;
|
||||
use App\Exceptions\NonExistingMigrationFile;
|
||||
use App\Exceptions\ProcessingMigrationArchiveFailed;
|
||||
use App\Exceptions\ResourceDependencyMissing;
|
||||
use App\Exceptions\ResourceNotAvailableForMigration;
|
||||
use App\Jobs\Util\Import;
|
||||
use App\Jobs\Util\StartMigration;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Mail\MigrationFailed;
|
||||
use App\Models\Account;
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyToken;
|
||||
@ -24,6 +32,7 @@ use Faker\Factory;
|
||||
use Faker\Generator;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Str;
|
||||
use ZipArchive;
|
||||
|
||||
class ImportMigrations extends Command
|
||||
{
|
||||
@ -69,17 +78,45 @@ class ImportMigrations extends Command
|
||||
public function handle()
|
||||
{
|
||||
$this->buildCache();
|
||||
|
||||
$path = $this->option('path') ?? storage_path('migrations/import');
|
||||
|
||||
$path = $this->option('path') ?? public_path('storage/migrations/import');
|
||||
|
||||
$directory = new DirectoryIterator($path);
|
||||
|
||||
foreach ($directory as $file) {
|
||||
if ($file->getExtension() === 'zip') {
|
||||
|
||||
$user = $this->getUser();
|
||||
$company = $this->getUser()->companies()->first();
|
||||
|
||||
$this->info('Started processing: '.$file->getBasename().' at '.now());
|
||||
StartMigration::dispatch($file->getRealPath(), $this->getUser(), $this->getUser()->companies()->first());
|
||||
}
|
||||
}
|
||||
|
||||
$zip = new ZipArchive();
|
||||
$archive = $zip->open($file->getRealPath());
|
||||
|
||||
try {
|
||||
if (! $archive) {
|
||||
throw new ProcessingMigrationArchiveFailed('Processing migration archive failed. Migration file is possibly corrupted.');
|
||||
}
|
||||
|
||||
$filename = pathinfo($file->getRealPath(), PATHINFO_FILENAME);
|
||||
|
||||
$zip->extractTo(public_path("storage/migrations/{$filename}"));
|
||||
$zip->close();
|
||||
|
||||
$import_file = public_path("storage/migrations/$filename/migration.json");
|
||||
|
||||
Import::dispatch($import_file, $this->getUser()->companies()->first(), $this->getUser());
|
||||
// StartMigration::dispatch($file->getRealPath(), $this->getUser(), $this->getUser()->companies()->first());
|
||||
}
|
||||
catch (NonExistingMigrationFile | ProcessingMigrationArchiveFailed | ResourceNotAvailableForMigration | MigrationValidatorFailed | ResourceDependencyMissing $e) {
|
||||
\Mail::to($this->user)->send(new MigrationFailed($e, $e->getMessage()));
|
||||
|
||||
if (app()->environment() !== 'production') {
|
||||
info($e->getMessage());
|
||||
}
|
||||
|
||||
}}}
|
||||
}
|
||||
|
||||
public function getUser(): User
|
||||
|
@ -55,7 +55,7 @@ class CompanySettings extends BaseSettings
|
||||
public $default_task_rate = 0; // @TODO Where do we inject this?
|
||||
|
||||
public $payment_terms = ''; //@implemented
|
||||
public $send_reminders = false; //@TODO
|
||||
public $send_reminders = true; //@TODO
|
||||
|
||||
public $custom_message_dashboard = ''; // @TODO There currently is no dashboard so this is pending
|
||||
public $custom_message_unpaid_invoice = '';
|
||||
|
@ -22,6 +22,6 @@ class ShowInvoiceRequest extends Request
|
||||
*/
|
||||
public function authorize() : bool
|
||||
{
|
||||
return auth('contact')->user()->client->id === $this->invoice->client_id;
|
||||
return auth('contact')->user()->client->id == $this->invoice->client_id;
|
||||
}
|
||||
}
|
||||
|
@ -177,6 +177,9 @@ class Import implements ShouldQueue
|
||||
{
|
||||
set_time_limit(0);
|
||||
|
||||
auth()->login($this->user, false);
|
||||
auth()->user()->setCompany($this->company);
|
||||
|
||||
// $jsonStream = \JsonMachine\JsonMachine::fromFile($this->file_path, "/data");
|
||||
$array = json_decode(file_get_contents($this->file_path), 1);
|
||||
$data = $array['data'];
|
||||
|
@ -39,6 +39,7 @@ class ActivityTransformer extends EntityTransformer
|
||||
'company_id' => $activity->company_id ? (string) $this->encodePrimaryKey($activity->company_id) : '',
|
||||
'user_id' => (string) $this->encodePrimaryKey($activity->user_id),
|
||||
'invoice_id' => $activity->invoice_id ? (string) $this->encodePrimaryKey($activity->invoice_id) : '',
|
||||
'quote_id' => $activity->quote_id ? (string) $this->encodePrimaryKey($activity->quote_id) : '',
|
||||
'payment_id' => $activity->payment_id ? (string) $this->encodePrimaryKey($activity->payment_id) : '',
|
||||
'credit_id' => $activity->credit_id ? (string) $this->encodePrimaryKey($activity->credit_id) : '',
|
||||
'updated_at' => (int) $activity->updated_at,
|
||||
|
@ -75,7 +75,6 @@ return [
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
|
@ -88,7 +88,7 @@
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function () {
|
||||
navigator.serviceWorker.register('/flutter_service_worker.js?v={{ config('ninja.app_version') }}');
|
||||
navigator.serviceWorker.register('flutter_service_worker.js?v={{ config('ninja.app_version') }}');
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user