Welcome, Guest
Username: Password: Remember me

TOPIC: [FIXED] bug - reseting FK in unpublished items

bug - reseting FK in unpublished items 30 Oct 2014 15:05 #12720

  • krasy
  • krasy's Avatar
  • Offline
  • Premium Member
  • Posts: 90
  • Thank you received: 8
  • Karma: 5
hi,
i have found a serious bug: reseting foreign key value while editing trashed, unpublished or archived items
(in published everything works normal)
to reproduce:

-wordkspace
Tables A:
-publish (from wizard)
-string

Table B:
-publish (from wizard)
-string
-FK (Table A )

-add record to Table A
-add record to Table B and set FK
-change publish state of Table B record to "unpublished", "archived" or "trashed"
-edit record form table B

please fix soon,
this is critical
Last Edit: 31 Oct 2014 13:35 by krasy.
The administrator has disabled public write access.

bug - reseting FK in unpublished items 03 Nov 2014 12:41 #12729

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
I tried (only in back-end), and it works for me.
I tried also to unpublish / trash / archive the both entries (Table A and Table B )

What is the returned error ?
Is the error in sandbox too ?
Coding is now a piece of cake
Last Edit: 03 Nov 2014 12:42 by admin.
The administrator has disabled public write access.

bug - reseting FK in unpublished items 03 Nov 2014 12:55 #12730

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
It works for me even in sandbox, and even in front-end.
Strange...

If you give me more details, I will fix it as soon as possible.
Coding is now a piece of cake
The administrator has disabled public write access.

bug - reseting FK in unpublished items 03 Nov 2014 16:21 #12737

  • krasy
  • krasy's Avatar
  • Offline
  • Premium Member
  • Posts: 90
  • Thank you received: 8
  • Karma: 5
hi,
check my:
project: lims
table: zwierzetaprojekty

try to
-archive item in sandbox
-change publish scope to archived
-edit archived item
-you ll see reseted combobox ;)
-try to set state to published and save - impossible.
The administrator has disabled public write access.

bug - reseting FK in unpublished items 04 Nov 2014 14:29 #12742

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Ok, I got it.
Good catch.

It is caused by the filter in the URL. (filter_published=2)
When you choose 'Archived' in the list to see your records, then edit a record, you can see this variable in URL.
The filter is defined in order to autopopulate fields of the form. Most of the case it is really usefull.

But there was a small issue. In facts, this feature is relevant only for 'New' task. For editing, it is useless.
So I have fixed it and you can regenerate your component, and update :
classes / controller / item.php

If you want, you can override applyRedirection() only.

So, when this filter is applied, it applies also on the FK's combos.
If you edit a 'new' record, from the filtered list, you still will get the problem. (It is fixed for edition only)

But you have a workaround:
This filter var is applied by the controller after a redirection.
Fork the concerned controller (front item in your case):
Fork the applyRedirection() function. Write something like this inside :
protected function applyRedirection($result, $redirections, $vars = array())
{
	parent::applyRedirection($result, $redirections, array_merge($vars, array(
	    'filter_published' => null
	)));
}

I havn't tested but it should work. You have the main idea...

EDIT : Tested. It works
Coding is now a piece of cake
Last Edit: 04 Nov 2014 14:32 by admin.
The administrator has disabled public write access.
The following user(s) said Thank You: krasy
Time to create page: 0.114 seconds

Get Started