سامانه صدور فاکتور و حسابداری
Bound product Excel import resources
davoodmehraban89 committed
Sep 29, 2026 at 22:34 UTC
e3b686937f2abc128244f240913939081dddf38c
1 file changed
+2
-2
js/products.js
+2
-2
@@ -64,13 +64,13 @@ function importProductsFromExcel(event){
64
if(!requireWrite())return;
65
if(!currentUser)return;
66
const file=event.target.files[0];
67
- if(!file)return;
67
+ if(!file)return;if(file.size>5*1024*1024){event.target.value='';alert('حجم فایل اکسل نباید بیشتر از ۵ مگابایت باشد.');return;}
68
const reader=new FileReader();
69
reader.onload=function(e){
70
try{
71
const data=new Uint8Array(e.target.result);
72
const workbook=XLSX.read(data,{type:'array'});
73
- const rows=XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]]);
73
+ const rows=XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]]);if(rows.length>10000)throw new Error('too many rows');
74
const myProducts=getMyProducts();
75
rows.forEach((r,idx)=>{
76
const name=r["نام کالا"]||r["عنوان"];