[Vtigercrm-developers] Vtiger_Request get and a default value

Prasad prasad at vtiger.com
Thu Dec 12 12:56:20 GMT 2013


Thank you for the use-case. We have addressed it - (please
review<http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7840#comment:4>
).

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 Thu, Dec 12, 2013 at 2:48 PM, Zygmuntowicz Michal <m.zygmuntowicz at onet.pl
> wrote:

>  But the problem I see here is that if the request has a value set for
> some key
> (and it is found the the valuemap) and the defaultmap has a value for the
> same key too,
> the get function will return the default value (from defaultmap) instead
> of the value
> from the request (found in the valuemap). E.g.:
>
> valuemap contains ('mode' => 'edit')
> defaultmap contains ('mode' => 'delete')
>
> when we call get('mode') the retrun value will be always 'delete',
> no matter what the valuemap actually contains.
>
>  *From:* Prasad <prasad at vtiger.com>
> *Sent:* Thursday, December 12, 2013 6:27 AM
> *To:* vtigercrm-developers at lists.vtigercrm.com
> *Subject:* Re: [Vtigercrm-developers] Vtiger_Request get and a default
> value
>
> 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/
>>
>
>  ------------------------------
>
> _______________________________________________
> http://www.vtiger.com/
>
>
> _______________________________________________
> http://www.vtiger.com/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20131212/bba76bb7/attachment.html>


More information about the vtigercrm-developers mailing list