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

TOPIC:

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

  • krasy
  • krasy's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 90
  • Thank you received: 8
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

Please Log in or Create an account to join the conversation.

Last edit: by krasy.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

Please Log in or Create an account to join the conversation.

Last edit: by admin.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

Please Log in or Create an account to join the conversation.

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

  • krasy
  • krasy's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 90
  • Thank you received: 8
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.

Please Log in or Create an account to join the conversation.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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
The following user(s) said Thank You: krasy

Please Log in or Create an account to join the conversation.

Last edit: by admin.
  • Page:
  • 1
Time to create page: 0.060 seconds
  I still don't believe he can really be human to do all this ! From all of the forums that I've ever participated in this is certainly the one that most encapsulates the feeling of being truly open source where everyone's opinions and contributions can and will shape the development of the service! It's truly awesome! Hope you enjoy cooking and look forward to reading and contributing to any of the editorial work that you proposed too!! Thanks
Gez (audibleid - JED)

Get Started