var $errors = array();
var $max_upgrade_time = 300;
- function fa_patch()
+ function __construct()
{
global $path_to_root;
var $label;
var $link;
- function menu_item($label, $link)
+ function __construct($label, $link)
{
$this->label = $label;
$this->link = $link;
var $title;
var $items;
- function menu($title)
+ function __construct($title)
{
$this->title = $title;
$this->items = array();
var $access;
var $category;
- function app_function($label,$link,$access='SA_OPEN',$category='')
+ function __construct($label,$link,$access='SA_OPEN',$category='')
{
$this->label = $label;
$this->link = $link;
var $lappfunctions;
var $rappfunctions;
- function module($name,$icon = null)
+ function __construct($name,$icon = null)
{
$this->name = $name;
$this->icon = $icon;
var $modules;
var $enabled;
- function application($id, $name, $enabled=true)
+ function __construct($id, $name, $enabled=true)
{
$this->id = $id;
$this->name = $name;
***********************************************************************/
class customers_app extends application
{
- function customers_app()
+ function __construct()
{
- $this->application("orders", _($this->help_context = "&Sales"));
+ parent::__construct("orders", _($this->help_context = "&Sales"));
$this->add_module(_("Transactions"));
$this->add_lapp_function(0, _("Sales &Quotation Entry"),
***********************************************************************/
class dimensions_app extends application
{
- function dimensions_app()
+ function __construct()
{
$dim = get_company_pref('use_dimension');
- $this->application("proj", _($this->help_context = "&Dimensions"), $dim);
+ parent::__construct("proj", _($this->help_context = "&Dimensions"), $dim);
if ($dim > 0)
{
***********************************************************************/
class assets_app extends application
{
- function assets_app()
+ function __construct()
{
- $this->application("assets", _($this->help_context = "&Fixed Assets"));
+ parent::__construct("assets", _($this->help_context = "&Fixed Assets"));
$this->add_module(_("Transactions"));
$this->add_lapp_function(0, _("Fixed Assets &Purchase"),
***********************************************************************/
class general_ledger_app extends application
{
- function general_ledger_app()
+ function __construct()
{
- $this->application("GL", _($this->help_context = "&Banking and General Ledger"));
+ parent::__construct("GL", _($this->help_context = "&Banking and General Ledger"));
$this->add_module(_("Transactions"));
$this->add_lapp_function(0, _("&Payments"),
***********************************************************************/
class inventory_app extends application
{
- function inventory_app()
+ function __construct()
{
- $this->application("stock", _($this->help_context = "&Items and Inventory"));
+ parent::__construct("stock", _($this->help_context = "&Items and Inventory"));
$this->add_module(_("Transactions"));
$this->add_lapp_function(0, _("Inventory Location &Transfers"),
***********************************************************************/
class manufacturing_app extends application
{
- function manufacturing_app()
+ function __construct()
{
- $this->application("manuf", _($this->help_context = "&Manufacturing"));
+ parent::__construct("manuf", _($this->help_context = "&Manufacturing"));
$this->add_module(_("Transactions"));
$this->add_lapp_function(0, _("Work &Order Entry"),
***********************************************************************/
class setup_app extends application
{
- function setup_app()
+ function __construct()
{
- $this->application("system", _($this->help_context = "S&etup"));
+ parent::__construct("system", _($this->help_context = "S&etup"));
$this->add_module(_("Company Setup"));
$this->add_lapp_function(0, _("&Company Setup"),
***********************************************************************/
class suppliers_app extends application
{
- function suppliers_app()
+ function __construct()
{
- $this->application("AP", _($this->help_context = "&Purchases"));
+ parent::__construct("AP", _($this->help_context = "&Purchases"));
$this->add_module(_("Transactions"));
$this->add_lapp_function(0, _("Purchase &Order Entry"),
var $menu;
- function front_accounting()
- {
- }
function add_application($app)
{
if ($app->enabled) // skip inactive modules
* If an object is created WITHOUT an active AJAX query, it is simply marked as
* non-active. Use statuc method isActive() to check.
*/
- function JsHttpRequest($enc)
+ function __construct($enc)
{
global $JsHttpRequest_Active;
var $aCommands = array();
var $triggers = array();
- function Ajax()
+ function __construct()
{
- $this->JsHttpRequest(@$_SESSION['language']->encoding);
+ parent::__construct(@$_SESSION['language']->encoding);
}
//
// This function is used in ctrl routines to activate
class archive
{
- function archive($name)
+ function __construct($name)
{
$this->options = array (
'basedir' => ".",
class tar_file extends archive
{
- function tar_file($name)
+ function __construct($name)
{
- $this->archive($name);
+ parent::__construct($name);
$this->options['type'] = "tar";
}
class gzip_file extends tar_file
{
- function gzip_file($name)
+ function __construct($name)
{
- $this->tar_file($name);
+ parent::__construct($name);
$this->options['type'] = "gzip";
}
var $prefs;
var $cur_con; // current db connection (can be different from $company for superuser)
- function current_user()
+ function __construct()
{
global $def_coy;
$tsep = $SysPrefs->thoseps[user_tho_sep()];
$dsep = $SysPrefs->decseps[user_dec_sep()];
+ if ($number == '')
+ $number = 0;
if($decimals==='max')
$dec = 15 - floor(log10(abs($number)));
else {
{
global $SysPrefs;
- return isset($_SESSION["wa_current_user"]) ? $_SESSION["wa_current_user"]->prefs->date_sep() : $SysPrefs->dflt_date_sep;
+ return isset($_SESSION["wa_current_user"]->prefs->date_sep) ? $_SESSION["wa_current_user"]->prefs->date_sep() : $SysPrefs->dflt_date_sep;
}
function user_tho_sep()
$this->errors = array();
}
- function record_set($name, $fields, $key, $subset=null)
+ function __construct($name, $fields, $key, $subset=null)
{
$this->name = $name;
$this->fields = $fields;
class data_set extends record_set {
- function data_set($name, $fields, $key, $subset=null)
+ function __construct($name, $fields, $key, $subset=null)
{
- $this->record_set($name, $fields, $key, $subset);
+ parent::__construct($name, $fields, $key, $subset);
}
//
var $object_class; // name of record object class or null for arrays
- function array_set($name, $fields, $key=null, &$arr=array(), $class = null)
+ function __construct($name, $fields, $key=null, &$arr=array(), $class = null)
{
$this->array = &$arr;
$this->object_class = $class;
- $this->record_set($name, $fields, $key);
+ parent::__construct($name, $fields, $key);
}
//===========================================================================
**/
class reflines_db extends data_set {
- function reflines_db()
+ function __construct()
{
$this->set_validator('prefix:ui:_check_prefix', _("This prefix conflicts with another one already defined. Prefix have to be unambigous."));
$this->set_validator('prefix:ui:_check_template', _("Invalid template format."));
$this->set_validator('trans_type:ui:required', _("Transaction type cannot be empty."));
$this->set_validator('pattern:ui:required', _("Next reference cannot be empty."));
- $this->data_set('reflines',
+ parent::__construct('reflines',
array('trans_type', 'prefix', 'description', 'default', 'pattern', 'id', 'inactive'),
'id');
}
// array('select' => 'SUM(quantity)', 'from' => TB_PREF."stock_moves", 'group' => 'location')
//
// $name is base name for pager controls
- function db_pager($sql, $name, $table = null, $page_len=0)
+ function __construct($sql, $name, $table = null, $page_len=0)
{
$this->width = "95%";
if ($page_len == 0) $page_len = user_query_size();
foreach($trace as $trn => $tr) {
if ($trn <= $skip) continue;
if ($html) $str .= '<tr><td>';
- $str .= $tr['file'].':'.$tr['line'].': ';
+ if (isset($tr['file']) && isset($tr['line']))
+ $str .= $tr['file'].':'.$tr['line'].': ';
if ($html) $str .= '</td><td>';
if (isset($tr['type'])) {
if($tr['type'] == '::') {
}
$str .= $tr['function'].'(';
- if(is_array($tr['args'])) {
+ if(isset($tr['args']) && is_array($tr['args'])) {
$args = array();
foreach($tr['args'] as $n=>$a) {
if (is_object($tr['args'][$n]))
return true;
}
+
+function exception_handler($exception)
+{
+ error_handler(E_ERROR, sprintf(_("Unhandled exception [%s]: %s."), $exception->getCode(), $exception->getMessage()),
+ $exception->getFile(), $exception->getLine());
+ end_page();
+}
//------------------------------------------------------------------------------
// Formats system messages before insert them into message <div>
// FIX center is unused now
var $version; // lang package version
var $is_locale_file;
- function language($name, $code, $encoding, $dir = 'ltr')
+ function __construct($name, $code, $encoding, $dir = 'ltr')
{
global $dflt_lang;
// FrontAccounting package class
//
class package extends gzip_file {
- function package($filename, $basedir=null)
+
+ function __construct($filename, $basedir=null)
{
global $path_to_root;
} else
mkdir($basedir);
}
- $this->archive($filename);
+ parent::__construct($filename);
$this->set_options(array('basedir'=> $basedir));
$this->options['type'] = "pkg";
}
var $prefs;
var $db_ok; // check whether database has been upgraded after src update.
- function sys_prefs()
+ function __construct()
{
global $path_to_root;
var $def_print_destination; // default print destination. 0 = PDF/Printer, 1 = Excel
var $def_print_orientation; // default print orientation. 0 = Portrait. 1 = Landscape
- function user_prefs($user=null)
+ function __construct($user=null)
{
if ($user == null) {
// set default values, used before login
{
var $reflines;
- function references()
+ function __construct()
{
$this->reflines = new reflines_db();
}
include_once($path_to_root . "/includes/errors.inc");
// colect all error msgs
set_error_handler('error_handler' /*, errtypes */);
+set_exception_handler('exception_handler');
include_once($path_to_root . "/includes/current_user.inc");
include_once($path_to_root . "/frontaccounting.php");
var $allocs; /*array of transactions allocated to */
- function allocation($type, $trans_no, $person_id = null, $person_type_id=null)
+ function __construct($type, $trans_no, $person_id = null, $person_type_id=null)
{
$this->allocs = array();
var $current_allocated;
- function allocation_item ($type, $type_no, $date_, $due_date, $amount,
+ function __construct($type, $type_no, $date_, $due_date, $amount,
$amount_allocated, $current_allocated, $ref)
{
var $dec;
var $name;
- function user_view($name)
+ function __construct($name)
{
$this->name = $name;
}
var $display_both = false; //when set to true both list and editor are displayed all the time (eventually set in sub classes)
//
//
- function simple_crud_view($name, $data_set = null, $options=array())
+ function __construct($name, $data_set = null, $options=array())
{
- $this->user_view($name);
+ parent::__construct($name);
$this->options = array_merge($this->options, $options);
class selector_crud_view extends simple_crud_view {
- function selector_crud_view($name, $data_set = null, $options=array())
+ function __construct($name, $data_set = null, $options=array())
{
$this->display_both = true;
- $this->simple_crud_view($name, $data_set, $options);
+ parent::__construct($name, $data_set, $options);
}
function _check_mode()
var $title;
- function table_crud_view($name, &$data_set = null, $options=array())
+ function __construct($name, &$data_set = null, $options=array())
{
$this->display_both = true;
- $this->simple_crud_view($name, $data_set, $options);
+ parent::__construct($name, $data_set, $options);
}
/**
*
class fa_reflines extends simple_crud_view {
- function fa_reflines()
+ function __construct()
{
- $this->simple_crud_view('refs', new reflines_db(), array('clone' => false));
+ parent::__construct('refs', new reflines_db(), array('clone' => false));
$this->fields = array(
'prefix',
var $sub_class;
var $class;
- function contacts($name, $id, $class, $subclass=null) {
+ function __construct($name, $id, $class, $subclass=null) {
$fields = array('ref','name','name2','address', 'phone', 'phone2','fax',
'email','lang','notes', 'assgn' =>array('fld'=>'contacts'));
- $this->simple_crud($name, $fields);
+ parent::__construct($name, $fields);
$this->class = $class;
$this->subclass = $subclass;
$this->entity = $id;
var $fixed_asset;
- function items_cart($type, $trans_no=0)
+ function __construct($type, $trans_no=0)
{
$this->trans_type = $type;
$this->order_id = $trans_no;
var $price;
var $standard_cost;
- function line_item ($stock_id, $qty, $standard_cost=null, $description=null)
+ function __construct($stock_id, $qty, $standard_cost=null, $description=null)
{
$item_row = get_item($stock_id);
var $branch_id;
var $date;
- function gl_item($code_id=null, $dimension_id=0, $dimension2_id=0, $amount=0, $memo='',
+ function __construct($code_id=null, $dimension_id=0, $dimension2_id=0, $amount=0, $memo='',
$act_descr=null, $person_id=null, $date=null)
{
//echo "adding $index, $code_id, $dimension_id, $amount, $reference<br>";
var $dec;
//
//
- function simple_crud($name, $fields = null)
+ function __construct($name, $fields = null)
{
$this->name = $name;
$this->pre_handlers = array(
var $fixed_asset = false;
- function purch_order()
+ function __construct()
{
/*Constructor function initialises a new purchase order object */
$this->line_items = array();
var $standard_cost;
var $descr_editable;
- function po_line_details($line_no, $stock_item, $item_descr, $qty, $prc, $uom, $req_del_date,
+ function __construct($line_no, $stock_item, $item_descr, $qty, $prc, $uom, $req_del_date,
$qty_inv, $qty_recd, $grn_item_id=0)
{
var $dimension,
$dimension2;
- function supp_trans($trans_type, $trans_no=0)
+ function __construct($trans_type, $trans_no=0)
{
$this->trans_type = $trans_type;
/*Constructor function initialises a new Supplier Transaction object */
var $gl_code;
var $tax_included;
- function grn_item ($id, $po_detail_item, $item_code, $item_description, $qty_recd,
+ function __construct($id, $po_detail_item, $item_code, $item_description, $qty_recd,
$prev_quantity_inv, $this_quantity_inv, $order_price, $chg_price,
$std_cost_unit, $gl_code, $tax_included)
{
var $amount;
var $memo_;
- function gl_codes ($Counter, $gl_code, $gl_act_name, $gl_dim, $gl_dim2, $amount, $memo_)
+ function __construct($Counter, $gl_code, $gl_act_name, $gl_dim, $gl_dim2, $amount, $memo_)
{
/* Constructor function to add a new gl_codes object with passed params */
# _new (OLE::Storage_Lite::PPS)
# for OLE::Storage_Lite
#------------------------------------------------------------------------------
- function ole_pps($iNo, $sNm, $iType, $iPrev, $iNext, $iDir,
+ function __construct($iNo, $sNm, $iType, $iPrev, $iNext, $iDir,
$raTime1st, $raTime2nd, $iStart, $iSize,
$sData=false, $raChild=false)
{
class ole_pps_file extends ole_pps
{
- function ole_pps_file($sNm, $sData=false, $sFile=false)
+ function __construct($sNm, $sData=false, $sFile=false)
{
$this->No = false;
$this->Name = $sNm;
class ole_pps_root extends ole_pps
{
- function ole_pps_root($raTime1st=false, $raTime2nd=false, $raChild=false)
+ function __construct($raTime1st=false, $raTime2nd=false, $raChild=false)
{
$this->No = false;
$this->Name = Asc2Ucs('Root Entry');
*
* @access public
*/
- function Spreadsheet_Excel_Writer_BIFFwriter()
+ function __construct()
{
$this->_byte_order = '';
$this->_data = '';
*/
var $_parser;
- function Spreadsheet_Excel_Writer_Validator(&$parser)
+ function __construct(&$parser)
{
$this->_parser = $parser;
$this->_type = 0x01; // FIXME: add method for setting datatype
* @param integer $index the XF index for the format.
* @param array $properties array with properties to be set on initialization.
*/
- function Spreadsheet_Excel_Writer_Format($BIFF_version, $index = 0, $properties = array())
+ function __construct($BIFF_version, $index = 0, $properties = array())
{
$this->_xf_index = $index;
$this->_BIFF_version = $BIFF_version;
* @param integer $byte_order The byte order (Little endian or Big endian) of the architecture
(optional). 1 => big endian, 0 (default) little endian.
*/
- function Spreadsheet_Excel_Writer_Parser($byte_order, $biff_version)
+ function __construct($byte_order, $biff_version)
{
$this->_current_char = 0;
$this->_BIFF_version = $biff_version;
* @param mixed &$parser The formula parser created for the Workbook
* @access private
*/
- function Spreadsheet_Excel_Writer_Worksheet($BIFF_version, $name,
+ function __construct($BIFF_version, $name,
$index, &$activesheet,
&$firstsheet, &$str_total,
&$str_unique, &$str_table,
&$url_format, &$parser)
{
// It needs to call its parent's constructor explicitly
- $this->Spreadsheet_Excel_Writer_BIFFwriter();
+ parent::__construct();
$this->_BIFF_version = $BIFF_version;
$rowmax = 65536; // 16384 in Excel 5
$colmax = 256;
* @param string filename for storing the workbook. "-" for writing to stdout.
* @access public
*/
- function Spreadsheet_Excel_Writer_Workbook($filename)
+ function __construct($filename)
{
// It needs to call its parent's constructor explicitly
- $this->Spreadsheet_Excel_Writer_BIFFwriter();
+ parent::__construct();
$this->_filename = $filename;
$this->_parser = new Spreadsheet_Excel_Writer_Parser($this->_byte_order, $this->_BIFF_version);
* @param string $code code to print
* @param string $type type of barcode: <ul><li>C39 : CODE 39</li><li>C39+ : CODE 39 with checksum</li><li>C39E : CODE 39 EXTENDED</li><li>C39E+ : CODE 39 EXTENDED with checksum</li><li>I25 : Interleaved 2 of 5</li><li>C128A : CODE 128 A</li><li>C128B : CODE 128 B</li><li>C128C : CODE 128 C</li><li>EAN13 : EAN 13</li><li>UPCA : UPC-A</li><li>POSTNET : POSTNET</li><li>CODABAR : CODABAR</li></ul>
*/
- function TCPDFBarcode($code, $type) {
+ function __construct($code, $type) {
$this->setBarcode($code, $type);
}
var $fontfile = "";
var $encoding;
- function graph()
+ function __construct()
{
global $SysPrefs;
$this->encoding = strtoupper($_SESSION['language']->encoding);
var $charset = 'ISO-8859-1';
var $add_params;
- function email($name, $mail)
+ function __construct($name, $mail)
{
$this->boundary = md5(uniqid(time()));
$this->header = "From: $name <$mail>\n";
class Cpdf extends FPDI {
- function Cpdf($pageSize='A4', $lang=null, $pageOrientation='P')
+ function __construct($pageSize='A4', $lang=null, $pageOrientation='P')
{
- $this->TCPDF($pageOrientation, 'pt', $pageSize);//, $uni, $enc);
+ parent::__construct($pageOrientation, 'pt', $pageSize);//, $uni, $enc);
$this->SetLang($lang);
$this->setPrintHeader(false);
$this->setPrintFooter(false);
var $sheet;
- function FrontReport($title, $filename, $size = 'A4', $fontsize = 9, $orientation = 'P', $margins = NULL, $excelColWidthFactor = 6.5)
+ function __construct($title, $filename, $size = 'A4', $fontsize = 9, $orientation = 'P', $margins = NULL, $excelColWidthFactor = 6.5)
{
global $SysPrefs, $page_security;
$this->filename = $filename.".xls";
$this->unique_name = random_id().".xls";
$this->path = company_path(). '/pdf_files';
- $this->Spreadsheet_Excel_Writer_Workbook($this->path."/".$this->unique_name);
+ parent::__construct($this->path."/".$this->unique_name);
if ($this->code != "iso-8859-1")
$this->setVersion(8); // set biff version to 8 (0x0006 internal)
$this->sheet = $this->addWorksheet($this->worksheetNameGenerator($this->title));
class ASCII85Decode {
- function ASCII85Decode(&$fpdi) {
+ function __construct(&$fpdi) {
$this->fpdi =& $fpdi;
}
var $nextBits = 0;
var $andTable = array(511, 1023, 2047, 4095);
- function LZWDecode(&$fpdi) {
+ function __construct(&$fpdi) {
$this->fpdi =& $fpdi;
}
* @param string $filename Source-Filename
* @param object $fpdi Object of type fpdi
*/
- function fpdi_pdf_parser($filename,&$fpdi) {
+ function __construct($filename,&$fpdi) {
$this->fpdi =& $fpdi;
$this->filename = $filename;
- parent::pdf_parser($filename);
+ parent::__construct($filename);
// resolve Pages-Dictonary
$pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']);
// Constructor
- function pdf_context($f) {
+ function __construct($f) {
$this->file = $f;
$this->reset();
}
*
* @param string $filename Source-Filename
*/
- function pdf_parser($filename) {
+ function __construct($filename) {
$this->filename = $filename;
$this->f = @fopen($this->filename, "rb");
var $dest; // destination: email or printer
- function FrontReport($title, $filename, $size = 'A4', $fontsize = 9, $orientation = 'P', $margins = NULL, $excelColWidthFactor = NULL)
+ function __construct($title, $filename, $size = 'A4', $fontsize = 9, $orientation = 'P', $margins = NULL, $excelColWidthFactor = NULL)
{
global $page_security;
$this->scaleLogoWidth = false; // if Logo, scale on width (else height).
$this->SetHeaderType('Header'); // default
- $this->Cpdf($size, $_SESSION['language']->code, $orientation);
+ parent::__construct($size, $_SESSION['language']->code, $orientation);
}
/*
//
// Setting connection parameters
//
- function remote_printer($queue, $host='', $port=515, $timeout=20){
+ function __construct($queue, $host='', $port=515, $timeout=20){
if ($host == '')
$host = $_SERVER['REMOTE_ADDR']; // default is user's host
$this->host = $host;
var $ar_params;
var $controls;
- function Report($id, $name, $ar_params = null)
+ function __construct($id, $name, $ar_params = null)
{
$this->id = $id;
$this->name = $name;
* @param boolean $unicode TRUE means that the input text is unicode (default = true)
* @param String $encoding charset encoding; default is UTF-8
*/
- function TCPDF($orientation='P', $unit='mm', $format='A4', $uni=true, $encoding="UTF-8") {
+ function __construct($orientation='P', $unit='mm', $format='A4', $uni=true, $encoding="UTF-8") {
if ($uni) // Fix for FrontAccounting
{
global $unicode, $unicode_mirror, $unicode_arlet, $laa_array, $diacritics;
// $trans_no!=0 && $prepare_child==true => prepare for child doc entry
// $prepare_child is set to ST_SALESINVOICE for prepayment invoices
//
- function Cart($type, $trans_no=0, $prepare_child=false) {
+ function __construct($type, $trans_no=0, $prepare_child=false) {
/*Constructor function initialises a new shopping cart */
$this->line_items = array();
$this->sales_type = "";
var $qty_old = 0;
- function line_details ($stock_id, $qty, $prc, $disc_percent,
+ function __construct($stock_id, $qty, $prc, $disc_percent,
$qty_done, $standard_cost, $description, $id=0, $src_no=0, $src_id=0)
{
/* Constructor function to add a new LineDetail object with passed params */
var $description;
var $sql = 'alter2.1.sql';
- function fa2_1() {
+ function __construct() {
$this->description = _('Upgrade from version 2.0 to 2.1');
}
//
var $preconf = true;
var $beta = false; // upgrade from 2.1 or 2.2beta; set in prepare()
- function fa2_2() {
+ function __construct() {
global $security_groups;
$this->beta = !isset($security_groups);
$this->description = _('Upgrade from version 2.1/2.2beta to 2.2');
var $preconf = true;
var $beta = false; // upgrade from 2.2 or 2.3beta;
- function fa2_3() {
+ function __construct() {
$this->description = _('Upgrade from version 2.2 to 2.3');
}
var $preconf = true;
var $max_upgrade_time = 900; // table recoding is really long process
- function fa2_4() {
- parent::fa_patch();
+ function __construct() {
+ parent::__construct();
$this->description = _('Upgrade from version 2.3 to 2.4');
}
var $preconf = true;
var $max_upgrade_time = 900; // table recoding is really long process
- function fa2_4rc1() {
- parent::fa_patch();
+ function __construct() {
+ parent::__construct();
$this->description = _('Upgrade from version 2.4beta to 2.4RC1');
}