Skip to content

Instantly share code, notes, and snippets.

@YnievesDotNet
Created February 28, 2017 17:48
Show Gist options
  • Save YnievesDotNet/2a509eeebb251556a2f234bc79e63920 to your computer and use it in GitHub Desktop.
Save YnievesDotNet/2a509eeebb251556a2f234bc79e63920 to your computer and use it in GitHub Desktop.
Save extra data on vTigerCRM 6
<?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