Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] Unpublished records visible in referenced Forms

Unpublished records visible in referenced Forms 04 May 2016 17:38 #13927

  • organicwebs
  • organicwebs's Avatar
  • Offline
  • Premium Member
  • Chris
  • Posts: 133
  • Thank you received: 21
  • Karma: 4
Hi Everyone.

I have created a basic invoicing component. :)

I have a Client table for my clients details - including the publish field (installed by the wizard).

I then have a table for my invoices, which references my Client table. For new invoices, I have an Invoice form with a Client dropdown list field.

If I unpublish a particular Client record - I still see that client in my Clients dropdown list in my Invoice form.

Shouldn't unpublished records be hidden by default in referenced forms?

Cheers!
Just call me Chris :)
The administrator has disabled public write access.

Unpublished records visible in referenced Forms 10 May 2016 20:09 #13946

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
This is normal, you need to use the « Propagate option » of your FK.
In the builder, open your table ‘Invoices’, and open the properties of the FK linking to Client.
Then tick the option « Propagate access »

You are done.
Cook Self Service is very powerful on its small details that nobody sees.
You can even cascade them.

Hope it helps and solve your problem
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: organicwebs

Unpublished records visible in referenced Forms 13 May 2016 04:54 #13962

  • organicwebs
  • organicwebs's Avatar
  • Offline
  • Premium Member
  • Chris
  • Posts: 133
  • Thank you received: 21
  • Karma: 4
Thanks Chef,

It doesn't seem to work for me. I have now checked the "Propagate Access" and rebuilt in the sandbox - but I still see unpublished Clients when creating a new Invoice record (when creating a new "Sale item" in my sandbox build).

(For others... FK stands for Foreign Key).

Also, in the jcook interface, Foreign Key is spelt wrong. I think "Foreing" should be "Foreign" (or maybe that is French spelling?).

Cheers
Just call me Chris :)
The administrator has disabled public write access.

Unpublished records visible in referenced Forms 13 May 2016 11:13 #13963

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Ok.

This is absolutely normal.
Imagine that your item is populated with a unpublished Client, then when you edit the item, you may brake that link.
But your suggestion is accepted of course.
I will add some filter for that.

Hold on.
Coding is now a piece of cake
The administrator has disabled public write access.

Unpublished records visible in referenced Forms 13 May 2016 11:35 #13964

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Added fonctionality.

Now you can define 'applyAccess' to true in your concerned fields.
JDom::_('html.form.select', array(
..
'applyAccess' => true
));

or
You can define the same parameter in the XML form file.

This is manual at the moment because it can be dangerous.
If you edit again an 'Expense' wich has now it Client unpublished, and save... then you will brake that link.

I need now to create a snipplet that handle the case when an unpublished item has been set previously in FK, so that a user cannot break the link saving the form.
Well, for you this is solved, but in terms of consistency, I need to add some securities.

Guess you know what you do... lol
Correct ? Understood ?
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: organicwebs

Unpublished FK records visible in referenced Forms 02 Jul 2021 11:01 #15844

  • organicwebs
  • organicwebs's Avatar
  • Offline
  • Premium Member
  • Chris
  • Posts: 133
  • Thank you received: 21
  • Karma: 4
Hi Chef,

Hope you are well :)

This is not a fix because, like you say, when the user opens an existing form - all UNPUBLISHED FK values are instantly lost (without warning too). This is very bad and not useable.

If possible... it would be good if the FK field keeps its old UNPUBLISHED FK value. Only when the FK Dropdownbox is clicked should it show a list of PUBLISHED FK options.

I think we need a solution, because this is the purpose of the PUBLISH state. (To hide but not delete).

Cheers
Just call me Chris :)
Last Edit: 02 Jul 2021 11:02 by organicwebs.
The administrator has disabled public write access.
Time to create page: 0.099 seconds

Get Started