<div dir="ltr">Hi<div><br><div>In restore function change $this->db->pquery to $adb->pquery</div><div>I had the same issue and fixed this way<br><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><br>Regards,<br>Lajeesh<br></div><div>Freelance developer / entrepreneur</div><div><br></div></div></div></div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 4, 2019 at 7:29 AM Rubén A. Estrada Orozco <<a href="mailto:rulotec1@gmail.com">rulotec1@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Sending this message a second time, because it seems the first time failed:</div><div><br></div><div>Hi everyone<br></div><div><br></div>Has anybody noticed that restoring records from custom modules fails? It fails with modules I created as well as with modules from other 3rd parties. I spent some hours trying to fix it without success :(<br><br>I get the following error:<br><br><div><img src="cid:ii_k1bh7cqh0" alt="image.png" style="margin-right: 25px;"><br></div><div></div><br>If you try to restore it a second time, it takes a while before the http response is back:<br><div><img src="cid:ii_k1bh89121" alt="image.png" width="542" height="421"><br></div><br>The error is the following:<br><div><br></div>Error restoring records : Query Failed:UPDATE vtiger_crmentity SET deleted=0,modifiedtime=?,modifiedby=? WHERE crmid = ?::ADODB error Error restoring records : Query Failed:UPDATE vtiger_crmentity SET deleted=0,modifiedtime=?,modifiedby=? WHERE crmid = ?::->Lock wait timeout exceeded; try restarting transaction<br><br>Thats because the first time the the restore function at CRMEntity.php  executes, it doesn't complete (an exception is thrown when triggering the afterrestore event):<br><br><div><img src="cid:ii_k1bh93tr2" alt="image.png" style="margin-right: 25px;"><br></div><br>So the second time you try to restore the record, the vtiger_crmentity table is locked because of the startTransaction() call at line 1388 (I think) and that's why it takes a while.<br><br>It is the following handler that throws the exception the first time you try to restore the record:   modules/Vtiger/handlers/EmailLookupHandler.php because it tries to instantiate the record that's being restored at line 84:<br><br><div><img src="cid:ii_k1bh9gpg3" alt="image.png" style="margin-right: 25px;"><br></div><br>The strange thing is that it doesn't fail in the case of Vtiger native modules but only with custom modules, which is pretty strange.<br><br>Disabling the above event results in successfully being able to restore records.<br><br>Any help will be greatly appreciated.<br><br>Saludos<br><br>Rubén<br><br clear="all"><div><div dir="ltr"><div dir="ltr">Saludos<div><br></div><div>Rubén</div></div></div></div></div>
_______________________________________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a></blockquote></div>