This code is found reviewing MOrder.reactivateIt():
According to the comment the intention seems to be to replace the document type from "Prepay Order" to "POS Order" in order to force the automatic reversal of shipment and invoice when they are already created.
But the line 2726 compares against the same DOCSUBTYPESO_PrepayOrder instead of DOCSUBTYPESO_POSOrder.
The result is now:
whan a prepay order is reactivated and completed again, it duplicates the shipment and invoice