[Vtigercrm-developers] edit field type

Joe Bordes joe at tsolucio.com
Wed Oct 7 21:51:26 GMT 2015


You can try this:

- create custom field with the correct definition: cf_{SupportZeros}
- go to database and copy values from one to the other:

update vtiger_accountcf set cf_{SupportZeros} = cf_{DoesNotSupportZeros}

you can even get really fancy and use substrings and length to fill in 
missing zeros right in the SQL
- access the application and make sure the values are all correct
- delete cf_{DoesNotSupportZeros}

---------------
Alternatively you can change the structure of the field 
cf_{DoesNotSupportZeros} in the table and and in vtiger_field, that 
should work too: change it to varchar and for vtiger_field change uitype 
and typeofdata (copy the corresponding values from cf_{SupportZeros})


Joe
TSolucio



El 07/10/15 a las 19:57, lucia digirolamo escribió:
> Hi,
>
> A while ago I created a custom field for my Organizations module to 
> hold the vat number. Now I just realized that this custom field does 
> not keep the leading zeros. I don't remember what type I used, 
> probably integer, since vat number contains no letters, but surely is 
> not a text type, because I creating a new text field for testing 
> purpose and if I enter here a number starting with zero, the zero is 
> kept. But I cannot simply delete the existing field and substitute it 
> with a new text field because if I do I would lose all the data that 
> have been already inserted. So I have to change the type of this 
> custom field from whatever it is now (that doesn't keep zeros) to a 
> text field (which keeps zeros).
>
> Is there a way I can achieve this?
>
> thanks
>
> _______________________________________________
> http://www.vtiger.com/



More information about the vtigercrm-developers mailing list