[Vtigercrm-developers] default filter

Doug Creviston dcreviston at reality-technology.com
Tue Oct 11 16:10:15 PDT 2011


I am unable to create or modify the default filter using vtlib here is my code:

<html>
<body>
<?php
error_reporting(E_ALL);
ini_set('display_errors','On');

// Turn on debugging level
$Vtiger_Utils_Log = true;
echo "before include";

//echo "<br> after include";
require_once('vtlib/Vtiger/Module.php');
$moduleInstance = Vtiger_Module::getInstance('PriceBooks');
$moduleInstance->initWebservice();

//echo <br> $moduleInstance = Vtiger_Module::getInstance('PriceBook');";
$block1 = new Vtiger_Block();

$block1->label = 'LBL_PRICEBOOK_INFORMATION';
echo "<br> $block1->label = 'LBL_PRICEBOOK_INFORMATION';";
$moduleInstance->addBlock($block1);

$field1 = new Vtiger_Field();
$field1->name = 'txt_markup';
$field1->label = 'Markup';
$field1->columntype = 'VARCHAR(50)';
$field1->uitype = 1;
$field1->typeofdata = 'V~O';
$block1->addField($field1);

$field2 = new Vtiger_Field();
$field2->name = 'default_pricebook';
$field2->label = 'Default Pricebook';
$field2->columntype = 'CHAR';
$field2->uitype = 56;
$field2->typeofdata = 'V~O';
$block1->addField($field2);

// Create default custom filter (mandatory)
$filter1 = new Vtiger_Filter();
$filter1->name = 'All';
$filter1->isdefault = true;
$moduleInstance->addFilter($filter1);

$filter1->addField($field2);

?>
<p>working.</p>
</body>
</html>

here is the error I am getting when I execute the code:
Notice: Undefined variable: module in C:\xampp\htdocs\vtigercrm-5.2.1\apache\htdocs\vtigerCRM\api.pricebook.php on line 43

Fatal error: Call to a member function addFilter() on a non-object in C:\xampp\htdocs\vtigercrm-5.2.1\apache\htdocs\vtigerCRM\api.pricebook.php on line 43

iframe
     
    Posts: 21
    Joined: Mon Jun 06, 2011 4:22 pm





Doug Creviston
Software Analyst
Reality Technology Inc.
(303) 757-1107
2444 Washington Street, Denver, CO, 80205



More information about the vtigercrm-developers mailing list