[Vtigercrm-developers] Customising Products module - Checkbox default setup

Joe Bordes joe at tsolucio.com
Mon Jun 28 16:05:34 PDT 2010


Hi,

Default values for the fields can be easily set in the EditView.php script.
Look for the next block of code:

if(empty($_REQUEST['record']) && $focus->mode != 'edit'){
     setObjectValuesFromRequest($focus);
}


This is telling you that if we are creating then any value coming in 
from the REQUEST will be set as the default value.
Any value you want to set can be done here, like this:

if(empty($_REQUEST['record']) && $focus->mode != 'edit'){
     setObjectValuesFromRequest($focus);
     $focus->column_values['your_field']=your_default_value;
}

This is vtlib code, it is possible that Products doesn't have this, but 
you can add it.

Give it a try and let us know how it turns out.
Joe
TSolucio


El 29/06/10 00:57, Holbok István escribió:
> Hi,
>
> I need a small help.
>
> My problem is:
> There is a checkbox type field "Product Active" in the product module 
> set default checked when creating a new product.
>
> I have put some checkbox type fields into the Products module and all 
> of them inherited default checked. But I would like to use them 
> default unchecked.
>
> I have reviewed all resources:
> Forum: 
> http://forums.vtiger.com/viewtopic.php?t=28553&highlight=checkbox+default 
> (Joe Bordes solution)
> Smarty template files for the inventory
> EditView.php for the Products module
>
> but I did not find the place where the checkbox set default checked.
>
> It is the end of EditView.php file. Here is the only comment about it:
> *// Added to set product active when creating a new product*
> $mode=$focus->mode;
> if($mode != "edit" && $_REQUEST['isDuplicate'] != "true")
>     $smarty->assign("PROD_MODE", "create");
>
>
> if($focus->mode == 'edit') {
>     $smarty->display('Inventory/InventoryEditView.tpl');
> } else {
>     $smarty->display('Inventory/InventoryCreateView.tpl');
> }
>
> But I did not see where it is set
>
> Can some body help?
>
> Cheers:
>
> Holbok István
> telefon: +3670-342-0900
> e-mail: holbok at gmail.com <mailto:holbok at gmail.com>
>
>
> _______________________________________________
> Join vtiger community at http://forums.vtiger.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20100629/70b0cecc/attachment-0002.html 


More information about the vtigercrm-developers mailing list