CSV Import fixes

- Corrected Capitalization in File Handling Logic
- Populated $allowedStockLocations before sending it to the validation function

Signed-off-by: objec <objecttothis@gmail.com>
This commit is contained in:
objec
2026-04-02 23:51:07 +04:00
parent f915a6de1f
commit b41380d36a
4 changed files with 67 additions and 5 deletions

View File

@@ -4,12 +4,12 @@
RewriteCond %{REQUEST_URI} !^public$
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge [NC]
RewriteRule "^(.*)$" "/public/" [R=301,L]
# RewriteRule "^(.*)$" "/public/" [R=301,L]
# If you installed CodeIgniter in a subfolder, you will need to
# change the following line to match the subfolder you need. Uncomment
# the line below and comment the line above.
#RewriteRule "^(.*)$" "/[SUBDIRECTORY]/public/" [R=301,L]
RewriteRule "^(.*)$" "/opensourcepos/public/" [R=301,L]
</IfModule>
# disable directory browsing

View File

@@ -1008,7 +1008,7 @@ class Items extends Secure_Controller
'pic_filename' => $row['Image']
];
if (!empty($row['supplier ID'])) {
if (!empty($row['Supplier ID'])) {
$itemData['supplier_id'] = $this->supplier->exists($row['Supplier ID']) ? $row['Supplier ID'] : null;
}
@@ -1026,7 +1026,12 @@ class Items extends Secure_Controller
}
if (!$isFailedRow) {
$allowedStockLocations = $this->stock_location->get_allowed_locations();
$isFailedRow = $this->validateCSVData($row, $itemData, $allowedStockLocations, $attributeDefinitionNames, $attributeData);
if (!empty($invalidLocations)) {
$isFailedRow = true;
log_message('error', 'CSV import: Invalid stock location(s) found: ' . implode(', ', $invalidLocations));
}
}
// Remove false, null, '' and empty strings but keep 0

View File

@@ -23,11 +23,66 @@ $request = Services::request();
<?php if (ENVIRONMENT == 'development' || get_cookie('debug') == 'true' || $request->getGet('debug') == 'true') : ?>
<!-- inject:debug:css -->
<link rel="stylesheet" href="resources/css/jquery-ui-fe010342cb.css">
<link rel="stylesheet" href="resources/css/bootstrap-dialog-1716ef6e7c.css">
<link rel="stylesheet" href="resources/css/jasny-bootstrap-40bf85f3ed.css">
<link rel="stylesheet" href="resources/css/bootstrap-datetimepicker-66374fba71.css">
<link rel="stylesheet" href="resources/css/bootstrap-select-66d5473b84.css">
<link rel="stylesheet" href="resources/css/bootstrap-table-ed9d1a3360.css">
<link rel="stylesheet" href="resources/css/bootstrap-table-sticky-header-07d65e7533.css">
<link rel="stylesheet" href="resources/css/daterangepicker-85523b7dfe.css">
<link rel="stylesheet" href="resources/css/chartist-c19aedb81a.css">
<link rel="stylesheet" href="resources/css/chartist-plugin-tooltip-2e0ec92e60.css">
<link rel="stylesheet" href="resources/css/bootstrap-tagsinput-5a6d46a06c.css">
<link rel="stylesheet" href="resources/css/bootstrap-toggle-e12db6c1f3.css">
<link rel="stylesheet" href="resources/css/bootstrap-4875cf7b0d.autocomplete.css">
<link rel="stylesheet" href="resources/css/invoice-a99a4dfac3.css">
<link rel="stylesheet" href="resources/css/ospos_print-bf10c1438b.css">
<link rel="stylesheet" href="resources/css/ospos-d0b91fdf8f.css">
<link rel="stylesheet" href="resources/css/popupbox-57d45cb822.css">
<link rel="stylesheet" href="resources/css/receipt-0606f1c54e.css">
<link rel="stylesheet" href="resources/css/register-a6a6cc948d.css">
<link rel="stylesheet" href="resources/css/reports-ace7faf688.css">
<!-- endinject -->
<!-- inject:debug:js -->
<script src="resources/js/jquery-12e87d2f3a.js"></script>
<script src="resources/js/jquery-4fa896f615.form.js"></script>
<script src="resources/js/jquery-a0350e8820.validate.js"></script>
<script src="resources/js/jquery-ui-cbc65ff85e.js"></script>
<script src="resources/js/bootstrap-894d79839f.js"></script>
<script src="resources/js/bootstrap-dialog-27123abb65.js"></script>
<script src="resources/js/jasny-bootstrap-7c6d7b8adf.js"></script>
<script src="resources/js/bootstrap-datetimepicker-25e39b7ef8.js"></script>
<script src="resources/js/bootstrap-select-b01896a67b.js"></script>
<script src="resources/js/bootstrap-table-bdb06552ea.js"></script>
<script src="resources/js/bootstrap-table-export-6389dc2aa5.js"></script>
<script src="resources/js/bootstrap-table-mobile-fc655b68ab.js"></script>
<script src="resources/js/bootstrap-table-sticky-header-cb4d83d172.js"></script>
<script src="resources/js/moment-d65dc6d2e6.min.js"></script>
<script src="resources/js/daterangepicker-048c56a690.js"></script>
<script src="resources/js/es6-promise-855125e6f5.js"></script>
<script src="resources/js/FileSaver-e73b1946e8.js"></script>
<script src="resources/js/html2canvas-e1d3a8d7cd.js"></script>
<script src="resources/js/jspdf-81c4900447.umd.js"></script>
<script src="resources/js/purify-87a00e56b7.js"></script>
<script src="resources/js/jspdf-92d87e47e8.plugin.autotable.js"></script>
<script src="resources/js/tableExport-3d506dfa61.min.js"></script>
<script src="resources/js/chartist-8a7ecb4445.js"></script>
<script src="resources/js/chartist-plugin-pointlabels-0a1ab6aa4e.js"></script>
<script src="resources/js/chartist-plugin-tooltip-116cb48831.js"></script>
<script src="resources/js/chartist-plugin-axistitle-80a1198058.js"></script>
<script src="resources/js/chartist-plugin-barlabels-4165273742.js"></script>
<script src="resources/js/bootstrap-notify-376bc6eb87.js"></script>
<script src="resources/js/bootstrap-tagsinput-855a7c7670.js"></script>
<script src="resources/js/bootstrap-toggle-1c7a19a049.js"></script>
<script src="resources/js/clipboard-908af414ab.js"></script>
<script src="resources/js/imgpreview-1db063409f.full.jquery.js"></script>
<script src="resources/js/manage_tables-e5dae00ba1.js"></script>
<script src="resources/js/nominatim-89be77a11a.autocomplete.js"></script>
<!-- endinject -->
<?php else : ?>
<!--inject:prod:css -->
<link rel="stylesheet" href="resources/opensourcepos-8f45024eca.min.css">
<!-- endinject -->
<!-- Tweaks to the UI for a particular theme should drop here -->
@@ -35,6 +90,8 @@ $request = Services::request();
<link rel="stylesheet" href="<?= 'css/' . esc($config['theme']) . '.css' ?>">
<?php } ?>
<!-- inject:prod:js -->
<script src="resources/jquery-2c872dbe60.min.js"></script>
<script src="resources/opensourcepos-b4362c2fe5.min.js"></script>
<!-- endinject -->
<?php endif; ?>

View File

@@ -39,10 +39,10 @@ Options All -Indexes
RewriteCond %{REQUEST_FILENAME} !-d
# If in web root
RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]
# RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]
# If in subdir comment above line, uncomment the line below and replace <PATH> with your path
#RewriteRule ^(.*)$ /<PATH>/public/index.php?/$1 [L]
RewriteRule ^(.*)$ /opensourcepos/public/index.php?/$1 [L]
# Ensure Authorization header is passed along
RewriteCond %{HTTP:Authorization} .