diff --git a/CHANGELOG.md b/CHANGELOG.md index 91e05e2ca..1a279a6a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,26 @@ ## Gravity PDF +### 6.14.3 +* ๐Ÿงน Housekeeping: WordPress 7.0 Compatibility +* ๐Ÿงน Housekeeping: Improved screen-reader support for admin pages +* ๐Ÿงน Housekeeping: Remove obsolete Gravity Forms cache workaround +* ๐Ÿž Bug: Honor PDF Conditional Logic toggle setting, so disabling it in the UI skips stale conditional rules +* ๐Ÿž Bug: Fix Rich Text Editor rendering error when switching PDF templates +* ๐Ÿž Bug: Preserve unsaved edits to the Template fields if switching to a PDF template with the same fields (eg. Core / Invoice / Certificate) +* ๐Ÿž Bug: Preserve the selected template when adding a new PDF +* ๐Ÿž Bug: Fix Gravity Forms 2.6+ version detection on PDF form-settings pages +* ๐Ÿž Bug: Fix regression in the Template Manager when an invalid .zip is uploaded +* ๐Ÿž Bug: Minor UI fixes in the Template Manager +* ๐Ÿž Bug: Fix regression in the Core Fonts installer when a download error occurs +* ๐Ÿž Bug: Reset Gravity Wiz Nested Form field IDs after each group in PDFs + ### 6.14.2 -* ๐ŸžBug: Fix PHP warning caused by the GFCommon::get_lead_field_display() API change in Gravity Forms 2.9.29 -* ๐ŸžBug: Fix merge tag rendering issue when switching between PDF templates -* ๐ŸžBug: Fix Font Manager to Font select field syncing issue -* ๐ŸžBug: Fix edge-case issue with the URL signing feature and improve verification/validation checks -* ๐ŸžBug: Rename Chinese language files so it is correctly used when the site language is set to the zh_CN locale. +* ๐Ÿž Bug: Fix PHP warning caused by the GFCommon::get_lead_field_display() API change in Gravity Forms 2.9.29 +* ๐Ÿž Bug: Fix merge tag rendering issue when switching between PDF templates +* ๐Ÿž Bug: Fix Font Manager to Font select field syncing issue +* ๐Ÿž Bug: Fix edge-case issue with the URL signing feature and improve verification/validation checks +* ๐Ÿž Bug: Rename Chinese language files so it is correctly used when the site language is set to the zh_CN locale. * ๐Ÿงน Housekeeping: Improve template caching and performance * ๐Ÿงน Housekeeping: Update PHP and Javascript dependencies * ๐Ÿงน Housekeeping: Disable asset caching when `SCRIPT_DEBUG` constant enabled @@ -17,24 +31,24 @@ ### 6.14.1 * ๐Ÿงน Housekeeping: Add `gfpdf-{$type}` CSS class to the HTML mark-up when a field uses a different input type * ๐Ÿงน Housekeeping: Use the field type (not input type) in the `gfpdf_pdf_field_content_{$type}` filter -* ๐ŸžBug: Fix PHP error if another plugin lazy loads the PSR/Log v1 library +* ๐Ÿž Bug: Fix PHP error if another plugin lazy loads the PSR/Log v1 library ### 6.14.0 * ๐ŸŽ‰ Feature: Rotate Gravity PDF log files when Gravity Forms logging is enabled. This prevents the log file getting to large. * ๐ŸŽ‰ Feature: Add support for using v1, v2, and v3 of the PSR/Log Composer library with Gravity PDF -* ๐ŸžBug: Fix PHP error if a third-party plugin loads PSR/Log v2 or v3 +* ๐Ÿž Bug: Fix PHP error if a third-party plugin loads PSR/Log v2 or v3 ### 6.13.5 -* ๐ŸžBug: Ensure background queue uses correct entry data when resending notifications -* ๐ŸžBug: Prevent plugins corrupting PDF data when viewing/downloading (via output buffer) +* ๐Ÿž Bug: Ensure background queue uses correct entry data when resending notifications +* ๐Ÿž Bug: Prevent plugins corrupting PDF data when viewing/downloading (via output buffer) ### 6.13.4 -* ๐ŸžBug: Resolve PDF View/Download issue if both Event Espresso and LifterLMS plugin are installed +* ๐Ÿž Bug: Resolve PDF View/Download issue if both Event Espresso and LifterLMS plugin are installed ### 6.13.3 * ๐Ÿ”’ Security: Remove the mPDF and Gravity PDF version numbers in the PDF metadata -* ๐ŸžBug: Resolve PHP error in 6.13.2 upgrade routine if the temporary PDF directory has been incorrectly set to a shared system folder -* ๐ŸžBug: Resolve PHP error if the `page` or `subview` admin URL parameters are arrays +* ๐Ÿž Bug: Resolve PHP error in 6.13.2 upgrade routine if the temporary PDF directory has been incorrectly set to a shared system folder +* ๐Ÿž Bug: Resolve PHP error if the `page` or `subview` admin URL parameters are arrays ### 6.13.2 * ๐Ÿž Bug: Fix plugin build issue preventing the mPDF cache filesystem fix (6.13.0) from working diff --git a/pdf.php b/pdf.php index f58f9f9ee..5770e4f3e 100644 --- a/pdf.php +++ b/pdf.php @@ -1,7 +1,7 @@ entry['id'] . '_' . $this->field->id, false, false, 0 ); - } - /* * Get the Gravity Forms field value * diff --git a/src/Helper/Helper_Abstract_Pdf_Shortcode.php b/src/Helper/Helper_Abstract_Pdf_Shortcode.php index b8ff35e80..14e9ed4ad 100644 --- a/src/Helper/Helper_Abstract_Pdf_Shortcode.php +++ b/src/Helper/Helper_Abstract_Pdf_Shortcode.php @@ -148,7 +148,7 @@ protected function get_pdf_config( $entry_id, $pdf_id ) { throw new GravityPdfShortcodePdfInactiveException(); } - if ( isset( $settings['conditionalLogic'] ) && ! $this->misc->evaluate_conditional_logic( $settings['conditionalLogic'], $entry ) ) { + if ( ! $this->misc->conditional_logic_passes( $settings, $entry ) ) { throw new GravityPdfShortcodePdfConditionalLogicFailedException(); } diff --git a/src/Helper/Helper_Form.php b/src/Helper/Helper_Form.php index 1337dbe66..ab55b28e5 100644 --- a/src/Helper/Helper_Form.php +++ b/src/Helper/Helper_Form.php @@ -4,6 +4,7 @@ use GFAPI; use GFCommon; +use GFForms; use GFFormsModel; use WP_Error; @@ -33,7 +34,7 @@ class Helper_Form extends Helper_Abstract_Form { * @since 4.0 */ public function get_version() { - return \GFForms::$version; + return GFForms::$version; } /** diff --git a/src/Helper/Helper_Misc.php b/src/Helper/Helper_Misc.php index ac535f8bd..34f9e64df 100644 --- a/src/Helper/Helper_Misc.php +++ b/src/Helper/Helper_Misc.php @@ -832,6 +832,39 @@ public function update_deprecated_config( $value ) { return $value; } + /** + * Whether a PDF's saved settings should pass the entry through conditional-logic gating. + * + * The form-settings UI exposes two related fields: the `conditional` toggle (the user-visible + * on/off switch) and the `conditionalLogic` rules array. They can drift out of sync โ€” the + * toggle gets disabled while the rules array keeps its previous value โ€” so trusting only + * `conditionalLogic` makes the runtime disagree with what the UI shows. + * + * Returns true when the entry is allowed (toggle off, no rules, or rules pass), false when + * the toggle is on and rules explicitly reject the entry. + * + * The `conditional` key may be absent on very old settings; treat that as "no override, + * fall back to the rules" so legacy behaviour is preserved. + * + * @param array $settings The PDF settings array + * @param array $entry The Gravity Forms entry + * + * @return bool + * + * @since 6.14.3 + */ + public function conditional_logic_passes( $settings, $entry ) { + if ( array_key_exists( 'conditional', $settings ) && empty( $settings['conditional'] ) ) { + return true; + } + + if ( empty( $settings['conditionalLogic'] ) ) { + return true; + } + + return $this->evaluate_conditional_logic( $settings['conditionalLogic'], $entry ); + } + /** * Determine if the logic should show or hide the item * diff --git a/src/Helper/Helper_PDF_List_Table.php b/src/Helper/Helper_PDF_List_Table.php index 3585caf5f..b1da4a4aa 100644 --- a/src/Helper/Helper_PDF_List_Table.php +++ b/src/Helper/Helper_PDF_List_Table.php @@ -2,6 +2,7 @@ namespace GFPDF\Helper; +use GFForms; use WP_List_Table; /** @@ -223,7 +224,7 @@ public function column_cb( $item ) { $text = __( 'Inactive', 'gravity-pdf' ); } - $gf_less_than_288 = version_compare( \GFForms::$version, '2.8.8', '<' ); + $gf_less_than_288 = version_compare( GFForms::$version, '2.8.8', '<' ); ?> @@ -290,7 +291,7 @@ public function column_shortcode( $item ) { ob_start(); /* If the current GF version is 2.6 or higher, use the new updated UI for the shortcode button or else use the pre GF 2.5 version. */ - if ( version_compare( '2.6-rc-1', \GFForms::$version, '<=' ) ): + if ( version_compare( GFForms::$version, '2.6.0', '>=' ) ): ?>