[Vtigercrm-developers] Vtiger_Request get and a default value

Prasad prasad at vtiger.com
Thu Dec 12 05:27:51 GMT 2013


Michal,

You are right - (defvalue) has less precedence than (defaultmap).
If there is a value defined in defaultmap - defvalue will be ignored.

Regards,
Prasad


*Connect with us on: *Twitter <http://twitter.com/vtigercrm> *I*
Facebook<http://www.facebook.com/pages/vtiger/226866697333578?sk=wall>
 *I* Blog <https://blogs.vtiger.com/>* I*
Wiki<http://wiki.vtiger.com/index.php/Main_Page>
 *I *Forums  <https://discussions.vtiger.com>*I*
Website<https://www.vtiger.com/>


On Wed, Dec 11, 2013 at 8:16 PM, Zygmuntowicz Michal <m.zygmuntowicz at onet.pl
> wrote:

>  Hello,
>
> I've just took a look at Vtiger_Request class and found
> the following code:
>
>     ...
>     function get($key, $defvalue = '') {
>         $value = $defvalue;
>         if(isset($this->valuemap[$key])) {
>             $value = $this->valuemap[$key];
>         }
>         if($defvalue === '' && isset($this->defaultmap[$key])) {
>             $value = $this->defaultmap[$key];
>         }
>     ...
> It seems that if a default value is set in the defaultmap,
> it always overrides the value from the request - is it intentional?
>
> My guess is that the condition should look like:
>         if($value === '' && isset($this->defaultmap[$key])) {
> instead of:
>         if($defvalue === '' && isset($this->defaultmap[$key])) {
> Regards,
> Michał Zygmuntowicz
>
> _______________________________________________
> http://www.vtiger.com/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20131212/92263a1a/attachment-0001.html>


More information about the vtigercrm-developers mailing list