-
Notifications
You must be signed in to change notification settings - Fork 875
CRM: Fix Contact List Rendering in Local Dev Environment #47437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Significance: patch | ||
| Type: fixed | ||
|
|
||
| Fixed issue with list rendering in local dev. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -166,7 +166,7 @@ | |||||||||||||||||||||||||
| $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' ) ) { | ||||||||||||||||||||||||||
|
Check warning on line 169 in projects/plugins/crm/includes/ZeroBSCRM.List.php
|
||||||||||||||||||||||||||
| $sortOrder = sanitize_text_field( $_GET['sortdirection'] ); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -188,7 +188,7 @@ | |||||||||||||||||||||||||
| if ( isset( $customViews ) && isset( $customViews[ $this->objType ] ) ) { | ||||||||||||||||||||||||||
| $currentColumns = $customViews[ $this->objType ]; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| if ( $currentColumns == false ) { | ||||||||||||||||||||||||||
| if ( $currentColumns === false ) { | ||||||||||||||||||||||||||
| $currentColumns = $defaultColumns; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -270,7 +270,7 @@ | |||||||||||||||||||||||||
| 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 @@ | |||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // if NONE output, we need to always have smt to drop to, so put empty: | ||||||||||||||||||||||||||
| if ( $colGroupCount == 0 ) { | ||||||||||||||||||||||||||
| if ( $colGroupCount === 0 ) { | ||||||||||||||||||||||||||
| echo '<div class="zbs-column-manager-connected">'; | ||||||||||||||||||||||||||
| echo '</div>'; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
@@ -426,7 +426,7 @@ | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| <?php | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| $allowinlineedits = ( zeroBSCRM_getSetting( 'allowinlineedits' ) == '1' ); | ||||||||||||||||||||||||||
| $allowinlineedits = ( zeroBSCRM_getSetting( 'allowinlineedits' ) === '1' ); | ||||||||||||||||||||||||||
| $inlineEditStr = array(); | ||||||||||||||||||||||||||
| $columns = array(); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -440,7 +440,7 @@ | |||||||||||||||||||||||||
| // overrides | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // Invoicing: Ref | ||||||||||||||||||||||||||
| if ( $this->objType == 'invoice' && $colKey == 'ref' ) { | ||||||||||||||||||||||||||
| if ( $this->objType === 'invoice' && $colKey === 'ref' ) { | ||||||||||||||||||||||||||
| $column_title = $zbs->settings->get( 'reflabel' ); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -542,14 +542,8 @@ | |||||||||||||||||||||||||
| var zbsDrawListViewColUpdateBlocker = false; | ||||||||||||||||||||||||||
| var zbsDrawListViewColUpdateAJAXBlocker = false; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| var zbsObjectEmailLinkPrefix = ' | ||||||||||||||||||||||||||
| <?php | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // this assumes is contact for now, just sends to prefill - perhaps later add mailto: optional (wh wants lol) | ||||||||||||||||||||||||||
| echo jpcrm_esc_link( 'email', -1, 'zerobs_customer', true ); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ?> | ||||||||||||||||||||||||||
| '; | ||||||||||||||||||||||||||
| // this assumes is contact for now, just sends to prefill - perhaps later add mailto: optional (wh wants lol) | ||||||||||||||||||||||||||
| var zbsObjectEmailLinkPrefix = '<?php echo jpcrm_esc_link( 'email', -1, 'zerobs_customer', true ); ?>'; | ||||||||||||||||||||||||||
|
Comment on lines
+545
to
+546
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the actual fix. |
||||||||||||||||||||||||||
| var zbsObjectViewLinkPrefixCustomer = '<?php echo jpcrm_esc_link( 'view', -1, 'zerobs_customer', true ); ?>'; | ||||||||||||||||||||||||||
| var zbsObjectViewLinkPrefixCompany = '<?php echo jpcrm_esc_link( 'view', -1, 'zerobs_company', true ); ?>'; | ||||||||||||||||||||||||||
| var zbsObjectViewLinkPrefixQuote = '<?php echo jpcrm_esc_link( 'edit', -1, 'zerobs_quote', true ); ?>'; | ||||||||||||||||||||||||||
|
|
@@ -639,12 +633,12 @@ | |||||||||||||||||||||||||
| // 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'], | ||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||
|
Comment on lines
+636
to
+641
|
||||||||||||||||||||||||||
| 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'], | |
| ); |
Copilot
AI
Mar 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These echo statements inside the if/else are no longer indented under their control flow, which makes it easy to miss which branch they belong to in this mixed PHP/JS section. Please re-indent the echo wp_json_encode(...) / echo '[]' lines to match the surrounding block structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching this fallback check to a strict
=== falsechanges behavior when$customViews[$this->objType]is an empty array. The AJAX column-save paths can persist an empty array when the user saves with no columns selected, and with this change the list view would keep[]instead of falling back to$defaultColumns, potentially rendering an empty/broken table. Consider treating an empty array the same asfalsehere (e.g., fall back whenempty($currentColumns)or when it’s not a non-empty array).