Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • I ISPConfig 3
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 554
    • Issues 554
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 45
    • Merge requests 45
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ISPConfig
  • ISPConfig 3
  • Merge requests
  • !992

Centralize the contact name concat sql code

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Helmo requested to merge helmo/ispconfig3:patch-interface_concat_client_sql into develop May 21, 2020
  • Overview 19
  • Commits 17
  • Pipelines 12
  • Changes 26

We have this pattern to concat the contact name together 38 times in the codebase! Making for long and hard to read SQL queries...

CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')')

And we have subtle variations making it probably 46 times in total.

Lets replace that with a central definition to make these queries more readable. We could use a $conf var defined in config.inc.php... giving the additional benefit of being able to customize the format.

I've taken the opportunity to wrap the remaining sql query over multiple lines to further improve the readability.

I'm open to discuss the code style of this and where we store the pattern ... just hoping to improve the readability overall and reduce duplication.

Edited May 23, 2022 by Helmo
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: patch-interface_concat_client_sql