srm: Report correct state for RQUEUED and TQUEUED

An SRM request goes through the states SRM_REQUEST_QUEUED and
SRM_REQUEST_INPROGRESS, to SRM_FILE_PINNED, SRM_SPACE_AVAILABLE and
SRM_SUCCESS.

Internally a request passes from PENDING to TQUEUED, to alternating
between ASYNCWAIT, PRIORITYTQUEUED, RUNNING, RUNNINGWITHOUTTHREAD, to
RQUEUED, READY and DONE.

There were a number of errors in mapping the internal state to the
external state: RQUEUED was sometimes reported as SRM_REQUEST_QUEUED,
even though this is rather the last step of SRM_REQUEST_INPROGRESS.
TQUEUED on the other hand was often reported as SRM_REQUEST_INPROGRESS,
even though it is the state before any processing has been done and
thus should be reported as SRM_REQUEST_QUEUED.

Restore from database was also changed to reset TQUEUED back to
PENDING, since such jobs have not begun processing.

Target: trunk
Require-notes: yes
Require-book: no
Acked-by: Paul Millar <paulmillar@desy.de>
Acked-by: Dmitry Litvintsev <litvinse@fnal.gov>
Patch: http://rb.dcache.org/r/6951/