<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=text/html;charset=utf-8 http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.23536"></HEAD>
<BODY style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px"
id=MailContainerBody leftMargin=0 topMargin=0 CanvasTabStop="true"
name="Compose message area">
<DIV><FONT size=2 face=Arial>But the problem I see here is that if the request
has a value set for some key</FONT></DIV>
<DIV><FONT size=2 face=Arial>(and it is found the the valuemap) and the
defaultmap has a value for the same key too,</FONT></DIV>
<DIV><FONT size=2 face=Arial>the get function will return the default value
(from defaultmap) instead of the value</FONT></DIV>
<DIV><FONT size=2 face=Arial>from the request (found in the valuemap).
E.g.:</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>valuemap contains ('mode' =>
'edit')</FONT></DIV>
<DIV><FONT size=2 face=Arial>defaultmap contains ('mode' =>
'delete')</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>when we call get('mode') the retrun value will
be always 'delete',</FONT></DIV>
<DIV><FONT size=2 face=Arial>no matter what the valuemap actually
contains.</FONT></DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><FONT face=Arial></FONT><FONT face=Arial></FONT><FONT
face=Arial></FONT><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=prasad@vtiger.com
href="mailto:prasad@vtiger.com">Prasad</A> </DIV>
<DIV><B>Sent:</B> Thursday, December 12, 2013 6:27 AM</DIV>
<DIV><B>To:</B> <A title=vtigercrm-developers@lists.vtigercrm.com
href="mailto:vtigercrm-developers@lists.vtigercrm.com">vtigercrm-developers@lists.vtigercrm.com</A>
</DIV>
<DIV><B>Subject:</B> Re: [Vtigercrm-developers] Vtiger_Request get and a default
value</DIV></DIV></DIV>
<DIV><BR></DIV>
<DIV dir=ltr>Michal,
<DIV><BR></DIV>
<DIV>You are right - (<SPAN style="FONT-FAMILY: Arial">defvalue) has less
precedence than (defaultmap).</SPAN></DIV>
<DIV><FONT face=Arial>If there is a value defined in defaultmap -
defvalue will be ignored.</FONT></DIV>
<DIV><SPAN style="FONT-FAMILY: Arial"><BR></SPAN></DIV>
<DIV><SPAN style="FONT-FAMILY: Arial">Regards,<BR>Prasad</SPAN></DIV>
<DIV><SPAN style="FONT-FAMILY: Arial"><BR></SPAN></DIV></DIV>
<DIV class=gmail_extra><BR clear=all>
<DIV><SPAN
style="BORDER-COLLAPSE: collapse; FONT-FAMILY: arial,sans-serif; FONT-SIZE: 13px"><B>Connect
with us on: </B><A style="COLOR: rgb(0,0,204)"
href="http://twitter.com/vtigercrm"
target=_blank>Twitter</A> <B>I</B> <A style="COLOR: rgb(0,0,204)"
href="http://www.facebook.com/pages/vtiger/226866697333578?sk=wall"
target=_blank>Facebook</A> <B>I</B> <A style="COLOR: rgb(0,0,204)"
href="https://blogs.vtiger.com/" target=_blank>Blog</A><B> I</B> <A
style="COLOR: rgb(0,0,204)" href="http://wiki.vtiger.com/index.php/Main_Page"
target=_blank>Wiki</A> <B>I </B><A style="COLOR: rgb(0,0,204)"
href="https://discussions.vtiger.com"
target=_blank>Forums </A><B>I</B> <A style="COLOR: rgb(0,0,204)"
href="https://www.vtiger.com/" target=_blank>Website</A></SPAN></DIV><BR><BR>
<DIV class=gmail_quote>On Wed, Dec 11, 2013 at 8:16 PM, Zygmuntowicz Michal
<SPAN dir=ltr><<A href="mailto:m.zygmuntowicz@onet.pl"
target=_blank>m.zygmuntowicz@onet.pl</A>></SPAN> wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><U></U>
<DIV style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px"
name="Compose message area">
<DIV><FONT face=Arial>Hello,</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>I've just took a look at Vtiger_Request class and
found</FONT></DIV>
<DIV><FONT face=Arial>the following code:</FONT></DIV>
<DIV> </DIV>
<DIV> <FONT face=Arial>...</FONT></DIV>
<DIV><FONT face=Arial> function get($key, $defvalue =
'') {<BR> $value =
$defvalue;<BR> if(isset($this->valuemap[$key]))
{<BR> $value
=
$this->valuemap[$key];<BR> }<BR> if($defvalue
=== '' && isset($this->defaultmap[$key]))
{<BR> $value
=
$this->defaultmap[$key];<BR> }</FONT></DIV>
<DIV><FONT face=Arial> ...<BR></FONT></DIV>
<DIV><FONT face=Arial>It seems that if a default value is set in the
defaultmap,</FONT></DIV>
<DIV><FONT face=Arial>it always overrides the value from the request - is it
intentional?</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>My guess is that the condition should look
like:</FONT></DIV>
<DIV><FONT
face=Arial> if($value === ''
&& isset($this->defaultmap[$key])) {</FONT></DIV>
<DIV><FONT face=Arial>instead of:</FONT></DIV>
<DIV><FONT
face=Arial> if($defvalue === ''
&& isset($this->defaultmap[$key])) {<BR></FONT></DIV>
<DIV><FONT face=Arial>Regards,</FONT></DIV>
<DIV><FONT face=Arial>MichaĆ
Zygmuntowicz<BR></FONT></DIV></DIV><BR>_______________________________________________<BR><A
href="http://www.vtiger.com/"
target=_blank>http://www.vtiger.com/</A><BR></BLOCKQUOTE></DIV><BR></DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>http://www.vtiger.com/</BODY></HTML>