From: Janusz Dobrowolski Date: Fri, 13 Oct 2017 19:18:19 +0000 (+0200) Subject: PHP7 compatibility fixes. X-Git-Tag: v2.4.3~4 X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=19ddc3939071044c8e94b628f1d6a039f50cc493 PHP7 compatibility fixes. --- diff --git a/admin/includes/fa_patch.class.inc b/admin/includes/fa_patch.class.inc index 91e13f1a..d1666405 100644 --- a/admin/includes/fa_patch.class.inc +++ b/admin/includes/fa_patch.class.inc @@ -26,7 +26,7 @@ class fa_patch { var $errors = array(); var $max_upgrade_time = 300; - function fa_patch() + function __construct() { global $path_to_root; diff --git a/applications/application.php b/applications/application.php index 81bf2e10..c9f8e943 100644 --- a/applications/application.php +++ b/applications/application.php @@ -24,7 +24,7 @@ define('MENU_SYSTEM', 'menu_system'); var $label; var $link; - function menu_item($label, $link) + function __construct($label, $link) { $this->label = $label; $this->link = $link; @@ -36,7 +36,7 @@ define('MENU_SYSTEM', 'menu_system'); var $title; var $items; - function menu($title) + function __construct($title) { $this->title = $title; $this->items = array(); @@ -58,7 +58,7 @@ define('MENU_SYSTEM', 'menu_system'); 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; @@ -74,7 +74,7 @@ define('MENU_SYSTEM', 'menu_system'); var $lappfunctions; var $rappfunctions; - function module($name,$icon = null) + function __construct($name,$icon = null) { $this->name = $name; $this->icon = $icon; @@ -107,7 +107,7 @@ define('MENU_SYSTEM', 'menu_system'); var $modules; var $enabled; - function application($id, $name, $enabled=true) + function __construct($id, $name, $enabled=true) { $this->id = $id; $this->name = $name; diff --git a/applications/customers.php b/applications/customers.php index 0e6a2c90..e7453d86 100644 --- a/applications/customers.php +++ b/applications/customers.php @@ -11,9 +11,9 @@ ***********************************************************************/ 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"), diff --git a/applications/dimensions.php b/applications/dimensions.php index 52fb9f7e..605710d7 100644 --- a/applications/dimensions.php +++ b/applications/dimensions.php @@ -11,10 +11,10 @@ ***********************************************************************/ 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) { diff --git a/applications/fixed_assets.php b/applications/fixed_assets.php index 3967c06a..8a3bb86d 100644 --- a/applications/fixed_assets.php +++ b/applications/fixed_assets.php @@ -11,9 +11,9 @@ ***********************************************************************/ 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"), diff --git a/applications/generalledger.php b/applications/generalledger.php index 21d48b35..f81f04e0 100644 --- a/applications/generalledger.php +++ b/applications/generalledger.php @@ -11,9 +11,9 @@ ***********************************************************************/ 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"), diff --git a/applications/inventory.php b/applications/inventory.php index 965109b6..e1c941f6 100644 --- a/applications/inventory.php +++ b/applications/inventory.php @@ -11,9 +11,9 @@ ***********************************************************************/ 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"), diff --git a/applications/manufacturing.php b/applications/manufacturing.php index 9a7c393b..44b5e630 100644 --- a/applications/manufacturing.php +++ b/applications/manufacturing.php @@ -11,9 +11,9 @@ ***********************************************************************/ 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"), diff --git a/applications/setup.php b/applications/setup.php index 99fa48d5..5f29aff1 100644 --- a/applications/setup.php +++ b/applications/setup.php @@ -11,9 +11,9 @@ ***********************************************************************/ 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"), diff --git a/applications/suppliers.php b/applications/suppliers.php index 56b70219..5c649e48 100644 --- a/applications/suppliers.php +++ b/applications/suppliers.php @@ -11,9 +11,9 @@ ***********************************************************************/ 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"), diff --git a/frontaccounting.php b/frontaccounting.php index ec21ddb9..a7432037 100644 --- a/frontaccounting.php +++ b/frontaccounting.php @@ -31,9 +31,6 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ var $menu; - function front_accounting() - { - } function add_application($app) { if ($app->enabled) // skip inactive modules diff --git a/includes/JsHttpRequest.php b/includes/JsHttpRequest.php index f71c0ed2..7eb712dd 100644 --- a/includes/JsHttpRequest.php +++ b/includes/JsHttpRequest.php @@ -63,7 +63,7 @@ class JsHttpRequest * 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; diff --git a/includes/ajax.inc b/includes/ajax.inc index 220c0084..a89b5587 100644 --- a/includes/ajax.inc +++ b/includes/ajax.inc @@ -16,9 +16,9 @@ class Ajax extends JsHttpRequest { 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 diff --git a/includes/archive.inc b/includes/archive.inc index 413e3308..b1a81001 100644 --- a/includes/archive.inc +++ b/includes/archive.inc @@ -16,7 +16,7 @@ class archive { - function archive($name) + function __construct($name) { $this->options = array ( 'basedir' => ".", @@ -238,9 +238,9 @@ class archive class tar_file extends archive { - function tar_file($name) + function __construct($name) { - $this->archive($name); + parent::__construct($name); $this->options['type'] = "tar"; } @@ -428,9 +428,9 @@ class tar_file extends archive class gzip_file extends tar_file { - function gzip_file($name) + function __construct($name) { - $this->tar_file($name); + parent::__construct($name); $this->options['type'] = "gzip"; } diff --git a/includes/current_user.inc b/includes/current_user.inc index 431cfefe..e6f05188 100644 --- a/includes/current_user.inc +++ b/includes/current_user.inc @@ -36,7 +36,7 @@ class current_user var $prefs; var $cur_con; // current db connection (can be different from $company for superuser) - function current_user() + function __construct() { global $def_coy; @@ -305,6 +305,8 @@ function number_format2($number, $decimals=0) $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 { @@ -511,7 +513,7 @@ function user_date_sep() { 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() diff --git a/includes/db/class.data_set.inc b/includes/db/class.data_set.inc index f536e13c..93846d0d 100644 --- a/includes/db/class.data_set.inc +++ b/includes/db/class.data_set.inc @@ -37,7 +37,7 @@ abstract class record_set { $this->errors = array(); } - function record_set($name, $fields, $key, $subset=null) + function __construct($name, $fields, $key, $subset=null) { $this->name = $name; $this->fields = $fields; @@ -253,9 +253,9 @@ abstract class record_set { 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); } // @@ -417,11 +417,11 @@ class array_set extends record_set { 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); } //=========================================================================== diff --git a/includes/db/class.reflines_db.inc b/includes/db/class.reflines_db.inc index 47976504..f67aa60a 100644 --- a/includes/db/class.reflines_db.inc +++ b/includes/db/class.reflines_db.inc @@ -17,13 +17,13 @@ include_once 'class.data_set.inc'; **/ 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'); } diff --git a/includes/db_pager.inc b/includes/db_pager.inc index 416773ac..daaa2e8e 100644 --- a/includes/db_pager.inc +++ b/includes/db_pager.inc @@ -65,7 +65,7 @@ class db_pager { // 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(); diff --git a/includes/errors.inc b/includes/errors.inc index c5414d60..53587df6 100644 --- a/includes/errors.inc +++ b/includes/errors.inc @@ -21,7 +21,8 @@ function get_backtrace($html = false, $skip=0) foreach($trace as $trn => $tr) { if ($trn <= $skip) continue; if ($html) $str .= ''; - $str .= $tr['file'].':'.$tr['line'].': '; + if (isset($tr['file']) && isset($tr['line'])) + $str .= $tr['file'].':'.$tr['line'].': '; if ($html) $str .= ''; if (isset($tr['type'])) { if($tr['type'] == '::') { @@ -32,7 +33,7 @@ function get_backtrace($html = false, $skip=0) } $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])) @@ -87,6 +88,13 @@ function error_handler($errno, $errstr, $file, $line) { 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
// FIX center is unused now diff --git a/includes/lang/language.inc b/includes/lang/language.inc index 1609cdc5..fd3762c0 100644 --- a/includes/lang/language.inc +++ b/includes/lang/language.inc @@ -25,7 +25,7 @@ class language 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; diff --git a/includes/packages.inc b/includes/packages.inc index 2e1b92e3..c3aa518c 100644 --- a/includes/packages.inc +++ b/includes/packages.inc @@ -19,7 +19,8 @@ define('PUBKEY_PATH', $path_to_root); // FrontAccounting package class // class package extends gzip_file { - function package($filename, $basedir=null) + + function __construct($filename, $basedir=null) { global $path_to_root; @@ -30,7 +31,7 @@ class package extends gzip_file { } else mkdir($basedir); } - $this->archive($filename); + parent::__construct($filename); $this->set_options(array('basedir'=> $basedir)); $this->options['type'] = "pkg"; } diff --git a/includes/prefs/sysprefs.inc b/includes/prefs/sysprefs.inc index cce4769c..34e52bcc 100644 --- a/includes/prefs/sysprefs.inc +++ b/includes/prefs/sysprefs.inc @@ -21,7 +21,7 @@ class sys_prefs var $prefs; var $db_ok; // check whether database has been upgraded after src update. - function sys_prefs() + function __construct() { global $path_to_root; diff --git a/includes/prefs/userprefs.inc b/includes/prefs/userprefs.inc index 0f368477..863dc1fa 100644 --- a/includes/prefs/userprefs.inc +++ b/includes/prefs/userprefs.inc @@ -41,7 +41,7 @@ class user_prefs 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 diff --git a/includes/references.inc b/includes/references.inc index ff65fa38..7a919f27 100644 --- a/includes/references.inc +++ b/includes/references.inc @@ -70,7 +70,7 @@ class references { var $reflines; - function references() + function __construct() { $this->reflines = new reflines_db(); } diff --git a/includes/session.inc b/includes/session.inc index 3ec67df1..bba6496f 100644 --- a/includes/session.inc +++ b/includes/session.inc @@ -372,6 +372,7 @@ if (isset($_GET['path_to_root']) || isset($_POST['path_to_root'])) 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"); diff --git a/includes/ui/allocation_cart.inc b/includes/ui/allocation_cart.inc index f51046b0..b45110b3 100644 --- a/includes/ui/allocation_cart.inc +++ b/includes/ui/allocation_cart.inc @@ -30,7 +30,7 @@ class allocation 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(); @@ -254,7 +254,7 @@ class allocation_item 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) { diff --git a/includes/ui/class.crud_view.inc b/includes/ui/class.crud_view.inc index 8572fdbe..dd3ffb54 100644 --- a/includes/ui/class.crud_view.inc +++ b/includes/ui/class.crud_view.inc @@ -43,7 +43,7 @@ class user_view { var $dec; var $name; - function user_view($name) + function __construct($name) { $this->name = $name; } @@ -269,9 +269,9 @@ class simple_crud_view extends user_view { 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); @@ -596,10 +596,10 @@ class simple_crud_view extends user_view { 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() @@ -650,10 +650,10 @@ class table_crud_view extends simple_crud_view { 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); } /** * diff --git a/includes/ui/class.reflines_crud.inc b/includes/ui/class.reflines_crud.inc index 70403f62..60226fe2 100644 --- a/includes/ui/class.reflines_crud.inc +++ b/includes/ui/class.reflines_crud.inc @@ -14,9 +14,9 @@ include_once $path_to_root.'/includes/ui/class.crud_view.inc'; 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', diff --git a/includes/ui/contacts_view.inc b/includes/ui/contacts_view.inc index d27b8faa..8ad1496a 100644 --- a/includes/ui/contacts_view.inc +++ b/includes/ui/contacts_view.inc @@ -21,11 +21,11 @@ class contacts extends simple_crud { 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; diff --git a/includes/ui/items_cart.inc b/includes/ui/items_cart.inc index 7a19d235..bb473fe7 100644 --- a/includes/ui/items_cart.inc +++ b/includes/ui/items_cart.inc @@ -40,7 +40,7 @@ class items_cart 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; @@ -465,7 +465,7 @@ class line_item 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); @@ -509,7 +509,7 @@ class gl_item 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
"; diff --git a/includes/ui/simple_crud_class.inc b/includes/ui/simple_crud_class.inc index 05d92801..40c8ebea 100644 --- a/includes/ui/simple_crud_class.inc +++ b/includes/ui/simple_crud_class.inc @@ -26,7 +26,7 @@ class simple_crud { var $dec; // // - function simple_crud($name, $fields = null) + function __construct($name, $fields = null) { $this->name = $name; $this->pre_handlers = array( diff --git a/purchasing/includes/po_class.inc b/purchasing/includes/po_class.inc index b197cb03..c24119d2 100644 --- a/purchasing/includes/po_class.inc +++ b/purchasing/includes/po_class.inc @@ -47,7 +47,7 @@ class purch_order var $fixed_asset = false; - function purch_order() + function __construct() { /*Constructor function initialises a new purchase order object */ $this->line_items = array(); @@ -216,7 +216,7 @@ class po_line_details 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) { diff --git a/purchasing/includes/supp_trans_class.inc b/purchasing/includes/supp_trans_class.inc index 00226d9f..8a70e414 100644 --- a/purchasing/includes/supp_trans_class.inc +++ b/purchasing/includes/supp_trans_class.inc @@ -49,7 +49,7 @@ class supp_trans 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 */ @@ -230,7 +230,7 @@ all the info to do the necessary entries without looking up ie additional querie 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) { @@ -274,7 +274,7 @@ class gl_codes 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 */ diff --git a/reporting/includes/Workbook.php b/reporting/includes/Workbook.php index 30a716cb..7e64a1b3 100644 --- a/reporting/includes/Workbook.php +++ b/reporting/includes/Workbook.php @@ -178,7 +178,7 @@ class ole_pps # _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) { @@ -315,7 +315,7 @@ class ole_pps 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; @@ -366,7 +366,7 @@ class ole_pps_file extends ole_pps 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'); @@ -948,7 +948,7 @@ class Spreadsheet_Excel_Writer_BIFFwriter * * @access public */ - function Spreadsheet_Excel_Writer_BIFFwriter() + function __construct() { $this->_byte_order = ''; $this->_data = ''; @@ -1136,7 +1136,7 @@ class Spreadsheet_Excel_Writer_Validator */ var $_parser; - function Spreadsheet_Excel_Writer_Validator(&$parser) + function __construct(&$parser) { $this->_parser = $parser; $this->_type = 0x01; // FIXME: add method for setting datatype @@ -1469,7 +1469,7 @@ class Spreadsheet_Excel_Writer_Format * @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; @@ -2387,7 +2387,7 @@ class Spreadsheet_Excel_Writer_Parser * @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; @@ -4143,14 +4143,14 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr * @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; @@ -7412,10 +7412,10 @@ class Spreadsheet_Excel_Writer_Workbook extends Spreadsheet_Excel_Writer_BIFFwri * @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); diff --git a/reporting/includes/barcodes.php b/reporting/includes/barcodes.php index 4454ec99..03ee468e 100644 --- a/reporting/includes/barcodes.php +++ b/reporting/includes/barcodes.php @@ -81,7 +81,7 @@ class TCPDFBarcode { * @param string $code code to print * @param string $type type of barcode: */ - function TCPDFBarcode($code, $type) { + function __construct($code, $type) { $this->setBarcode($code, $type); } diff --git a/reporting/includes/class.graphic.inc b/reporting/includes/class.graphic.inc index da537dd5..81e93d25 100644 --- a/reporting/includes/class.graphic.inc +++ b/reporting/includes/class.graphic.inc @@ -149,7 +149,7 @@ class graph var $fontfile = ""; var $encoding; - function graph() + function __construct() { global $SysPrefs; $this->encoding = strtoupper($_SESSION['language']->encoding); diff --git a/reporting/includes/class.mail.inc b/reporting/includes/class.mail.inc index e40ffe8d..16cc81c3 100644 --- a/reporting/includes/class.mail.inc +++ b/reporting/includes/class.mail.inc @@ -41,7 +41,7 @@ class email 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"; diff --git a/reporting/includes/class.pdf.inc b/reporting/includes/class.pdf.inc index 172c328a..ab76ab46 100644 --- a/reporting/includes/class.pdf.inc +++ b/reporting/includes/class.pdf.inc @@ -63,9 +63,9 @@ include_once (dirname(__FILE__).'/fpdi/fpdi.php'); 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); diff --git a/reporting/includes/excel_report.inc b/reporting/includes/excel_report.inc index 3786a91a..483d0fde 100644 --- a/reporting/includes/excel_report.inc +++ b/reporting/includes/excel_report.inc @@ -60,7 +60,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook 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; @@ -84,7 +84,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook $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)); diff --git a/reporting/includes/fpdi/decoders/ASCII85Decode.php b/reporting/includes/fpdi/decoders/ASCII85Decode.php index 1f9492c1..48be3ca6 100644 --- a/reporting/includes/fpdi/decoders/ASCII85Decode.php +++ b/reporting/includes/fpdi/decoders/ASCII85Decode.php @@ -28,7 +28,7 @@ if (!defined("ORD_tilde")) class ASCII85Decode { - function ASCII85Decode(&$fpdi) { + function __construct(&$fpdi) { $this->fpdi =& $fpdi; } diff --git a/reporting/includes/fpdi/decoders/LZWDecode.php b/reporting/includes/fpdi/decoders/LZWDecode.php index 59d1b487..027cde86 100644 --- a/reporting/includes/fpdi/decoders/LZWDecode.php +++ b/reporting/includes/fpdi/decoders/LZWDecode.php @@ -29,7 +29,7 @@ class LZWDecode { var $nextBits = 0; var $andTable = array(511, 1023, 2047, 4095); - function LZWDecode(&$fpdi) { + function __construct(&$fpdi) { $this->fpdi =& $fpdi; } diff --git a/reporting/includes/fpdi/fpdi_pdf_parser.php b/reporting/includes/fpdi/fpdi_pdf_parser.php index 8d9288e4..a23302ff 100644 --- a/reporting/includes/fpdi/fpdi_pdf_parser.php +++ b/reporting/includes/fpdi/fpdi_pdf_parser.php @@ -66,11 +66,11 @@ class fpdi_pdf_parser extends pdf_parser { * @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']); diff --git a/reporting/includes/fpdi/pdf_context.php b/reporting/includes/fpdi/pdf_context.php index ce0b0e0c..703b5aa5 100644 --- a/reporting/includes/fpdi/pdf_context.php +++ b/reporting/includes/fpdi/pdf_context.php @@ -28,7 +28,7 @@ class pdf_context { // Constructor - function pdf_context($f) { + function __construct($f) { $this->file = $f; $this->reset(); } diff --git a/reporting/includes/fpdi/pdf_parser.php b/reporting/includes/fpdi/pdf_parser.php index b47ea7ac..54e198d4 100644 --- a/reporting/includes/fpdi/pdf_parser.php +++ b/reporting/includes/fpdi/pdf_parser.php @@ -90,7 +90,7 @@ class pdf_parser { * * @param string $filename Source-Filename */ - function pdf_parser($filename) { + function __construct($filename) { $this->filename = $filename; $this->f = @fopen($this->filename, "rb"); diff --git a/reporting/includes/pdf_report.inc b/reporting/includes/pdf_report.inc index 65aaaf9e..31dcdb36 100644 --- a/reporting/includes/pdf_report.inc +++ b/reporting/includes/pdf_report.inc @@ -70,7 +70,7 @@ class FrontReport extends Cpdf 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; @@ -222,7 +222,7 @@ class FrontReport extends Cpdf $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); } /* diff --git a/reporting/includes/printer_class.inc b/reporting/includes/printer_class.inc index e2de6657..ecc0542f 100644 --- a/reporting/includes/printer_class.inc +++ b/reporting/includes/printer_class.inc @@ -14,7 +14,7 @@ class remote_printer { // // 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; diff --git a/reporting/includes/reports_classes.inc b/reporting/includes/reports_classes.inc index 647209f8..0a672003 100644 --- a/reporting/includes/reports_classes.inc +++ b/reporting/includes/reports_classes.inc @@ -462,7 +462,7 @@ class Report 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; diff --git a/reporting/includes/tcpdf.php b/reporting/includes/tcpdf.php index 6e7b6f4a..139dea60 100644 --- a/reporting/includes/tcpdf.php +++ b/reporting/includes/tcpdf.php @@ -1112,7 +1112,7 @@ if (!class_exists('TCPDF')) { * @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; diff --git a/sales/includes/cart_class.inc b/sales/includes/cart_class.inc index 13f383bf..7d68e2a4 100644 --- a/sales/includes/cart_class.inc +++ b/sales/includes/cart_class.inc @@ -90,7 +90,7 @@ class Cart // $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 = ""; @@ -693,7 +693,7 @@ class line_details 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 */ diff --git a/sql/alter2.1.php b/sql/alter2.1.php index 6d2e767b..1dade602 100644 --- a/sql/alter2.1.php +++ b/sql/alter2.1.php @@ -15,7 +15,7 @@ class fa2_1 extends fa_patch { var $description; var $sql = 'alter2.1.sql'; - function fa2_1() { + function __construct() { $this->description = _('Upgrade from version 2.0 to 2.1'); } // diff --git a/sql/alter2.2.php b/sql/alter2.2.php index 837f44ce..db6b3aec 100644 --- a/sql/alter2.2.php +++ b/sql/alter2.2.php @@ -18,7 +18,7 @@ class fa2_2 extends fa_patch { 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'); diff --git a/sql/alter2.3.php b/sql/alter2.3.php index f186ff62..2667d15c 100644 --- a/sql/alter2.3.php +++ b/sql/alter2.3.php @@ -17,7 +17,7 @@ class fa2_3 extends fa_patch { 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'); } diff --git a/sql/alter2.4.php b/sql/alter2.4.php index 5e9b83db..b3ec864d 100644 --- a/sql/alter2.4.php +++ b/sql/alter2.4.php @@ -18,8 +18,8 @@ class fa2_4 extends fa_patch { 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'); } diff --git a/sql/alter2.4rc1.php b/sql/alter2.4rc1.php index 93464054..66a029fb 100644 --- a/sql/alter2.4rc1.php +++ b/sql/alter2.4rc1.php @@ -18,8 +18,8 @@ class fa2_4rc1 extends fa_patch { 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'); }