script for creating fields
Since version 8.3 the classic script to create fields in the main table no longer works, can someone tell me the new version of the script?
Old Script:
<?php
include_once('vtlib/Vtiger/Module.php');
include_once('vtlib/Vtiger/Block.php');
$blockId = 131;
$nomeModulo = '<nameModule>';
$tabellaMySQL = '<table>';
$nomeCampoMySQL = '<namefield>';
$nomeCampoVTiger = '<namefield>';
$etichettaCampo = '<label>';
$block1 = Vtiger_Block::getInstance($blockId);
$module = Vtiger_Module::getClassInstance($nomeModulo);
//Iniziazione del campo
$newField = new Vtiger_Field();
$newField->name = $nomeCampoVTiger;
$newField->label= $etichettaCampo;
$newField->table = $tabellaMySQL;
$newField->column = $nomeCampoMySQL;
$newField->columntype = 'int(19)';
$newField->uitype = 57;
$newField->typeofdata = 'I~O';
$block1->addField($newField);
echo "Done ".$etichettaCampo;
?>
Error:
Fatal error: Uncaught Error: Class "Monolog\Logger" not found in /home/LogSys/vtigercrm/vtigercrm/modules/Vtiger/helpers/Logger.php:83 Stack trace: #0 /home/LogSys/vtigercrm/vtigercrm/include/logging.php(24): require_once() #1 /home/LogSys/vtigercrm/vtigercrm/include/database/PearDatabase.php(16): require_once('...') #2 /home/LogSys/vtigercrm/vtigercrm/include/utils/UserInfoUtil.php(12): require_once('...') #3 /home/LogSys/vtigercrm/vtigercrm/vtlib/Vtiger/Access.php(10): include_once('...') #4 /home/LogSys/vtigercrm/vtigercrm/vtlib/Vtiger/ModuleBasic.php(10): include_once('...') #5 /home/LogSys/vtigercrm/vtigercrm/vtlib/Vtiger/Module.php(12): include_once('...') #6 /home/LogSys/vtigercrm/vtigercrm/creaField.php(3): include_once('...') #7 {main} thrown in /home/LogSys/vtigercrm/vtigercrm/modules/Vtiger/helpers/Logger.php on line 83
Edited by Andrea Verdolini