Skip to content

vt71: Users_Record_Model::getCurrentUserModel() always returning 1.

When, as a non-admin user I edit my Calendar settings and add a user to the Calendar Sharing selected users list, I save this, for some reason the function above keeps returning "1". Irrespective of who I am logged in as.

This is a migrated system so I am not sure if this a database issue, a problem with some custom code or something more serious...

I edited the saveCalendarSettings class:

	public function saveCalendarSharing(Vtiger_Request $request){
		global $log;
		$log->debug("In saveCalendarSharing...");
		$log->debug(print_r($request,true));

		$sharedIds = $request->get('sharedIds');
		$sharedType = $request->get('sharedtype');

		$currentUserModel = Users_Record_Model::getCurrentUserModel();
		$log->debug("Got currentUserModel");
		$log->debug(print_r($currentUserModel->id,true));

I then logged in as two different, non-admin, users and examined the vtiger debug log:

In this one I am user id 527:

Thu Mar 22 14:04:06 2018,757 [28343] DEBUG VT - In saveCalendarSharing...
Thu Mar 22 14:04:06 2018,758 [28343] DEBUG VT - Vtiger_Request Object
(
    [valuemap:Vtiger_Request:private] => Array
        (
            [__vtrftk] => sid:ee32b0bfcf5767fadcd9779fc9fbab482f11417e,1521727402
            [module] => Users
            [action] => SaveCalendarSettings
            [record] => 527
            [timeFormatOptions] => 
            [sourceView] => Calendar
            [dayoftheweek] => Sunday
            [start_hour] => 07:00
            [date_format] => mm-dd-yyyy
            [hour_format] => 12
            [time_zone] => America/Chicago
            [activity_view] => Today
            [reminder_interval] => 
            [defaultcalendarview] => MyCalendar
            [defaulteventstatus] => Planned
            [defaultactivitytype] => Call
            [callduration] => 5
            [othereventduration] => 5
            [hidecompletedevents] => on
            [sharedtype] => selectedusers
            [sharedIds] => Array
                (
                    [0] => 1064
                    [1] => 1189
                    [2] => 1252
                    [3] => 9495
                    [4] => 10114
                    [5] => 10366
                    [6] => 10508
                )

            [HDB] => 
            [ALVT] => 
            [PLVT] => 
            [QLTQ] => 
            [CVLVT] => 
            [HLT] => 
            [GRT] => 
            [OLTSO] => 
            [ILTI] => 
            [MNL] => 
            [OLTPO] => 
            [LTFAQ] => 
            [UA] => 
            [PA] => 
        )

    [rawvaluemap:Vtiger_Request:private] => Array
        (
            [__vtrftk] => sid:ee32b0bfcf5767fadcd9779fc9fbab482f11417e,1521727402
            [module] => Users
            [action] => SaveCalendarSettings
            [record] => 527
            [timeFormatOptions] => 
            [sourceView] => Calendar
            [dayoftheweek] => Sunday
            [start_hour] => 07:00
            [date_format] => mm-dd-yyyy
            [hour_format] => 12
            [time_zone] => America/Chicago
            [activity_view] => Today
            [reminder_interval] => 
            [defaultcalendarview] => MyCalendar
            [defaulteventstatus] => Planned
            [defaultactivitytype] => Call
            [callduration] => 5
            [othereventduration] => 5
            [hidecompletedevents] => on
            [sharedtype] => selectedusers
            [sharedIds] => Array
                (
                    [0] => 1064
                    [1] => 1189
                    [2] => 1252
                    [3] => 9495
                    [4] => 10114
                    [5] => 10366
                    [6] => 10508
                )

        )

    [defaultmap:Vtiger_Request:private] => Array
        (
        )

)

Thu Mar 22 14:04:06 2018,760 [28343] DEBUG VT - Got currentUserModel
Thu Mar 22 14:04:06 2018,760 [28343] DEBUG VT - 1

In this one I am user id 1252:

Thu Mar 22 14:15:17 2018,866 [23643] DEBUG VT - In saveCalendarSharing...
Thu Mar 22 14:15:17 2018,866 [23643] DEBUG VT - Vtiger_Request Object
(
    [valuemap:Vtiger_Request:private] => Array
        (
            [__vtrftk] => sid:cb395c380415291bd94c20b6ed9b8df4cfe75c6b,1521728100
            [module] => Users
            [action] => SaveCalendarSettings
            [record] => 1252
            [timeFormatOptions] => 
            [sourceView] => Calendar
            [dayoftheweek] => Sunday
            [start_hour] => 00:00
            [date_format] => mm-dd-yyyy
            [hour_format] => 12
            [time_zone] => America/Chicago
            [activity_view] => Today
            [reminder_interval] => 
            [defaultcalendarview] => MyCalendar
            [defaulteventstatus] => Planned
            [defaultactivitytype] => Call
            [callduration] => 5
            [othereventduration] => 5
            [hidecompletedevents] => 0
            [sharedtype] => selectedusers
            [sharedIds] => Array
                (
                    [0] => 527
                )

            [HDB] => 
            [ALVT] => 
            [PLVT] => 
            [QLTQ] => 
            [CVLVT] => 
            [HLT] => 
            [GRT] => 
            [OLTSO] => 
            [ILTI] => 
            [MNL] => 
            [OLTPO] => 
            [LTFAQ] => 
            [UA] => 
            [PA] => 
        )

    [rawvaluemap:Vtiger_Request:private] => Array
        (
            [__vtrftk] => sid:cb395c380415291bd94c20b6ed9b8df4cfe75c6b,1521728100
            [module] => Users
            [action] => SaveCalendarSettings
            [record] => 1252
            [timeFormatOptions] => 
            [sourceView] => Calendar
            [dayoftheweek] => Sunday
            [start_hour] => 00:00
            [date_format] => mm-dd-yyyy
            [hour_format] => 12
            [time_zone] => America/Chicago
            [activity_view] => Today
            [reminder_interval] => 
            [defaultcalendarview] => MyCalendar
            [defaulteventstatus] => Planned
            [defaultactivitytype] => Call
            [callduration] => 5
            [othereventduration] => 5
            [hidecompletedevents] => 0
            [sharedtype] => selectedusers
            [sharedIds] => Array
                (
                    [0] => 527
                )

        )

    [defaultmap:Vtiger_Request:private] => Array
        (
        )

)

Thu Mar 22 14:15:17 2018,867 [23643] DEBUG VT - Got currentUserModel
Thu Mar 22 14:15:17 2018,867 [23643] DEBUG VT - 1

Any ideas or suggestions?