aaro-scripts
Advanced tools
Comparing version 1.0.4 to 1.0.5
const getAllProducts = require("./sections/stock/stockScripts"); | ||
const getAllPriceListItems = require("./sections/priceList/priceListScripts"); | ||
const { | ||
getAllPriceListItems, | ||
showPassiveItemsOnPriceList, | ||
} = require("./sections/priceList/priceListScripts"); | ||
const getStocksForPriceList = require("./sections/combined/combinedScripts"); | ||
@@ -9,2 +12,3 @@ | ||
getStocksForPriceList, | ||
showPassiveItemsOnPriceList, | ||
}; |
{ | ||
"name": "aaro-scripts", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Useful scripts for aaro erp", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,3 +6,3 @@ const { sleep } = require("../helpers/sleep"); | ||
* @param {object} aaro object | ||
* @param {object} params extra limitations like EsnekAramaKisiti="PRF.PRVU" | ||
* @param {object} params extra limitations like FiyatListesiID=84 | ||
* @returns {array} | ||
@@ -43,2 +43,35 @@ */ | ||
module.exports = getAllPriceListItems; | ||
/** | ||
* @description It removes all the passive products from a price list. | ||
* When you duplicate a price list and turn a product into a passive which is already in the list | ||
* Remains on the list. With that method you can see them. | ||
* @param {object} aaro authenticated object | ||
* @param {integer} priceListID | ||
* @return {array} of passive products | ||
*/ | ||
const showPassiveItemsOnPriceList = async (aaro, priceListID) => { | ||
try { | ||
const passiveItems = []; | ||
const products = await getAllPriceListItems(aaro, { | ||
FiyatListesiID: priceListID, | ||
}); | ||
const search = products.map((el) => el.StokID); | ||
while (search.length) { | ||
const partialSearch = search.splice(0, 100); | ||
const searchQuery = partialSearch.join(","); | ||
const detailedProducts = await aaro | ||
.get("Stok", { SayfaSatirSayisi: 100, StokID: searchQuery }) | ||
.then((response) => response.data.Model); | ||
detailedProducts.forEach((product) => | ||
product.Durum == false ? passiveItems.push(product) : "" | ||
); | ||
} | ||
return passiveItems; | ||
} catch (err) { | ||
throw err; | ||
} | ||
}; | ||
module.exports = { getAllPriceListItems, showPassiveItemsOnPriceList }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6092
160