commit de compras
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tempo\Finance\Payables\Payables;
|
||||
|
||||
$f = json_decode(file_get_contents($s['root'].'/fixture.json'), true, 64, JSON_THROW_ON_ERROR);
|
||||
$prior = json_decode(file_get_contents($s['root'].'/page-post.json'), true, 64, JSON_THROW_ON_ERROR);
|
||||
DB::beginTransaction(); DB::statement('SET TRANSACTION READ ONLY');
|
||||
try {
|
||||
$hash = hash_init('sha256');
|
||||
foreach (['pa_imported_sources', 'pa_source_histories', 'pa_sources', 'pa_proposals', 'pa_obligations', 'pa_history_imports', 'pa_imported_payments', 'pa_events', 'pa_commands', 'pa_access'] as $table) {
|
||||
hash_update($hash, $table."\n");
|
||||
foreach (DB::table($table)->where($f['scope'])->orderBy('id')->cursor() as $row) hash_update($hash, Payables::canonical((array) $row)."\n");
|
||||
}
|
||||
$current = hash_final($hash);
|
||||
if ($current !== $prior['scoped_business_fingerprint'] || DB::getSchemaBuilder()->hasTable('ps_payments') || config('supplier_payable_history.synthetic_enabled') !== false) throw new LogicException('Previous financial proof or default guard changed');
|
||||
$report = ['passed' => true, 'read_only' => true, 'previous_scoped_business_fingerprint_equal' => true, 'scoped_business_fingerprint' => $current, 'temporary_settlement_schema_absent' => true, 'history_default_disabled' => true, 'previous_post_proof_sha256' => hash_file('sha256', $s['root'].'/page-post.json')];
|
||||
file_put_contents($s['root'].'/evidence-post.json', json_encode($report, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
|
||||
echo json_encode($report)."\n";
|
||||
} finally { DB::rollBack(); }
|
||||
Reference in New Issue
Block a user