? Pending

User tests: Successful: Unsuccessful:

avatar Quy
Quy
18 Nov 2019

Pull Request for Issue #26749.

Summary of Changes

In Global Configuration, 0/1 are saved as true/false. Read #26749 (comment)
false cast as string returns empty string and true returns 1.
Assign it 0 so it can match the option value 0.

			<option value="0">JNO</option>
			<option value="1">JYES</option>

Testing Instructions

Go to Global Configurations
See Site Offline missing label
Apply PR
Make sure switcher labels not missing

Open configuration.php
Toggle Site Offline
Make sure $offline is saved as true or false

avatar Quy Quy - open - 18 Nov 2019
avatar Quy Quy - change - 18 Nov 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 18 Nov 2019
Category Libraries
avatar Quy Quy - change - 18 Nov 2019
Labels Added: ?
avatar ChristineWk ChristineWk - test_item - 18 Nov 2019 - Tested successfully
avatar ChristineWk
ChristineWk - comment - 18 Nov 2019

I have tested this item successfully on f17349d

Toggled Site Offline. configuration.php > public $offline=true;


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27098.

avatar ChristineWk
ChristineWk - comment - 18 Nov 2019

I have tested this item successfully on f17349d

Toggled Site Offline. configuration.php > public $offline=true;


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27098.

avatar vaibhavsTekdi vaibhavsTekdi - test_item - 19 Nov 2019 - Tested successfully
avatar vaibhavsTekdi
vaibhavsTekdi - comment - 19 Nov 2019

I have tested this item successfully on f17349d

Working fine as per the mentioned "Testing instructions".


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27098.

avatar SharkyKZ SharkyKZ - change - 19 Nov 2019
Status Pending Ready to Commit
avatar SharkyKZ
SharkyKZ - comment - 19 Nov 2019

RTC.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27098.

avatar Quy Quy - change - 20 Nov 2019
Labels Added: ?
avatar infograf768
infograf768 - comment - 21 Nov 2019

@HLeithner
is that OK for you?

avatar HLeithner
HLeithner - comment - 21 Nov 2019

I'm still not sure if this is the proper way to do this. But yeah if it's the best solution to resolve the problem. Shouldn't this be done in the model/formfield layer and not in the layout?

avatar HLeithner
HLeithner - comment - 21 Nov 2019

Forget my comment I mixed 2 pr's it seams to be ok.

avatar wilsonge
wilsonge - comment - 21 Nov 2019

In this specific case wondering if we actually should have this in the form. normally this is correct. However in the normal (non-switcher) radio field it may not be.

avatar Quy
Quy - comment - 22 Nov 2019

It is working now for switcher and non-switcher.

27098

629384d 22 Nov 2019 avatar Quy cs
avatar HLeithner
HLeithner - comment - 5 Dec 2019

Changing this in the Jformfield would mean that this is valid for all abstracted classes, that means if I have a input field I get a '0' instead of an empty string correct? (if the function is not overridden)

I wouldn't expect this.

avatar Quy
Quy - comment - 5 Dec 2019

It is checking for a false value. Empty string does not apply.
To test, apply PR. See Path to Cache Folder field where it is empty. It does not display 0.

avatar HLeithner
HLeithner - comment - 6 Dec 2019

thats true but if the value is false it would convert it also for a text field into '0' and not ''

avatar Quy
Quy - comment - 6 Dec 2019

It is a strict comparison for boolean and false. A string value will not be affected.

avatar Quy Quy - change - 30 Dec 2019
Title
[4.0] Fixing switcher label
[4.0] Fixing switcher label for true/false
avatar Quy Quy - edited - 30 Dec 2019
avatar infograf768
infograf768 - comment - 26 Jan 2020

@Quy
You mean that when we have:

			<option value="true">JYES</option>
			<option value="false">JNO</option> 

It would have no impact?

avatar Quy
Quy - comment - 26 Jan 2020

I am not at a computer to test but it should not be affected because it is string and not boolean.

avatar Quy
Quy - comment - 26 Jan 2020

Also this applies to the configuration file only when storing true/false values if I am not wrong. It has been a while since doing this PR. My memory not so good these days.

avatar Fedik
Fedik - comment - 26 Jan 2020

I wounder how it may have RTC 😉

Doing if ($this->value === false) globally in FormField is incorrect, it will affect every field.

That maybe better to do after #27202 will be merged

avatar brianteeman
brianteeman - comment - 2 Feb 2020

Works perfectly for me. I dont see any issues.

@Fedik please post exactly where it breaks


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27098.

avatar brianteeman
brianteeman - comment - 2 Feb 2020

Works perfectly for me. I dont see any issues.

@Fedik please post exactly where it breaks


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27098.

avatar brianteeman brianteeman - test_item - 2 Feb 2020 - Tested successfully
avatar brianteeman
brianteeman - comment - 2 Feb 2020

I have tested this item successfully on 72e779b


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27098.

avatar brianteeman
brianteeman - comment - 2 Feb 2020

I can't comment about the code but it solves the problem


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27098.

avatar Fedik
Fedik - comment - 2 Feb 2020

please post exactly where it breaks

People tested it with switcher field, but this changes:

will affect every field

this may lead to unexpected behavior, when example some extension have a custom field,
which expect value to be boolean false, and we force it to be string '0'.

avatar infograf768
infograf768 - comment - 3 Feb 2020

Took off RTC until @Fedik comment is taken care of.

avatar infograf768 infograf768 - change - 3 Feb 2020
Status Ready to Commit Pending
avatar infograf768
infograf768 - comment - 3 Feb 2020

setting to pending


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27098.

avatar brianteeman
brianteeman - comment - 3 Feb 2020

@Fedik could you please provide a specific example

avatar Fedik
Fedik - comment - 3 Feb 2020

I do not have a specific example to demonstrate, it a logic assumption that comes from the code review.

If we need this hacky thing, then better to do it specifically for the switcher field, not global.

There a couple ways:
Or move this hacky code to the switcher layout itself layouts/joomla/form/field/radio/switcher.php
Or fix these two conditions to work correctly:

<?php
// Initialize some option attributes.
$checked = ((string) $option->value == $value) ? 'checked="checked"' : '';
$active = ((string) $option->value == $value) ? 'class="active"' : '';
$oid = $id . $i;

avatar Quy Quy - change - 14 Feb 2020
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 14 Feb 2020
Category Libraries Layout
avatar Quy
Quy - comment - 14 Feb 2020

Is this better?

avatar Fedik
Fedik - comment - 14 Feb 2020

much better 😉

avatar wilsonge wilsonge - change - 16 Feb 2020
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-02-16 15:40:55
Closed_By wilsonge
avatar wilsonge wilsonge - close - 16 Feb 2020
avatar wilsonge wilsonge - merge - 16 Feb 2020
avatar wilsonge
wilsonge - comment - 16 Feb 2020

I mean it's grim. But much better than the initial code change. So merging. Thankyou!

Add a Comment

Login with GitHub to post a comment