fixes auto discount and discount msg if discount not available
Created by: sdragnev
Not sure if this is correct. I've removed the "!empty($code)" check on 371. We don't have a code if there's an automatic discount so $applyToAllLineItems would never get set.
It seems to work now both with and without a code (auto discount) but there may be more to it that I'm not aware of.
Sorry about one PR for two issues but one needs the other to work.