Announcement

Collapse
No announcement yet.

Bug: Order Number not being populated when resending email notifications C&P v .008

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bug: Order Number not being populated when resending email notifications C&P v .008

    We recently updated to C&P v 3.700.008, and just noticed that the order number would be populated in the email notification that is sent out on the form submission, however when resending an email notification that is using an {order_number} merge tag from the Notifications panel on the Gravity Forms Entries page, the {order_number} is blank. We traced this back to the following:

    Here is a snippet from the Gravity Forms forms_model.php
    Code:
    Gravity Forms v2.4.14 (forms_model.php)
    line 2635
             /**
             * Save Entry to database.
             *
             * @since 2.4.8.13 Updated created_by property to save as an empty value when undefined.
             * @since Unknown
             *
             * @param array $form  Form object.
             * @param array $entry Entry object.
             */
             public static function save_entry( $form, &$entry ) {
                ...
                line 2726
                $entry = array(
                                    'id'               => (string) $lead_id,
                                    'status'           => 'active',
                                    'form_id'          => (string) $form['id'],
                                    'ip'               => $ip,
                                    'source_url'       => $source_url,
                                    'currency'         => $currency,
                                    'post_id'          => null,
                                    'date_created'     => $current_date,
                                    'date_updated'     => $current_date,
                                    'is_starred'       => 0,
                                    'is_read'          => 0,
                                    'user_agent'       => $user_agent,
                                    'payment_status'   => null,
                                    'payment_date'     => null,
                                    'payment_amount'   => null,
                                    'payment_method'   => '',
                                    'transaction_id'   => null,
                                    'is_fulfilled'     => null,
                                    'created_by'       => (string) $user_id,
                                    'transaction_type' => null,
                            );
    So when C&P runs this:
    Code:
    C&P v 3.700.008
    class.GFCnpPlugin.php
    /**
    768        * replace custom merge tags
    769        * @param string $text
    770        * @param array $form
    771        * @param array $lead
    772        * @param bool $url_encode
    773        * @param bool $esc_html
    774        * @param bool $nl2br
    775        * @param string $format
    776        * @return string
    777        */
    778       
    779        public function gformReplaceMergeTags($text, $form, $lead, $url_encode, $esc_html, $nl2br, $format) {
    780                if ($this->hasFieldType($form['fields'], 'creditcard')) {
    781                        if (is_null($this->txResult)) {
    782                                // lead loaded from database, get values from lead meta
    783                                /*$transaction_id = isset($lead['transaction_id']) ? $lead['transaction_id'] : '';*/
    784                                $order_number = isset($lead['order_number']) ? $lead['order_number'] : '';
    Line 784 of the above GFCnpPlugin is blank since Gravity Forms does not save into a field named 'order_number', instead they save to a field named 'transaction_id' as you can see in the Gravity Forms code from the forms_model.php.

    Here is a screenshot from our Gravity Forms Database, note there is no 'order_number' field, just the 'transaction_id' field:

    Click image for larger version

Name:	Screen Shot 2019-10-10 at 12.19.53 PM.png
Views:	15
Size:	20.7 KB
ID:	49399

    We changed the following line in class.GFCnpPlugin.php from:

    Code:
    784                                $order_number = isset($lead['order_number']) ? $lead['order_number'] : '';
    to:

    Code:
    784                                $order_number = isset($lead['transaction_id']) ? $lead['transaction_id'] : '';
    And our resend notifications worked again by populating the {order_number} merge tag correctly. Please fix this as we don't want to have to modify the plugin code directly to achieve proper functionality. Thank you.

  • #2
    Good day @PatODay

    Sorry for the inconvenience and thank you for notifying us. I have forwarded it to our developers to review and fix it.
    Regards,
    Click & Pledge Support Department

    On Salesforce? Help us by rating our app: Click & Pledge Donor Management on AppExchange

    Join us @ the educational webinars: https://clickandpledge.com/webinars/
    Live Support available Join between 3:00 - 3:30 p.m. ET Monday - Thursday: https://clickandpledge.com/webinars/
    Are you on Salesforce? Join us at the Power of Us Hub: https://powerofus.force.com/0F980000000CjpC

    Comment


    • #3
      Good day @PatODay

      The above issue has been fixed in the today's release. Please update to the latest version: https://forums.clickandpledge.com/fo...bility-release
      Regards,
      Click & Pledge Support Department

      On Salesforce? Help us by rating our app: Click & Pledge Donor Management on AppExchange

      Join us @ the educational webinars: https://clickandpledge.com/webinars/
      Live Support available Join between 3:00 - 3:30 p.m. ET Monday - Thursday: https://clickandpledge.com/webinars/
      Are you on Salesforce? Join us at the Power of Us Hub: https://powerofus.force.com/0F980000000CjpC

      Comment

      Working...
      X