problems with the calc plugin

mvilela

Member
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;
}
 
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:
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 "";
}
 
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.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top