This works great. But how can I do this with the orders, to prevent the users from deleting orders, go to packing slip and invoice.

It is about this code in orders.php

$contents[] =...