Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
I
ISPConfig 3
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 494
    • Issues 494
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 28
    • Merge Requests 28
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ISPConfig
  • ISPConfig 3
  • Merge Requests
  • !992

Open
Opened May 21, 2020 by Helmo@helmoReporter
  • Report abuse
Report abuse

Centralize the contact name concat sql code

  • Overview 16
  • Commits 14
  • Pipelines 10
  • Changes 25

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 Sep 08, 2020 by Marius Burkard
Assignee
Assign to
Reviewer
Request review from
Planned features
Milestone
Planned features
Assign milestone
Time tracking
Reference: ispconfig/ispconfig3!992
Source branch: patch-interface_concat_client_sql