It doesn't seem like this confirm page would have this problem. Are you sure it is paypal orders not credit card orders? It might be related to the not inserting transaction issue.
It is probably failing that insert because of a field that doesn't allow null not having a set value... like the OrderUserID column. A good way to debug that is to add debug code after line 179 like:
var_dump($ConditionalQuery);
die();
That should let you know why the orders table isn't inserting. Once that is working it may fix the details issue. If not we can work on that one next.