I have written a before_save logic_hook in Leads to create the task if th assigned to field changes. But the task is not saving and produces the below error. Is it a 'Connector for Google Calendar' issue?
Code:
Notice: Undefined variable: response in D:\wamp\www\urbancrm\custom\include\Calls\google_calendar_plg.php on line 58

Notice: Undefined variable: tn1 in D:\wamp\www\urbancrm\custom\include\Calls\google_calendar_plg.php on line 58

Notice: Undefined property: Task::$location in D:\wamp\www\urbancrm\custom\include\Calls\google_calendar_plg.php on line 73

Notice: Undefined property: Task::$date_end in D:\wamp\www\urbancrm\custom\include\Calls\google_calendar_plg.php on line 76

Notice: Undefined property: Task::$reminder_time in D:\wamp\www\urbancrm\custom\include\Calls\google_calendar_plg.php on line 77

Notice: Undefined property: Task::$duration_hours in D:\wamp\www\urbancrm\custom\include\Calls\google_calendar_plg.php on line 146

Notice: Undefined property: Task::$duration_minutes in D:\wamp\www\urbancrm\custom\include\Calls\google_calendar_plg.php on line 146

Notice: Undefined offset: 2 in D:\wamp\www\urbancrm\custom\include\Calls\google_calendar_plg.php on line 146

Notice: Undefined offset: 2 in D:\wamp\www\urbancrm\custom\include\Calls\google_calendar_plg.php on line 161
My logic Hook is

PHP Code:

    
function lead_before_save_func(&$bean$event$arguments) {
    
        global 
$db$current_user;
        include_once(
'modules/Tasks/Task.php');
        if(
$bean->fetched_row['assigned_user_id'] != $bean->assigned_user_id ) {
            
// Assigned to field changed
            
$create_task true;
            
// Some code here

            
if($create_task) {
            
                
$task = new Task();
                
                
$guid create_guid();
                
$name $bean->first_name.' '.$bean->last_name;
                
$date date("Y-m-d h:i:s");
                
$description "Name: $name, \nPhone: $bean->phone_mobile, \nEmail:$bean->email1, \nComments: $bean->comments_c";
            
//    $task->id = $guid;
                
$task->name $name;
                
$task->date_entered $date;
                
$task->created_by   $current_user->id;
                
$task->assigned_user_id $bean->assigned_user_id;
                
$task->status "Not Started";
                
$task->date_due $date;
                
$task->date_start $date;
                
$task->parent_type "Leads";
                
$task->parent_id $bean->id;
                
$task->priority "Medium";
                
$task->description $description;
                
$_SESSION["called_from_sync"] = false;
                
                
$task->save();
                
            }
            
        }