The button is more like a toggle ...
Green for Available for Download
Yellow for disabled
Red for filename cannot be downloaded
If you click the Green button you cannot download and it will be marked Yellow ...
If you click the Yellow button you can download and it will be marked as Green ...
If you see the Red button, then you need to check the filename on the Attribute and make sure that it is on the server ...
Keep in mind, adding 7 days to an old order is not enough ...
The reason it is setup with the original calculation is to give the number of extra days needed from the Order Date to allow for a new "7" days or whatever setting there is ...
So if I make an Order today ... and get it to process ... then go into phpMyAdmin and change the Order Date to October 6th, the Download is unavailable and I will see Yellow on the Order ...
If I click the Yellow button it will change the settings on the Attribute to be Green and I will now see 38 days ... as October 6th to 7 days from now is 38 days ...
If you change the formula to just be 7 days, then it is still expired based on the Order date ...
I think the original code is correct and it is just the display of the number of days confusing you as you are not taking into account how many days are needed from Order Date to give the New 7 days for the Download ...