[Vtigercrm-developers] vtlib (6.1) creates entity module base table without primary key - BUG

Holbok István holbok at gmail.com
Thu Jul 3 12:23:15 GMT 2014


Dear Vtiger Team,

As I am involved in vtiger custom module development I am facing with 
several issues.

One of them is, the bootstrap vtlib script creates entity module base 
table *without primary key* to table - and this is obviously a BUG.

How to reproduce it:

Use the script from the page:
http://community.vtiger.com/help/vtigercrm/developers/extensions/examples/entity-module.html
*Create the bootstrap vtlib script in root folder of Vtiger to activate 
the module entry.*

Running the script (environment PHP 5.4.19, XAMPP Windows 8.1) you will 
get 2 tables in vtiger CRM. (Sorry for the Hungarian screen shoots, but 
my PHPMyadmin do not want to give screens in English in this moment :-), 
I hope the main data is shown. )
*The base table without primary key:*


  vtiger_expenses

Oszlop 	Típus 	Nulla 	Alapértelmezett 	Megjegyzések
expensesid 	int(11)	Igen 	/NULL/ 	
summary 	varchar(255)	Igen 	/NULL/ 	
expenseon 	date	Igen 	/NULL/ 	
expenseamount 	varchar(255)	Igen 	/NULL/ 	


      Indexek

Nincs meghatározott index!  (No indexes!)


  vtiger_expensescf

Oszlop 	Típus 	Nulla 	Alapértelmezett 	Megjegyzések
expensesid 	int(11)	Nem 		


      Indexek

Kulcsnév 	Típus 	Egyedi 	Csomagolt 	Oszlop 	Számosság 	Illesztés 
Nulla 	Megjegyzés
PRIMARY 	BTREE 	Igen 	Nem 	expensesid 	0 	A 	Nem


The custom field table with necessary primary key to table.

The exported module manifest file also will not contain the primary key.

I think due to this vtlib bug there are several variant of table usage. 
And this variation is independent from the usage of Autoincrement
*
For example the Assets module (from the latest developments) has primary 
key in its base table:*


  vtiger_assets

Oszlop 	Típus 	Nulla 	Alapértelmezett 	Hivatkozás 	Megjegyzések
assetsid 	int(11)	Nem 		vtiger_crmentity -> crmid 	
asset_no 	varchar(30)	Nem 			
account 	int(19)	Igen 	/NULL/ 		
product 	int(19)	Nem 			
serialnumber 	varchar(200)	Igen 	/NULL/ 		
datesold 	date	Igen 	/NULL/ 		
dateinservice 	date	Igen 	/NULL/ 		
assetstatus 	varchar(200)	Igen 	In Service 		
tagnumber 	varchar(300)	Igen 	/NULL/ 		
invoiceid 	int(19)	Igen 	/NULL/ 		
shippingmethod 	varchar(200)	Igen 	/NULL/ 		
shippingtrackingnumber 	varchar(200)	Igen 	/NULL/ 		
assetname 	varchar(100)	Igen 	/NULL/ 		
contact 	int(19)	Igen 	/NULL/ 		


      Indexek

Kulcsnév 	Típus 	Egyedi 	Csomagolt 	Oszlop 	Számosság 	Illesztés 
Nulla 	Megjegyzés
PRIMARY 	BTREE 	Igen 	Nem 	assetsid 	0 	A 	Nem


*But the Project module has not primary key.*


  vtiger_project

Oszlop 	Típus 	Nulla 	Alapértelmezett 	Megjegyzések
projectid 	int(11)	Igen 	/NULL/ 	
projectname 	varchar(255)	Igen 	/NULL/ 	
project_no 	varchar(100)	Igen 	/NULL/ 	
startdate 	date	Igen 	/NULL/ 	
targetenddate 	date	Igen 	/NULL/ 	
actualenddate 	date	Igen 	/NULL/ 	
targetbudget 	varchar(255)	Igen 	/NULL/ 	
projecturl 	varchar(255)	Igen 	/NULL/ 	
projectstatus 	varchar(100)	Igen 	/NULL/ 	
projectpriority 	varchar(100)	Igen 	/NULL/ 	
projecttype 	varchar(100)	Igen 	/NULL/ 	
progress 	varchar(100)	Igen 	/NULL/ 	
linktoaccountscontacts 	varchar(100)	Igen 	/NULL/ 	


      Indexek

Nincs meghatározott index!

*The Pricebook also has primary key:*


  vtiger_pricebook

Oszlop 	Típus 	Nulla 	Alapértelmezett 	Hivatkozás 	Megjegyzések
pricebookid 	int(19)	Nem 	0 	vtiger_crmentity -> crmid 	
pricebook_no 	varchar(100)	Nem 			
bookname 	varchar(100)	Igen 	/NULL/ 		
active 	int(1)	Igen 	/NULL/ 		
currency_id 	int(19)	Nem 	1 		


      Indexek

Kulcsnév 	Típus 	Egyedi 	Csomagolt 	Oszlop 	Számosság 	Illesztés 
Nulla 	Megjegyzés
PRIMARY 	BTREE 	Igen 	Nem 	pricebookid 	0 	A 	Nem



--------------------------
My suggestion is to correct vtlib to create primary key for the base 
tables of modules.
And use primary key to all table of vtiger CRM database.

Kindest regards:
István


-- 
üdvözlettel:

*Holbok István*

+3670-342-0900
*e-mail:* holbok at gmail.com
*SkyPe:* holboki

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20140703/b2d5172a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dot.gif
Type: image/gif
Size: 43 bytes
Desc: not available
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20140703/b2d5172a/attachment-0001.gif>


More information about the vtigercrm-developers mailing list