Database Decimal Data Length not working properly - dropping D of M,D length setting #518
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#518
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Steps to reproduce the issue
Create a field that stores it's data as DECIMAL
Set Data Length to : Other
in Other Length enter: 3,1
(or any #,# value which should be acceptable as a decimal length for mysql)
Save the field
Expected result
Length should be set to 3,1
and Component Updates should show:
ALTER TABLE
#__kr_books_reviews_assignment
ADDrating_overall
rating_overall
DECIMAL(3,1) NULL DEFAULT 0 AFTERrating_overall_display
;Actual result
Length (in the field GUI view) is set to: 3
and component updates shows:
ALTER TABLE
#__kr_books_reviews_assignment
ADDrating_overall
rating_overall
DECIMAL(3) NULL DEFAULT 0 AFTERrating_overall_display
;System information (as much as possible)
Additional comments
This was working properly at some point before JCB 2.10.9
Also, if you have a field that was originally created with "3,1" and you edit that field and save it then recompile, it creates a component update to change all the updated fields to "3" (dropping the decimal portion).
Does decimal not get saved as 3.1 instead of 3,1 in the database?
I know the other field is expecting an integer, so I think this is part of the issue.Yet I did not know you could define data length with a decimal, I will need to look that up.
But my first question is still my greater concern.
Lastly I would deal with this kind of value management with a field validation rule instead of with the database itself. Since the database will only give an error, where the field validation rule can work well with a message that is also set in the field directing the user to provide the correct input.
No. The proper length syntax in the SQL is "3,1" (three-comma-one).
Again, the issue is not with the database or anything else. It's just when you are in the field manager and have a DECIMAL and set the length to "3,1" (anything with any decimal notation - i.e. 'comma-number') and press save to save the field, it strips the ",1".
The problem is in the JCB GUI, it should allow the ,1 notation.
BTW ... this was working properly prior to 2.10.9 I think (or maybe one or two releases before that. So something got changed.
This change is not due to JCB as far as I know. If it worked before and now does not, it must be a change made in Joomla. I will see how we can help restore/fix this issue.
Strange. I haven't updated Joomla on this site (still on 3.9.14) and I'm pretty sure that it was working prior to upgrading to 3.9.14.
I'll see if I can find any of my dev sites running 3.9.13 and test it there.
I'll also do some more testing on 3.9.15 just in case it was in Joomla and fixed in the latest release.
I'll post back here shortly.
BTW ... there have been a number of js problems/conflicts with the latest JCE editor; however, this site where I'm seeing this does not have JCE (just using TinyMCE), so the JCE issue is not related to this.
FYI ... I've tested on 3.9.15 and also confirmed that this is not related to JCE (tested on site where JCE has never been installed).
Having trouble finding any site with any older version of JCB installed.
I did try to do some debugging of the jcb code but can't see anything in the PHP code. There are some places in the /administrator/components/com_componentbuilder/models/forms/field.js file that deal with that field value but it doesn't appear to be doing anything either.
I'm starting to wonder if this is related to PHP or MySQL versions as I just realized that those got updated recently here.
I'm going to do some testing on older php/mysql just to isolate that.
I did some more testing:
Round 1 (old system)
J: 3.9.12
JCB: 2.10.1
Mysql: 5.7.19
PHP: 7.2.14
STATUS: It works
Round 2 (upgrade Joomla)
J: 3.9.15
OTHERS: Same version (JCB: 2.10.1)
STATUS: It works
Round 3 (upgrade JCB to 2.10.5)
JCB: 2.10.5 (I don't have local copies of 2.10.2 - 2.10.4)
OTHERS: Same version
STATUS: BROKEN
So the issue appears to have been introduced somewhere between 2.10.1 and 2.10.5.
Unfortunately I don't have install packages for 2.10.2-2.10.4 to possibly narrow it down further; however, it sure does appear to me that the issue is in JCB somehow stripping that field of anything other than an integer (or decimal) value, and it needs to allow x,x format for proper mySQL DECIMAL field definition.
I hope that helps locate the issue.
Can anyone else at least confirm that they are having similar issues?
(I've only tested on WAMP and Binami-Lamp stack, but with same results, all in a windows environment)
Also, I downgraded (installed JCB 2.10.1 overtop 2.10.9) on the original dev site with the problem and that corrected the problem.
So, seems pretty clear to me that the issue is in JCB and happened sometime after 2.10.1 an by 2.10.5
Can anyone else test (using the steps at the start of this issue) to see if you are able to save a new field was a DECIMAL with length OTHER and "3,1" as the length?
It would be helpful to know if it's just me (or if others are able to catch anything that might be causing this - like possibly javascript issues?)
Wow thank you @cpaschen for all your debugging here. I see this is the classic fixed it and the fix revealed other things that are not correct. Well not correct according to Llewellyn 😄
Okay I will do a quick trace of this... and see where the breakdown occur. Will keep you posted.
Here is the patch. Go to line 2736 in the compiler_fields class and replace all from 2736 to 2766 with the following:
I will push out the fix with the next release. Let me know if you have any more issues.
I am still experiencing problems as per this issue.
Steps to reproduce the issue
Expected Result
Actual Result
System information
Additional comments
The fix provided as per issue gh-518 on 27 Jan 2020 did not correct problem.
On further investigation of previous JCB versions, I established the following:
I can understand that the INTEGER filter may be necessary for other Data types, but surely we still need a mechanism to set up the database with the correct number of decimals when configuring a DECIMAL Data type?
To overcome this problem temporarily until a solution is provided, I have manually modified the my compiler's code in the "fields.xml" file to reflect filter="STRING" again.
Thanks
You are indeed correct that these two issues has a relationship. I will dig in to this issue, and get back to you 👍
Any update for this issue?
So, this is now a urgent issue.
The field works fine in JCB v 2.9.21...
We (me for one) really need this fixed.
Thanks in advance.
@jcodewalker really trying to get to this, I am currently focused on gh-444 issue, this one is also on the short list. Should have this resolved soon.
@duetnet said:
@jcodewalker can this not work for you as a workaround at the moment?
I have the same problem and if it is not solved, i have to look for an other comonent builder.
Have you found a patch in the meantime?
@wado55 did you read the following:
So it really is that simple, try it, you can do it!