update_col list plugin

lcollong

FabriKant d'applications web
This plugin seems to work as expected (do not use the email part).
However, I use the prompt user feature for the value and I verify the value is correct using an api to an external site then returning true or false to validate the update. Here is the code in the preeval field :
PHP:
$k = array_search('f_inscriptions.insc_id_stadline', $update->coltoupdate);
$v = $update->update_value[$k];
//echo "<pre>k:$k et val = $v";print_r($update);exit;

// et on vérifie si elle est correcte
$r = Exam_Inscriptions::isStadLineIdValid($v);

if ($r === false) {
  $this->msg = "<span style=\"color:red;\">Pas possible de se connecter à StadLines !</span>";
  return false;
}
if ($r === true) {
  $this->msg = "<span style=\"color:red;\">Le code examen saisi (<strong>$v</strong>) n'existe pas !</span>";
  return false;
}
if (Exam_Inscriptions::isStadLineIdAlreadyExist($v)) {
  $this->msg = "<span style=\"color:red;\">Le code examen saisi (<strong>$v</strong>) existe déjà pour un autre candidat/session. Merci de vérifier et de recommencer.</span>";
  return false;
}
$this->msg = $r;
return true;

The first two lines are using the $update var to catch back the user input value and the column concerned.
In order to make it runs as it was running on the J3/F3 site, I had to modify the update_col.php in line 201 to :

PHP:
        if (!empty($preEval))
        {
            FabrikWorker::clearEval();
//apchea    $res = Php::Eval(['code' => $preEval, 'vars'=>['data'=>$data, 'ids'=>$ids], 'thisVars'=>['msg'=>&$this->msg]]);
            $res = Php::Eval(['code' => $preEval, 'vars'=>['data'=>$data, 'ids'=>$ids, 'update'=>$update], 'thisVars'=>['msg'=>&$this->msg]]);          
            Worker::logEval($res, 'Caught exception on eval in updatecol::process() : %s');

            if ($res === false)
            {
                return false;
            }
        }

Could this mod added to the next distrib ?

Also when the Jdebug is on, this plugin throws errors on a eval field regarding incorrect use of language method. Could not be able to localize it. And also a "partial router error" when displaying back the list (list is not ajaxified).
 
Added the vars.

language: I think it's J! itself using still the "deprecated" call - which then looks so alarming in Fabrik debug;)
partial router:
Do you have some more infos? (URL, screenshot etc)
 
Here is a screen shot. Error level is max and Jdebug is on.
 

Attachments

  • update_col_routing_error.PNG
    update_col_routing_error.PNG
    33.1 KB · Views: 61
I can't find where the getLanguage is coming from.
Do you have custom code in update_col emailTo or message?
But anyway, it's only "deprecated", we can wait until it's breaking with php9 or so;)

Routing warning:
Should be also only displayed with (Fabrik) debug on.
J!4 router will fail if there are unprocessed segments (which shouldn't happen on a "clean" system).
So Fabrik is creating a warning/log and resets unprocessed segments.

Are you on an upgraded Fabrik3 (or even Fabrik2) site?
I assume it's this issue https://fabrikar.com/forums/index.p...items-the-requested-page-cant-be-found.53717/
 
ok to wait php 9 ! :)

Routing warning : yes only with debug. Not a real problem.

Indeed it's an update from a F3 site built from scratch in may 2021.
I'll check if it could come from the issue 53717 you've mentionned.
 
I've checked regarding post 53717 and I do not have any menu's link with "resetfilters" or "calculation".
Just for the record.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top