Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • CiviCRM Core CiviCRM Core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Graph
    • Compare revisions
  • Issues 1.1k
    • Issues 1.1k
    • List
    • Boards
    • Service Desk
    • Milestones
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • DevelopmentDevelopment
  • CiviCRM CoreCiviCRM Core
  • Issues
  • #1308
Closed
Open
Issue created Oct 09, 2019 by Björn Endres@BjoernE⛵Developer

Refactor inefficient ID generation (creditnote_id)

In a discussion in the financial working group in the Barcelona 2019 sprint there was the idea to refactor the inefficient generation of the creditnote_id (see links below).

The general idea is to create a new hook to enable generation of various identifiers, in this instance creditnote_id and invoice_id. In the future, potentially even more (e.g. contact_external_identifier or campaign_external_identifier)

I suggest the following signature for the new hook:

  /**
   * This hook allows custom implementation for the generation
   * of various identifiers like the invoice_id or the
   * creditnote_id
   *
   * @param string $identifier  the identifier to be used, can be manipulated
   * @param string $type        currently one of 'invoice_id', 'creditnote_id'
   * @param array  $context     list of key-indexed context data, 
   * @param bool   $can_be_null true iff the resulting IDs may be NULL 
   * @return mixed
   */
  public static function generateIdentifier(&$identifier, $type, $context, $can_be_null) {
    return self::singleton()->invoke(['identifier', 'type', 'context', 'can_be_null'], $identifier, $type, $context, $can_be_null, self::$_nullObject, self::$_nullObject, 'civicrm_generateIdentifier');
  }

Related PR's:

  • https://github.com/civicrm/civicrm-core/pull/11110 - closed because it is stale
  • https://github.com/civicrm/civicrm-core/pull/15232 - merged
  • https://github.com/civicrm/civicrm-core/pull/15235
  • https://github.com/civicrm/civicrm-core/pull/16462

Related issues:

  • https://issues.civicrm.org/jira/browse/CRM-21289
  • financial#84 (closed)
Edited Feb 13, 2023 by CiviCRM Dev Support
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking