Hello, in chronoforms ver 4.0 in custom code I have this php fucntion to generate a value called "Referencia":
I try to do the same in version 6 but is not working, {data:Referencia} value is empty ¿any solution?
<?php
$form->data['Referencia'] = GenReferencia($form->data['numero']);
// !! copy and paste your function code here !!
function GenReferencia()
{
$mult=2;
$pref=40;
$fecha = getdate();
$numero = $pref.$fecha[mday].$fecha[mon].$fecha[year].$fecha[hours].$fecha[minutes].$fecha[seconds];
$numero = trim($numero);
$tam = strlen($numero);
//echo "El numero es: \t\t",$numero, "\t\tEl tamaño es: \t\t",$tam, "<br>", "<br>";
$i=0;
for($i=$tam ; $i>=1 ; $i--)
{
$dato = substr($numero, $i-1, 1);
$resul = intval($dato) * $mult;
if ($resul>9)
{
$otro = trim(strval($resul));
$aux1=substr($otro,0,1);
$aux2=substr($otro,1,1);
$tot = intval($aux1) + intval($aux2);
//echo "\t\totro :\t\t", $otro,"\t\tAux 1:\t\t", $aux1, "\t\t Aux 2\t\t", $aux2, "\t\t Total:\t\t", $tot;
}
else
{
$tot = $resul;
}
//echo "La posición\t\t", $i, "\t\tEl valor de dato es: \t\t", $dato, "\t\t * \t\t", $mult, "\t\t =\t\t", $resul, "\t\tValor final:\t\t", $tot, "<br>";
$sumatot=$sumatot + $tot;
$mult = $mult + 1;
if ($mult>2)
{
$mult=1;
}
}
// echo "La suma total es:\t\t", $sumatot;
$maximo = intval(substr(trim(strval($sumatot)),0,1)) + 1;
$maximo =$maximo * 10;
$ref = $maximo - $sumatot;
if ($maximo - $sumatot>=10) $ref=0;
//echo "<br>","La Referencia es: \t\t", $ref;
return $numero.$ref;
}
?>
I try to do the same in version 6 but is not working, {data:Referencia} value is empty ¿any solution?
Hello again, I really like this tool, and I bought a suscription but I'm very frustrated because a hadn't recieve and answer, I wish I could keep working with chronoforms v4 in jooma 3.8 but is not working. Also I have another issue, the form is not showing. It works and looks fine in preview, but when I click on view is empty. Please help me, or tell me if I need to find another tool.
I loved this tool in joomla 2.5 and chronoforms v4, but now is really a problem!!!
I loved this tool in joomla 2.5 and chronoforms v4, but now is really a problem!!!
Hi educazion,
Please use $this->data instead of $form->data
Additionally, if you have the latest update then there is a bug which enables the wysiwyg editor and that removes the PHP code, so either wait for the 6.0.11 update or apply the CEGCORE2 library update after you update Chronoforms, or keep your existing v6 old install and wait for 6.0.11
Best regards,
Max
Please use $this->data instead of $form->data
Additionally, if you have the latest update then there is a bug which enables the wysiwyg editor and that removes the PHP code, so either wait for the 6.0.11 update or apply the CEGCORE2 library update after you update Chronoforms, or keep your existing v6 old install and wait for 6.0.11
Best regards,
Max
This topic is locked and no more replies can be posted.