diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-06 17:44:21 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-06 17:44:21 +0100 |
| commit | 20d282c1bbb6385150486a6c88ad65ce97e746d7 (patch) | |
| tree | 7125406856d8aad9427967dd63e0d9787c89fb3f /edit_assembly.php | |
| parent | 85add8e6c0fa75baeeee342e6e36051faf923e5c (diff) | |
| download | stock-20d282c1bbb6385150486a6c88ad65ce97e746d7.tar.gz stock-20d282c1bbb6385150486a6c88ad65ce97e746d7.tar.bz2 stock-20d282c1bbb6385150486a6c88ad65ce97e746d7.zip | |
import: save uploaded CSVs to storage/stock/ for audit trail
Add STOCK_IMPORT_PATH = STORAGE_PKG_PATH.'stock/' to bit_setup_inc.
edit_assembly.php: move_uploaded_file BOM CSV to
storage/stock/<origname>_bom_<content_id>.csv before processing.
edit_movement.php: copy movement CSV to
storage/stock/<origname>_move_<content_id>.csv before calling importCsv().
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'edit_assembly.php')
| -rwxr-xr-x | edit_assembly.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/edit_assembly.php b/edit_assembly.php index c3199b7..e86c5c4 100755 --- a/edit_assembly.php +++ b/edit_assembly.php @@ -66,9 +66,12 @@ if( !empty( $_REQUEST['savegallery'] ) ) { $csvLoaded = $csvSkipped = 0; $csvErrors = []; if( !empty( $_FILES['csv_file']['tmp_name'] ) && is_uploaded_file( $_FILES['csv_file']['tmp_name'] ) ) { + $origName = preg_replace( '/[^a-zA-Z0-9_-]/', '_', pathinfo( $_FILES['csv_file']['name'], PATHINFO_FILENAME ) ); + $savedBom = STOCK_IMPORT_PATH . $origName . '_bom_' . $gContent->mContentId . '.csv'; + move_uploaded_file( $_FILES['csv_file']['tmp_name'], $savedBom ); // Valid BOM unit types (MOV is for movements, not BOM lines) $validItems = [ 'SGL', 'PCK', 'SHT', 'VOL' ]; - if( ($fh = fopen( $_FILES['csv_file']['tmp_name'], 'r' )) !== false ) { + if( ($fh = fopen( $savedBom, 'r' )) !== false ) { $rowNum = 0; while( ($cols = fgetcsv($fh, 0, ',', '"', '')) !== false ) { $rowNum++; |
