PartKeepr icon indicating copy to clipboard operation
PartKeepr copied to clipboard

Impossible to set initial stockLevel from CSV Import?

Open jpubb opened this issue 1 year ago • 1 comments

# Bug description

When attemping to import stockLevel, the value of "Stock" in the front end table views is not altered (remains 0).

To test, we use a fairly minimal import field mapping preset:

PartKeepr.PartBundle.Entity.Part > name PartKeepr.PartBundle.Entity.Part > description PartKeepr.PartBundle.Entity.Part > comment PartKeepr.PartBundle.Entity.Part > internalPartNumber PartKeepr.PartBundle.Entity.Part > category
PartKeepr.PartBundle.Entity.Part > storageLocation

partPartKeeprStockBundleEntityStockEntries > [x] create new item partPartKeeprStockBundleEntityStockEntries > stockLevel

Looks like this... image

When importing, everything except stockLevel was imported.

System Information

  • PartKeepr Version: 1.4.0
  • Operating System: Ubuntu 20.04.1 LTS
  • Web Server: Apache
  • PHP Version: PHP 7.2.34-36+ubuntu20.04.1+deb.sury.org+1 (cli)
  • Database and version: /usr/sbin/mysqld Ver 8.0.32-0ubuntu0.20.04.2 for Linux on x86_64 ((Ubuntu))
  • Reproducible on the demo system: Yes

jpubb avatar Apr 07 '23 16:04 jpubb

WORKAROUND (hack)....

Instead of using stockLevel because it's broken/bugged

instead map your quantity to the field status (assuming you don't use/need status. Or map to something else)

Then your import will work, and status will represent qty on hand.

Next go into phpmyadmin and run query:

UPDATE `Part` SET `stockLevel` = `status` WHERE `status` >0

So anything where status is >0 will be mapped to "stockLevel" as you want.

You can then blank all your status back to 0 (be careful - if you use status for something you probably don't want to do this)

UPDATE `Part` SET `status` = 0 WHERE `status` IS NOT NULL

jpubb avatar Apr 07 '23 23:04 jpubb