It looks like you're new here. If you want to get involved, click one of these buttons!
$field1 = new Vtiger_Field();
$field1->name = 'PayslipType';
$field1->label = 'Payslip Type';
$field1->columntype = 'VARCHAR(100)';
$field1->uitype = 15;
$field1->typeofdata = 'V~O';// Varchar~Optional
$block1->addField($field1); /** table and column are automatically set */
$field1->setPicklistValues( Array ('Employee', 'Trainee') );
Comments
klaus
here is the sample of he code:
$field2 = new vtiger_field();
$field2->name = 'paysliptype';
$field2->label = 'payslip type';
$field2->columntype = 'varchar(100)';
$field2->uitype = 15;
$field2->typeofdata = 'v~o';// varchar~optional
$block1->addfield($field2); /** table and column are automatically set */
$field2->setpicklistvalues( array ('employee', 'trainee') );
how to resolve this problem.please suggest.
this is missing in the above code.
in the example it shows some fields with the column and some fields without.
is it mandatory?
i found when i just changed the names instead of using names that payslips had then i was fine.
you can delete a module (search forum) and reinstall the updated one or you can just go to the picklist editor and add the dropdown choices that you want.
$field2->column = 'paysliptype';
if you had run the "buggy" script and having the empty picklist problem, just create the following 2 tables 'vtiger_paysliptype' and 'vtiger_paysliptype_seq' (table name must be lowercase):
create table `vtiger_paysliptype` (
`paysliptypeid` int(11) not null auto_increment,
`paysliptype` varchar(200) not null,
`presence` int(1) not null default '1',
`picklist_valueid` int(11) not null default '0',
primary key (`paysliptypeid`)
) engine=myisam auto_increment=3 default charset=utf8
create table `vtiger_paysliptype_seq` (
`id` int(11) not null
) engine=myisam default charset=utf8
and insert a row to vtiger_paysliptype_seq table as
insert into vtiger_paysliptype_seq values(0);
and drop the 2 tables (table names are case sensitive) that caused by the "buggy" script:
drop table vtiger_paysliptype;
drop table vtiger_paysliptype_seq;
finally you can login as 'admin', then go to settings->picklist editor to add in values "employee" and "trainee" etc.
hope it helps.
tq
this is what worked for me:
field name had to also be lowercase.
on another note, i was also having problems saving a new payslip. it would take me to a blank page. after reading the forums, i found the solution. add the following code:
after the call to
i've attached the entire working file as well. you'll have to rename it to .php file extension for it to work.
hope this helps.
zamil
thanks!
i did the suggestion gave here, adding the follow script in my complete vtlib script to create a new module:
$module->initwebservice();
and when i try to save a record i received the follow error message:
record you are trying to access is not found. go back.
the another problem is with the picklist values. i try to create a relation between a field of my new module to the records from the products inventory, but it now work. i dont know if it possible?
$field4 = new vtiger_field();
$field4->name = 'produtos_descricao';
$field4->label = 'produto';
$field4->table = 'vtiger_products'; //get products do select from inventory products
$field4->column = 'productname';
$field4->columntype = 'varchar(50)';
$field4->uitype = 15;
$field4->typeofdata = 'v~o';// varchar~optional
$block1->addfield($field4); /** table and column are automatically set */
thank you.