When dbr.selectable is combined with callbefore it seems to break the callbefore

(7 posts) (2 voices)

Tags:

No tags yet.

  1. jptreen, Member

    The very same callbefore works without the selectable. The selectable works either way. Is this expected?

  2. myDBR Team, Key Master

    Hi,
    callbefore and selectable should work together. See sample.

    Can you elaborate what happens when callbefore "breaks"?

    --
    myDBR Team

  3. jptreen, Member

    Fair ask. It's probably best if I show you.

    The callbefore function, as defined in the procedure.

    select 'dbr.javascript',
    "
    function confirm_send(ignore)
    {
    return confirm('Email All Customers?');
    }";

    Button Case A: With selectable. Callbefore does not get called in this case. But selectable.orders does work as expected.


    SELECT 'dbr.button', 'Send Selected Invoices to Customer';
    SELECT 'dbr.report',"sp_DBR_send_invoices_from_selection", 'invoice_return_notes[]', 'popup', 'inLogin=inLogin', 'in_ids=selectable.orders', "callbefore=confirm_send";
    SELECT inLogin;

    Button Case B: Callbefore DOES get called in this case (when I mimic the output of selectable.orders with a string of the same format that it returns).


    SELECT 'dbr.button', 'Send Selected Invoices to Customer';
    SELECT 'dbr.report',"sp_DBR_send_invoices_from_selection", 'invoice_return_notes[]', 'popup', 'inLogin=inLogin', 'in_ids=arbitrary_ids', "callbefore=confirm_send";
    SELECT inLogin, "5001,5002" as arbitrary_ids;

    By 'break' I mean the href for the button changes and the callbefore does not appear in case A.

    Case A button href:
    href="javascript:selected.execute('orders','popup','[SERVER_ADDRESS]/report.php?r=1465&p2=[USERNAME]&u1=%5Bselectable.orders%5D&m=20&h=2a6d783b94e5e838b618d2e472fb8c3341f37da5&i=1&hide=1','Invoice: Send invoices to customers from selection',null,null)"

    Case B button href:
    href="javascript:if (confirm_send(this.parentNode)) {embed_element('popup','[SERVER_ADDRESS]/report.php?r=1465&p2=[USERNAME]&p1=5001%252C5002&m=20&h=cb9b28eb900d5dfc15b7b5374da7e89441bd4dca&i=1','Invoice: Send invoices to customers from selection',null,null);}"

    Does this make sense?

  4. myDBR Team, Key Master

    We seem to have problems replicating your issue.

    See the sample code and try to spot the difference. The same exact logic is in the sample. If you are not successful, open a support ticket and attach the sql-export of the report output.

    Btw, you got couple of errors in the code:

    1. You have defined two targets invoice_return_notes[] and popup
    2. You are passing inLogin as parameter, but the inLogin column is not named inLogin. There is no need to pass inLogin as myDBR do that automatically for you

    --
    myDBR Team

  5. jptreen, Member

    Thank you. Removing the errors you spotted does not fix it, but it's good to be better.

    There is no 'see how this report is done' for the sample in the database, so I feel a little blind, but I will take a look and have a play.

    Thanks!

  6. myDBR Team, Key Master

    The reason is quite likely a simple one. Support for callback in selectable was added in 5.0.2, so perhaps you are running older version? Just run the updater and you should be fine.

    The sample was referring to the link in previous forum post.

    --
    myDBR Team

  7. jptreen, Member

    Ah! Thank you very much. I was on 5.0.0. I should have thought of that!


Reply

You must log in to post.