• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

js error in CDD since J3.7.3/F3.7 update

lcollong

FabriKant d'applications web
Hi,

Following a recent update (through J! extension menu) of Joomla (3.7.3) and Fabrik (3.7) we have some js errors on the cascading drop down plugin. Strange enough, the error occurs only for regristred users. As a super-user, it works.
The master DBjoin element has the following Sql restrict :
Code:
WHERE ({thistable}.id IN (SELECT contrats.fk_entreprise FROM fk_contrats_has_utilisateurs map, fk_contrats contrats WHERE map.fk_contrat=contrats.id AND map.fk_utilisateur={$my->id})) OR (8 IN ({$my->groups}))
giving : (debug output) :
Code:
SELECT DISTINCT(`fk_entreprises`.`id`) AS value, `nom` AS text FROM `fk_entreprises` AS `fk_entreprises` WHERE (`fk_entreprises`.id IN (SELECT contrats.fk_entreprise FROM fk_contrats_has_utilisateurs map, fk_contrats contrats WHERE map.fk_contrat=contrats.id AND map.fk_utilisateur=450)) OR (8 IN (2,44,50,52,54)) ORDER BY text ASC
but the cdd debug query shows (twice) :
Code:
SELECT DISTINCT(`fk_contrats`.`id`) AS value, `fk_contrats`.`nom`AS text FROM `fk_contrats` AS `fk_contrats` WHERE 4 = -4 ORDER BY text ASC
Thus empty result.
Here is the console output :
JavaScript:
JQMIGRATE: Migrate is installed, version 1.4.1
utils.js:3 no content option set for window.html
utils.js:3 fk_rdv___fk_contrat attach to form:TypeError: this.options.value.getLast is not a function
utils.js:3 fk_rdv___fk_lieu_rdv attach to form:TypeError: this.options.value.getLast is not a function
utils.js:3 fk_rdv_has_contacts___fk_contact_0 attach to form:TypeError: this.options.value.getLast is not a function
databasejoin.js:774 Uncaught TypeError: this.options.value.getLast is not a function
    at Object.getValue (databasejoin.js:774)
    at Object.e.extend.$owner (mootools-core.js?3afb010?:38)
    at Object.<anonymous> (form.js:3)
    at Function.<anonymous> (mootools-core.js?3afb010?:9)
    at Object.forEach (mootools-more.js?3afb010?:139)
    at Object.getFormElementData (form.js:3)
    at Object.e.extend.$owner (mootools-core.js?3afb010?:38)
    at Object.change (cascadingdropdown-min.js:3)
    at Object.e.extend.$owner (mootools-core.js?3afb010?:38)
    at Object.dowatch (cascadingdropdown-min.js:3)
getValue @ databasejoin.js:774
e.extend.$owner @ mootools-core.js?3afb010?:38
(anonymous) @ form.js:3
(anonymous) @ mootools-core.js?3afb010?:9
forEach @ mootools-more.js?3afb010?:139
getFormElementData @ form.js:3
e.extend.$owner @ mootools-core.js?3afb010?:38
change @ cascadingdropdown-min.js:3
e.extend.$owner @ mootools-core.js?3afb010?:38
dowatch @ cascadingdropdown-min.js:3
e.extend.$owner @ mootools-core.js?3afb010?:38
doChange @ cascadingdropdown-min.js:3
e.extend.$owner @ mootools-core.js?3afb010?:38
m @ mootools-core.js?3afb010?:119
ListPicker._handleMouseUp @ about:blank:663
databasejoin.js:774 Uncaught TypeError: this.options.value.getLast is not a function
    at Object.getValue (databasejoin.js:774)
    at Object.e.extend.$owner (mootools-core.js?3afb010?:38)
    at Object.<anonymous> (form.js:3)
    at Function.<anonymous> (mootools-core.js?3afb010?:9)
    at Object.forEach (mootools-more.js?3afb010?:139)
    at Object.getFormElementData (form.js:3)
    at Object.e.extend.$owner (mootools-core.js?3afb010?:38)
    at Object.change (cascadingdropdown-min.js:3)
    at Object.e.extend.$owner (mootools-core.js?3afb010?:38)
    at Object.dowatch (cascadingdropdown-min.js:3)
 
4=-4 is coming from cascadingdropdown.php around line 825

I assume "SELECT DISTINCT(`fk_entreprises`.`id`) AS value, `nom`..." doesn't return a record for user 450?
 
Actually, it does. The master DBjoin (fk_entreprises) renders without errors and show whatever it has to show (the list of enterprises the #450'id user is allowed to see).
The dbjoin behave normally. But there are two CDD on it which both doesn't work. The second probably stopped by the js errors on the first one.
I've tried unpublished all js around this form or these elements without any changes.
I've also tried with the Protostar Template with no more success.
 
Also when I use my super-user login the last 3 lines don't show in the console whereas the first one shows up also :
JavaScript:
utils.js:13 no content option set for window.html
utils.js:13 fk_rdv___fk_contrat attach to form:TypeError: this.options.value.getLast is not a function
utils.js:13 fk_rdv___fk_lieu_rdv attach to form:TypeError: this.options.value.getLast is not a function
utils.js:13 fk_rdv_has_contacts___fk_contact_0 attach to form:TypeError: this.options.value.getLast is not a function
None of the "fk_rdv___fk_contrat" or "fk_rdv_has_contacts___fk_contact" (_0 ?) which are both following the fk_entreprise DBJoin elt is working.
However, "fk_rdv___fk_lieu_rdv" which is a CDD following a DBjoin element on the table #__users is working as expected.
 
Not so easy. We used to clone the target site to drive such tests but it contains a lot of customer's sensitive data.
I need either official customer authorization to grant you access to the cloned site or to clone it another time, suppress all the data and recreate enough fake data in order to reproduce the problem. I'm working on either way.

In the meantime, I made some further investigations. It is related to "add" ACL. In editing mode there is no problem. He can change the contact (fk) of an existing main record without JS errors. It displays the right list of enterprise (belonging to "him") as well as the right list of contacts (belonging to the enterprise's list he "owns")

If he try to create a new main record (add) we have the js errors as explained in the first post.If I grant him some more access level (which seems not to be related), he can also "add" a record without problems (no JS errors, the right contacts are displayed). I have checked the ACL of the list/form/group and the concerned elements without finding what could generate this behavior.

I've also double checked that this was working before the recent update (F3.7) in the same ACL definition.
 
I've tried replicating, but I can't get it to error out, so I really need to see the site. Otherwise it's like asking a mechanic to fix your car by just describing the symptoms and not letting him see the car. I understand you have customer data issues, but I'm quite happy to sign an NDA.

-- hugh
 
Hi Hugh,

Sorry for the delay due to some one or others (me ! :) ) hollidays.

I've managed to clone the site which allow us to do whatever test we need. The site is "LA" in mysites.
If you connect yourself on the front end using your SU credentials, you can add a company (just the name), add a contact (name) and finally add an appointment using the menu items (available in english :)
You can select "contributor", "Company" and "Contract" in the "MAIN INFORMATION" tab. Then in the Contacts tab, you can select contacts (one appointment may have several) from the company/contract previously selected.

If you disconnect from the front and use the user "bpaoli" (same password) and try to make a new appointment using menu item or "add" link in "list of appointments", you'll see that the contract can't be selected in tne MAIN INFORMATION tab. Thus the CDD in "Contacts" tab shows the spinning and generates a js error.
However, if you edit the existing appointment, all the fields are ok and could be changed without problem (barilla --> ferrari and change the contract then the contact)

The element involved are 48 (company), 47 (contract) and 45 (contact). The last one is in the group "Rendez-vous-contacts" from the form "Rendez-vous". The first two others are in the group "Rendez-vous" of the same form.

The list is #7

As a reminder this is running since 2015 and the "new appointment" link is used every day by the users. It stop to work following a very recent update. It seems to be related to some ACL change somewhere in Joomla and/or Fabrik : If you add "bpaoli" to the group "Responsables" (the second one), the "new appointment" works.

Thanks for looking at this one.
 
OK, try editing plugins/fabrik_element/databasejoin/databasejoin.js, line 770, change ...

Code:
                       if (typeof this.options.value === 'string') {

... to ...

Code:
                       if (!jQuery.isArray(this.options.value)) {

For whatever reason, your readonly joins are getting their values set to integers, rather than strings. Which I've never seen happen before, dunno why it's happening there. I was sure we always set those to strings in the server side when building the element's JS options. So because I was testing for "typeof" being "string", and if not assume it's an array ... being an integer caused the code to try and treat it as an array.

If that works, run with that code for a day or two, and let me know if you run into any other issues with it. If not, I'll commit that change, along with the minified JS.

-- hugh
 
Congratulation. Everything back to work as before on the "cloned" site. I did some tests without any visible side effect. I'll ask "real users" to do the same and will make the same mod on the production site. I'll tell you.
Did you find any relationship with some recent Fabrik or Joomla changes ? From our side we did not change the setup or anything in the app nor j! acl these last month except updates.
 
Nope, no clue. If the spirit moves me I'll set up a test case and see if I can figure out what's going on.

Sent from my HTC6545LVW using Tapatalk
 
We have done several tests on the "clone" without any side effects. We have applied the same modif on both js and min.js files (compressed through https://jscompress.com/ site) and we'll see.... activity is low these days. I'll tell you if any "strange thing" is showing up :)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top