Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Transaction Patterns » Error running output2 pattern
Re: Error running output2 pattern [message #4341 is a reply to message #4340] Sat, 12 July 2014 02:18 Go to previous messageGo to previous message
htManager is currently offline  htManager
Messages: 415
Registered: May 2014
Senior Member
All the code is automatically generated by the Frameword, that's why I don't understand that it doesn't work.

Here is the code of the task script: htm_kontakte(output2).php:

<?php
//********************************************************** *******************
// Extract the contents of a database table and export them to a PDF file which
// will be downloaded to the client device.
//********************************************************** *******************

$table_id = 'kontakte'; // table name
$report = 'kontakte.list.report.inc'; // file identifying report structure

// customise the SQL SELECT statement
$sql_select = null;
$sql_from = null;
$sql_where = null;
$sql_groupby = null;
$sql_having = null;
$sql_orderby = null;

require 'std.output2.inc'; // activate page controller

?>

Here is the code of the class file:

<?php
// ************************************************************ *****************
// Copyright 2003-2005 by A J Marston <http://www.tonymarston.net>
// Copyright 2006-2012 by Radicore Software Limited <http://www.radicore.org>
// ************************************************************ *****************
require_once 'std.table.class.inc';
class kontakte extends Default_Table
{
// ************************************************************ ****************
function kontakte ()
{
// save directory name of current script
$this->dirname = dirname(__file__);

$this->dbms_engine = ''; // to be supplied by getFieldSpec_original()
$this->dbprefix = ''; // to be supplied by getFieldSpec_original()
$this->dbname = 'htm';
$this->tablename = 'kontakte';

// call this method to get original field specifications
// (note that they may be modified at runtime)
$this->fieldspec = $this->getFieldSpec_original();

} // kontakte

function _cm_getInitialData ($fieldarray)
// Perform custom processing for the getInitialData method.
// $fieldarray contains data from the initial $where clause.
{
// $_SESSION['logon_user_id'] = $logon_user_id;
// $_SESSION['logon_user_name'] = $fieldarray['user_name'];
// $_SESSION['role_id'] = $fieldarray['role_id'];
// $_SESSION['logon_email_addr'] = $fieldarray['email_addr'];
// $_SESSION['rdcaccount_id'] = $fieldarray['rdcaccount_id'];

if (!empty($_SESSION['logon_user_id'])) {
// get next available number for user_seq_no
$where = "user_id='{$_SESSION['logon_user_id']}'";
$query = "SELECT max(user_seq_no) FROM $this->tablename WHERE $where";
$count = $this->getCount($query);
$fieldarray['user_id'] = $_SESSION['logon_user_id'];
$fieldarray['user_seq_no'] = $count + 1;
} // if

// set these fields to 'noedit' (read only)
$this->fieldspec['user_id']['noedit'] = 'y';
$this->fieldspec['user_seq_no']['noedit'] = 'y';

return $fieldarray;

} // _cm_getInitialData

function _cm_getExtraData ($where, $fieldarray)
// Perform custom processing for the getExtraData method.
// $where = a string in SQL 'where' format.
// $fieldarray = the contents of $where as an array.
{
// get values for kontakt_typ_id and insert into lookup array
$array = $this->getValRep('kontakt_typ_id');
$this->lookup_data['kontakt_typ_id'] = $array;

// get values for kontakt_position_id and insert into lookup array
$array = $this->getValRep('kontakt_position_id'); // Feld in Tabelle kontakte
$this->lookup_data['kontakt_position_id'] = $array; // s.o.

// get contents of foreign table KONTAKTE_TYP and add to lookup array
$dbobject =& RDCsingleton::getInstance('kontakte_typ');
$array = $dbobject->getValRep('kontakt_typ_id_list');
$this->lookup_data['kontakt_typ_id_list'] = $array;

// get contents of foreign table KONTAKTE_POSITION and add to lookup array
$dbobject =& RDCsingleton::getInstance('kontakte_position'); // Lookup-Tabelle
$array = $dbobject->getValRep('kontakt_position_id'); // Lookup-Tabellen-Feld
$this->lookup_data['kontakt_position_id'] = $array;

return $fieldarray;

} // _cm_getExtraData

// ************************************************************ ****************
} // end class
// ************************************************************ **************** <?php
// file created on July 11, 2014, 3:31 pm

// field specifications for table htm.kontakte
$fieldspec['user_id'] = array('type' => 'string',
'size' => 16,
'pkey' => 'y',
'required' => 'y',
'uppercase' => 'y');

$fieldspec['user_seq_no'] = array('type' => 'integer',
'type_native' => 'int',
'size' => 11,
'minvalue' => 0,
'maxvalue' => 4294967295,
'pkey' => 'y',
'required' => 'y');

$fieldspec['rdcaccount_id'] = array('type' => 'integer',
'type_native' => 'int',
'size' => 10,
'minvalue' => 0,
'maxvalue' => 4294967295,
'required' => 'y',
'default' => '1');

$fieldspec['kontakt_typ_id'] = array('type' => 'string',
'size' => 6,
'required' => 'y',
'default' => 'SP',
'uppercase' => 'y',
'control' => 'dropdown',
'optionlist' => 'kontakt_typ_id_list');

$fieldspec['node_id'] = array('type' => 'integer',
'type_native' => 'int',
'size' => 5,
'minvalue' => 0,
'maxvalue' => 4294967295,
'default' => '0');

$fieldspec['kontakt_name'] = array('type' => 'string',
'size' => 50,
'required' => 'y');

$fieldspec['kontakt_vorname'] = array('type' => 'string',
'size' => 50);

$fieldspec['kontakt_strasse'] = array('type' => 'string',
'size' => 100);

$fieldspec['kontakt_lkz'] = array('type' => 'string',
'size' => 10);

$fieldspec['kontakt_plz'] = array('type' => 'string',
'size' => 10);

$fieldspec['kontakt_ort'] = array('type' => 'string',
'size' => 50);

$fieldspec['kontakt_telefon_privat'] = array('type' => 'string',
'size' => 30);

$fieldspec['kontakt_telefon_arbeit'] = array('type' => 'string',
'size' => 30);

$fieldspec['kontakt_telefon_mobil'] = array('type' => 'string',
'size' => 30);

$fieldspec['kontakt_email'] = array('type' => 'string',
'size' => 50);

$fieldspec['kontakt_fax'] = array('type' => 'string',
'size' => 50);

$fieldspec['kontakt_geburtstag'] = array('type' => 'date',
'size' => 12);

$fieldspec['kontakt_wurfhand'] = array('type' => 'string',
'size' => 2,
'default' => 'R');

$fieldspec['kontakt_position_id'] = array('type' => 'string',
'size' => 6,
'control' => 'dropdown',
'optionlist' => 'kkontakt_position_id');

$fieldspec['created_date'] = array('type' => 'datetime',
'size' => 20,
'required' => 'y',
'default' => '2014-01-01 00:00:00',
'autoinsert' => 'y',
'noedit' => 'y',
'nosearch' => 'y');

$fieldspec['created_user'] = array('type' => 'string',
'size' => 16,
'required' => 'y',
'autoinsert' => 'y',
'noedit' => 'y',
'nosearch' => 'y');

$fieldspec['revised_date'] = array('type' => 'datetime',
'size' => 20,
'autoupdate' => 'y',
'noedit' => 'y',
'nosearch' => 'y');

$fieldspec['revised_user'] = array('type' => 'string',
'size' => 16,
'autoupdate' => 'y',
'noedit' => 'y',
'nosearch' => 'y');

// primary key details
$this->primary_key = array('user_id',
'user_seq_no');

// unique key details
$this->unique_keys = array();

// child relationship details
$this->child_relations[] = array('child' => 'kontakte_ausruestung',
'type' => 'RES',
'fields' => array('user_id' => 'user_id',
'user_seq_no' => 'user_seq_no'));

$this->child_relations[] = array('child' => 'mannschaften_kontakte',
'type' => 'RES',
'fields' => array('user_id' => 'kontakt_ma_user_id',
'user_seq_no' => 'kontakt_ma_user_seq_no'));

$this->child_relations[] = array('child' => 'spiele_transport',
'type' => 'RES',
'fields' => array('user_id' => 'transport_user_id',
'user_seq_no' => 'transport_user_seq_no'));

$this->child_relations[] = array('child' => 'spiele_transport_mitfahrer',
'type' => 'RES',
'fields' => array('user_id' => 'mitfahrer_user_id',
'user_seq_no' => 'mitfahrer_user_seq_no'));

// parent relationship details
$this->parent_relations[] = array('parent' => 'kontakte_position',
'fields' => array('kontakt_position_id' => 'kontakt_position_id',
'rdcaccount_id' => 'rdcaccount_id'));

$this->parent_relations[] = array('parent' => 'kontakte_typ',
'fields' => array('kontakt_typ_id' => 'kontakt_typ_id',
'rdcaccount_id' => 'rdcaccount_id'));

$this->parent_relations[] = array('parent' => 'mnu_account',
'dbname' => 'menu',
'subsys_dir' => 'menu',
'fields' => array('rdcaccount_id' => 'rdcaccount_id'));

// determines if database updates are recorded in an audit log
$this->audit_logging = TRUE;

// default sort sequence
$this->default_orderby = '';

// alternative language options
$this->alt_language_table = '';
$this->alt_language_cols = '';

// alias names
$this->nameof_start_date = '';
$this->nameof_end_date = '';

// finished
?><?php
// report structure for a LIST view

$structure['pdf'] = array('orientation' => 'L', // L=Landscape, P=Portrait
'units' => 'mm', // pt=Point, mm=Millimeter, cm=Centimeter, in=Inch
'format' => 'A4', // A3, A4, A5, Letter, Legal
'name' => '', // filename (if destination = D or F)
'destination' => 'I'); // I=Inline (browser), D=Download (browser), F=Filename (on server), S=String

$structure['title']['style'] = 'title'; // style for page title
$structure['head']['style'] = 'hdg'; // style for column headings
$structure['body']['style'] = 'body'; // style for main body
$structure['foot']['style'] = 'foot'; // style for page footer

// define contents of page title
$structure['title'][] = array('text' => '- Kontakte -',
'width' => 100,
'align' => 'center',
'border' => 'y');

// set column widths
$structure['columns'][] = array('width' => '20', 'overflow' => 'y'); // Name
$structure['columns'][] = array('width' => '20', 'overflow' => 'y'); // Vorname
$structure['columns'][] = array('width' => '20', 'overflow' => 'y'); // Strasse
$structure['columns'][] = array('width' => '10', 'overflow' => 'y'); // LKZ
$structure['columns'][] = array('width' => '10', 'overflow' => 'y'); // PLZ
$structure['columns'][] = array('width' => '20', 'overflow' => 'y'); // Ort

// identify column names and associated labels
$structure['body']['fields'][] = array('kontakt_name' => 'Name');
$structure['body']['fields'][] = array('kontakt_vorname' => 'Vorname');
$structure['body']['fields'][] = array('kontakt_strasse' => 'Strasse');
$structure['body']['fields'][] = array('kontakt_lkz' => 'LKZ');
$structure['body']['fields'][] = array('kontakt_plz' => 'PLZ');
$structure['body']['fields'][] = array('kontakt_ort' => 'Ort');

// define contents of page footer
$structure['foot1'][] = array('type' => 'date', 'align' => 'left', 'style' => 'textalignleft');
$structure['foot1'][] = array('type' => 'pageno', 'align' => 'center');
$structure['foot1'][] = array('type' => 'time', 'align' => 'right', 'style' => 'textalignright');
$structure['foot2'][] = array('text' => 'This is a piece of text', 'align' => 'center');

?>

Can you see something wrong?

And the report file:



?>

The dict.inc file:

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Dropdown list
Next Topic: output2 with parent/child tables
Goto Forum:
  


Current Time: Sun Apr 28 18:33:35 EDT 2024

Total time taken to generate the page: 0.06278 seconds