Fix conditions when searching for a valid period
When searching for valid periods during the fee generation phase, we
were using the wrong query: instead of checking that the period
start_date is earlier than the membership start date (which is true
only for the first year!), we should check that the period end_date
is later than the membership start.
In this way we include:
- periods that start before the given date, and
- periods that start before member left, and
- periods that end before the member joined, and
- periods of the right membership type
Fixes #12.