YetiForceCompany / YetiForceCRM

Our team created for you one of the most innovative CRM systems that supports mainly business processes and allows for customization according to your needs. Be ahead of your competition and implement YetiForce!
https://yetiforce.com
Other
1.73k stars 748 forks source link

How to create validation for field with KRS number #1823

Closed krzychoxdd closed 9 years ago

krzychoxdd commented 9 years ago

I want to create validation for field with KRS number( 10 digit no more no less) in account module i've tried to change column typeofdata in colomn vtiger_field like this: I~O~10,10 and I~O~10, I~O~10~10, I~O~10,10 but this is not working. Does someone known how to do this?

bpabiszczak commented 9 years ago

Please use "Field Mask" on field: https://gitdeveloper.yetiforce.com/index.php?module=LayoutEditor&parent=Settings&view=Index&sourceModule=Accounts

krzychoxdd commented 9 years ago

Sorry I did not give version.

I do not have this option in version 2.0.0 RC. Is it possible to do that in my version.

mariuszkrzaczkowski commented 9 years ago

The 2.0,0 RC version has this option, check the screenshot below For what type of a field do you want to add the mask? mask

krzychoxdd commented 9 years ago

All about field from vtiger_field

tabid - 6
fieldid - 1768
columnname - krs
tablename - vtiger_account
generatedtype - 2
uitype - 7
fieldname - krs
fieldlabel - KRS
readonly - 1
presence - 2
defaultvalue - NULL
maximumlength - 100
sequence - 8
block - 194
displaytype - 1
typeofdata - I~O~10~10
quickcreate - 1
quickcreatesequence - NULL
info_type - BAS
masseditable - 1
helpinfo - NULL
summaryfield - 0
fieldparams - NULL

OK, i found "Field Mask" input in other field in this module but KRS and some other field do not have this input. Is possible to add this input to KRS edit popup ?

mariuszkrzaczkowski commented 9 years ago

There's no possibility to set a mask for this type of a field, currently a mask is available for the following types of fields: string,phone,currency,url You can enable the mask, but modifying system files would be necessary.

krzychoxdd commented 9 years ago

Ok thanks i change three files and work.

I add belowe code to input in layouts/vlayout/modules/Vtiger/uitypes/Number.tpl

{if $FIELD_MODEL->get('fieldparams') != ''}data-inputmask="'mask': '{$FIELD_MODEL->get('fieldparams')}'"{/if}

and layout/modules/Settings/LayoutEditor/Index.tpl in line 240 add below values to array

'integer','double'

and change one if statement in line 55 modules/Settings/LayoutEditor/actions/Field.php

from

if($request->get('fieldMask') != '') {

to

if( isset($_POST['fieldMask']) ) {