1. Fabrik 3.8 has been released. As usual, we strongly recommend that you backup your site (using Akeeba) before upgrading. Report any issues in the forums, we will answer promptly.

An error has occurred with a eval'd field - please inform the web-site owner. Debug: Eval except

Discussion in 'Standard Support' started by ontarget, Oct 12, 2017.

  1. ontarget

    ontarget Member

    Level: Standard
    Hi I was reading this thread and the wiki http://fabrikar.com/forums/index.php?wiki/common-php-tasks/#update and I believe I have the same issue but wanted to confirm if it was due to code deprecation
    http://fabrikar.com/forums/index.php?threads/list-plugin-erros.46427/
    Im using F3.7 and J3.8
    Code (Text):
    // Adds a Attended button for list

    $item = $model->getTable();
    $app = JFactory::getApplication();
    $ids = $app->input->get('ids', array(), 'array');
    $db = FabrikWorker::getDbo();
    $tr_table = $db->quoteName('course_registrants');
    $c_id = $db->quoteName('id');
    $claim_approved = $db->quoteName('claim_approved');
    $timestamp = $db->quoteName('approved_timestamp');
    $date=new DateTime(); //this returns the current date time
    $time = $date->format('d/m/Y');

    foreach ($ids AS $myid)  
    {
        $row = $model->getRow($myid);
        $complete = $row->course_registrants___complete;
        $comp = explode('"',$complete);
        $compV = $comp[1];
        if ($compV == 1) {
     
          $db =& JFactory::getDBO();  
          $query = "SELECT cr.teacher_email, cr.team_leader_email, cs.full_course_name
                    FROM course_registrants AS cr
                    INNER JOIN courses AS cs
                    ON cr.course = cs.id
                    WHERE cr.id = $myid
                  ";
          $db->setQuery($query);
          $result = $db->loadObject();
          $tl_email = $result->team_leader_email;
     
          $headers = "From: $tl_email";
          $email = $result->teacher_email;
          $subject = "Claim Approved";
          $msg = "Your claim has been approved by your Team Leader for course $result->full_course_name.\n
                 Regards,\n
                 \n
                 ----------------------\n
                 Login to to view your claims";
          mail($email,$subject,$msg,$headers);
       
          $q = "UPDATE $tr_table SET $claim_approved = 1, $timestamp = \"$time\" WHERE $c_id = $myid";
          $db->setQuery($q);
          $db->execute();
       
        }
     
    }
     
     
  2. troester

    troester Well-Known Member Staff Member

    Level: Standard
    You need F3.8 for J!3.8 (but I don't think this is the problem here).

    As you can see in the thread you mentioned:
    $db =& JFactory::getDBO();
    Should be
    $mydb =JFactory::getDbo();
    (and then $mydb->xyz)
     
  3. ontarget

    ontarget Member

    Level: Standard
    Thanks for the quick reply Troester - yes you're right i have j!3.7.5.
    I will put in the amendments and revert.
     
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Also instead of just using mail(), which will just use the (very unreliable) built in PHP mail() function, best to use ...

    Code (Text):

    FabrikWorker::sendMail($tl_email, $tl_email, $email, $subject, $msg, true);
     
    You could replace the second arg with the senders name, if you want.

    The last arg (true) tells the function to send HTML formatted email, you could change that to false.

    By using the sendMail() helper, it'll then go through Joomla's mail API, and you can then set that to use an SMTP relay for reliability.

    -- hugh
     

Share This Page