Import ignores Created By field data #944

Open
opened 2022-08-04 21:46:27 +00:00 by Chris Paschen · 2 comments
Member

Steps to reproduce the issue

Create Component with an admin view
Enter some data
Export the data (using the standard Export Data button on the admin view)
Delete all data from the view/table
Import the data (using the file just exported)

Expected result

The data in the "Created By" field should use the data provided in the import.

Actual result

Uses the current user's ID (the person doing the import) as the Created By.

System information (as much as possible)

  • OS Name & Version: WWAMP
  • MySql Version: 5.7.31
  • Apache Version: 2.4.46
  • PHP Version: 7.4.9
  • Joomla Version: 3.10.10
  • JCB Version: 3.1.4
  • Browser: Firefox Developer

Additional comments

I understand that having the created_by field use the data provided in the import might cause a problem (if the user IDs are different - esp. when moving from one system to another); however, the fact that the import field selection allows you to set the created_by field to the created_by import filed would imply to me that it should be using that data directly, without making any changes to it.

At this point I don't see a way around this (other than modifying the JCB code).

Am I missing a setting somewhere that would allow it to just import the raw data from the import file?

I guess an ideal solution might be to have an option for that field to allow:

  1. Use current user
  2. Use existing (import data) - allowing it to possibly break if no user by that ID
  3. Use existing import data, but if the user ID is not found, then use the current user ID

Let me know if I missed something here, or if this is a somewhat simple change that I could make and submit.

(BTW ... if anyone runs into this issue, the work-aroudn is just to do the import directly using the db manager)

### Steps to reproduce the issue Create Component with an admin view Enter some data Export the data (using the standard Export Data button on the admin view) Delete all data from the view/table Import the data (using the file just exported) ### Expected result The data in the "Created By" field should use the data provided in the import. ### Actual result Uses the current user's ID (the person doing the import) as the Created By. ### System information (as much as possible) - OS Name & Version: WWAMP - MySql Version: 5.7.31 - Apache Version: 2.4.46 - PHP Version: 7.4.9 - Joomla Version: 3.10.10 - JCB Version: 3.1.4 - Browser: Firefox Developer ### Additional comments I understand that having the created_by field use the data provided in the import might cause a problem (if the user IDs are different - esp. when moving from one system to another); however, the fact that the import field selection allows you to set the created_by field to the created_by import filed would imply to me that it should be using that data directly, without making any changes to it. At this point I don't see a way around this (other than modifying the JCB code). Am I missing a setting somewhere that would allow it to just import the raw data from the import file? I guess an ideal solution might be to have an option for that field to allow: 1. Use current user 2. Use existing (import data) - allowing it to possibly break if no user by that ID 3. Use existing import data, but if the user ID is not found, then use the current user ID Let me know if I missed something here, or if this is a somewhat simple change that I could make and submit. (BTW ... if anyone runs into this issue, the work-aroudn is just to do the import directly using the db manager)
Owner

Yes, this is a feature... and so it forces the created_by to use the current user doing the import, to avoide all kinds of other issues. This field is a strong control field in Joomla, so changing that behaviour will be a security risk, therfore can not be the default.

But I get the point that it may be what end-users want, and so we developers must give it to them. Okay so it seems like a feature request. I will mark it like that and see when we can get back to it.

Yes, this is a feature... and so it forces the created_by to use the current user doing the import, to avoide all kinds of other issues. This field is a strong control field in Joomla, so changing that behaviour will be a security risk, therfore can not be the default. But I get the point that it may be what end-users want, and so we developers must give it to them. Okay so it seems like a feature request. I will mark it like that and see when we can get back to it.
Llewellyn added the
enhancement
label 2022-08-05 08:16:34 +00:00
Llewellyn added this to the Feature Requests project 2022-08-05 08:18:05 +00:00
Author
Member

Yes, I see that importing that data directly could cause a problem.
And after looking more closely at the export data it's also missing the asset-id field. And I realized re-importing that would lead to problems also.

I think I'm just trying to do something that is different than an 'export' of data, and it's specifically related to development - not end-user purposes.

I think the existing system is good, but maybe just change the selector on that import field for the created_by field to just be set to 'current user' so that the person importing knows that it won't be imported from the original data.

The real 'issue' that I was having was that I needed to uninstall the component before re-building and re-installing (beause I messed up something in the data fields), and I didn't want to loose the data in the tables.

Maybe the easiest solution is if we had a way to specify that on uninstall the tables aren't deleted.

I seem to remember seeing that mentioned in a video a long time ago but couldn't find it.
If you happen to remember which video I'll just go back there and find it and that would solve my issue.

Yes, I see that importing that data directly could cause a problem. And after looking more closely at the export data it's also missing the asset-id field. And I realized re-importing that would lead to problems also. I think I'm just trying to do something that is different than an 'export' of data, and it's specifically related to development - not end-user purposes. I think the existing system is good, but maybe just change the selector on that import field for the created_by field to just be set to 'current user' so that the person importing knows that it won't be imported from the original data. The real 'issue' that I was having was that I needed to uninstall the component before re-building and re-installing (beause I messed up something in the data fields), and I didn't want to loose the data in the tables. Maybe the easiest solution is if we had a way to specify that on uninstall the tables aren't deleted. I seem to remember seeing that mentioned in a video a long time ago but couldn't find it. If you happen to remember which video I'll just go back there and find it and that would solve my issue.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#944
No description provided.