From 35cea4bf54e87f4651211bf744c6d132f763cbf9 Mon Sep 17 00:00:00 2001 From: Bob Matyas <45246438+bobmatyas@users.noreply.github.com> Date: Tue, 3 Mar 2026 16:32:21 -0500 Subject: [PATCH 1/2] Fix error rendering contact list in local dev. --- .../crm/changelog/fix-crm-error-in-local-dev | 4 ++ .../plugins/crm/includes/ZeroBSCRM.List.php | 43 ++++++++----------- 2 files changed, 23 insertions(+), 24 deletions(-) create mode 100644 projects/plugins/crm/changelog/fix-crm-error-in-local-dev diff --git a/projects/plugins/crm/changelog/fix-crm-error-in-local-dev b/projects/plugins/crm/changelog/fix-crm-error-in-local-dev new file mode 100644 index 000000000000..b088d41b303b --- /dev/null +++ b/projects/plugins/crm/changelog/fix-crm-error-in-local-dev @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Fixed issue with list rendering in local dev. diff --git a/projects/plugins/crm/includes/ZeroBSCRM.List.php b/projects/plugins/crm/includes/ZeroBSCRM.List.php index 861199e0970f..69a57ffc4d0a 100644 --- a/projects/plugins/crm/includes/ZeroBSCRM.List.php +++ b/projects/plugins/crm/includes/ZeroBSCRM.List.php @@ -166,7 +166,7 @@ public function drawListView() { $sort = sanitize_text_field( $_GET['sort'] ); } $sortOrder = false; - if ( isset( $_GET['sortdirection'] ) && ( $_GET['sortdirection'] == 'asc' || $_GET['sortdirection'] == 'desc' ) ) { + if ( isset( $_GET['sortdirection'] ) && ( $_GET['sortdirection'] === 'asc' || $_GET['sortdirection'] === 'desc' ) ) { $sortOrder = sanitize_text_field( $_GET['sortdirection'] ); } @@ -188,7 +188,7 @@ public function drawListView() { if ( isset( $customViews ) && isset( $customViews[ $this->objType ] ) ) { $currentColumns = $customViews[ $this->objType ]; } - if ( $currentColumns == false ) { + if ( $currentColumns === false ) { $currentColumns = $defaultColumns; } @@ -270,7 +270,7 @@ public function drawListView() { if ( ! array_key_exists( $colKey, $currentColumns ) ) { // split em up - if ( isset( $col[2] ) && $col[2] == 'basefield' ) { + if ( isset( $col[2] ) && $col[2] === 'basefield' ) { $allColumnsSorted['basefields'][ $colKey ] = $col; $hasMultiColumnGroups = true; } else { @@ -334,7 +334,7 @@ public function drawListView() { } // if NONE output, we need to always have smt to drop to, so put empty: - if ( $colGroupCount == 0 ) { + if ( $colGroupCount === 0 ) { echo '
'; echo '
'; } @@ -426,7 +426,7 @@ public function drawListView() { objType == 'invoice' && $colKey == 'ref' ) { + if ( $this->objType === 'invoice' && $colKey === 'ref' ) { $column_title = $zbs->settings->get( 'reflabel' ); } @@ -542,14 +542,9 @@ public function drawListView() { var zbsDrawListViewColUpdateBlocker = false; var zbsDrawListViewColUpdateAJAXBlocker = false; - var zbsObjectEmailLinkPrefix = ' - - '; + // this assumes is contact for now, just sends to prefill - perhaps later add mailto: optional (wh wants lol) + var zbsObjectEmailLinkPrefix = ''; + var zbsObjectViewLinkPrefixCustomer = ''; var zbsObjectViewLinkPrefixCompany = ''; var zbsObjectViewLinkPrefixQuote = ''; @@ -639,12 +634,12 @@ public function drawListView() { // make simplified $simple_tags = array(); if ( is_array( $tags ) && count( $tags ) > 0 ) { - foreach ( $tags as $t ) { - $simple_tags[] = array( - 'id' => $t['id'], - 'name' => $t['name'], - 'slug' => $t['slug'], - ); + foreach ( $tags as $t ) { + $simple_tags[] = array( + 'id' => $t['id'], + 'name' => $t['name'], + 'slug' => $t['slug'], + ); } } @@ -664,9 +659,9 @@ public function drawListView() { // phpcs:disable WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase global $zbsCustomerFields; if ( is_array( $zbsCustomerFields['status'][3] ) ) { - echo wp_json_encode( $zbsCustomerFields['status'][3] ); + echo wp_json_encode( $zbsCustomerFields['status'][3] ); } else { - echo '[]'; + echo '[]'; } // phpcs:enable WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase ?> @@ -678,9 +673,9 @@ public function drawListView() { // hardcoded customer perms atm $possible_owners = zeroBS_getPossibleOwners( array( 'zerobs_admin', 'zerobs_customermgr' ), true ); if ( ! is_array( $possible_owners ) ) { - echo wp_json_encode( array() ); + echo wp_json_encode( array() ); } else { - echo wp_json_encode( $possible_owners ); + echo wp_json_encode( $possible_owners ); } ?> From 5c4bd74fe20f1b071755c972626dbf5b02d2c642 Mon Sep 17 00:00:00 2001 From: Bob Matyas <45246438+bobmatyas@users.noreply.github.com> Date: Tue, 3 Mar 2026 16:50:46 -0500 Subject: [PATCH 2/2] Remove trailing space. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- projects/plugins/crm/includes/ZeroBSCRM.List.php | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/plugins/crm/includes/ZeroBSCRM.List.php b/projects/plugins/crm/includes/ZeroBSCRM.List.php index 69a57ffc4d0a..7ef98cc6ff37 100644 --- a/projects/plugins/crm/includes/ZeroBSCRM.List.php +++ b/projects/plugins/crm/includes/ZeroBSCRM.List.php @@ -544,7 +544,6 @@ public function drawListView() { // this assumes is contact for now, just sends to prefill - perhaps later add mailto: optional (wh wants lol) var zbsObjectEmailLinkPrefix = ''; - var zbsObjectViewLinkPrefixCustomer = ''; var zbsObjectViewLinkPrefixCompany = ''; var zbsObjectViewLinkPrefixQuote = '';