print_this_action always hits first record
Posted: Fri Oct 05, 2012 11:06 am
Steve,
(busy Friday, I know...)
I am reusing the help you gave back then to Martin @ Berlin in using fpdf to print.
Followed yours and his indications and got the thing up and running...but.
When I "find" a record using your advanced find and then hit the print icon I get the right record printed. Good.
When I just select a record from the list view (by clicking on the check box to the left), DF insists on giving me the FIRST record. Not Good.
I have the actions.ini in the table's directory, and the print_this_action.php in the app's action folder under the app's root.
The ini:
[print_this_action]
label = print
description = print this record
url = "{$this->url('-action=print_this_action')}"
accessKey = p
category = selected_result_actions;
icon = "{$dataface_url}/images/print_icon.gif"
mode = print
permission = view
order=5
The print_this_ini.php starts with (the rest is just a shameless copy of Martin's work, more or less):
<?php
import('user_functions/fpdfresources/PDF.php'); // custom fPDF class
class actions_print_this_action {
function handle(&$params){
$app =& Dataface_Application::getInstance();
$record =& $app->getRecord();
... and then it goes to extract the goodies from $record with val() and display() -you gotta love that one , and it produces the pdf output fine... of the first record, always.
Any magic clues?
Thanks again and again.
(busy Friday, I know...)
I am reusing the help you gave back then to Martin @ Berlin in using fpdf to print.
Followed yours and his indications and got the thing up and running...but.
When I "find" a record using your advanced find and then hit the print icon I get the right record printed. Good.
When I just select a record from the list view (by clicking on the check box to the left), DF insists on giving me the FIRST record. Not Good.
I have the actions.ini in the table's directory, and the print_this_action.php in the app's action folder under the app's root.
The ini:
[print_this_action]
label = print
description = print this record
url = "{$this->url('-action=print_this_action')}"
accessKey = p
category = selected_result_actions;
icon = "{$dataface_url}/images/print_icon.gif"
mode = print
permission = view
order=5
The print_this_ini.php starts with (the rest is just a shameless copy of Martin's work, more or less):
<?php
import('user_functions/fpdfresources/PDF.php'); // custom fPDF class
class actions_print_this_action {
function handle(&$params){
$app =& Dataface_Application::getInstance();
$record =& $app->getRecord();
... and then it goes to extract the goodies from $record with val() and display() -you gotta love that one , and it produces the pdf output fine... of the first record, always.
Any magic clues?
Thanks again and again.