Page 1 of 1

Print in Custom Action

Posted: Wed Nov 30, 2022 2:09 am
by stpaulin

Hi,
I use fpdf in a php page to print a report from a list page.
In ListOptions Rendered event :

$this->ListOptions->Items["print"]->Body = "<a class=\"btn btn-default center\" href=\"fpdfreports/ac_remise.php?id=".$this->id->CurrentValue."&current_user_id=". CurrentUserID() ."\" target=\"_blank\"><i class=\"fas fa-solid fa-print\"></i></a>";

Then, I can print my report for each record.

Now, I want to call my page that makes the print (ac_remise.php) in a custom_action.
My purpose is to print the the report for each selected records from a list page using a custom action.

How can I do that ?

Help please


Re: Print in Custom Action

Posted: Wed Nov 30, 2022 9:26 am
by mobhar

Re: Print in Custom Action

Posted: Thu Dec 01, 2022 5:40 pm
by stpaulin

Can you help me with the use of key_m[] in my case ?

I've tried before replying without success.
What i did :

Table setup => "Multi-Update page"
Multi-Update : enabled
Modal-dialog : enabled

I define just one field for multi-update modal and then in Page_Redirecting event of multi-update page :

// Page Redirecting event
function Page_Redirecting(&$url)
{
    // Example:
    //$url = "your URL";
    $url = "fpdfreports/ac_remise.php?id=".$this->id->$row['id']."&current_user_id=". CurrentUserID()."&keys=key_m[]";
}

But it doesn't work.
How can I send selected records to "ac_remise.php" ?
Help please


Re: Print in Custom Action

Posted: Thu Dec 01, 2022 9:38 pm
by mobhar

You may put this code in Page_Redirecting server event under Multi-Update page to check the filter string:

$this->setMessage($this->getFilterFromRecordKeys(false));


Re: Print in Custom Action

Posted: Fri Dec 02, 2022 11:41 am
by mobhar

If you want to get only the selected records key, then you may put this following code in Page_Redirecting server event under Multi-Update page:

if (!empty(Post("key_m")))
    $this->setMessage("Selected keys: " . implode(',', Post("key_m")));