The subrion does not save decimal value in field type="text"

Discussion in 'Subrion CMS Plugins Discussion' started by olairmarcos, Dec 7, 2013.

  1. olairmarcos

    olairmarcos Member

    Hello, I am creating a plugin to display GoogleMaps in starting a block of input data related to geographic coordinates.
    The problem:
    Upon entering the coordinate (decimal) in field type = "text" in the configuration panel, the subrion does not save decimal value, only the whole number value and ignores the fractional part, this causes an error in the map.

    If I enter a number with a comma subrion saved completely and if I enter the number with the decimal point subrion ignores everything after the dot.

    GoogleMaps I need to enter the geographic coordinate with decimal point. Example: latitude -27.23141
    Subrion saves only the field type="text": -27 ignoring the rest of the number.

    How can I do to save the number in decimal field?

    I tried setting up for field type = "number" does not work, the field disappears in the panel configuration.

    Thanks for the help.
  2. Gleb_S.

    Gleb_S. Subrion Designer Staff Member

    Thank you very much for your report.
    We have found the reason of such a behavior.
    I have explained it here: http://dev.subrion.com/issues/1225

    Here is a temporal solution:
    Edit [subrion_folder]/includes/classes/ia.core.mysqli.php & [subrion_folder]/includes/classes/ia.core.mysql.php

    Find protected function _wrapValues() and replace the next code:

    PHP:

    case is_numeric($value):
        $pattern = "`%s` = '%d'";
        break;
     
    With this:

    PHP:

    case is_numeric($value):
        $pattern = "`%s` = '%s'";
        break;
     
    Save the changes. That should fix the issue.
    Probably, there will be more elegant way to fix the problem. Our lead developer will review the issue ASAP. The fix will be included into the next patch.
  3. olairmarcos

    olairmarcos Member

    Thank you, Now the plugin is working correctly. Good job.
  4. Gleb_S.

    Gleb_S. Subrion Designer Staff Member

    You are always welcome!

Share This Page