diff --git a/app/Export/Collector/AttachmentCollector.php b/app/Export/Collector/AttachmentCollector.php deleted file mode 100644 index 271ffd595a..0000000000 --- a/app/Export/Collector/AttachmentCollector.php +++ /dev/null @@ -1,154 +0,0 @@ -. - */ - -declare(strict_types=1); - -namespace FireflyIII\Export\Collector; - -use Carbon\Carbon; -use Crypt; -use FireflyIII\Models\Attachment; -use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface; -use Illuminate\Contracts\Encryption\DecryptException; -use Illuminate\Contracts\Filesystem\FileNotFoundException; -use Illuminate\Support\Collection; -use Log; -use Storage; - -/** - * Class AttachmentCollector. - * - * @deprecated - * @codeCoverageIgnore - */ -class AttachmentCollector extends BasicCollector implements CollectorInterface -{ - /** @var Carbon The end date of the range. */ - private $end; - /** @var \Illuminate\Contracts\Filesystem\Filesystem File system */ - private $exportDisk; - /** @var AttachmentRepositoryInterface Attachment repository */ - private $repository; - /** @var Carbon Start date of range */ - private $start; - /** @var \Illuminate\Contracts\Filesystem\Filesystem Disk with uploads on it */ - private $uploadDisk; - - /** - * AttachmentCollector constructor. - */ - public function __construct() - { - /** @var AttachmentRepositoryInterface repository */ - $this->repository = app(AttachmentRepositoryInterface::class); - // make storage: - $this->uploadDisk = Storage::disk('upload'); - $this->exportDisk = Storage::disk('export'); - - parent::__construct(); - } - - /** - * Run the routine. - * - * @return bool - */ - public function run(): bool - { - // grab all the users attachments: - $attachments = $this->getAttachments(); - - /** @var Attachment $attachment */ - foreach ($attachments as $attachment) { - $this->exportAttachment($attachment); - } - - return true; - } - - /** - * Set the start and end date. - * - * @param Carbon $start - * @param Carbon $end - */ - public function setDates(Carbon $start, Carbon $end) - { - $this->start = $start; - $this->end = $end; - } - - /** @noinspection MultipleReturnStatementsInspection */ - /** - * Export attachments. - * - * @param Attachment $attachment - * - * @return bool - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException - */ - private function exportAttachment(Attachment $attachment): bool - { - $file = $attachment->fileName(); - $decrypted = false; - if ($this->uploadDisk->exists($file)) { - try { - $decrypted = Crypt::decrypt($this->uploadDisk->get($file)); - } catch (DecryptException|FileNotFoundException $e) { - Log::error('Catchable error: could not decrypt attachment #' . $attachment->id . ' because: ' . $e->getMessage()); - - return false; - } - } - if (false === $decrypted) { - return false; - } - $exportFile = $this->exportFileName($attachment); - $this->exportDisk->put($exportFile, $decrypted); - $this->getEntries()->push($exportFile); - - return true; - } - - /** - * Returns the new file name for the export file. - * - * @param $attachment - * - * @return string - */ - private function exportFileName($attachment): string - { - return sprintf('%s-Attachment nr. %s - %s', $this->job->key, (string)$attachment->id, $attachment->filename); - } - - /** - * Get the attachments. - * - * @return Collection - */ - private function getAttachments(): Collection - { - $this->repository->setUser($this->user); - - return $this->repository->getBetween($this->start, $this->end); - } -} diff --git a/app/Export/Collector/BasicCollector.php b/app/Export/Collector/BasicCollector.php deleted file mode 100644 index c1db2a82a3..0000000000 --- a/app/Export/Collector/BasicCollector.php +++ /dev/null @@ -1,94 +0,0 @@ -. - */ - -declare(strict_types=1); - -namespace FireflyIII\Export\Collector; - -use FireflyIII\Models\ExportJob; -use FireflyIII\User; -use Illuminate\Support\Collection; - -/** - * Class BasicCollector. - * - * @codeCoverageIgnore - * @deprecated - */ -class BasicCollector -{ - /** @var ExportJob The job to export. */ - protected $job; - /** @var User The user */ - protected $user; - /** @var Collection All the entries. */ - private $entries; - - /** - * BasicCollector constructor. - */ - public function __construct() - { - $this->entries = new Collection; - } - - /** - * Get all entries. - * - * @return Collection - */ - public function getEntries(): Collection - { - return $this->entries; - } - - /** - * Set entries. - * - * @param Collection $entries - */ - public function setEntries(Collection $entries): void - { - $this->entries = $entries; - } - - /** - * Set export job. - * - * @param ExportJob $job - */ - public function setJob(ExportJob $job): void - { - $this->job = $job; - $this->user = $job->user; - } - - /** - * Set user. - * - * @param User $user - */ - public function setUser(User $user): void - { - $this->user = $user; - } -} diff --git a/app/Export/Collector/CollectorInterface.php b/app/Export/Collector/CollectorInterface.php deleted file mode 100644 index c58e538ee1..0000000000 --- a/app/Export/Collector/CollectorInterface.php +++ /dev/null @@ -1,67 +0,0 @@ -. - */ - -declare(strict_types=1); - -namespace FireflyIII\Export\Collector; - -use FireflyIII\Models\ExportJob; -use Illuminate\Support\Collection; - -/** - * Interface CollectorInterface. - * - * @codeCoverageIgnore - * @deprecated - */ -interface CollectorInterface -{ - /** - * Get entries. - * - * @return Collection - */ - public function getEntries(): Collection; - - /** - * Run the collector. - * - * @return bool - */ - public function run(): bool; - - /** - * Set entries. - * - * @param Collection $entries - */ - public function setEntries(Collection $entries); - - /** - * Set export job. - * - * @param ExportJob $job - * - * @return mixed - */ - public function setJob(ExportJob $job); -} diff --git a/app/Export/Collector/UploadCollector.php b/app/Export/Collector/UploadCollector.php deleted file mode 100644 index 85852944c5..0000000000 --- a/app/Export/Collector/UploadCollector.php +++ /dev/null @@ -1,123 +0,0 @@ -. - */ - -declare(strict_types=1); - -namespace FireflyIII\Export\Collector; - -use Crypt; -use Exception; -use Illuminate\Contracts\Encryption\DecryptException; -use Log; -use Storage; - -/** - * Class UploadCollector. - * - * @codeCoverageIgnore - * @deprecated - */ -class UploadCollector extends BasicCollector implements CollectorInterface -{ - /** @var \Illuminate\Contracts\Filesystem\Filesystem */ - private $exportDisk; - /** @var \Illuminate\Contracts\Filesystem\Filesystem */ - private $uploadDisk; - - /** - * AttachmentCollector constructor. - */ - public function __construct() - { - parent::__construct(); - $this->uploadDisk = Storage::disk('upload'); - $this->exportDisk = Storage::disk('export'); - } - - /** - * Is called from the outside to actually start the export. - * - * @return bool - */ - public function run(): bool - { - Log::debug('Going to collect attachments', ['key' => $this->job->key]); - $this->collectModernUploads(); - - return true; - } - - /** - * This method collects all the uploads that are uploaded using the new importer. So after the summer of 2016. - * - * @return bool - */ - private function collectModernUploads(): bool - { - $set = $this->job->user->importJobs()->whereIn('status', ['import_complete', 'finished'])->get(['import_jobs.*']); - Log::debug(sprintf('Found %d import jobs', $set->count())); - $keys = []; - if ($set->count() > 0) { - $keys = $set->pluck('key')->toArray(); - } - - foreach ($keys as $key) { - $this->processModernUpload($key); - } - - return true; - } - - /** @noinspection MultipleReturnStatementsInspection */ - /** - * Process new file uploads. - * - * @param string $key - * - * @return bool - */ - private function processModernUpload(string $key): bool - { - // find job associated with import file: - $job = $this->job->user->importJobs()->where('key', $key)->first(); - if (null === $job) { - return false; - } - - // find the file for this import: - $content = ''; - try { - $content = Crypt::decrypt($this->uploadDisk->get(sprintf('%s.upload', $key))); - } catch (Exception | DecryptException $e) { - Log::error(sprintf('Could not decrypt old import file "%s". Skipped because: %s', $key, $e->getMessage())); - } - - if ('' !== $content) { - // add to export disk. - $date = $job->created_at->format('Y-m-d'); - $file = sprintf('%s-Old %s import dated %s.%s', $this->job->key, strtoupper($job->file_type), $date, $job->file_type); - $this->exportDisk->put($file, $content); - $this->getEntries()->push($file); - } - - return true; - } -} diff --git a/app/Export/Entry/Entry.php b/app/Export/Entry/Entry.php deleted file mode 100644 index 01386cbfcc..0000000000 --- a/app/Export/Entry/Entry.php +++ /dev/null @@ -1,189 +0,0 @@ -. - */ - -declare(strict_types=1); - -namespace FireflyIII\Export\Entry; - -use FireflyIII\Models\Transaction; - -/** - * To extend the exported object, in case of new features in Firefly III for example, - * do the following:. - * - * - Add the field(s) to this class. If you add more than one related field, add a new object. - * - Make sure the "fromJournal"-routine fills these fields. - * - Add them to the static function that returns its type (key=value. Remember that the only - * valid types can be found in config/csv.php (under "roles"). - * - * These new entries should be should be strings and numbers as much as possible. - * - * - * - * Class Entry - * - * @SuppressWarnings(PHPMD.LongVariable) - * @SuppressWarnings(PHPMD.TooManyFields) - * - * @codeCoverageIgnore - * @deprecated - */ -final class Entry -{ - /** @var string The amount. */ - public $amount; - /** @var string Asset account BIC */ - public $asset_account_bic; - /** @var string Asset account IBAN */ - public $asset_account_iban; - /** @var string Asset account ID */ - public $asset_account_id; - /** @var string Asset account name */ - public $asset_account_name; - /** @var string Asset account number */ - public $asset_account_number; - /** @var string Asset account currency code */ - public $asset_currency_code; - /** @var string Bill ID */ - public $bill_id; - /** @var string Bill name */ - public $bill_name; - /** @var string Budget ID */ - public $budget_id; - /** @var string Budget name */ - public $budget_name; - /** @var string Category ID */ - public $category_id; - /** @var string Category name */ - public $category_name; - /** @var string The currency code. */ - public $currency_code; - /** @var string The date. */ - public $date; - /** @var string The description */ - public $description; - /** @var string Foreign amount */ - public $foreign_amount = '0'; - /** @var string The foreign currency code */ - public $foreign_currency_code = ''; - /** @var int ID of the journal */ - public $journal_id; - /** @var string Notes */ - public $notes; - /** @var string Opposing account BIC */ - public $opposing_account_bic; - /** @var string Opposing account IBAN */ - public $opposing_account_iban; - /** @var string Opposing account ID */ - public $opposing_account_id; - /** @var string Opposing account name */ - public $opposing_account_name; - /** @var string Opposing account number */ - public $opposing_account_number; - /** @var string Opposing account code */ - public $opposing_currency_code; - /** @var string Tags */ - public $tags; - /** @var int ID of the transaction */ - public $transaction_id = 0; - /** @var string Transaction type */ - public $transaction_type; - - /** - * Entry constructor. - */ - private function __construct() - { - } - - /** - * Converts a given transaction (as collected by the collector) into an export entry. - * - * @SuppressWarnings(PHPMD.CyclomaticComplexity) // complex but little choice. - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) // cannot be helped - * - * @param Transaction $transaction - * - * @return Entry - */ - public static function fromTransaction(Transaction $transaction): Entry - { - $entry = new self(); - $entry->journal_id = $transaction->journal_id; - $entry->transaction_id = $transaction->id; - $entry->date = $transaction->date->format('Ymd'); - $entry->description = $transaction->description; - if ('' !== (string)$transaction->transaction_description) { - $entry->description = $transaction->transaction_description . '(' . $transaction->description . ')'; - } - $entry->currency_code = $transaction->transactionCurrency->code; - $entry->amount = (string)round($transaction->transaction_amount, $transaction->transactionCurrency->decimal_places); - - $entry->foreign_currency_code = null === $transaction->foreign_currency_id ? null : $transaction->foreignCurrency->code; - $entry->foreign_amount = null === $transaction->foreign_currency_id - ? null - : (string)round( - $transaction->transaction_foreign_amount, - $transaction->foreignCurrency->decimal_places - ); - - $entry->transaction_type = $transaction->transaction_type_type; - $entry->asset_account_id = (string)$transaction->account_id; - $entry->asset_account_name = $transaction->account_name; - $entry->asset_account_iban = $transaction->account_iban; - $entry->asset_account_number = $transaction->account_number; - $entry->asset_account_bic = $transaction->account_bic; - $entry->asset_currency_code = $transaction->account_currency_code; - - $entry->opposing_account_id = (string)$transaction->opposing_account_id; - $entry->opposing_account_name = $transaction->opposing_account_name; - $entry->opposing_account_iban = $transaction->opposing_account_iban; - $entry->opposing_account_number = $transaction->opposing_account_number; - $entry->opposing_account_bic = $transaction->opposing_account_bic; - $entry->opposing_currency_code = $transaction->opposing_currency_code; - - // budget - $entry->budget_id = (string)$transaction->transaction_budget_id; - $entry->budget_name = $transaction->transaction_budget_name; - if (null === $transaction->transaction_budget_id) { - $entry->budget_id = $transaction->transaction_journal_budget_id; - $entry->budget_name = $transaction->transaction_journal_budget_name; - } - - // category - $entry->category_id = (string)$transaction->transaction_category_id; - $entry->category_name = $transaction->transaction_category_name; - if (null === $transaction->transaction_category_id) { - $entry->category_id = $transaction->transaction_journal_category_id; - $entry->category_name = $transaction->transaction_journal_category_name; - } - - // budget - $entry->bill_id = (string)$transaction->bill_id; - $entry->bill_name = $transaction->bill_name; - - $entry->tags = $transaction->tags; - $entry->notes = $transaction->notes; - - return $entry; - } -} diff --git a/app/Export/ExpandedProcessor.php b/app/Export/ExpandedProcessor.php deleted file mode 100644 index 4fb5d7d1e5..0000000000 --- a/app/Export/ExpandedProcessor.php +++ /dev/null @@ -1,375 +0,0 @@ -. - */ - -/** @noinspection PhpDynamicAsStaticMethodCallInspection */ - -declare(strict_types=1); - -namespace FireflyIII\Export; - -use DB; -use FireflyIII\Exceptions\FireflyException; -use FireflyIII\Export\Collector\AttachmentCollector; -use FireflyIII\Export\Collector\UploadCollector; -use FireflyIII\Export\Entry\Entry; -use FireflyIII\Export\Exporter\ExporterInterface; -use FireflyIII\Helpers\Filter\InternalTransferFilter; -use FireflyIII\Models\AccountMeta; -use FireflyIII\Models\ExportJob; -use FireflyIII\Models\Note; -use FireflyIII\Models\Transaction; -use FireflyIII\Models\TransactionJournal; -use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; -use Illuminate\Support\Collection; -use Illuminate\Support\Facades\Storage; -use Log; -use ZipArchive; - -/** - * Class ExpandedProcessor. - * - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) // its doing a lot. - * - * @codeCoverageIgnore - * @deprecated - */ -class ExpandedProcessor implements ProcessorInterface -{ - /** @var Collection All accounts */ - public $accounts; - /** @var string The export format */ - public $exportFormat; - /** @var bool Should include attachments */ - public $includeAttachments; - /** @var bool Should include old uploads */ - public $includeOldUploads; - /** @var ExportJob The export job itself */ - public $job; - /** @var array The settings */ - public $settings; - /** @var Collection The entries to export. */ - private $exportEntries; - /** @var Collection The files to export */ - private $files; - /** @var Collection The journals. */ - private $journals; - - /** - * Processor constructor. - */ - public function __construct() - { - $this->journals = new Collection; - $this->exportEntries = new Collection; - $this->files = new Collection; - } - - /** - * Collect all attachments - * - * @return bool - */ - public function collectAttachments(): bool - { - /** @var AttachmentCollector $attachmentCollector */ - $attachmentCollector = app(AttachmentCollector::class); - $attachmentCollector->setJob($this->job); - $attachmentCollector->setDates($this->settings['startDate'], $this->settings['endDate']); - $attachmentCollector->run(); - $this->files = $this->files->merge($attachmentCollector->getEntries()); - - return true; - } - - /** - * Collects all transaction journals. - * - * @return bool - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - public function collectJournals(): bool - { - return true; - // use journal collector thing. - /** @var TODO replace me. $collector */ - //$collector = app(); - $collector->setUser($this->job->user); - $collector->setAccounts($this->accounts)->setRange($this->settings['startDate'], $this->settings['endDate']) - ->withOpposingAccount()->withBudgetInformation()->withCategoryInformation() - ->removeFilter(InternalTransferFilter::class); - $transactions = $collector->getTransactions(); - // get some more meta data for each entry: - $ids = $transactions->pluck('journal_id')->toArray(); - $assetIds = $transactions->pluck('account_id')->toArray(); - $opposingIds = $transactions->pluck('opposing_account_id')->toArray(); - $notes = $this->getNotes($ids); - $tags = $this->getTags($ids); - /** @var array $ibans */ - $ibans = array_merge($this->getIbans($assetIds), $this->getIbans($opposingIds)); - $currencies = $this->getAccountCurrencies($ibans); - $transactions->each( - function (Transaction $transaction) use ($notes, $tags, $ibans, $currencies) { - $journalId = (int)$transaction->journal_id; - $accountId = (int)$transaction->account_id; - $opposingId = (int)$transaction->opposing_account_id; - $currencyId = (int)($ibans[$accountId]['currency_id'] ?? 0.0); - $opposingCurrencyId = (int)($ibans[$opposingId]['currency_id'] ?? 0.0); - $transaction->notes = $notes[$journalId] ?? ''; - $transaction->tags = implode(',', $tags[$journalId] ?? []); - $transaction->account_number = $ibans[$accountId]['accountNumber'] ?? ''; - $transaction->account_bic = $ibans[$accountId]['BIC'] ?? ''; - $transaction->account_currency_code = $currencies[$currencyId] ?? ''; - $transaction->opposing_account_number = $ibans[$opposingId]['accountNumber'] ?? ''; - $transaction->opposing_account_bic = $ibans[$opposingId]['BIC'] ?? ''; - $transaction->opposing_currency_code = $currencies[$opposingCurrencyId] ?? ''; - } - ); - - $this->journals = $transactions; - - return true; - } - - /** - * Returns, if present, for the given journal ID's the notes. - * - * @param array $array - * - * @return array - */ - private function getNotes(array $array): array - { - $array = array_unique($array); - $notes = Note::where('notes.noteable_type', TransactionJournal::class) - ->whereIn('notes.noteable_id', $array) - ->get(['notes.*']); - $return = []; - /** @var Note $note */ - foreach ($notes as $note) { - if ('' !== trim((string)$note->text)) { - $id = (int)$note->noteable_id; - $return[$id] = $note->text; - } - } - - return $return; - } - - /** - * Returns a comma joined list of all the users tags linked to these journals. - * - * @param array $array - * - * @return array - * @throws \Illuminate\Contracts\Encryption\DecryptException - */ - private function getTags(array $array): array - { - $set = DB::table('tag_transaction_journal') - ->whereIn('tag_transaction_journal.transaction_journal_id', $array) - ->leftJoin('tags', 'tag_transaction_journal.tag_id', '=', 'tags.id') - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'tag_transaction_journal.transaction_journal_id') - ->where('transaction_journals.user_id', $this->job->user_id) - ->get(['tag_transaction_journal.transaction_journal_id', 'tags.tag']); - $result = []; - foreach ($set as $entry) { - $id = (int)$entry->transaction_journal_id; - $result[$id] = $result[$id] ?? []; - $result[$id][] = $entry->tag; - } - - return $result; - } - - /** - * Get all IBAN / SWIFT / account numbers. - * - * @param array $array - * - * @return array - */ - private function getIbans(array $array): array - { - $array = array_unique($array); - $return = []; - $set = AccountMeta::whereIn('account_id', $array) - ->leftJoin('accounts', 'accounts.id', 'account_meta.account_id') - ->where('accounts.user_id', $this->job->user_id) - ->whereIn('account_meta.name', ['accountNumber', 'BIC', 'currency_id']) - ->get(['account_meta.id', 'account_meta.account_id', 'account_meta.name', 'account_meta.data']); - /** @var AccountMeta $meta */ - foreach ($set as $meta) { - $id = (int)$meta->account_id; - $return[$id][$meta->name] = $meta->data; - } - - return $return; - } - - /** - * Get currencies. - * - * @param array $array - * - * @return array - */ - private function getAccountCurrencies(array $array): array - { - /** @var CurrencyRepositoryInterface $repository */ - $repository = app(CurrencyRepositoryInterface::class); - $return = []; - $ids = []; - $repository->setUser($this->job->user); - foreach ($array as $value) { - $ids[] = (int)($value['currency_id'] ?? 0.0); - } - $ids = array_unique($ids); - $result = $repository->getByIds($ids); - - foreach ($result as $currency) { - $return[$currency->id] = $currency->code; - } - - return $return; - } - - /** - * Get old oploads. - * - * @return bool - */ - public function collectOldUploads(): bool - { - /** @var UploadCollector $uploadCollector */ - $uploadCollector = app(UploadCollector::class); - $uploadCollector->setJob($this->job); - $uploadCollector->run(); - - $this->files = $this->files->merge($uploadCollector->getEntries()); - - return true; - } - - /** - * Convert journals to export objects. - * - * @return bool - */ - public function convertJournals(): bool - { - $this->journals->each( - function (Transaction $transaction) { - $this->exportEntries->push(Entry::fromTransaction($transaction)); - } - ); - Log::debug(sprintf('Count %d entries in exportEntries (convertJournals)', $this->exportEntries->count())); - - return true; - } - - /** - * Create a ZIP file locally (!) in storage_path('export'). - * - * @return bool - * - * @throws FireflyException - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException - */ - public function createZipFile(): bool - { - $zip = new ZipArchive; - $file = $this->job->key . '.zip'; - $localPath = storage_path('export') . '/' . $file; - - if (true !== $zip->open($localPath, ZipArchive::CREATE)) { - throw new FireflyException('Cannot store zip file.'); - } - // for each file in the collection, add it to the zip file. - $disk = Storage::disk('export'); - foreach ($this->getFiles() as $entry) { - // is part of this job? - $zipFileName = str_replace($this->job->key . '-', '', $entry); - $zip->addFromString($zipFileName, $disk->get($entry)); - } - - $zip->close(); - - // delete the files: - $this->deleteFiles(); - - return true; - } - - /** - * Get files. - * - * @return Collection - */ - public function getFiles(): Collection - { - return $this->files; - } - - /** - * Delete files. - */ - private function deleteFiles(): void - { - $disk = Storage::disk('export'); - foreach ($this->getFiles() as $file) { - $disk->delete($file); - } - } - - /** - * Export the journals. - * - * @return bool - */ - public function exportJournals(): bool - { - $exporterClass = config('firefly.export_formats.' . $this->exportFormat); - /** @var ExporterInterface $exporter */ - $exporter = app($exporterClass); - $exporter->setJob($this->job); - $exporter->setEntries($this->exportEntries); - $exporter->run(); - $this->files->push($exporter->getFileName()); - - return true; - } - - /** - * Save export job settings to class. - * - * @param array $settings - */ - public function setSettings(array $settings): void - { - // save settings - $this->settings = $settings; - $this->accounts = $settings['accounts']; - $this->exportFormat = $settings['exportFormat']; - $this->includeAttachments = $settings['includeAttachments']; - $this->includeOldUploads = $settings['includeOldUploads']; - $this->job = $settings['job']; - } -} diff --git a/app/Export/Exporter/BasicExporter.php b/app/Export/Exporter/BasicExporter.php deleted file mode 100644 index de7eaed474..0000000000 --- a/app/Export/Exporter/BasicExporter.php +++ /dev/null @@ -1,80 +0,0 @@ -. - */ - -declare(strict_types=1); - -namespace FireflyIII\Export\Exporter; - -use FireflyIII\Models\ExportJob; -use Illuminate\Support\Collection; - -/** - * Class BasicExporter. - * - * @codeCoverageIgnore - * @deprecated - */ -class BasicExporter -{ - /** @var ExportJob The export job */ - protected $job; - /** @var Collection The entries */ - private $entries; - - /** - * BasicExporter constructor. - */ - public function __construct() - { - $this->entries = new Collection; - } - - /** - * Get all entries. - * - * @return Collection - */ - public function getEntries(): Collection - { - return $this->entries; - } - - /** - * Set all entries. - * - * @param Collection $entries - */ - public function setEntries(Collection $entries): void - { - $this->entries = $entries; - } - - /** - * Set the job. - * - * @param ExportJob $job - */ - public function setJob(ExportJob $job): void - { - $this->job = $job; - } -} diff --git a/app/Export/Exporter/CsvExporter.php b/app/Export/Exporter/CsvExporter.php deleted file mode 100644 index 00d909d762..0000000000 --- a/app/Export/Exporter/CsvExporter.php +++ /dev/null @@ -1,90 +0,0 @@ -. - */ - -declare(strict_types=1); - -namespace FireflyIII\Export\Exporter; - -use FireflyIII\Export\Entry\Entry; -use Illuminate\Support\Facades\Storage; -use League\Csv\Writer; - -/** - * Class CsvExporter. - * - * @codeCoverageIgnore - * @deprecated - */ -class CsvExporter extends BasicExporter implements ExporterInterface -{ - /** @var string Filename */ - private $fileName; - - /** - * Get file name. - * - * @return string - */ - public function getFileName(): string - { - return $this->fileName; - } - - /** - * Run collector. - * - * @return bool - * - */ - public function run(): bool - { - // choose file name: - $this->fileName = $this->job->key . '-records.csv'; - - //we create the CSV into memory - $writer = Writer::createFromString(''); - $rows = []; - - // get field names for header row: - $first = $this->getEntries()->first(); - $headers = []; - if (null !== $first) { - $headers = array_keys(get_object_vars($first)); - } - - $rows[] = $headers; - - /** @var Entry $entry */ - foreach ($this->getEntries() as $entry) { - $line = []; - foreach ($headers as $header) { - $line[] = $entry->$header; - } - $rows[] = $line; - } - $writer->insertAll($rows); - $disk = Storage::disk('export'); - $disk->put($this->fileName, $writer->getContent()); - - return true; - } -} diff --git a/app/Export/Exporter/ExporterInterface.php b/app/Export/Exporter/ExporterInterface.php deleted file mode 100644 index 998510f65b..0000000000 --- a/app/Export/Exporter/ExporterInterface.php +++ /dev/null @@ -1,72 +0,0 @@ -. - */ - -declare(strict_types=1); - -namespace FireflyIII\Export\Exporter; - -use FireflyIII\Models\ExportJob; -use Illuminate\Support\Collection; - -/** - * Interface ExporterInterface. - * - * @codeCoverageIgnore - * @deprecated - */ -interface ExporterInterface -{ - /** - * Get entries. - * - * @return Collection - */ - public function getEntries(): Collection; - - /** - * Get file name. - * - * @return string - */ - public function getFileName(): string; - - /** - * Run exporter. - * - * @return bool - */ - public function run(): bool; - - /** - * Set entries. - * - * @param Collection $entries - */ - public function setEntries(Collection $entries); - - /** - * Set job. - * - * @param ExportJob $job - */ - public function setJob(ExportJob $job); -} diff --git a/app/Export/ProcessorInterface.php b/app/Export/ProcessorInterface.php deleted file mode 100644 index 330e69c2d2..0000000000 --- a/app/Export/ProcessorInterface.php +++ /dev/null @@ -1,97 +0,0 @@ -. - */ - -declare(strict_types=1); - -namespace FireflyIII\Export; - -use Illuminate\Support\Collection; - -/** - * Interface ProcessorInterface. - * - * @codeCoverageIgnore - * @deprecated - */ -interface ProcessorInterface -{ - /** - * Processor constructor. - */ - public function __construct(); - - /** - * Collect all attachments. - * - * @return bool - */ - public function collectAttachments(): bool; - - /** - * Collect all journals. - * - * @return bool - */ - public function collectJournals(): bool; - - /** - * Collect old uploads. - * - * @return bool - */ - public function collectOldUploads(): bool; - - /** - * Convert all journals. - * - * @return bool - */ - public function convertJournals(): bool; - - /** - * Create a zip file. - * - * @return bool - */ - public function createZipFile(): bool; - - /** - * Export journals. - * - * @return bool - */ - public function exportJournals(): bool; - - /** - * Get all files. - * - * @return Collection - */ - public function getFiles(): Collection; - - /** - * Set the settings. - * - * @param array $settings - */ - public function setSettings(array $settings); -} diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php index c0966526cd..de92357d05 100644 --- a/app/Http/Controllers/DebugController.php +++ b/app/Http/Controllers/DebugController.php @@ -204,7 +204,7 @@ class DebugController extends Controller 'rules.select', 'search.search', 'test-flash', 'transactions.link.delete', 'transactions.link.switch', 'two-factor.lost', 'reports.options', 'debug', 'import.create-job', 'import.download', 'import.start', 'import.status.json', 'preferences.delete-code', 'rules.test-triggers', 'piggy-banks.remove-money', 'piggy-banks.add-money', - 'accounts.reconcile.transactions', 'accounts.reconcile.overview', 'export.download', + 'accounts.reconcile.transactions', 'accounts.reconcile.overview', 'transactions.clone', 'two-factor.index', 'api.v1', 'installer.', 'attachments.view', 'import.create', 'import.job.download', 'import.job.start', 'import.job.status.json', 'import.job.store', 'recurring.events', 'recurring.suggest', diff --git a/app/Http/Controllers/ExportController.php b/app/Http/Controllers/ExportController.php deleted file mode 100644 index 6d744049f3..0000000000 --- a/app/Http/Controllers/ExportController.php +++ /dev/null @@ -1,198 +0,0 @@ -. - */ -declare(strict_types=1); - -namespace FireflyIII\Http\Controllers; - -use Carbon\Carbon; -use FireflyIII\Exceptions\FireflyException; -use FireflyIII\Export\ProcessorInterface; -use FireflyIII\Http\Middleware\IsDemoUser; -use FireflyIII\Http\Requests\ExportFormRequest; -use FireflyIII\Models\ExportJob; -use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface; -use Illuminate\Http\JsonResponse; -use Illuminate\Http\Response as LaravelResponse; - -/** - * Class ExportController. - */ -class ExportController extends Controller -{ - /** - * ExportController constructor. - */ - public function __construct() - { - parent::__construct(); - - $this->middleware( - function ($request, $next) { - app('view')->share('mainTitleIcon', 'fa-file-archive-o'); - app('view')->share('title', (string)trans('firefly.export_and_backup_data')); - - return $next($request); - } - ); - $this->middleware(IsDemoUser::class)->except(['index']); - } - - /** - * Download exported file. - * - * @param ExportJobRepositoryInterface $repository - * @param ExportJob $job - * - * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response - * - * @throws FireflyException - */ - public function download(ExportJobRepositoryInterface $repository, ExportJob $job) - { - $file = $job->key . '.zip'; - $date = date('Y-m-d \a\t H-i-s'); - $name = 'Export job on ' . $date . '.zip'; - $quoted = sprintf('"%s"', addcslashes($name, '"\\')); - - if (!$repository->exists($job)) { - throw new FireflyException('Against all expectations, zip file "' . $file . '" does not exist.'); - } - $content = $repository->getContent($job); - - $repository->changeStatus($job, 'export_downloaded'); - /** @var LaravelResponse $response */ - $response = response($content); - $response - ->header('Content-Description', 'File Transfer') - ->header('Content-Type', 'application/octet-stream') - ->header('Content-Disposition', 'attachment; filename=' . $quoted) - ->header('Content-Transfer-Encoding', 'binary') - ->header('Connection', 'Keep-Alive') - ->header('Expires', '0') - ->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0') - ->header('Pragma', 'public') - ->header('Content-Length', strlen($content)); - - return $response; - } - - /** - * Get current export status. - * - * @param ExportJob $job - * - * @return \Illuminate\Http\JsonResponse - */ - public function getStatus(ExportJob $job): JsonResponse - { - return response()->json(['status' => (string)trans('firefly.' . $job->status)]); - } - - /** - * Index of export routine. - * - * @param ExportJobRepositoryInterface $jobs - * - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View - */ - public function index(ExportJobRepositoryInterface $jobs) - { - // create new export job. - $job = $jobs->create(); - - // does the user have shared accounts? - $formats = array_keys(config('firefly.export_formats')); - $defaultFormat = app('preferences')->get('export_format', config('firefly.default_export_format'))->data; - $first = session('first')->format('Y-m-d'); - $today = Carbon::now()->format('Y-m-d'); - - return view('export.index', compact('job', 'formats', 'defaultFormat', 'first', 'today')); - } - - /** - * Submit the job. - * - * @param ExportFormRequest $request - * @param AccountRepositoryInterface $repository - * @param ExportJobRepositoryInterface $jobs - * - * @return JsonResponse - * - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - public function postIndex(ExportFormRequest $request, AccountRepositoryInterface $repository, ExportJobRepositoryInterface $jobs): JsonResponse - { - $job = $jobs->findByKey($request->get('job')); - $accounts = $request->get('accounts') ?? []; - $settings = [ - 'accounts' => $repository->getAccountsById($accounts), - 'startDate' => new Carbon($request->get('export_start_range')), - 'endDate' => new Carbon($request->get('export_end_range')), - 'exportFormat' => $request->get('exportFormat'), - 'includeAttachments' => $request->boolean('include_attachments'), - 'includeOldUploads' => $request->boolean('include_old_uploads'), - 'job' => $job, - ]; - - $jobs->changeStatus($job, 'export_status_make_exporter'); - - /** @var ProcessorInterface $processor */ - $processor = app(ProcessorInterface::class); - $processor->setSettings($settings); - - // Collect journals: - $jobs->changeStatus($job, 'export_status_collecting_journals'); - $processor->collectJournals(); - $jobs->changeStatus($job, 'export_status_collected_journals'); - - // Transform to exportable entries: - $jobs->changeStatus($job, 'export_status_converting_to_export_format'); - $processor->convertJournals(); - $jobs->changeStatus($job, 'export_status_converted_to_export_format'); - - // Transform to (temporary) file: - $jobs->changeStatus($job, 'export_status_creating_journal_file'); - $processor->exportJournals(); - $jobs->changeStatus($job, 'export_status_created_journal_file'); - // Collect attachments, if applicable. - if ($settings['includeAttachments']) { - $jobs->changeStatus($job, 'export_status_collecting_attachments'); - $processor->collectAttachments(); - $jobs->changeStatus($job, 'export_status_collected_attachments'); - } - - // Collect old uploads - if ($settings['includeOldUploads']) { - $jobs->changeStatus($job, 'export_status_collecting_old_uploads'); - $processor->collectOldUploads(); - $jobs->changeStatus($job, 'export_status_collected_old_uploads'); - } - - // Create ZIP file: - $jobs->changeStatus($job, 'export_status_creating_zip_file'); - $processor->createZipFile(); - $jobs->changeStatus($job, 'export_status_created_zip_file'); - $jobs->changeStatus($job, 'export_status_finished'); - - return response()->json('ok'); - } -} diff --git a/app/Http/Requests/ExportFormRequest.php b/app/Http/Requests/ExportFormRequest.php deleted file mode 100644 index d19441209c..0000000000 --- a/app/Http/Requests/ExportFormRequest.php +++ /dev/null @@ -1,69 +0,0 @@ -. - */ -declare(strict_types=1); - -namespace FireflyIII\Http\Requests; - -use Carbon\Carbon; - -/** - * Class ExportFormRequest. - */ -class ExportFormRequest extends Request -{ - /** - * Verify the request. - * - * @return bool - */ - public function authorize(): bool - { - // Only allow logged in users - return auth()->check(); - } - - /** - * Rules for this request. - * - * @return array - */ - public function rules(): array - { - /** @var Carbon $sessionFirst */ - $sessionFirst = clone session('first'); - $first = $sessionFirst->subDay()->format('Y-m-d'); - $today = Carbon::now()->addDay()->format('Y-m-d'); - $formats = implode(',', array_keys(config('firefly.export_formats'))); - - // fixed - - return [ - 'export_start_range' => 'required|date|after:' . $first, - 'export_end_range' => 'required|date|before:' . $today, - 'accounts' => 'required', - 'job' => 'required|belongsToUser:export_jobs,key', - 'accounts.*' => 'required|exists:accounts,id|belongsToUser:accounts', - 'include_attachments' => 'in:0,1', - 'include_config' => 'in:0,1', - 'exportFormat' => 'in:' . $formats, - ]; - } -} diff --git a/app/Http/Requests/SelectTransactionsRequest.php b/app/Http/Requests/SelectTransactionsRequest.php index 5697fdfb62..74085b2806 100644 --- a/app/Http/Requests/SelectTransactionsRequest.php +++ b/app/Http/Requests/SelectTransactionsRequest.php @@ -25,7 +25,7 @@ namespace FireflyIII\Http\Requests; use Carbon\Carbon; /** - * Class ExportFormRequest. + * Class SelectTransactionsRequest. * * @codeCoverageIgnore */ diff --git a/app/Models/ExportJob.php b/app/Models/ExportJob.php deleted file mode 100644 index 59953fe3b7..0000000000 --- a/app/Models/ExportJob.php +++ /dev/null @@ -1,115 +0,0 @@ -. - */ -declare(strict_types=1); - -namespace FireflyIII\Models; - -use FireflyIII\User; -use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; - -/** - * Class ExportJob. - * - * @property User $user - * @property string $key - * @property int $user_id - * @property string status - * @property int id - * @property int $id - * @property \Illuminate\Support\Carbon|null $created_at - * @property \Illuminate\Support\Carbon|null $updated_at - * @property string $status - * @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\ExportJob newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\ExportJob newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\ExportJob query() - * @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\ExportJob whereCreatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\ExportJob whereId($value) - * @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\ExportJob whereKey($value) - * @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\ExportJob whereStatus($value) - * @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\ExportJob whereUpdatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\ExportJob whereUserId($value) - * @mixin \Eloquent - */ -class ExportJob extends Model -{ - /** - * The attributes that should be casted to native types. - * - * @var array - */ - protected $casts - = [ - 'created_at' => 'datetime', - 'updated_at' => 'datetime', - ]; - - /** - * Route binder. Converts the key in the URL to the specified object (or throw 404). - * - * @param string $value - * - * @return ExportJob - * - * @throws NotFoundHttpException - */ - public static function routeBinder(string $value): ExportJob - { - if (auth()->check()) { - $key = trim($value); - /** @var User $user */ - $user = auth()->user(); - /** @var ExportJob $exportJob */ - $exportJob = $user->exportJobs()->where('key', $key)->first(); - if (null !== $exportJob) { - return $exportJob; - } - } - throw new NotFoundHttpException; - } - - /** - * Change the status of this export job. - * - * @param $status - * - * @deprecated - * @codeCoverageIgnore - */ - public function change($status): void - { - $this->status = $status; - $this->save(); - } - - /** - * Returns the user this objects belongs to. - * - * - * @return BelongsTo - * @codeCoverageIgnore - */ - public function user(): BelongsTo - { - return $this->belongsTo(User::class); - } -} diff --git a/app/Providers/ExportJobServiceProvider.php b/app/Providers/ExportJobServiceProvider.php deleted file mode 100644 index 262c561f54..0000000000 --- a/app/Providers/ExportJobServiceProvider.php +++ /dev/null @@ -1,91 +0,0 @@ -. - */ -declare(strict_types=1); - -namespace FireflyIII\Providers; - -use FireflyIII\Repositories\ExportJob\ExportJobRepository; -use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface; -use FireflyIII\Repositories\ImportJob\ImportJobRepository; -use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface; -use Illuminate\Foundation\Application; -use Illuminate\Support\ServiceProvider; - -/** - * @codeCoverageIgnore - * Class ExportJobServiceProvider. - */ -class ExportJobServiceProvider extends ServiceProvider -{ - /** - * Bootstrap the application services. - */ - public function boot(): void - { - } - - /** - * Register the application services. - */ - public function register(): void - { - $this->exportJob(); - $this->importJob(); - } - - /** - * Register export job. - */ - private function exportJob(): void - { - $this->app->bind( - ExportJobRepositoryInterface::class, - function (Application $app) { - /** @var ExportJobRepository $repository */ - $repository = app(ExportJobRepository::class); - if ($app->auth->check()) { - $repository->setUser(auth()->user()); - } - - return $repository; - } - ); - } - - /** - * Register import job. - */ - private function importJob(): void - { - $this->app->bind( - ImportJobRepositoryInterface::class, - function (Application $app) { - /** @var ImportJobRepository $repository */ - $repository = app(ImportJobRepository::class); - if ($app->auth->check()) { - $repository->setUser(auth()->user()); - } - - return $repository; - } - ); - } -} diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php index 38f88ecc49..28edf30249 100644 --- a/app/Providers/FireflyServiceProvider.php +++ b/app/Providers/FireflyServiceProvider.php @@ -23,8 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Providers; use FireflyIII\Exceptions\FireflyException; -use FireflyIII\Export\ExpandedProcessor; -use FireflyIII\Export\ProcessorInterface; use FireflyIII\Generator\Chart\Basic\ChartJsGenerator; use FireflyIII\Generator\Chart\Basic\GeneratorInterface; use FireflyIII\Helpers\Attachments\AttachmentHelper; @@ -167,8 +165,6 @@ class FireflyServiceProvider extends ServiceProvider ); // other generators - // export: - $this->app->bind(ProcessorInterface::class, ExpandedProcessor::class); $this->app->bind(UserRepositoryInterface::class, UserRepository::class); $this->app->bind(TransactionTypeRepositoryInterface::class, TransactionTypeRepository::class); $this->app->bind(AttachmentHelperInterface::class, AttachmentHelper::class); diff --git a/app/Repositories/ExportJob/ExportJobRepository.php b/app/Repositories/ExportJob/ExportJobRepository.php deleted file mode 100644 index e11c1b88f6..0000000000 --- a/app/Repositories/ExportJob/ExportJobRepository.php +++ /dev/null @@ -1,147 +0,0 @@ -. - */ -declare(strict_types=1); - -namespace FireflyIII\Repositories\ExportJob; - -use FireflyIII\Models\ExportJob; -use FireflyIII\User; -use Illuminate\Contracts\Filesystem\FileNotFoundException; -use Illuminate\Support\Facades\Storage; -use Illuminate\Support\Str; -use Log; - -/** - * Class ExportJobRepository. - */ -class ExportJobRepository implements ExportJobRepositoryInterface -{ - /** @var User */ - private $user; - - /** - * Constructor. - */ - public function __construct() - { - if ('testing' === config('app.env')) { - Log::warning(sprintf('%s should not be instantiated in the TEST environment!', \get_class($this))); - } - } - - /** - * @param ExportJob $job - * @param string $status - * - * @return bool - */ - public function changeStatus(ExportJob $job, string $status): bool - { - Log::debug(sprintf('Change status of job #%d to "%s"', $job->id, $status)); - $job->status = $status; - $job->save(); - - return true; - } - - /** - * @return ExportJob|null - */ - public function create(): ?ExportJob - { - $count = 0; - while ($count < 30) { - $key = Str::random(12); - $existing = $this->findByKey($key); - if (null === $existing) { - $exportJob = new ExportJob; - $exportJob->user()->associate($this->user); - $exportJob->key = Str::random(12); - $exportJob->status = 'export_status_never_started'; - $exportJob->save(); - - // breaks the loop: - - return $exportJob; - } - ++$count; - } - - return null; - } - - /** - * @param ExportJob $job - * - * @return bool - */ - public function exists(ExportJob $job): bool - { - $disk = Storage::disk('export'); - $file = $job->key . '.zip'; - - return $disk->exists($file); - } - - /** - * @param string $key - * - * @return ExportJob|null - */ - public function findByKey(string $key): ?ExportJob - { - /** @var ExportJob $result */ - $result = $this->user->exportJobs()->where('key', $key)->first(['export_jobs.*']); - if (null === $result) { - return null; - } - - return $result; - } - - /** - * @param ExportJob $job - * - * @return string - */ - public function getContent(ExportJob $job): string - { - $disk = Storage::disk('export'); - $file = $job->key . '.zip'; - - try { - $content = $disk->get($file); - } catch (FileNotFoundException $e) { - Log::warning(sprintf('File not found: %s', $e->getMessage())); - $content = ''; - } - - return $content; - } - - /** - * @param User $user - */ - public function setUser(User $user): void - { - $this->user = $user; - } -} diff --git a/app/Repositories/ExportJob/ExportJobRepositoryInterface.php b/app/Repositories/ExportJob/ExportJobRepositoryInterface.php deleted file mode 100644 index 89be429ccf..0000000000 --- a/app/Repositories/ExportJob/ExportJobRepositoryInterface.php +++ /dev/null @@ -1,71 +0,0 @@ -. - */ -declare(strict_types=1); - -namespace FireflyIII\Repositories\ExportJob; - -use FireflyIII\Models\ExportJob; -use FireflyIII\User; - -/** - * Interface ExportJobRepositoryInterface. - */ -interface ExportJobRepositoryInterface -{ - /** - * @param ExportJob $job - * @param string $status - * - * @return bool - */ - public function changeStatus(ExportJob $job, string $status): bool; - - /** - * @return ExportJob|null - */ - public function create(): ?ExportJob; - - /** - * @param ExportJob $job - * - * @return bool - */ - public function exists(ExportJob $job): bool; - - /** - * @param string $key - * - * @return ExportJob|null - */ - public function findByKey(string $key): ?ExportJob; - - /** - * @param ExportJob $job - * - * @return string - */ - public function getContent(ExportJob $job): string; - - /** - * @param User $user - */ - public function setUser(User $user); -} diff --git a/app/User.php b/app/User.php index 41092e5011..0446a19b73 100644 --- a/app/User.php +++ b/app/User.php @@ -32,7 +32,6 @@ use FireflyIII\Models\Bill; use FireflyIII\Models\Budget; use FireflyIII\Models\Category; use FireflyIII\Models\CurrencyExchangeRate; -use FireflyIII\Models\ExportJob; use FireflyIII\Models\ImportJob; use FireflyIII\Models\PiggyBank; use FireflyIII\Models\Preference; @@ -78,7 +77,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Category[] $categories * @property-read \Illuminate\Database\Eloquent\Collection|\Laravel\Passport\Client[] $clients * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\CurrencyExchangeRate[] $currencyExchangeRates - * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\ExportJob[] $exportJobs * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\ImportJob[] $importJobs * @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBank[] $piggyBanks @@ -234,17 +232,6 @@ class User extends Authenticatable return $this->hasMany(CurrencyExchangeRate::class); } - /** - * @codeCoverageIgnore - * Link to export jobs - * - * @return HasMany - */ - public function exportJobs(): HasMany - { - return $this->hasMany(ExportJob::class); - } - /** * @codeCoverageIgnore * Generates access token. diff --git a/resources/views/v1/export/index.twig b/resources/views/v1/export/index.twig deleted file mode 100644 index 0bb79c101f..0000000000 --- a/resources/views/v1/export/index.twig +++ /dev/null @@ -1,109 +0,0 @@ -{% extends "./layout/default" %} - -{% block breadcrumbs %} - {{ Breadcrumbs.render(Route.getCurrentRoute.getName) }} -{% endblock %} - -{% block content %} -
- - -{% endblock %} -{% block scripts %} - - - - -{% endblock %} -{% block styles %} - - -{% endblock %} diff --git a/resources/views/v1/partials/menu-sidebar.twig b/resources/views/v1/partials/menu-sidebar.twig index d2636f7b39..87467fbae8 100644 --- a/resources/views/v1/partials/menu-sidebar.twig +++ b/resources/views/v1/partials/menu-sidebar.twig @@ -58,6 +58,14 @@ {{ 'reports'|_ }} + +