13 lines
1.2 KiB
PHP
13 lines
1.2 KiB
PHP
<?php
|
|
namespace App\Modules\Services;
|
|
use App\Shared\Installation\CompositionRuntime;use App\Modules\Accounting\SourceBook;use Illuminate\Support\Facades\DB;
|
|
final class DocumentPeriod
|
|
{
|
|
public static function open(array $scope):array
|
|
{
|
|
$physical=CompositionRuntime::physical();$run=(string)getenv('SGF_ISOLATED_REGRESSION_RUN');$file='C:/laragon/data/sgf-tempo/run/modular-regression-'.$run.'/private/receipt-composition-'.$physical['composition'].'/binding.json';
|
|
abort_unless(realpath((string)config('receipt_qa.profile'))===realpath($file),403);$p=json_decode(file_get_contents($file),true,64,JSON_THROW_ON_ERROR);$c=$p['connection'];abort_unless($c['database']==='compras_receipts_test_'.$physical['composition']&&$c['username']==='payable_history_native_'.$physical['composition']&&$c['host']==='127.0.0.1'&&(int)$c['port']===55439,403);
|
|
config(['database.connections.receipt_native'=>$c]);$period=SourceBook::table('gl_periods')->where($scope)->where('period_key','QA-2026-INTEGRADO')->orderByDesc('version')->first();abort_unless($period&&$period->status==='open',409,'A anulação exige período QA aberto; não há reabertura.');return (array)$period;
|
|
}
|
|
}
|