<?php

/* +***********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 * *********************************************************************************** */

class Google_SaveSettings_Action extends Vtiger_BasicAjax_Action {

    public function requiresPermission(\Vtiger_Request $request) {
		return array();
	}
    
    public function process(Vtiger_Request $request) {
        $sourceModule = $request->get('sourcemodule');
        $fieldMapping = $request->get('fieldmapping');
        Google_Utils_Helper::saveSettings($request);
        if($fieldMapping) {
            Google_Utils_Helper::saveFieldMappings($sourceModule, $fieldMapping);
        }
        $response = new Vtiger_Response;
        $result = array('settingssaved' => true);
        $response->setResult($result);
        $response->emit();
    }
    
}

?>