Skip to main content

Install Signature Field

 

If during the steps you change the names of the files, classes and / or the relative paths remember to change them also in the installation script (InstallSignatureField.php)

  • Create new file TouchCustom.php (or whatever you want) in modules/SDK/src/MyCustomizations/modules/Touch folder (or whatever you want). Put the following piece of code in the file:
<?php

require_once('modules/Touch/Touch.php');

class TouchCustom extends Touch {
	
	public function __construct() {
		parent::__construct();
		$this->webservices['GetRecord'] = array('file' => 'overrides/TouchGetRecord2.php', 'class' => 'TouchGetRecord2');
		$this->webservices['SaveRecord'] = array('file' => 'overrides/TouchSaveRecord2.php', 'class' => 'TouchSaveRecord2');
	}
	
}
  •  
  • Create new file Custom.js (or whatever you want) in modules/Touch/overrides. The app will automatically download it to extend/overwrite the default behavior. Put the following piece of code in the file:
(function() {
	if (Vtecrm && Vtecrm.app) {
		Ext.define("Vtecrm.view.ShowRecordCustom", { // You can replace "Custom" with whatever you want
			override: "Vtecrm.view.ShowRecord",
			signatureModules: ["HelpDesk", "ModuleCustom1", "ModuleCustom2", "ModuleCustomN"], // ModuleCustom* are the modules where you want to enable the signature
		});
	}
})();

If you already have customizations in the file, you just need to add the class definition (Vtecrm.view.ShowRecordCustom).

If you have already extended/overwritten the class Vtecrm.view.ShowRecord you just need to overwrite the variable signatureModules adding the modules where you want to enable the signature

  • Create new file InstallSignatureField.php (or whatever you want) in plugins/script folder and copy&paste the following code:
<?php
die(); // Uncomment this to run the script

require('../../config.inc.php');
chdir($root_directory);
require_once('include/utils/utils.php');
require_once('vtlib/Vtecrm/Module.php');
$Vtiger_Utils_Log = true;
global $adb, $table_prefix;
VteSession::start(); // crmv@128133

SDK::setClass('Touch', 'TouchCustom', 'modules/SDK/src/MyCustomizations/modules/Touch/TouchCustom.php'); // You can replace "Custom" with whatever you 

$moduleName = 'ModuleCustom'; // ModuleCustom is the module where you want to enable the signature

$signatureBlock = new Vtiger_Block();
$signatureBlock->label = 'LBL_SIGNATURE_BLOCK';
$moduleInstance = Vtiger_Module::getInstance($moduleName);
$moduleInstance->addBlock($signatureBlock);

$fields = array();
$fields[] = array(
	'module' => $moduleName, 
	'block' => 'LBL_SIGNATURE_BLOCK', 
	'name' => 'signature', 
	'label' => 'signature', 
	'uitype' => '1016', 
	'columntype' => 'VARCHAR(255)', 
	'typeofdata' => 'V~O'
);
include('modules/SDK/examples/fieldCreate.php');

SDK::setLanguageEntries($moduleName, 'LBL_SIGNATURE_BLOCK', array('it_it' => 'Signature Information', 'en_us' => 'Signature Information'));
SDK::setLanguageEntries($moduleName, 'signature', array('it_it' => 'Firma', 'en_us' => 'Signature'));
SDK::setLanguageEntries($moduleName, 'NO_SIGNATURE_IMAGE', array('it_it' => 'Nessuna Firma', 'en_us' => 'No Signature'));
  • Execute the file InstallSignatureField.php and logout/login from VTENEXT on both the web and app side

You can run the script in the browser or through the CLI

cd plugins/script && php -f InstallSignatureField.php > InstallSignatureField.log