Created
February 28, 2017 17:48
-
-
Save YnievesDotNet/2a509eeebb251556a2f234bc79e63920 to your computer and use it in GitHub Desktop.
Save extra data on vTigerCRM 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Module_Save_Action extends Vtiger_Save_Action { | |
public function process(Vtiger_Request $request) { | |
$recordModel = $this->getRecordModelFromRequest($request); | |
$accountId = (int)$request->get('module_tks_account'); | |
$accountModel = Vtiger_Record_Model::getInstanceById($accountId, 'Accounts'); | |
$fieldList = array( | |
'module_tks_email' => 'email1', | |
'module_tks_direccion' => 'bill_street', | |
'module_tks_telefono' => 'phone' | |
); | |
foreach ($fieldList as $key => $value) { | |
//die(var_dump($key . ' > ' . $accountModel->get($value))); | |
$recordModel->set($key, $accountModel->get($value)); | |
$recordModel->column_fields[$key] = $accountModel->get($value); | |
} | |
$recordModel->save(); | |
// die(var_dump($recordModel)); | |
$loadUrl = $recordModel->getDetailViewUrl(); | |
header("Location: $loadUrl"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment