OpenPetra
Free Administration Software for Non-Profits
|
handle the family ID this determines the parents of the family (id 0 and 1, and the children) More...
Public Member Functions | |
TFamilyIDSuccessEnum | GetNewFamilyID (Int64 AFamilyPartnerKey, out Int32 ANewFamilyID, out String AProblemMessage) |
Get a family ID for a new person in the family Simply a shortcut for calling the GetAvailableFamilyID function when just any new FamilyID is wanted and no previous FamilyID needs to be maintained. More... | |
TFamilyIDSuccessEnum | GetNewFamilyID (Int64 AFamilyPartnerKey, Int32 APreferredFamilyID, out Int32 ANewFamilyID, out String AProblemMessage) |
Get a family ID for a new person in the family Simply a shortcut for calling the GetAvailableFamilyID function when just any new FamilyID is wanted and no previous FamilyID needs to be maintained. More... | |
TFamilyIDSuccessEnum | GetNewFamilyID_FamilyChange (Int64 AFamilyPartnerKey, Int32 APreferredFamilyID, out Int32 ANewFamilyID, out String AProblemMessage) |
Get a family ID for a new person in the family Simply a shortcut for calling the GetAvailableFamilyID function when just any new FamilyID is wanted and no previous FamilyID needs to be maintained. More... | |
TFamilyIDSuccessEnum | GetAvailableFamilyID (Int64 AFamilyPartnerKey, Int64 APersonPartnerKey, Int64 AFromFamilyPartnerKey, Int32 APreferredFamilyID, out Int32 ABestAvailableFamilyID, out string AProblemMessage, TDBTransaction AReadTransaction) |
Returns an available FamilyID for a given Family according to certain rules and specified preferences More... | |
TFamilyIDSuccessEnum | GetAvailableFamilyID (Int64 AFamilyPartnerKey, Int64 APersonPartnerKey, Int64 AFromFamilyPartnerKey, Int32 APreferredFamilyID, out Int32 ABestAvailableFamilyID, out string AProblemMessage, out ArrayList AAvailableFamilyIDs, TDBTransaction AReadTransaction) |
Returns an available FamilyID for a given Family according to certain rules and specified preferences More... | |
handle the family ID this determines the parents of the family (id 0 and 1, and the children)
|
inline |
Returns an available FamilyID for a given Family according to certain rules and specified preferences
Further Comments: see above overloaded function
AFamilyPartnerKey | Family Key of an already existing Family for which the available FamilyID should be retrieved. Mandatory! |
APersonPartnerKey | Partner Key of the Person for which the available FamilyID is to be determined. Optional (set to 0 if you don't want to pass in a Partner Key). |
AFromFamilyPartnerKey | Family Key where the Person is currently in - taken into consideration only if APartnerKey is not 0! |
APreferredFamilyID | Set to a preferred FamilyID that should be returned, or to -1 if there is no preferred FamilyID. Must be -1 if APersonPartnerKey is specified |
ABestAvailableFamilyID | The (best matching) available FamilyID in the Family specified AFamilyPartnerKey |
AProblemMessage | Contains the error message that can be displayed if the return value of the function (TFamilyIDSuccessEnum) did not return a success value |
AAvailableFamilyIDs | A list of available FamilyID's |
AReadTransaction | Current TDBTransaction |
|
inline |
Returns an available FamilyID for a given Family according to certain rules and specified preferences
The FamilyID is determined by first looking if the Family specified by AFamilyPartnerKey has any members yet. If it has no Family members yet, FamilyID 0 is returned (no matter if APreferredFamilyID was not -1 or whether APersonPartnerKey was not 0; in these cases, a note is returned in AProblemMessage). If the Family already has got members: in case the preferred FamilyID (APreferredFamilyID) is not -1 or APersonPartnerKey is not 0 and the FamilyID specified by these is available in the given Family, this FamilyID is returned. If the FamilyID specified by these is not available (or APreferredFamilyID is -1 and APersonPartnerKey is 0), the next higher FamilyID's up to 9 are checked whether they are available, starting from the APreferredFamilyID + 1 (or from 0 if it is -1). If one of these FamilyID's is available, this FamilyID is returned. If not, the next lower FamilyID's down to 2 are checked whether they are available. If one of these FamilyID's is available, this FamilyID is returned. If none of these FamilyID's is available, the next available higher FamilyID after 9 is determined and this + 1 is returned and a note in AProblemMessage.
Note: If APreferredFamilyID is 0 or 1 and it is not available, it is first checked whether the other available FamilyID for parents (0 or 1) is available before the FamilyID's from 2 up to 9 are checked for availability. This tries to keep a person that preferres a FamilyID for parents to give it a FamilyID for parents in the given Family (AFamilyPartnerKey).
Important: APersonPartnerKey and AFromFamilyPartnerKey must both be 0 if APreferredFamilyID is not -1! If the pv_preferred_family_id_i is -1, APersonPartnerKey and AFromFamilyPartnerKey must both be specified. In this case the current FamilyID of the p_person record specified by AFromFamilyPartnerKey and APersonPartnerKey is fetched. This FamilyID is then taken as APreferredFamilyID. This saves the calling procedure to determine the preferred FamilyID if it does it not have at hand.
Further Notes: Calling this procedure with APreferredFamilyID set to -1 and APersonPartnerKey set to 0 simply finds the lowest free FamilyID, starting the search at 0. Calling this procedure with either APreferredFamilyID set to an FamilyID or APersonPartnerKey set to a Partner Key finds the closest matching FamilyID (up or down) of the FamilyID sumbitted. The procedure returns fiError if a serious error occured, otherwise an available FamilyID. The caller should always check the return code - if it is fiSuccess the FamilyID found is equal to the submitted FamilyID (if none is submitted, return value is also fiSuccess). If, for any reason, the submitted FamilyKey is not available, fiWarning is returned plus further explanations for the user in AProblemMessage. NB: If the calling procedure wants to change the Family of a Partner and try to preserve this FamilyID in the new Family, the calling procedure can pass in the Partner's current FamilyID either with the APreferredFamilyID parameter or by specifying its APersonPartnerKey and AFromFamilyPartnerKey.
AFamilyPartnerKey | Family Key of an already existing Family for which the available FamilyID should be retrieved. Mandatory! |
APersonPartnerKey | Partner Key of the Person for which the available FamilyID is to be determined. Optional (set to 0 if you don't want to pass in a Partner Key). |
AFromFamilyPartnerKey | Family Key where the Person is currently in - taken into consideration only if APartnerKey is not 0! |
APreferredFamilyID | Set to a preferred FamilyID that should be returned, or to -1 if there is no preferred FamilyID. Must be -1 if APersonPartnerKey is specified |
ABestAvailableFamilyID | The (best matching) available FamilyID in the Family specified AFamilyPartnerKey |
AProblemMessage | Contains the error message that can be displayed if the return value of the function (TFamilyIDSuccessEnum) did not return a success value |
AReadTransaction | Current TDBTransaction |
|
inline |
Get a family ID for a new person in the family Simply a shortcut for calling the GetAvailableFamilyID function when just any new FamilyID is wanted and no previous FamilyID needs to be maintained.
AFamilyPartnerKey | PartnerKey of the family |
APreferredFamilyID | preferred family ID |
ANewFamilyID | new family ID if function was successful |
AProblemMessage | error text if function was not successful |
|
inline |
Get a family ID for a new person in the family Simply a shortcut for calling the GetAvailableFamilyID function when just any new FamilyID is wanted and no previous FamilyID needs to be maintained.
AFamilyPartnerKey | PartnerKey of the family |
ANewFamilyID | new family ID if function was successful |
AProblemMessage | error text if function was not successful |
|
inline |
Get a family ID for a new person in the family Simply a shortcut for calling the GetAvailableFamilyID function when just any new FamilyID is wanted and no previous FamilyID needs to be maintained.
AFamilyPartnerKey | PartnerKey of the family |
APreferredFamilyID | family ID that is aimed at being preserved |
ANewFamilyID | new family ID if function was successful |
AProblemMessage | error text if function was not successful |