Add an editable menu name and reserve billing material numbers on creation
- Company details get an optional "Valikon nimi", shown at the left of the main menu; it falls back to the application name when empty. - A billing material gets its running number (billing_exports.number) only when it is created, so discarded drafts leave no gaps. Drafts have no number; existing created materials are numbered by the migration, and the CSV file name uses the number. - TaskAssigneeMigrationTest rolls back from its own migration onward instead of assuming it is the last one. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Modules\Billing\Presentation\Http\Controllers;
|
||||
|
||||
use App\Modules\Billing\Application\DTOs\ExportRow;
|
||||
use App\Modules\Billing\Application\Services\ExportRows;
|
||||
use App\Modules\Billing\Application\Services\ExportViews;
|
||||
use App\Modules\Billing\Domain\Enums\LineKind;
|
||||
use App\Modules\Billing\Domain\Exceptions\BillingExportNotFound;
|
||||
use App\Modules\Billing\Domain\Exceptions\ExportNotCreated;
|
||||
@@ -19,7 +20,7 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
*/
|
||||
class DownloadBillingCsv
|
||||
{
|
||||
public function __invoke(int $export, ExportRows $exportRows): StreamedResponse
|
||||
public function __invoke(int $export, ExportRows $exportRows, ExportViews $exportViews): StreamedResponse
|
||||
{
|
||||
Gate::authorize('billing.manage');
|
||||
|
||||
@@ -29,6 +30,8 @@ class DownloadBillingCsv
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$number = $exportViews->of($export)->number ?? abort(404);
|
||||
|
||||
return response()->streamDownload(function () use ($rows): void {
|
||||
$out = fopen('php://output', 'w');
|
||||
|
||||
@@ -44,7 +47,7 @@ class DownloadBillingCsv
|
||||
}
|
||||
|
||||
fclose($out);
|
||||
}, __('billing.csv.file', ['number' => $export]), [
|
||||
}, __('billing.csv.file', ['number' => $number]), [
|
||||
'Content-Type' => 'text/csv; charset=UTF-8',
|
||||
'Cache-Control' => 'no-store, private',
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user