Replace PrimaryLinkTrait::acceptsCoId and CoIdEventListener

XMLWordPrintable

    • Type: Task
    • Resolution: Unresolved
    • Priority: Minor
    • Affects Version/s: PE Milestone 13 (Bakers Dozen)
    • None

      Certain MVEAs (Address, Name, TelephoneNumber) require configuration from CO Settings to determine validation rules, which in turn requires knowing the current CO. The current CO is passed to these models via PrimaryLinkTrait in one of several ways:

      1. AppController::setCOID, when the current model is one of these MVEAs.
      2. CoIdEventListener, via AppController, when the current model is not one of these MVEAs.
      3. CoIdEventListener, via JobCommand, since the command line doesn't trigger AppController.

      This is brittle, and probably doesn't cover all use cases (including JobCommand running tasks for multiple COs). A better approach would be to write a new validation rule that uses the available primary links and finds the CO based on them (similar to PrimaryLinkTrait::calculateCoForRecord). For example, when an Address is saved, if that Address belongsTo a Person (person_id is set in the entity data), the CO is obtained from person_id and then the appropriate required fields would be set.

      The complication here will be dynamically updating the required fields when the entity data is available but before validation is actually performed.

            Assignee:
            Benn Oshrin (internet2.edu)
            Reporter:
            Benn Oshrin (internet2.edu)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: