[Vtigercrm-developers] New Entity Module: 1048: Column 'cvid' cannot be null

Adam Heinz amh at metricwise.net
Thu Jul 12 07:09:10 PDT 2012


I think I remember hitting something similar to this.  I think you
want to add filter to a module before you start adding fields to the
filter.

$filter = new Vtiger_Filter();
$filter->name = 'All';
$filter->isdefault = 0;
$filter->inmetrics = 0;
$module->addFilter($filter);
...
$filter->addField($field);

On Wed, Jul 11, 2012 at 9:13 PM, possebon <possebon at gmail.com> wrote:
> Hi,
>
> I'm trying to create a new entity module (ZipCode) where I plan to store all
> zipcodes from my country.
>
> If I don't have the database debugging enabled, I receive OK message.
>
> When I enable database debugging, I receive this error message:
>
> 1048: Column 'cvid' cannot be null
>
>       ADOConnection._Execute(INSERT INTO
> vtiger_cvcolumnlist(cvid,columnindex,columnname)
> VALUES(NULL,0,'vtiger_zipcode:zipcodename:zipcodename:ZipCode_LBL_Z...) %
> line  842, file: adodb.inc.php
>    ADOConnection.Execute(INSERT INTO
> vtiger_cvcolumnlist(cvid,columnindex,columnname) VALUES(?,?,?), Array[3]) %
> line  468, file: PearDatabase.php
> PearDatabase.pquery(INSERT INTO
> vtiger_cvcolumnlist(cvid,columnindex,columnname) VALUES(?,?,?), Array[3]) %
> line  147, file: Filter.php
> Vtiger_Filter.addField(Object:Vtiger_Field) % line  131, file:
> create_zipcode.php
>
>
> I compared with other entities module that I already create and I think that
> problem is related with this:
>
> (mysql): UPDATE vtiger_cvcolumnlist SET columnindex=columnindex+1 WHERE
> cvid=NULL AND columnindex>=0 ORDER BY columnindex DESC
> ________________________________
> ________________________________
> (mysql): INSERT INTO vtiger_cvcolumnlist(cvid,columnindex,columnname)
> VALUES(NULL,0,'vtiger_zipcode:zipcodename:zipcodename:ZipCode_LBL_ZIPCODE_NAME:V')
>
> For some reason the cvid is setting as NULL, but I could not figure out the
> reason.
>
> This is a sample where it works perfectly:
>
> mysql): INSERT INTO vtiger_entityname(tabid, modulename, tablename,
> fieldname, entityidfield, entityidcolumn)
> VALUES(61,'PoliticalParty','vtiger_politicalparty','politicalpartyacronym','politicalpartyid','politicalpartyid')
> ________________________________
> Setting entity identifier ... DONE
> ________________________________
> (mysql): update vtiger_customview_seq set id=LAST_INSERT_ID(id+1);
> ________________________________
> ________________________________
> (mysql): INSERT INTO
> vtiger_customview(cvid,viewname,setdefault,setmetrics,entitytype)
> VALUES(64,'All',1,0,'PoliticalParty')
> ________________________________
> Creating Filter All ... DONE
> ________________________________
> (mysql): UPDATE vtiger_customview SET status='0' WHERE cvid=64
> ________________________________
> Setting Filter All to status [0] ... DONE
>
> This is something that really driving me nuts, if someone could give me some
> help to understand why the error occurs, please let me know.
>
> Thanks in advance
>
>
> _______________________________________________
> http://www.vtiger.com/


More information about the vtigercrm-developers mailing list