I am a bit concerned about this utilities script that has crept in without discussion. It appears to alter transactions with a period of 0 (zero) because of an issue with the web cart. However zero is a legitimate period number, and is most likely to contain take on transactions at company set up. So it is by no means impossible that transactions with a genuine period of zero, but with transaction date outside that period will exist and this utility script would alter them.
I would definitely mark this script up as "dangerous, could screw up your ledger, use with extreme caution" for the reasons I have stated, and as the author doesn't seem able to defend his code.