News:

Looking for documentation? Take a look on our wiki

Main Menu

Bug: Custom fields ignore numbers with comma

Started by MarioP, January 29, 2014, 16:00:46 PM

Previous topic - Next topic

MarioP

Hi,
As in topic (please see the attachment). When we insert some number with comma, everything that was inserted after comma sign, disappears on the website. What can be wrong?

[attachment cleanup by admin]

lindapowers

Doesnt work with . instead of , ?

We never use commas in VM.

MarioP

#2
Quote from: lindapowers on January 29, 2014, 17:01:55 PM
We never use commas in VM.
Strange.. There is no problem with numbers separated by comma in VM 2.0.18a ( I have one website with this version) and I'm almost convinced that the problem wasn't appeared in VM.2.0.26a ( I updated the site to 26d so I'm not sure). The dot sign (.) works but I guess that is more clear to write e.g. 'battery operation time (hours)': 3,5-7 than 3.5-7. Or when we have something like speaker size (inch) - it's widely accepted to write 1,75" not 1.75".  Now I don't know myself  what is better :) Maybe you have a point but as I've mentioned, I haven't encountered that problem in the previous VM versions, so I thought this is a bug...

MarioP

By the way I'm testing VM 2.1 now and the problem with commas doesn't occur...

Milbo

The reason is that joomla guys meant to overload the robust function JText with a extra test if it should do a vsprintf,...
read here http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32612&start=0

The reason it works with vm2.1 again is our vmText, the robust and fast replacement for JText. It works also correctly in vm2.0.26D, you just need to replace the JText with one of an older joomla version.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

MarioP

#5
Please someone to confirm or correct me if I'm doing wrong (I'm not a programmer I don't know exactly what was the purpose of this change by Joomla team). So what I need to do is to remove the code specified in the diff file below or simply replace the /libraries/joomla/methods.php wtih this from elder version e.g. from J!2.5.11?
diff --git a/libraries/joomla/methods.php b/libraries/joomla/methods.php
index ff5bc2f..7ad9bb8 100644
--- a/libraries/joomla/methods.php
+++ b/libraries/joomla/methods.php
@@ -151,25 +151,5 @@
}
}
- if (!(strpos($string, ',') === false))
- {
- $test = substr($string, strpos($string, ','));
- if (strtoupper($test) === $test)
- {
- $strs = explode(',', $string);
- foreach ($strs as $i => $str)
- {
- $strs[$i] = $lang->_($str, $jsSafe, $interpretBackSlashes);
- if ($script)
- {
- self::$strings[$str] = $strs[$i];
- }
- }
- $str = array_shift($strs);
- $str = preg_replace('/\[\[%([0-9]+):[^\]]*\]\]/', '%\1$s', $str);
- $str = vsprintf($str, $strs);

- return $str;
- }
- }
if ($script)
{
@@ -339,5 +319,5 @@
$args[0] = $lang->_($string);
}
- $args[0] = preg_replace('/\[\[%([0-9]+):[^\]]*\]\]/', '%\1$s', $args[0]);
+
return call_user_func_array('sprintf', $args);
}

Milbo

too lazy to check this. you can just replace the whole file. Or take a look on the vm2.1, which is using vmText everywhere,.. you can also now already use vmText instead of JText. Just replace it in the customfield model.

I will release a 2.0.27 maybe tomorrow. It has 3-4 mini fixes and I replaced already the JText against vmText
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/