[Vtigercrm-developers] Field only changed once?

Alan Lord alanslists at gmail.com
Thu Nov 8 04:56:27 PST 2012



On 08/11/12 12:05, Joe Bordes wrote:
> Try with displaytype=4  and let us know how it goes

Really? That easy?

Doesn't look like it unfortunately :-(  but thanks for the suggestion.

I *might* not need to do this anyway.

It looks like I'm going to add new sequencing value fields to the 
Company module, create new rows in modentity_num (where semodule will be 
ModuleName+companyid) and then I should be able to use the standard 
functions to get incrementing record numbers, e.g. in 
CRMEntity::setModuleSeqNumber(), getModuleSeqInfo() and 
checkModuleSeqNumber() etc.

By the looks of this I only need to make a very small tweak to the 
insertIntoEntityTable() function to override the module name where I 
need to, e.g.:

// My small hack for Multi Company Support
if ($module == 'Quotes' || $module == 'Invoice' || $module == 
'SalesOrder' && $this->column_fields['companylink']) {
     $moduleComod = $module . $this->column_fields['companylink'];
     $log->info("Modified Module name to " . $moduleComod);
     $fldvalue = $this->setModuleSeqNumber("increment", $moduleComod);
} else {
     $fldvalue = $this->setModuleSeqNumber("increment", $module);
}

This way, it doesn't really matter if the user changes the company after 
the Quote/Invoice is created and saved. The Quote's record Number won't 
change.

It would be good to fix the Company field too as an interesting 
exercise, but it might not be essential now ;-)

Another idea I just had would be to register an event handler on 
"vtiger.entity.beforesave.modifiable" to simply replace the company id 
value with the old one ;-)


Cheers

Al


>
>
> Joe
> TSolucio
>
>
> On 08/11/12 10:20, Alan Lord wrote:
>> Hi all,
>>
>> I'm now thinking about this Company module thing and I think I really
>> need to stop users from changing the type 10 Company field in Quotes
>> etc. after the first save.
>>
>> This is like the way the "username" field works when creating a user. I
>> can edit it first time but not subsequently, and if I duplicate a user
>> it is again editable first-time round...
>>
>> By the way, you can't duplicate a user in vtiger6. The new username
>> field is uneditable ;-)
>>
>>
>> TIA
>>
>> Al
>>
>> _______________________________________________
>> http://www.vtiger.com/
>>
>
>




More information about the vtigercrm-developers mailing list