Working on issue 17

Issue 17 reports that users cannot assign documents to purchase
invoices, probably after copying purchase invoices.  I cannot reproduce
this problem but I fix a related issue that DataFile records are
created both in database and file system even if there are input errors.
I validate the input before creating the DataFile.