Files
SGF/scripts/sgf-multiline-invoice-inspect.php
T
2026-11-11 15:04:01 +02:00

3 lines
917 B
PHP

<?php
$book='8085';require __DIR__.'/sgf-single-bootstrap.php';$before=json_decode(file_get_contents(json_decode(file_get_contents($s['root'].'/multiline-invoice-backup-pointer.json'),true)['root'].'/preservation-private.json'),true);$changes=[];$changed=[];foreach(['host','native']as$n){$db=$n==='host'?$host:$native;foreach($before[$n]as$t=>$json){$old=json_decode($json,true);$now=$db->table($t)->get()->map(fn($r)=>(array)$r)->all();$canon=fn($r)=>Tempo\Finance\Payables\Payables::canonical($r);$seen=array_fill_keys(array_map($canon,$now),true);foreach($old as$r)if(!isset($seen[$canon($r)]))$changed[]=$n.'.'.$t;if(count($now)!==count($old))$changes[$n.'.'.$t]=count($now)-count($old);}}echo json_encode(['original_changed'=>array_unique($changed),'appends'=>$changes,'steps'=>count(json_decode(file_get_contents($s['root'].'/multiline-invoice-http-progress-private.json'),true)['steps'])],JSON_PRETTY_PRINT);