Skip to content
This repository has been archived by the owner on May 27, 2023. It is now read-only.

Location data being lost when importing items into ITDB #62

Open
computerman-13 opened this issue Apr 27, 2017 · 4 comments
Open

Location data being lost when importing items into ITDB #62

computerman-13 opened this issue Apr 27, 2017 · 4 comments

Comments

@computerman-13
Copy link

I noticed an issue when importing data into the database using the import function.
When I attempt to import a file, the location information is populated pre import check, but once the data is imported and I list the items, the location field is blank. Additionally, if there is information in the area field in the csv file, that is entered into the database.

@kalanUM
Copy link

kalanUM commented Apr 28, 2017

Hi computerman-13,
Check out the file import.php - find "INSERT into items" query, change this:

           //'locationid'=>$locationid,
           'locationid'=>$locid,

Or find the two "$locid" vars and change them to $locationid (note, don't change the 'locid' array tags):

	$lr=getlocidsbynames($cols[$name2fno['location']],$cols[$name2fno['area']]);
	if ($lr[0]<0) {
		echo "Location/locarea non existent: {$cols[$name2fno['location']]}/{$cols[$name2fno['area']]}<br>";
		$locid="";
		$locareaid="";
	}
	else {
		$locid=$lr['locid'];
		$locareaid=$lr['locareaid'];
	}
  • K

@computerman-13
Copy link
Author

computerman-13 commented Apr 29, 2017

I first tried the first change changing 'locationid'=>$locid, which I saw a few days ago in your othe post, but that did not correct the issue.
I also tried changing
$lr=getlocidsbynames($cols[$name2fno['location']],$cols[$name2fno['area']]);
if ($lr[0]<0) {
echo "Location/locarea non existent: {$cols[$name2fno['location']]}/{$cols[$name2fno['area']]}
";
$locid="";
$locareaid="";
}
else {
$locid=$lr['locid'];
$locareaid=$lr['locareaid'];
}

to $locationid but that did not work either.

@computerman-13
Copy link
Author

I just did some additional testing. I found that If I put in an area as well as the location, then the location is imported into the database correctly. If there is only a location in the itdb database, then the information isn't imported because it appears to be referencing the locareaid table. I looked at the table and nothing is created in the table unless an area is filled in for each location.

@nikband
Copy link

nikband commented Aug 23, 2017

Location (example London with floor 1,2,3 have different locationid) have problem with actual import procedure.

I try to solve this in my fork but I not able to fix... @sivann can you help with this location-floor-area import problem?

info: There is a check if SN is present into items? for skip just imported items or done an UPDATE (i prefer a skip)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants