A pull request to fix issue 6: "The inactivity test doesn't work correctly"

Hi again Chelmertz,

Following our problem with the inactivity test that we submitted https://github.com/chelmertz/mantis-triggerclose/issues/6, we changed the sql request and the code to fix the issue.

This pull request contains the modification we made.