[BUGFIX] Set fieldname in categories relations

In TYPO3 6.2, a table may have several categories fields.
It is thus necessary to set values for the "fieldname" field
when filling the "sys_category_record_mm" table.
[BUGFIX] Wrong building of relations to system categories

The task that migrates the DAM category relations makes two critical
mistakes:

* the uid_local and uid_foreign fields are inverted (sys_category
  is local, sys_file is foreign)
* the table with the categories relation is sys_file_metadata
  and not sys_file anymore.
[BUGFIX] File references use foreign_sorting for order

In the backend, FAL references are ordered using the sorting_foreign
field of sys_file_reference and not sorting. As such the migration
task should fill the sorting_foreign field instead of sorting.

Furthermore, the relevant order from tx_dam_mm_ref is also
sorting_foreign instead of sorting.
[BUGFIX] Wrong check for existing relations

The MigrateRelations service checks if a given relation has
already been migrated, by querying the sys_file_reference table.
But it doesn't take the fieldname parameter into account
which means that it will ignore relations to the same file
but from a different field in the same table.
Merge pull request #11 from fsuter/master

[BUGFIX] Set fieldname in categories relations