Files
SGF/scripts/sgf-install-service-documents.php
T
2026-11-11 09:00:17 +02:00

7 lines
2.2 KiB
PHP

<?php
$book='8085';require __DIR__.'/sgf-single-bootstrap.php';$files=['app/Modules/Services/ServiceDocuments.php','app/Modules/Services/DocumentPeriod.php','app/Modules/Services/Http/ServiceDocumentsController.php','app/Modules/Services/ServiceInvoicing.php','app/Modules/Services/ServiceReceivables.php','app/Modules/Accounting/SalesLedgerSource.php','app/Modules/Accounting/ComposedLedgerCandidates.php','packages/general-ledger/src/LedgerSales.php','packages/general-ledger/src/PayableJournal.php','packages/general-ledger/src/LedgerCycle.php','app/Shared/Context/ModuleNavigation.php','app/Modules/Identity/Services/IdentityWorkflow.php','routes/web.php','resources/views/commercial/documents.blade.php','resources/views/accounting/composed-ledger.blade.php','public/sgf-service-documents.mjs','public/sgf-stock-completion.mjs'];$hashes=[];
$copy=function($source,$file)use($s,$work,&$hashes){$target=$s['app'].'/'.$file;$backup=$work.'/before/'.$file;if(is_file($target)){if(!is_dir(dirname($backup)))mkdir(dirname($backup),0700,true);copy($target,$backup);}if(!is_dir(dirname($target)))mkdir(dirname($target),0700,true);copy($source,$target);$hashes[$file]=hash_file('sha256',$target);};
foreach($files as $file)if(str_ends_with($file,'.php')&&!str_ends_with($file,'.blade.php'))(new Symfony\Component\Process\Process([PHP_BINARY,'-l',$repo.'/'.$file]))->mustRun();foreach($files as $file)$copy($repo.'/'.$file,$file);
$build=$run['root'].'/private/single-documents-ui-build-20261110';foreach(glob($build.'/assets/*') as $file)$copy($file,'public/build/assets/'.basename($file));$copy($build.'/manifest.json','public/build/manifest.json');$file=$work.'/service_documents.php';file_put_contents($file,"<?php\nreturn ".var_export(['enabled'=>true,'invoice_receipt_enabled'=>true,'inputs_sha256'=>hash_file('sha256',$s['root'].'/single-document-inputs.json')],true).";\n");$copy($file,'config/service_documents.php');
file_put_contents($work.'/service-documents-installation.json',json_encode(['passed'=>true,'source_hashes'=>$hashes,'installation'=>$tag,'cache_cleared'=>false,'new_demo'=>false,'real_activation'=>false],JSON_PRETTY_PRINT));echo json_encode(['passed'=>true,'proof'=>$work.'/service-documents-installation.json']).PHP_EOL;