سامانه صدور فاکتور و حسابداری
fix(company): stamp company on invoice-excel-import.js records and guard company writes
davoodmehraban89 committed
Oct 14, 2026 at 11:35 UTC
5b228d581f74c5fc893c9e2f52626100f5d06040
1 file changed
+2
-2
js/invoice-excel-import.js
+2
-2
@@ -2,7 +2,7 @@
2
function importInvoiceItemsFromExcel(event){
3
if(!requireWrite())return;
4
const file=event.target.files[0];
5
- if(!file)return;if(file.size>5*1024*1024){event.target.value='';alert('حجم فایل اکسل نباید بیشتر از ۵ مگابایت باشد.');return;}
5
+ if(!file)return;if(!finoraActiveCompanyId()){alert('ابتدا شرکت فعال را انتخاب کنید.');return;}if(file.size>5*1024*1024){event.target.value='';alert('حجم فایل اکسل نباید بیشتر از ۵ مگابایت باشد.');return;}
6
const reader=new FileReader();
7
reader.onload=function(e){
8
try{
@@ -24,7 +24,7 @@ function importInvoiceItemsFromExcel(event){
24
prodId=prod.id;
25
}else{
26
prodId='P_'+Date.now()+'_'+Math.random().toString(36).slice(2,6);
27
- const newProd={id:prodId,ownerUserId:currentUser.id,code:code||(myProducts.length+added+1).toString(),name:name||code,spec:'',type:'good',unit,buy_price:0,sale_price:price,stock:0,internal_id:''};
27
+ const newProd={id:prodId,ownerUserId:currentUser.id,companyId:finoraActiveCompanyId(),code:code||(myProducts.length+added+1).toString(),name:name||code,spec:'',type:'good',unit,buy_price:0,sale_price:price,stock:0,internal_id:''};
28
datastore.products.push(newProd);
29
myProducts.push(newProd);
30
}