Scheduler Module goes Blank

I am using 7.10 on-demand and when i upload my module with module loader and install it my Scheduler goes blank and i can't see it until i uninstall it. I searched on this forum and some say that its because there is a logic flaw in my code. can someone point that out? thanks beforehand.

code:

function lftm_it_late_task_job() {

$builder = $GLOBALS['db']->getConnection()->createQueryBuilder();
$builder->select('id')
->from('tasks')
->where('deleted = 0')
->andwhere('DATE(NOW) > DATE_ADD(date_due, INTERVAL 1 HOUR)');

$stmt = $builder->execute();

foreach($stmt->fetchAll() as $row) {
$id = $row['id'];

$task = BeanFactory::retrieveBean('Tasks', $id, array('disable_row_level_security' => true));

if (isset($task) && isset($task -> id) && !empty($task -> id)) {

if($task->it_late_c != true) {
$task->it_late_c = true
}

}

}

return true
}

ps: it_late_c is a checkbox field

Parents
  • As a general rule, a blank page or 500 Error is a symptom of a PHP error.

    Check your php log.

    I cut and pasted your code in a php file, did a php -l on it and found that have a syntax error, missing a semi-colon:

    function lftm_it_late_task_job() {

    $builder = $GLOBALS['db']->getConnection()->createQueryBuilder();
    $builder->select('id')
    ->from('tasks')
    ->where('deleted = 0')
    ->andwhere('DATE(NOW) > DATE_ADD(date_due, INTERVAL 1 HOUR)');

    $stmt = $builder->execute();

    foreach($stmt->fetchAll() as $row) {
    $id = $row['id'];

    $task = BeanFactory::retrieveBean('Tasks', $id, array('disable_row_level_security' => true));

    if (isset($task) && isset($task -> id) && !empty($task -> id)) {

    if($task->it_late_c != true) {
    $task->it_late_c = true <===add semicolon here}

    }

    }

    return true
    }

    Just a side note, as an on-demand customer you should have access to a development copy of Sugar that you can install on your local machine so you can test and debug your code prior to deployment.

    HTH

    FrancescaS

  • Thank you very much. Where can I see the log (or debug module if it exists).

    Update: Sadly still doesn't work

  • Administration->System at the bottom of the page you can set the log level to Debug (the log will be very big and will take some digging). Just below that there is a link to "view Log" which shows you the resulting log. That could give you some hints.

    As for the PHP log I'm not sure how that can be accessed for on-demand customers, I run Sugar on-site and have full access to the server so it's easier.

    I strongly suggest that you clone your instance locally to test this out, then copy it to your production server only when you are sure it works.

    http://support.sugarcrm.com/Knowledge_Base/Platform_Management/Cloning_a_Sugar_Instance_for_Testing/ 

    in bocca al lupo!

    FrancescaS

Reply Children
No Data