Export Data #303

Closed
opened 2018-06-18 23:52:10 +00:00 by mwweb · 9 comments
mwweb commented 2018-06-18 23:52:10 +00:00 (Migrated from github.com)

Steps to reproduce the issue

It's an odd behavior, but if I go to a component admin list view for one of my components, select records, then click Export Data, the data exports, but without the header row. But, another admin list view works perfectly fine doing the exact same thing.

Expected result

Export data complete with header row.

Actual result

Data is exported without header.

System information (as much as possible)

  • OS Name & Version: 4.04.1-Ubuntu
  • MySql Version: 5.5.5-10.1.28-MariaDB-1~trusty
  • Apache Version: 2.4.29
  • PHP Version: 7.1.11-1+ubuntu 14.04.1+deb.sury.org+1
  • Joomla Version: 3.8.8
  • JCB Version: 2.8.0
  • Browser: Chrome/Firefox/MS Edge

Additional comments

### Steps to reproduce the issue It's an odd behavior, but if I go to a component admin list view for one of my components, select records, then click Export Data, the data exports, but without the header row. But, another admin list view works perfectly fine doing the exact same thing. ### Expected result Export data complete with header row. ### Actual result Data is exported without header. ### System information (as much as possible) - OS Name & Version: 4.04.1-Ubuntu - MySql Version: 5.5.5-10.1.28-MariaDB-1~trusty - Apache Version: 2.4.29 - PHP Version: 7.1.11-1+ubuntu 14.04.1+deb.sury.org+1 - Joomla Version: 3.8.8 - JCB Version: 2.8.0 - Browser: Chrome/Firefox/MS Edge ### Additional comments
ro-ot commented 2018-06-19 20:35:58 +00:00 (Migrated from github.com)

The code used to build the headers are found here in each list view module. You can debug the issue by starting at that function and working your way up into the main helper class of your component.

The code used to build the headers are [found here](https://github.com/SermonDistributor/Joomla-3-Component/blob/master/admin/models/preachers.php#L279) in each list view module. You can debug the issue by starting at that function and working your way up into the main helper class of your component.
mwweb commented 2018-06-19 22:19:14 +00:00 (Migrated from github.com)

Cursory look doesn't show an issue. It was working fine pre-JCB 2.8.0.

For the time being i think I'm just going to have to remove they import/export function, which would have made life easier, and just make a notation in my mind that this featureis unreliable.

When i eventually have time to dedicate to debugging JCB inserted code, then i will. Until then, this is an unreliable/unstable feature.

Cursory look doesn't show an issue. It was working fine pre-JCB 2.8.0. For the time being i think I'm just going to have to remove they import/export function, which would have made life easier, and just make a notation in my mind that this featureis unreliable. When i eventually have time to dedicate to debugging JCB inserted code, then i will. Until then, this is an unreliable/unstable feature.
mwweb commented 2018-06-20 17:44:54 +00:00 (Migrated from github.com)

What's not getting added is lines 242-260 from that sample model in Sermon Distributor.

				if (SermondistributorHelper::checkArray($items))
				{
					// get user object.
					$user = JFactory::getUser();
					foreach ($items as $nr => &$item)
					{
						$access = ($user->authorise('preacher.access', 'com_sermondistributor.preacher.' . (int) $item->id) && $user->authorise('preacher.access', 'com_sermondistributor'));
						if (!$access)
						{
							unset($items[$nr]);
							continue;
						}
						// unset the values we don't want exported.
						unset($item->asset_id);
						unset($item->checked_out);
						unset($item->checked_out_time);
					}`

I'll further point out that I created a blank site, installed JCB 2.7.10, and the export works as intended. upgrade to JCB 2.8.0 and it failed. Reinstall JCB 2.7.10, overwriting 2.8.0, and it gets compiled correctly.

What's not getting added is lines 242-260 from that sample model in Sermon Distributor. ``` // set values to display correctly. if (SermondistributorHelper::checkArray($items)) { // get user object. $user = JFactory::getUser(); foreach ($items as $nr => &$item) { $access = ($user->authorise('preacher.access', 'com_sermondistributor.preacher.' . (int) $item->id) && $user->authorise('preacher.access', 'com_sermondistributor')); if (!$access) { unset($items[$nr]); continue; } // unset the values we don't want exported. unset($item->asset_id); unset($item->checked_out); unset($item->checked_out_time); }` ``` I'll further point out that I created a blank site, installed JCB 2.7.10, and the export works as intended. upgrade to JCB 2.8.0 and it failed. Reinstall JCB 2.7.10, overwriting 2.8.0, and it gets compiled correctly.
ro-ot commented 2018-06-21 00:21:06 +00:00 (Migrated from github.com)

I just looked at JCB and it still added those lines for example to the the fields model of JCB.

@Llewellynvdm I remember you made improvements to Interpretation class function called setGetItemsMethodStringFix, could this be the issue.

The code mentioned by @mwweb is build in that class function.

I just looked at JCB and it still added those lines for example to the the [fields](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/admin/models/fields.php#L405) model of JCB. @Llewellynvdm I remember you made improvements to [Interpretation class function called setGetItemsMethodStringFix](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/admin/helpers/compiler/e_Interpretation.php#L11801), could this be the issue. The code mentioned by @mwweb is build in [that class function](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/admin/helpers/compiler/e_Interpretation.php#L12067).

@mwweb does the view have permissions set? You will see we check for that on line 11813.

You can set the views permissions in the Admin view->Settings (tab)->Permissions That it looks something like this:
image

Then it will add the code your are missing, but that still does not explain why the header values are not added to your export data.

@mwweb does the view have permissions set? You will see we check for that on [line 11813](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/admin/helpers/compiler/e_Interpretation.php#L11813). You can set the views permissions in the Admin view->Settings (tab)->Permissions That it looks something like this: ![image](https://user-images.githubusercontent.com/5607939/41710800-790d2bec-753e-11e8-985e-de0414c61a6e.png) Then it will add the code your are missing, but that still does not explain why the header values are not added to your export data.
ro-ot commented 2018-06-21 09:46:45 +00:00 (Migrated from github.com)

Well it actually does, if we does no permissions, and no strings to fix, it will not add the headers on line 12076. I would suggest we move those to be added even if we have no permissions, if the export switch is active.

I think we have a bug.

Well it actually does, if we does no permissions, and no strings to fix, it will not add the headers on [line 12076](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/admin/helpers/compiler/e_Interpretation.php#L12076). I would suggest we move those to be added even if we have no permissions, if the export switch is active. I think we have a bug.

Hmmm yes that is right, okay I will push a patch for this.

Hmmm yes that is right, okay I will push a patch for this.

@mwweb a quick patch would be to change line 12067 to:

if (ComponentbuilderHelper::checkString($fix) || $export)

This will resolve the issue, and with the next update it will be patched.

@mwweb a quick patch would be to change [line 12067](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/admin/helpers/compiler/e_Interpretation.php#L12067) to: ``` if (ComponentbuilderHelper::checkString($fix) || $export) ``` This will resolve the issue, and with the next update it will be patched.
mwweb commented 2018-06-22 07:01:03 +00:00 (Migrated from github.com)

I did testing, and that did resolve the issue.

I did testing, and that did resolve the issue.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 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#303
No description provided.