Jump to content

Gateway Log Filter Not Working


Chance

Recommended Posts

We have many entries in the gateway log for PayPal Payments Standard.  We are looking to find the gateway log for a specific transaction.  We visit Logs -> Gateway and filter by Content.  We enter the transaction ID of the transaction we want to look up.  We have tried entering both a start and end date applicable to the transaction date as well as leaving both filter date fields empty.  We click Submit.  We get nothing.  Watching the console, we see the AJAX call does not return a matching transaction.  It appears to simply reload the same page content as before filtering:

{"replacer":".content_section","content":"\n        \n\t\t\t\t<div class=\"tabs_row\">\n\t\t\t\t\t<div class=\"tabs_nav\"><a href=\"#\" class=\"prev\">&nbsp;<\/a><a href=\"#\" class=\"next\">&nbsp;<\/a><\/div>\n\t\t\t\t\t<div class=\"tab_slider\">\n\t\t\t\t\t\t<ul>\n<li class=\"first\"><a href=\"\/admin\/tools\/logs\/module\/\">Module<\/a><\/li>\n<li class=\"\"><a href=\"\/admin\/tools\/logs\/messenger\/\">Messenger<\/a><\/li>\n<li class=\"current\"><a href=\"\/admin\/tools\/logs\/gateway\/\">Gateway<\/a><\/li>\n<li class=\"\"><a href=\"\/admin\/tools\/logs\/email\/\">Email<\/a><\/li>\n<li class=\"\"><a href=\"\/admin\/tools\/logs\/users\/\">User Logins<\/a><\/li>\n<li class=\"\"><a href=\"\/admin\/tools\/logs\/contacts\/\">Contacts<\/a><\/li>\n<li class=\"\"><a href=\"\/admin\/tools\/logs\/clientsettings\/\">Client Settings<\/a><\/li>\n<li class=\"\"><a href=\"\/admin\/tools\/logs\/accountaccess\/\">Account Access<\/a><\/li>\n<li class=\"\"><a href=\"\/admin\/tools\/logs\/transactions\/\">Transactions<\/a><\/li>\n<li class=\"\"><a href=\"\/admin\/tools\/logs\/cron\/\">Cron<\/a><\/li>\n<li class=\"\"><a href=\"\/admin\/tools\/logs\/invoicedelivery\/\">Invoice Delivery<\/a><\/li>\n<\/ul>\n\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"tabs_content\">\n<div class=\"inner\"><form method=\"post\" action=\"\/admin\/tools\/logs\/gateway\/\" style=\"\" class=\"widget_filter_form\">\n<input type=\"hidden\" name=\"_csrf_token\" value=\"0b4c59bb7966d8d62f3a6753aac0008e5707c5dbf573dc2e07db9e7ba83e3385\" \/>\n<div class=\"pad\"><ul class=\"row\"><li class=\"col-md-3\"><label for=\"string\">Content<\/label>\n<input type=\"text\" name=\"filters[string]\" value=\"7M8076186K676010F\" id=\"string\" class=\"form-control stretch\" placeholder=\"Content\" data-value=\"7M8076186K676010F\" \/>\n<\/li><li class=\"col-md-3\"><label for=\"start_date\">Start Date<\/label>\n<input type=\"text\" name=\"filters[start_date]\" value=\"2023-10-30\" id=\"start_date\" class=\"date form-control\" placeholder=\"Start Date\" data-value=\"2023-10-30\" \/>\n<\/li><li class=\"col-md-3\"><label for=\"end_date\">End Date<\/label>\n<input type=\"text\" name=\"filters[end_date]\" value=\"2023-12-31\" id=\"end_date\" class=\"date form-control\" placeholder=\"End Date\" data-value=\"2023-12-31\" \/>\n<\/li><\/ul><input type=\"submit\" name=\"submit\" value=\"Submit\" class=\"btn btn-default pull-right\" \/>\n<\/div><\/form>\n<\/div>\n                <script type=\"text\/javascript\">\n                    $(document).ready(function () {\n                        $(\"#admin_tools_loggateway.common_box\").on(\"click\", \"a.ajax\", function(e) {\n                            e.preventDefault();\n                            var form = $(this).parents(\".common_box\").find(\"form.widget_filter_form\");\n\n                            form.find(\"input\").each(function() {\n                                var data_value = $(this).data(\"value\");\n\n                                if (data_value != undefined && data_value !== \"\" && $(this).val == \"\") {\n                                    $(this).attr(\"value\", data_value).val(data_value);\n                                }\n                            });\n\n                            form.find(\"select\").each(function() {\n                                var data_value = $(this).data(\"value\");\n\n                                if (data_value != undefined && data_value !== \"\" && $(this).val == \"\") {\n                                    $(this).val(data_value);\n                                }\n                            });\n\n                            var action = $(form).attr(\"action\");\n                            $(form).attr(\"action\", $(this).attr(\"href\"));\n                            $(form).submit();\n                            $(form).attr(\"action\", action);\n                            return false;\n                        });\n                    });\n                <\/script>\n            <script type=\"text\/javascript\">\n                $(document).ready(function () {\n                    $(this).blestaBindDatePicker();\n                });\n            <\/script>\n        \n            <script type=\"text\/javascript\">\n                $(document).ready(function () {\n                    $(\"#admin_tools_loggateway .filter-toggle\").click(function () {\n                        $(this).parents(\".common_box\").find(\"form.widget_filter_form\").toggle();\n                    });\n                });\n            <\/script>\n            <script type=\"text\/javascript\">\n                $(document).ready(function () {\n                    $(\"form.widget_filter_form\").submit(function(event) {\n                        event.preventDefault();\n                        var that = this;\n                        if ($(this).blestaDisableFormSubmission($(this))) {\n                            $(this).blestaRequest(\"POST\", $(this).attr(\"action\"), $(this).serialize(),\n                                \/\/ On success\n                                function(data) {\n                                    if (data.hasOwnProperty(\"replacer\") && data.hasOwnProperty(\"content\")) {\n                                        $(that).parents(\".common_box\").find(data.replacer).html(data.content);\n                                    }\n                                },\n                                null,\n                                {dataType: \"json\", complete: function() { $(\"form.widget_filter_form\").blestaEnableFormSubmission($(\"form.widget_filter_form\")); }}\n                            );\n                        }\n                    });\n                });\n            <\/script><div class=\"common_box_content\">        <div class=\"inner\">\n                        <table class=\"table\">\n                <tr class=\"heading_row\">\n                    <td><span><a href=\"\/admin\/tools\/logs\/gateway\/?sort=gateway_name&amp;order=desc\" class=\"ajax\">Name<\/a><\/span><\/td>\n                    <td><span><a href=\"\/admin\/tools\/logs\/gateway\/?sort=staff_first_name&amp;order=desc\" class=\"ajax\">Staff<\/a><\/span><\/td>\n                    <td class=\"last\"><span><a href=\"\/admin\/tools\/logs\/gateway\/?sort=date_added&amp;order=asc\" class=\"ajax desc\">Date<\/a><\/span><\/td>\n                <\/tr>\n                                <tr class=\"expand gateway_list\">\n                    <td><a href=\"\/admin\/settings\/company\/gateways\/manage\/1\/\">PayPal Payments Standard<\/a><\/td>\n                    <td> <\/td>\n                    <td>Nov 01, 2023 4:22:14 AM<\/td>\n                <\/tr>\n                <tr class=\"expand_details\" id=\"group_c90ec838\">\n                    <td colspan=\"3\" class=\"subtable\">\n                    <\/td>\n                <\/tr>\n                            <\/table>\n                    <\/div>\n        \n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n<script type=\"text\/javascript\">\n    $(document).ready(function() {\n        \/\/ Fetch all gateway logs applied to the given gateway log group\n        $(\".gateway_list\").click(function() {\n            $(this).blestaUpdateRow(\"\/admin\/tools\/gatewayloglist\/\" + $(this).next(\"tr\").attr(\"id\").split(\"_\")[1], \".subtable\");\n        });\n    });\n<\/script>","message":null}

I would expect that when I filter the gateway logs for a transaction ID, the Content field would map to the data field in DB table and find any log entries containing my search criteria. I can find the transaction log entry simply by using Ctrl + F and entering the same transaction ID into browser's Find field, so we know the gateway logs DO contain this transaction.  The log system should allow us to filter on any log field as needed.

 

Blesta v5.9.3

PHP 7.4.33

MySQL 10.2.44

Link to comment
Share on other sites

I tried to reproduce this with Stripe Payments (Not able to test with PayPal Payments Standard, but it shouldn't matter). Using the filter option, and entering the transaction # in the content box (Not selecting anything for dates), and clicking Submit did return the gateway log that contains the transaction # in the response data.

If the transaction # is included in the gateway log for PayPal, it should find a match, it does appear to do a LIKE search on the response data.

I would check ../logs_blesta/ logs to see if there are any errors while performing the filter operation.

Link to comment
Share on other sites

I deleted all log files in logs_blesta and tried searching for a single transaction.  Left date fields blank.  I have the PayPal Payments Standard row expanded showing hundreds of log entries as I enter the transaction ID to filter.  I click Submit.  The page simply reloads with the PayPal Payments Standard row collapsed.  I get no search results that I can see.  If I click on the PayPal Payments Standard row, it just reloads ALL the gateway log entries.  And the logs_blesta directory remains empty.

Link to comment
Share on other sites

Further reviewing the POST when filtering the gateway logs......In controller (admin_tools.php) and action (logGateway), it shows that the method (getGatewayList) of model (Logs) DOES return a matching log entry for the transaction being searched for.  I see this by dumping the results of line #247 in admin_tools.php and terminating program execution.  The single matched transaction is shown.  But the AJAX request response to the posted filter does NOT contain the transaction.  And the admin page simply appears to refresh, as if no search operation transpired at all.

Link to comment
Share on other sites

Does this happen on an unmodified installation with no 3rd party extensions installed? I've tried and have been unable to reproduce this. When I search the gateway log, I'm seeing the expected results. We will need steps required to reproduce.

Link to comment
Share on other sites

34 minutes ago, Paul said:

Does this happen on an unmodified installation with no 3rd party extensions installed? I've tried and have been unable to reproduce this. When I search the gateway log, I'm seeing the expected results. We will need steps required to reproduce.

There are no 3rd-party extensions installed outside of my own 3 plugins.  My plugins do NOTHING in admin (other than add some admin menu items and load content IF those menu items are clicked).  To be sure they are not interfering, I have disabled them all.    The gateway log filter does POST to server, and the Logs model DOES find the matching transaction.  The search results are not shown to admin...entire admin logs page just seems to reload. 

I did programmatically insert the logs_gateway records because the ImportManager plugin does not import that data.  Our client wanted EVERYTHING from WHMCS imported over.  In doing this, I used Blesta's Logs Model to achieve this.  I can see that the log filtering IS matching the search criteria....just not showing the result to admin.

I provided the steps to reproduce in previous post. 

 

Link to comment
Share on other sites

Clearly this is not a bug after all.  Figured I should update this to let others know the issue in case they encounter it as well following imports.

Issue is 100% related to log group not being set proper when importing from WHMCS.  Since all the imported gateway log entries had the same group value, only one PayPal Payments Standard row was being shown in the Blesta Gateway Logs.  So EVERY log entry was tied to the same gateway row.  Corrected this by providing a unique group value for each entry.  The Gateway log lists now shows more than just the single PayPal Payments Standard row this post first mentioned.  And filtering works like it should.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...