Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: [FIXED] New Record REUSE - Current ID maintained

[RE-OPEN] when reuse defined for NEW record 23 Sep 2012 05:05 #3872

  • BTB300
  • BTB300's Avatar
  • Online
  • Moderator
  • Posts: 415
  • Thank you received: 131
  • Karma: 47
Hi Admin,
I noticed this has been put into closed tickets Sorry but i need to reopen this one
The TimeField Issue is resolved for redirect for an existing record

=> but there is now redirect issue when creating a new record that was not present before the TimeField problem was fixed

Details here => www.j-cook.pro/forum/18-closed-tickets/3...d/post?do=reply#3836
The administrator has disabled public write access.

Re: [RE-OPEN] when reuse defined for NEW record 24 Sep 2012 14:30 #3959

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 985
  • Karma: 140
Please wait the next upgrade... tomorrow.


TODO :
In your controller.
function save()
switch($this->getLayout() .'.'. $this->getTask())
{
case 'xxxx.save':
	$this->applyRedirection($result, array(
		'com_xxxxx.yyyy.error',  //Well...you understand
		'com_xxxxx.yyyy.success'
	), array(
		'cid[]' => $model->getState('xxxx.id')   ///TODO : HERE xxxx = model item alias
	));
	break;

EDIT : Not tested very well, for any kind of redirections.
Please help me to test it ;-)
Coding is now a piece of cake
Last Edit: 24 Sep 2012 14:30 by admin.
The administrator has disabled public write access.

Re: [RE-OPEN] when reuse defined for NEW record 24 Sep 2012 14:56 #3964

  • BTB300
  • BTB300's Avatar
  • Online
  • Moderator
  • Posts: 415
  • Thank you received: 131
  • Karma: 47
Thank you Admin,
Of course i will help you test it!
Always happy to help
;)
The administrator has disabled public write access.

Re: [RE-OPEN] when reuse defined for NEW record 26 Sep 2012 01:38 #3995

  • BTB300
  • BTB300's Avatar
  • Online
  • Moderator
  • Posts: 415
  • Thank you received: 131
  • Karma: 47
HI Admin,
Just Working on testing the redirect code above hopefully i will have an solution tonight very close to working out why its not working
The administrator has disabled public write access.

Re: [RE-OPEN] when reuse defined for NEW record 26 Sep 2012 09:02 #3998

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 985
  • Karma: 140
I am soon uploading the fix.
Coding is now a piece of cake
The administrator has disabled public write access.

Re: [RE-OPEN] when reuse defined for NEW record 26 Sep 2012 09:31 #4001

  • BTB300
  • BTB300's Avatar
  • Online
  • Moderator
  • Posts: 415
  • Thank you received: 131
  • Karma: 47
Hi Admin
After some testing I can confirm that this is working for my test project on the save button redirect

- it works between forms related to the same table
table1.layout1 -> table1.layout2 -> table1.layout3

- it works between forms with tables unrelated to each other
table1.layout1 -> table2.layout1 -> table3.layout1

Perhaps at some stage in the development of v2.0+ we could use a variable array containing additional variables and their related values in the redirect?

currently only the current id is passed,
It would be possible in the current V2.0 to pass more than one value or a specific field value
- if the redirect field accepted a string such as "filter_category_id=[id], filter_group_id=[cid]"
- the csv string would then be read and the array defined as in the second example below

the structure is there to pass multiple values as shown below
- the only thing is that the url becomes very long passing additional individual values
- could an array of values be passed as ....&values in the url

Just a thought

REDIRECT WORKS WITH THE FOLLOWING
	case 'yyyyyy.save':
		$this->applyRedirection($result, array(
			'com_xxxx.yyyyyy.layout1',
			'com_xxxx.yyyyyy.layout2'
		), array(
			'cid[]' => null,
			'filter_some_id'=> 'cid['.$model->getId().']', // pass the current id
					
		));
		break;

For those wanting to pass more than one variable in the redirect to combos in the next form (not currently available in cook redirect) edit the relevant controller file save function

PASSING MORE THAN ONE VARIABLE - not currently available in cook redirect
	case 'yyyyyyy.save':
		$this->applyRedirection($result, array(
			'com_xxxx.yyyyyy.layout1',
			'com_xxxx.yyyyyy.layout2'
		), array(
			'cid[]' => null,
			'filter_some_id'=> 'cid['.$model->getId().']', // pass the current id
			'filter_another_id'=> $item->another_id // add the the additional value cor the combo here
					
		));
		break;

PASSING ALTERNATE VARIABLES - not currently available in cook redirect
	case 'yyyyyy.save':
		$this->applyRedirection($result, array(
			'com_xxxx.yyyyyy.layout1',
			'com_xxxx.yyyyyy.layout2'
		), array(
			'cid[]' => null,
			// remove this 'filter_some_id'=> 'cid['.$model->getId().']', // pass the current id
			'filter_another_id'=> $item->another_id // add the the additional value cor the combo here
					
		));
		break;


Hope it helps
Last Edit: 26 Sep 2012 10:18 by BTB300.
The administrator has disabled public write access.

Re: [RE-OPEN] when reuse defined for NEW record 26 Sep 2012 11:04 #4004

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 985
  • Karma: 140
Fixed.
Coding is now a piece of cake
The administrator has disabled public write access.

Re: [RE-OPEN] when reuse defined for NEW record 26 Sep 2012 11:06 #4005

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 985
  • Karma: 140
I see you have understood very well how the redirector works.

This is not available in Joomla native.
The native can deal only with one form and one default list.

Do you think a good idea to propose it to the core ?
Coding is now a piece of cake
The administrator has disabled public write access.

Re: [RE-OPEN] when reuse defined for NEW record 26 Sep 2012 18:29 #4037

  • BTB300
  • BTB300's Avatar
  • Online
  • Moderator
  • Posts: 415
  • Thank you received: 131
  • Karma: 47
For the Core, Yes

The redirect works well now and you can pass integer values easily using the methods above
- it allows you to pass to a filter (combo box) using 'filter_some_id' = cid
- it also allows you to display a specific record by using id = cid
- it allows you to create step by step wizards based on the same table
- it allows you to pass the current id to any other layout

Limitations of current redirect could be improved if included in core
- currently passing strings such as " Freds Group" it does work without code modification
- you could pass an alternate variable to display a related layout
- you could pass more than one variable to assist with table relationships and easy data access
- currently you have to know the field names in the next table
- could you not then create additional "custom redirect" task bar buttons?
- the structure is there to create previous / next task bar buttons
- Pre-population of data such as shipping / registration / map location using user state variables

=> sometimes you need to pass something other than the current id
- you may want to point the user to a default page for a specific group after registration of profile details

=> sometimes you need to pass more than one value
- this would allow you to pass between item layouts without going to a collection layout then back to an item layout

A Real Life Example
One of my recent projects needed a company to register a number of groups of people to attend seminars at various times, the members could be part of a number of groups and could attend multiple seminars

- passing only the current id proved to be a headache for this project
- multiple variables needed to be passed

Below shows the FK Inherited from the redirect using only the current id

[joomla_users] // Register as joomla site user

[companies] [user_id] // Register a company

[groups] [company_id] // Create a group (or two)

[bookings] [group_id] // Make a booking for a specific seminar

[members] [booking_id] // Add Members to seminar

From above can you see any issues redirect from the members item layout to their company item layout?


Using Multiple variables passed in the redirect

[joomla_users] // Register as joomla site user

[companies] [user_id] // Register a company

[groups] [company_id] // Create a group (or two)

[members] [company_id] [group_id] // Add Members to group

[bookings] [company_id] [group_id] [member_id] // Make a booking for a specific seminar

Have not worked with them before but could using user state variables such as below form part of the solution?
- $mainframe->setUserState( "$option.state_variable", "state1" );
- $stateVar = $mainframe->getUserStateFromRequest( "$option.state_variable", 'state_variable', 'state1' );
- $stateVar = $mainframe->getUserState( "$option.state_variable", 'state1' );

Sorry its a long answer but i guess there is still a lot more to think about when looking to integrate into the core just giving you a starting point
The administrator has disabled public write access.
The following user(s) said Thank You: admin, twev, VeCrea
  • Page:
  • 1
  • 2
Time to create page: 0.124 seconds

Get Started