Welcome, Guest
Username: Password: Remember me

TOPIC: Joomla User not passed in form

Joomla User not passed in form 03 Dec 2013 19:07 #11728

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
I updated a few minor things from my v2.6 J-Cook component. In the v2.6.2 component the Joomla User ID is no longer being passed. This comes from a select box in the item form.

From admin/models/item.php
public function save($data)
{
	//Convert from a non-SQL formated date (creation_date)
	$data['creation_date'] = LkmHelperDates::getSqlDate($data['creation_date'], array('Y-m-d'), true);

	//Convert from a non-SQL formated date (expiration_date)
	$data['expiration_date'] = LkmHelperDates::getSqlDate($data['expiration_date'], array('Y-m-d'), true);
	//Some security checks
	$acl = LkmHelper::getActions();

	//Secure the published tag if not allowed to change
	if (isset($data['published']) && !$acl->get('core.edit.state'))
		unset($data['published']);

	if (parent::save($data)) {
		return true;
	}
	return false;

}

in v2.6 this would correctly output the Joomla User ID in the $data array. Now it will not. In the below array the Joomla User ID should be in licensed_user. Example:
Array (
[licensed_user] => 0 
[product] => 1 
[support_level] => 1 
[published] => 1 
[set_for_del] => 
[asset_name] => M1C - 00:50:56:a2:47:8a 
[mac_address] => 00:50:56:a2:47:8a 
[days_override] => 0 
[admin_notes] => 
[id] => 0 
[creation_date] => 
[expiration_date] => 2015-12-04 18:50:45 
[key_file] => license-0-KPoNtC-2013-12-03.php 
[license_id] => KFY3V9LNOK 
)

Joomla Version: 3.2

Also, the same behavior is in the sandbox.


Ideas?
--
Jerry Benton
Last Edit: 03 Dec 2013 19:18 by jcbenton.
The administrator has disabled public write access.

Joomla User not passed in form 03 Dec 2013 19:29 #11729

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
I think I found the problem within the same file. This is J-Cook generated code with no mods:
	protected function loadFormData()
	{
		// Check the session for previously entered form data.
		$data = JFactory::getApplication()->getUserState('com_lkm.edit.licensesitem.data', array());

		if (empty($data)) {
			//Default values shown in the form for new item creation
			$data = $this->getItem();

			// Prime some default values.
			if ($this->getState('licensesitem.id') == 0)
			{
				$jinput = JFactory::getApplication()->input;

				$data->id = 0;
				$data->joomla_access = $jinput->get('filter_joomla_access', $this->getState('filter.joomla_access'), 'INT');
				$data->licensed_user = $jinput->get('filter_licensed_user', $this->getState('filter.licensed_user'), 'INT');
				$data->creation_date = null;
				$data->expiration_date = null;
				$data->product = $jinput->get('filter_product', $this->getState('filter.product'), 'INT');
				$data->asset_name = null;
				$data->mac_address = null;
				$data->days_override = 0;
				$data->key_file = null;
				$data->license_id = null;
				$data->details = 'View';
				$data->admin_notes = null;
				$data->published = 1;
				$data->set_for_del = 0;
				$data->support_level = $jinput->get('filter_support_level', $this->getState('filter.support_level'), 'INT');
				$data->licensed_user = $jinput->get('filter_licensed_user', $this->getState('filter.licensed_user'), 'INT');
				$data->product = $jinput->get('filter_product', $this->getState('filter.product'), 'INT');
				$data->_product_product_type = $jinput->get('filter_product_product_type', $this->getState('filter.product_product_type'), 'INT');
				$data->support_level = $jinput->get('filter_support_level', $this->getState('filter.support_level'), 'INT');

			}
		}
		return $data;
	}

Notice the duplicate entries for $data->licensed_user near the bottom.



My old component generated with J-Cook v2.6 looked like this:
	protected function loadFormData()
	{
		// Check the session for previously entered form data.
		$data = JFactory::getApplication()->getUserState('com_lkm.edit.licensesitem.data', array());

		if (empty($data)) {
			//Default values shown in the form for new item creation
			$data = $this->getItem();

			// Prime some default values.
			if ($this->getState('licensesitem.id') == 0)
			{
				$jinput = JFactory::getApplication()->input;

				$data->id = 0;
				$data->joomla_access = $jinput->get('filter_joomla_access', $this->getState('filter.joomla_access'), 'INT');
				$data->licensed_user = $jinput->get('filter_licensed_user', $this->getState('filter.licensed_user'), 'INT');
				$data->creation_date = null;
				$data->expiration_date = null;
				$data->product = $jinput->get('filter_product', $this->getState('filter.product'), 'INT');
				$data->asset_name = null;
				$data->mac_address = null;
				$data->days_override = 0;
				$data->key_file = null;
				$data->license_id = null;
				$data->details = 'View';
				$data->admin_notes = null;
				$data->published = 1;
				$data->set_for_del = 0;
				$data->support_level = $jinput->get('filter_support_level', $this->getState('filter.support_level'), 'INT');

			}
		}
		return $data;
	}


I am going to try and mod the code in the v2.6.2 component and see how it goes. I will post the results.
--
Jerry Benton
Last Edit: 03 Dec 2013 19:30 by jcbenton.
The administrator has disabled public write access.

Joomla User not passed in form 03 Dec 2013 20:11 #11730

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
Well, that wasn't the problem.

admin?
--
Jerry Benton
The administrator has disabled public write access.

Joomla User not passed in form 03 Dec 2013 20:36 #11731

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
Found the problem. -> Ajax Loading

When I disable this for the Joomla User field it works correctly. However, it would be nice to have this feature.
--
Jerry Benton
The administrator has disabled public write access.

Joomla User not passed in form 06 Dec 2013 16:46 #11752

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Sorry I was 4 day off the forum.


Well you are simply experiencing some issues because some fields are broken in the builder, or must commonly for ajax filters, the group path is corrupted because you have changed or deleted the relations based on.

Solution for you :
Recreate fields and filters that are causing problems.

For the moment it is the only workaround.
This can also happen on very old projects. Fields created last year. The JUser is now created as a regular FK, not a special field anymore. So on it is open for all possible features of the FK's.

If you still experiment problems, tell me. We gonna search better.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.119 seconds

Get Started