Merge pull request #82 from sfe-ev/fixes_v44

Fix fallout from batching rework
Cleanup: drop unused `payment_instrument_id` field

Creditor doesn't have this field anymore in the New World Order.
Cleanup: drop unused variable
Don't rely on $form->_values in postProcess hook

This is only available when editing an existing Payment Processor
record, but not when creating a new one. Thus, we need to use other ways
to get at the values:

 * 'user_name' is available from $form->_submitValues

 * The Payment Processor Type can be fetched by the ID in $form->_ppType
   using the API. (We could also get the ID from _submitValues -- but as
   we get the convenient _ppType too, let's use it :-) )

 * The 'payment_processor_id' (i.e. the ID of the newly created PP
   record) is not available anywhere in the postProcess hook. Instead,
   we have to fetch the record from the DB (by the uniqe `name`) using
   the API.
Only try retrieving existing creditor when editing existing PP record

Don't run the API 'get' with an unset $ppid, as this gets all existing
creditor records, rather than getting none. (Resulting in bogus values
being pre-filled when adding a new record.)
Use `mandate_prefix` from Creditor settings

In the fallback mandate reference generation code, use the value
actually configured for the Creditor (in the Payment Processor setup),
rather than having everyone impersonate WMFR...
Include mandate type in default mandate reference

Include 'RCUR' or 'OOFF' in the fallback mandate reference generation --
I'd say that's indeed the most relevant piece of information to have in
there...
Base fallback Mandate Reference on Mandate ID rather than Entity ID

The previous code had several issues: the conditional was buggy; the
generated reference was actually not guaranteed to be unique (as it
didn't include the Entity Type); and the random case was not random
enough.

While all of these issues could have been fixed, basing the reference on
the Mandate's own unique ID is more generic (no conditionals); simpler;
probably safer; more obvious (especially once a mandate can be used for
multiple contracts...); and IMHO also more informative.

As the auto ID is only available once the record was created, the code
needed some shuffling around: we initially create the record with an
arbitrary unique reference (to satisfy the index constraint); and only
later update it with the proper meaningful reference.
Merge branch 'v44' of github.com:Project60/sepa_dd into v44
Merge branch 'creditor_save_fix' into v44

Conflicts:
	sepa.php
Merge branch 'mandate_reference' into v44