Partner Edit - Details of Advanced Address Tab Functionality

From OpenPetra Wiki
Jump to navigation Jump to search

Overview

The Address Tab on the Partner Edit screen has got several advanced and specific functionalities that aren't found anywhere else in OpenPetra - and the appearance of the Tab doesn't indicate the presence of those at all! Additionally, some of these functionalities are run only 'under the hood' and hence are not easily noticed.

The purpose of this page is to document those 'specialities' so more people than just WolfgangB and ChristianK know about them, and that they can get tested as needed.

In software development terms those 'specialities' are called 'Business Rules' .

This page ties in with the wiki page Testing the Partner Edit Screen's Address Functionality!!!

Address Added / Changed

Defaults for New Addresses

  • Country
    • For a new Partner...
      • when created from the Partner Edit screen with either the 'New Partner' functionality (ToolBarButton or File Menu MenuItem by that name) or by clicking the 'Create new Person for this Family' Button on the 'Family Members' Tab (only available when current Partner is of Partner Class FAMILY):
        • if current Partner is of Partner Class FAMILY:
          • when the user chooses to create a Partner of Partner Class PERSON in the 'New Partner' Dialog: The current FAMILY and currently selected Address get preset in the 'New Partner' Dialog - the FAMILY itself can be seen once 'PERSON' gets selected in the 'Partner Class' ComboBox (the Address not, however - but see feature Bug 3746 that requests that to be changed). If the user accepts those by choosing 'OK', the Country Code from the currently selected Address is taken over because the whole Address of the FAMILY is taken over as the first Address of the PERSON. (But see Feature Bug 4961 for a requested new option of optionally copying all Addresses of the FAMILY over to the new PERSON). --Christiankatict (talk) 09:15, 24 February 2016 (UTC) Tested OK (While this was only working when the chosen Address was saved in the Database and not working on Feb. 23rd, 2015 when an Address just got added to a FAMILY and the user didn't press 'Save' yet in a specific situation this got fixed with my fix for Bug 5087)
          • when the user chooses to create a Partner of any Partner Class other than PERSON in the 'New Partner' Dialog: the Country Code from the currently selected Address should get taken over. --Christiankatict (talk) 16:19, 3 March 2016 (UTC) Tested OK (While this was not working on Feb. 23rd, 2015 it got fixed with my fix for Bug 5124)
        • if current Partner is of any Partner Class other than FAMILY: takes over the Country Code from the currently selected Address. --Christiankatict (talk) 09:15, 24 February 2016 (UTC) Tested OK
          • Exception to that: if the user chooses 'PERSON' in the New Partner Dialog: see next bullet point ('when created from anywhere else...') Tested OK
      • when created from anywhere else than from the Partner Edit screen (e.g. from Partner Find, or directly from the Main Menu):
        • if the user chooses 'PERSON' in the 'Partner Class' ComboBox: The PartnerKey of the 'Last Used Family' (the last opened Partner of Partner Class FAMILY) gets determined and from that the 'Best Address' of that FAMILY and both are preset in the dialog - the FAMILY itself can be seen (the Address not, however - but see feature Bug 3746 that requests that to be changed). If the user accepts those by choosing 'OK', the Country Code from that 'Best Address' is taken over because that 'Best Address' of the FAMILY as a whole is taken over as the first Address of the PERSON. (But see Feature Bug 4961 for a requested new option of optionally copying all Addresses of the FAMILY over to the new PERSON). --Christiankatict (talk) 09:15, 24 February 2016 (UTC) Tested OK
        • if the user chooses a Partner Class other than FAMILY in the 'Partner Class' ComboBox:
          • The Country Code from a 'random' Address of the UNIT Partner (if that UNIT has got more than one Address; if not then from the one Address of the UNIT) that the OpenPetra 'Site Key' identifies gets taken over. (This should be OK though ideally the 'Best Address' of the UNIT Partner that the OpenPetra 'Site Key' identifies should be taken instead.) --Christiankatict (talk) 09:15, 24 February 2016 (UTC) Tested OK
    • For a new Address: uses the same as the currently selected Address. --Christiankatict (talk) 14:01, 23 February 2016 (UTC) Tested OK
  • Location Type: Depends on PartnerClass of the Partner: BANK->BUSINESS, CHURCH->CHURCH, ORGANISATION->BUSINESS, FAMILY->HOME, PERSON->HOME, UNIT->FIELD, VENUE->BUSINESS. --Christiankatict (talk) 14:01, 23 February 2016 (UTC) Tested OK
  • Mailing Address
    • for a new Partner: For partners with PartnerClass PERSON: while a FAMILY address gets taken over, the Mailing flag must get set to 'No'. --Christiankatict (talk) 14:07, 23 February 2016 (UTC) Tested OK
    • for a new Address: 'Yes', unless this is a PERSON partner, in which case 'No'. --Christiankatict (talk) 16:19, 3 March 2016 (UTC) Tested OK (While the latter case was not working on Feb. 23rd, 2015 it got fixed with Alan's fix for Bug 4534)
      • set in Method NewRowManual in C# file UC_PartnerAddresses.ManualCode.cs.
  • Valid From: 'Today's date' (also in case a PERSON gets created for a FAMILY [see above: 'Country' -> 'For a new Partner...' -> 'if current Partner is of Partner Class FAMILY' -> '... the whole Address of the FAMILY is taken over as the first Address of the PERSON...']) --Christiankatict (talk) 14:01, 23 February 2016 (UTC) Tested OK
  • Valid To
    • for a new Partner:
      • PartnerClass PERSON: copy over from FAMILY address, but only if it doesn't lie in the past. --Christiankatict (talk) 14:07, 23 February 2016 (UTC) Tested OK
      • other PartnerClass: not set (empty) --Christiankatict (talk) 09:15, 24 February 2016 (UTC) Tested OK
    • for a new Address: not set (empty) --Christiankatict (talk) 14:01, 23 February 2016 (UTC) Tested OK

Special Actions That Get Taken When an Address Gets Added

  • Partner Status: Set to 'ACTIVE' if it wasn't. --Christiankatict (talk) 14:01, 23 February 2016 (UTC) NOT WORKING - see Bug 5092
  • Partner DB Row's 'DateModified' Column: A Partner is seen as being modified if an Address has been changed or added: set Partner DB Row's 'DateModified' Column to 'today's date' in those cases.
    • Address changed: --Christiankatict (talk) 16:19, 3 March 2016 (UTC) Tested OK (While this was not working on Feb. 23rd, 2015 it got fixed with my fix for Bug 5088)
    • Address added: --Christiankatict (talk) 12:14, 24 February 2016 (UTC) Tested OK

If an Address Got Added or Changed

  • Both when added or changed: check if a 'similar' Location exists and give user the option to use the existing Location. On choosing 'Yes' the existing Location replaces the Location that was previously held in the screen, if 'No' is chosen the added / changed address gets saved normally. --Christiankatict (talk) 13:42, 23 February 2016 (UTC) Tested OK
  • If an Address got added:
    • Make sure that Location 0 is no longer mapped to the Partner (this happens silently 'under the hood'). --Christiankatict (talk) 13:42, 23 February 2016 (UTC) Tested OK
      • Done in Method MakeSureLocation0IsNotPresent in C# file DataAggregates.PPartnerAddress.cs.
    • If the Partner Find screen is shown: The Partner Find screen gets refreshed to show it. --Christiankatict (talk) 13:42, 23 February 2016 (UTC) Tested OK
  • If an Address got added to a FAMILY Partner: A question gets shown whether to add that Address to all Family Members; the address in question gets shown in that MessageBox. On choosing 'Yes' the Address gets added to all Family Members that don't have that Address yet. If the user chose 'No' then the Address doesn't get added to any Family Member. --Christiankatict (talk) 13:42, 23 February 2016 (UTC) Tested OK
  • If the 'Valid To'-Date of an Address of a FAMILY Partner got changed:
    • The changed 'Valid To'-Date gets automatically applied to all Family Members that have that Address (no question or dialog gets brought up for that, it happens 'under the hood'). Nothing gets done if there are no Family Members. --Christiankatict (talk) 13:42, 23 February 2016 (UTC) Tested OK
    • Done in Method PromoteToFamilyMembersDateGoodUntilChange in C# file DataAggregates.PPartnerAddress.cs.
  • If an Address of a Partner (of any Partner Class) got changed and that Address is used by any other Partners (of any Partner Class): A Dialog gets brought up ('Change Location for selected Partners') that allows the promotion of that change to all, selected or none of the shown Partners. --Christiankatict (talk) 13:42, 23 February 2016 (UTC) Tested OK
    • If all Partners are selected and the user presses 'OK': the shared p_location record that got edited in the Address Tab simply gets updated (and hence this change will get reflected for all Partners as they all reference this p_location record). --Christiankatict (talk) 13:42, 23 February 2016 (UTC) Tested OK
    • If some, or no Partners are selected and the user presses 'OK': a new p_location record gets created that holds the data of the edited Address and this record gets assigned to the current Partner, plus to any of the selected Partners, too (if applicable). The originally edited p_location record doesn't get updated at all! --Christiankatict (talk) 13:42, 23 February 2016 (UTC) Tested OK
    • If the user chooses 'Cancel' in this Dialog the whole data saving operation gets cancelled and the user gets told that this is what happened. The screen then still holds the changed Address data (and any other changed data). --Christiankatict (talk) 13:42, 23 February 2016 (UTC) Tested OK

Address Deletion

  • If the Location behind the Address is no longer in use by any other Partners: OpenPetra automatically finds all Extract records (m_extract DB Table) that are referencing this p_partner_location and sets the p_location_key_i Column to 0 for those Extract records (no question or dialog gets brought up for that, it happens 'under the hood'). --Christiankatict (talk) 13:40, 23 February 2016 (UTC) Tested OK - this works as in Petra 2.3, but see Bug 5084 for further investigations that were requested on that topic.
    • Done in Method RemoveLocationFromExtracts in C# file DataAggregates.PPartnerAddress.cs.
  • If the Location behind the Address is not in use by other Partners then OpenPetra deletes it from the p_location DB Table. --Christiankatict (talk) 13:40, 23 February 2016 (UTC) Tested OK
  • If the last Address of a Partner is about to being deleted: Location 0 gets assigned to the to the p_partner_location record. --Christiankatict (talk) 16:20, 3 March 2016 (UTC) Tested OK; while in a certain scenario an Exception got thrown on on Feb. 25th, 2015 this got fixed with my fix for Bug 5094
  • If the Partner Find screen is shown: The Partner Find screen gets refreshed to show that the Address is gone. --Christiankatict (talk) 13:40, 23 February 2016 (UTC) Tested OK

Remarks

Explanation of Term 'Location 0'

If a Partner hasn't got any Address on file (not even an expired one) then the Partner Edit screen shows a disabled Address record, 'Bad address'. Internally, such Partners do have an Address, though - this is the 'Bad address Address', and that has got LocationKey 0 - that is what refer to as 'Location 0'. In such a situation the user needs to press 'Add' to be able to add an address. Once a user adds a 'real' Address, the Partner looses the association with the Location with LocationKey 0 - this happens automatically. Conversely, if a user deletes all 'real' Addresses of a Partner, the Partner gets the Address that has got LocationKey 0 - again, this happens automatically.