1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

problems with the calc plugin

Discussion in 'Community' started by mvilela, Mar 12, 2020.

  1. mvilela

    mvilela Member

    Level: Community
    In the field '{aaa_inscritos___iban_cal}', plugin "cal" I have this instruction for automatic choice according to the type of '{aaa_inscritos___prova}' and '{aaa_inscritos___ano_idade}'
    It happens that:
    Even if the field '{aaa_inscritos___prova}' is different from the ones indicated, information is always placed in '{aaa_inscritos___iban_cal}' when the field should remain blank.

    $ano_i = '{aaa_inscritos___ano_idade}';
    $prova_i = '{aaa_inscritos___prova}';
    $controlo_i = '{aaa_inscritos___iban_cal}';

    if ($ano_i <= 1970 and $prova_i = "PROVA_2_Regional_ARTS_21MAR2020")
    { return $controlo_i = "Veterano";
    } elseif ($ano_i <= 1999 and $prova_i = "PROVA_2_Regional_ARTS_21MAR2020")
    { return $controlo_i = "Senior";
    } elseif ($ano_i <= 2003 and $prova_i = "PROVA_2_Regional_ARTS_21MAR2020")
    { return $controlo_i = "Junior B";
    } elseif ($ano_i <= 2010 and $prova_i = "PROVA_2_Regional_ARTS_21MAR2020")
    { return $controlo_i = "Junior A";
    } elseif ($ano_i >= 2011 and $prova_i = "PROVA_2_Regional_ARTS_21MAR2020")
    { return $controlo_i = "Não Permitido";
    } elseif ($ano_i <= 1960 and $prova_i = "Circuito BTT Tramaga")
    { return $controlo_i = "Vet_D";
    } elseif ($ano_i <= 1970 and $prova_i = "Circuito BTT Tramaga")
    { return $controlo_i = "Vet_C";
    } elseif ($ano_i <= 1980 and $prova_i = "Circuito BTT Tramaga")
    { return $controlo_i = "Vet_B";
    } elseif ($ano_i <= 1990 and $prova_i = "Circuito BTT Tramaga")
    { return $controlo_i = "Vet_A";
    } elseif ($ano_i <= 2000 and $prova_i = "Circuito BTT Tramaga")
    { return $controlo_i = "Elite";
    } else
    { return $controlo_i;
    }
     
  2. troester

    troester Well-Known Member Staff Member

    Level: Community
    Use dum($your-variable); (you need JDump Joomla extension) or good, old var_dump() to see what you really get.
    Maybe you have to use {..._raw}
     
    Last edited: Mar 12, 2020
  3. mvilela

    mvilela Member

    Level: Community
    Thanks. I'll try
     
  4. troester

    troester Well-Known Member Staff Member

    Level: Community
    Sorry. JDump function must be
    dump(...)

    And looking closer at your code:

    This is your element aaa_inscritos___iban_cal?

    You can't do
    $controlo_i = '{aaa_inscritos___iban_cal}';
    (You can't even use a calc element in an other calc element because it's not determined which is calculated first)

    And you have to return a string
    ...
    { return "Veterano";
    ...
    {
    else return "";
    }
     
  5. mvilela

    mvilela Member

    Level: Community
    JDump blocks access to the page when I activate the plugin. I gave up and decided otherwise. I created a trigger in mysql and the matter was resolved for now.
     

Share This Page