Welcome, Guest. Please login or register.

Author Topic: Error when Importing updates to Assets. NeDi 2.0.120  (Read 3001 times)

torbsjos

  • Newbie
  • *
  • Posts: 5
    • View Profile
Error when Importing updates to Assets. NeDi 2.0.120
« on: June 10, 2021, 03:10:00 pm »
We use Asset to store information about all spares we have on shelf.
Import of Assets is done using the "custom" flag. And new devices are no problem at all.
It is the updates that generates errors.
If we import the same CSV again (maybe with updated comments, or no change at all) there should only be an update, but there is an error on every row:

"Incorrect integer value: 'username' for column `nedi`.`inventory`.`endsupport` at row 1"

I have found this in php file Assets-Management.php (line numbers included):

   292                                  if( DbQuery($link,'inventory','u','','','',
   293                                          array('serial'),
   294                                          array($sn),
   295                                          array('assettype','assetlocation','assetcontact','assetupdate','maintsla','maintdesc','maintcost','maintstatus','startmaint','endmaint','endwarranty','endsupport','endlife','usrname','dpmonths'),
   296                                          array($ty,$lo,$co,time(),$ms,$md,$mt,$em,0,$es,$el,$_SESSION['user'],$dp)
   297                                  ) ){

It seems that a few parameters are missing in the last array, causing the error.


rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2901
    • View Profile
    • NeDi
Re: Error when Importing updates to Assets. NeDi 2.0.120
« Reply #1 on: June 22, 2021, 11:07:28 am »
Interesting, do you see a usrname varchar(32) column in the inventory table? You can use System-Database to check...
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo

arphax

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Error when Importing updates to Assets. NeDi 2.0.120
« Reply #2 on: July 02, 2021, 03:46:01 pm »
So, been banging my head on a wall here.
I cannot seem to get it to import add/update most of the info on any device.

I have pulled the DB apart looking the order over as well as looking at the order in the PHP but can never seem to get the right order to import really most dates for anything that Nedi will keep up with.
With what I think is the correct Columns format. I can only get the "Maintenance End date" from what should be the "Service END Columns" and the "end warranty" will up date but with the "EOL Columns".

I do understand I can change the Columns around to match the date but per the DB and PHP this is the order.
I have replaced every Columns with dates but the SN to "test" import an update and that is the only things full Columns format will import/update.


Thanks for any help.


==================
Update: So if delete/remove the item from inventory then do a full import everything seem to import just fine. So I have the correct format but its just disregarding any "DATE updates" seem to be ignored?
« Last Edit: July 02, 2021, 05:25:28 pm by arphax »

torbsjos

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Error when Importing updates to Assets. NeDi 2.0.120
« Reply #3 on: July 05, 2021, 01:31:57 pm »
Interesting, do you see a usrname varchar(32) column in the inventory table? You can use System-Database to check...

Yes I can see a usrname varchar(32).

I'm still confused by the code snippet in my first post.
I can't get it to match if I compare the array with the column names to the array with the values.
Here are the pairs line by line:
assettype       - $ty
assetlocation   - $lo
assetcontact    - $co
assetupdate     - time()
maintsla        - $ms
maintdesc       - $md
maintcost       - $mt   <--- I think the mismatches start here
maintstatus     - $em
startmaint      - 0
endmaint        - $es
endwarranty     - $el
endsupport      - $_SESSION['user']
endlife         - $dp
usrname         - <no value left in array>
dpmonths        - <no value left in array>


torbsjos

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Error when Importing updates to Assets. NeDi 2.0.120
« Reply #4 on: October 11, 2021, 08:51:27 am »
We have an urgent need to update using import files.
Is there some PHP guru out there who can have a look at the code and correct it?
The error is in Assets-Management.php (Check my first post in this thread)

sjobergh

  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Error when Importing updates to Assets. NeDi 2.0.120
« Reply #5 on: October 13, 2021, 01:16:05 am »
I have the same problem,  importing new devices to asset works but update does nor work
I think one of NeDi?s best features is to keep track of what u have active in your network and keeping track of assets so "update" is maybe not crucial but really important.

torbsjos

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Error when Importing updates to Assets. NeDi 2.0.120
« Reply #6 on: November 25, 2021, 01:53:12 pm »
We have corrected a line of code, and it works now.
There was just a couple of variables missing.
I attached the patch to this message.