From 92516cf782e07af078fab627e35c75c822702ab2 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Thu, 5 Nov 2015 18:40:56 +0100 Subject: [PATCH] Cleanup comments. Small bugfixes. First run. --- access/login.php | 7 ++- access/password_reset.php | 31 +++++++------ admin/attachments.php | 15 +++---- admin/create_coy.php | 2 +- admin/db/maintenance_db.inc | 9 ---- admin/db/users_db.inc | 17 -------- admin/includes/fa_patch.class.inc | 2 +- admin/inst_chart.php | 1 - admin/inst_theme.php | 1 - admin/inst_upgrade.php | 1 + admin/print_profiles.php | 55 ++++++++++++------------ admin/security_roles.php | 5 --- admin/void_transaction.php | 3 +- applications/application.php | 17 ++------ dimensions/inquiry/search_dimensions.php | 4 -- gl/includes/db/gl_db_bank_trans.inc | 5 +-- gl/includes/db/gl_db_banking.inc | 17 ++------ gl/includes/db/gl_db_rates.inc | 46 ++++++++------------ gl/includes/db/gl_db_trans.inc | 3 -- gl/includes/db/gl_journal.inc | 7 +-- gl/includes/ui/gl_bank_ui.inc | 14 +----- gl/includes/ui/gl_journal_ui.inc | 2 +- gl/inquiry/balance_sheet.php | 7 +-- gl/inquiry/gl_account_inquiry.php | 2 +- gl/inquiry/gl_trial_balance.php | 3 -- gl/inquiry/profit_loss.php | 15 +++---- gl/inquiry/tax_inquiry.php | 4 -- 27 files changed, 93 insertions(+), 202 deletions(-) diff --git a/access/login.php b/access/login.php index 593f4992..fa91f352 100644 --- a/access/login.php +++ b/access/login.php @@ -29,9 +29,9 @@ function defaultCompany() else { $demo_text = _("Please login here"); - if (@$SysPrefs->allow_password_reset) { - $demo_text .= " "._("or")." "._("request new password").""; - } + if (@$SysPrefs->allow_password_reset) { + $demo_text .= " "._("or")." "._("request new password").""; + } } if (check_faillog()) @@ -109,7 +109,6 @@ function defaultCompany() echo "\n"; echo ""; } else { -// $coy = $def_coy; text_row(_("Company"), "company_login_nickname", "", 20, 50); } start_row(); diff --git a/access/password_reset.php b/access/password_reset.php index bdea9136..e9af83f7 100644 --- a/access/password_reset.php +++ b/access/password_reset.php @@ -62,22 +62,21 @@ function defaultCompany() text_row(_("Email"), "email_entry_field", "", 20, 30); - $coy = user_company(); - if (!isset($coy)) - $coy = $def_coy; - if (!@$SysPrefs->text_company_selection) { - echo ""._("Company")."\n"; - echo ""; - } else { -// $coy = $def_coy; - text_row(_("Company"), "company_login_nickname", "", 20, 50); - } - start_row(); - label_cell("Please enter your e-mail", "colspan=2 align='center' id='log_msg'"); - end_row(); + $coy = user_company(); + if (!isset($coy)) + $coy = $def_coy; + if (!@$SysPrefs->text_company_selection) { + echo ""._("Company")."\n"; + echo ""; + } else { + text_row(_("Company"), "company_login_nickname", "", 20, 50); + } + start_row(); + label_cell("Please enter your e-mail", "colspan=2 align='center' id='log_msg'"); + end_row(); end_table(1); echo "
\n"; diff --git a/admin/attachments.php b/admin/attachments.php index bd567bf2..f600e301 100644 --- a/admin/attachments.php +++ b/admin/attachments.php @@ -36,10 +36,7 @@ if ($view_id != -1) $type = ($row['filetype']) ? $row['filetype'] : 'application/octet-stream'; header("Content-type: ".$type); header('Content-Length: '.$row['filesize']); - //if ($type == 'application/octet-stream') - // header('Content-Disposition: attachment; filename='.$row['filename']); - //else - header("Content-Disposition: inline"); + header("Content-Disposition: inline"); echo file_get_contents(company_path(). "/attachments/".$row['unique_name']); exit(); } @@ -87,11 +84,11 @@ if ($Mode == 'ADD_ITEM' || $Mode == 'UPDATE_ITEM') elseif ($Mode == 'ADD_ITEM' && !isset($_FILES['filename'])) display_error(_("Select attachment file.")); elseif ($Mode == 'ADD_ITEM' && ($_FILES['filename']['error'] > 0)) { - if ($_FILES['filename']['error'] == UPLOAD_ERR_INI_SIZE) - display_error(_("The file size is over the maximum allowed.")); - else - display_error(_("Select attachment file.")); - } + if ($_FILES['filename']['error'] == UPLOAD_ERR_INI_SIZE) + display_error(_("The file size is over the maximum allowed.")); + else + display_error(_("Select attachment file.")); + } else { //$content = base64_encode(file_get_contents($_FILES['filename']['tmp_name'])); $tmpname = $_FILES['filename']['tmp_name']; diff --git a/admin/create_coy.php b/admin/create_coy.php index 588c727b..56b4fe21 100644 --- a/admin/create_coy.php +++ b/admin/create_coy.php @@ -199,7 +199,7 @@ function handle_delete($id) } $err = remove_connection($id); if ($err == 0) - display_error(_("Error removing Database: ") . $dbase . _(", please remove it manually")); + display_error(_("Error removing Database: ") . $id . _(", please remove it manually")); if ($def_coy == $id) $def_coy = 0; diff --git a/admin/db/maintenance_db.inc b/admin/db/maintenance_db.inc index 5c81bcc6..f621c2c2 100644 --- a/admin/db/maintenance_db.inc +++ b/admin/db/maintenance_db.inc @@ -71,7 +71,6 @@ function write_config_db($new = false) if ($new) $tb_pref_counter++; - $n = count($db_connections); $msg = "log_error(_("Upgrade failed. Original database content restored successfully."), 'Info'); else - $thi->log_error(sprintf(_("Database restore operation failed. Original database content is in %s file."), $this->backup)); + $this->log_error(sprintf(_("Database restore operation failed. Original database content is in %s file."), $this->backup)); $this->post_fail($this->cur_company); } } else { diff --git a/admin/inst_chart.php b/admin/inst_chart.php index 0bdfcb74..05165fbf 100644 --- a/admin/inst_chart.php +++ b/admin/inst_chart.php @@ -66,7 +66,6 @@ start_form(true); alt_table_row_color($k); -// label_cell(is_array($ext['Descr']) ? $ext['Descr'][0] : $ext['Descr']); label_cell($available ? get_package_view_str($pkg_name, $ext['name']) : $ext['name']); label_cell($id === null ? _("None") : diff --git a/admin/inst_theme.php b/admin/inst_theme.php index a2f26006..7c15dd53 100644 --- a/admin/inst_theme.php +++ b/admin/inst_theme.php @@ -71,7 +71,6 @@ start_form(true); alt_table_row_color($k); -// label_cell(is_array($ext['Descr']) ? $ext['Descr'][0] : $ext['Descr']); label_cell($available ? get_package_view_str($pkg_name, $ext['name']) : $ext['name']); label_cell($id === null ? _("None") : diff --git a/admin/inst_upgrade.php b/admin/inst_upgrade.php index 5fc66fc8..2fb9ac07 100644 --- a/admin/inst_upgrade.php +++ b/admin/inst_upgrade.php @@ -63,6 +63,7 @@ start_form(); $th = array(_("Company"), _("Table set"), _("Current version"), _("Last log"), _('Upgrade')); start_table(TABLESTYLE); table_header($th); +$k = 0; //row colour counter $uptodate = true; foreach($site_status as $i => $comp) diff --git a/admin/print_profiles.php b/admin/print_profiles.php index bf3d698f..534c5168 100644 --- a/admin/print_profiles.php +++ b/admin/print_profiles.php @@ -25,39 +25,38 @@ $selected_id = get_post('profile_id',''); function get_reports() { global $path_to_root, $SysPrefs; -if ($SysPrefs->go_debug || !isset($_SESSION['reports'])) { + if ($SysPrefs->go_debug || !isset($_SESSION['reports'])) { // to save time, store in session. $paths = array ( $path_to_root.'/reporting/', company_path(). '/reporting/'); $reports = array( '' => _('Default printing destination')); - foreach($paths as $dirno => $path) { - $repdir = opendir($path); - while(false !== ($fname = readdir($repdir))) - { - // reports have filenames in form rep(repid).php - // where repid must contain at least one digit (reports_main.php is not ;) - if (is_file($path.$fname) -// && preg_match('/.*[^0-9]([0-9]+)[.]php/', $fname, $match)) - && preg_match('/rep(.*[0-9]+.*)[.]php/', $fname, $match)) + foreach($paths as $dirno => $path) { + $repdir = opendir($path); + while(false !== ($fname = readdir($repdir))) { - $repno = $match[1]; - $title = ''; - - $line = file_get_contents($path.$fname); - if (preg_match('/.*(FrontReport\()\s*_\([\'"]([^\'"]*)/', $line, $match)) { - $title = trim($match[2]); - } - else // for any 3rd party printouts without FrontReport() class use + // reports have filenames in form rep(repid).php + // where repid must contain at least one digit (reports_main.php is not ;) + if (is_file($path.$fname) + && preg_match('/rep(.*[0-9]+.*)[.]php/', $fname, $match)) + { + $repno = $match[1]; + $title = ''; + + $line = file_get_contents($path.$fname); + if (preg_match('/.*(FrontReport\()\s*_\([\'"]([^\'"]*)/', $line, $match)) { + $title = trim($match[2]); + } + else // for any 3rd party printouts without FrontReport() class use if (preg_match('/.*(\$Title).*[\'"](.*)[\'"].+/', $line, $match)) { $title = trim($match[2]); } - $reports[$repno] = $title; + $reports[$repno] = $title; + } } + closedir(); } - closedir(); - } ksort($reports); $_SESSION['reports'] = $reports; } @@ -75,7 +74,7 @@ function clear_form() function check_delete($name) { -// check if selected profile is used by any user + // check if selected profile is used by any user if ($name=='') return 0; // cannot delete system default profile return key_in_foreign_table($name, 'users', 'print_profile'); } @@ -100,7 +99,7 @@ if ( get_post('submit')) $prof[$rep] = $val; } if ($_POST['profile_id']=='') - $_POST['profile_id'] = get_post('name'); + $_POST['profile_id'] = get_post('name'); update_printer_profile($_POST['profile_id'], $prof); if ($selected_id == '') { @@ -114,11 +113,11 @@ if ( get_post('submit')) if(get_post('delete')) { - if (!check_delete(get_post('name'))) { - delete_printer_profile($selected_id); - display_notification(_('Selected printing profile has been deleted')); - clear_form(); - } + if (!check_delete(get_post('name'))) { + delete_printer_profile($selected_id); + display_notification(_('Selected printing profile has been deleted')); + clear_form(); + } } if(get_post('_profile_id_update')) { diff --git a/admin/security_roles.php b/admin/security_roles.php index 885acd77..4b438091 100644 --- a/admin/security_roles.php +++ b/admin/security_roles.php @@ -147,9 +147,6 @@ if (!isset($_POST['role']) || get_post('clone') || list_updated('role')) { $row = get_security_role($id); $_POST['description'] = $row['description']; $_POST['name'] = $row['role']; -// if ($row['inactive'] -// $_POST['inactive'] = 1; - $_POST['inactive'] = $row['inactive']; $access = $row['areas']; $sections = $row['sections']; @@ -214,8 +211,6 @@ end_table(1); $ext = $newext; $sec = $newsec; $m = $parms[0] & ~0xff; -// if(!isset($security_sections[$m])) -// display_error(sprintf("Bad section %X:", $m)); label_row($security_sections[$m].':', checkbox( null, 'Section'.$m, null, true, _("On/off set of features")), diff --git a/admin/void_transaction.php b/admin/void_transaction.php index 41ff2f77..13f1e439 100644 --- a/admin/void_transaction.php +++ b/admin/void_transaction.php @@ -104,7 +104,6 @@ function exist_transaction($type, $type_no) return false; case ST_COSTUPDATE : // it's a stock cost update return false; - break; } return true; @@ -241,7 +240,7 @@ function check_valid_entries() { display_error(_("The selected transaction was closed for edition and cannot be voided.")); set_focus('trans_no'); - return; + return false; } if (!is_date($_POST['date_'])) { diff --git a/applications/application.php b/applications/application.php index 43996952..81bf2e10 100644 --- a/applications/application.php +++ b/applications/application.php @@ -19,7 +19,7 @@ define('MENU_UPDATE', 'menu_update'); define('MENU_SETTINGS', 'menu_settings'); define('MENU_SYSTEM', 'menu_system'); - class menu_item + class menu_item { var $label; var $link; @@ -56,7 +56,7 @@ define('MENU_SYSTEM', 'menu_system'); var $label; var $link; var $access; - var $category; + var $category; function app_function($label,$link,$access='SA_OPEN',$category='') { @@ -85,7 +85,6 @@ define('MENU_SYSTEM', 'menu_system'); function add_lapp_function($label,$link="",$access='SA_OPEN',$category='') { $appfunction = new app_function($label,$link,$access,$category); - //array_push($this->lappfunctions,$appfunction); $this->lappfunctions[] = $appfunction; return $appfunction; } @@ -93,7 +92,6 @@ define('MENU_SYSTEM', 'menu_system'); function add_rapp_function($label,$link="",$access='SA_OPEN',$category='') { $appfunction = new app_function($label,$link,$access,$category); - //array_push($this->rappfunctions,$appfunction); $this->rappfunctions[] = $appfunction; return $appfunction; } @@ -120,7 +118,6 @@ define('MENU_SYSTEM', 'menu_system'); function add_module($name, $icon = null) { $module = new module($name,$icon); - //array_push($this->modules,$module); $this->modules[] = $module; return $module; } @@ -144,15 +141,7 @@ define('MENU_SYSTEM', 'menu_system'); // function report_class_url($class) { - global $installed_extensions; - - // TODO : konwencja lub ? - $classno = 7; -// if (file_exists($path_to_root.'/'.$mod['path'].'/'.$entry['url'] -// .'/'.'reporting/reports_custom.php')) - return "reporting/reports_main.php?Class=".$class; -// else -// return ''; + return "reporting/reports_main.php?Class=".$class; } } diff --git a/dimensions/inquiry/search_dimensions.php b/dimensions/inquiry/search_dimensions.php index 2d7c8541..6d23976f 100644 --- a/dimensions/inquiry/search_dimensions.php +++ b/dimensions/inquiry/search_dimensions.php @@ -50,7 +50,6 @@ if (get_post('SearchOrders')) $Ajax->addDisable(true, 'OpenOnly', $disable); if ($disable) { -// $Ajax->addFocus(true, 'OrderNumber'); set_focus('OrderNumber'); } else set_focus('type_'); @@ -114,9 +113,6 @@ function is_overdue($row) function edit_link($row) { - //return $row["closed"] ? '' : - // pager_link(_("Edit"), - // "/dimensions/dimension_entry.php?trans_no=" . $row["id"], ICON_EDIT); return pager_link(_("Edit"), "/dimensions/dimension_entry.php?trans_no=" . $row["id"], ICON_EDIT); } diff --git a/gl/includes/db/gl_db_bank_trans.inc b/gl/includes/db/gl_db_bank_trans.inc index e0dbdf28..be1551f5 100644 --- a/gl/includes/db/gl_db_bank_trans.inc +++ b/gl/includes/db/gl_db_bank_trans.inc @@ -34,9 +34,6 @@ function add_bank_trans($type, $trans_no, $bank_act, $ref, $date_, $amount_bank = $amount; $amount_bank = round2($amount_bank, user_price_dec()); - // Also store the rate to the home - //$BankToHomeCurrencyRate = get_exchange_rate_to_home_currency($bank_account_currency, $date_); - $sql = "INSERT INTO ".TB_PREF."bank_trans (type, trans_no, bank_act, ref, trans_date, amount, person_type_id, person_id) "; @@ -152,7 +149,7 @@ function void_bank_trans($type, $type_no, $nested=false) SET amount=0 WHERE type=".db_escape($type)." AND trans_no=".db_escape($type_no); - $result = db_query($sql, "could not void bank transactions for type=$type and trans_no=$type_no"); + db_query($sql, "could not void bank transactions for type=$type and trans_no=$type_no"); void_gl_trans($type, $type_no, true); diff --git a/gl/includes/db/gl_db_banking.inc b/gl/includes/db/gl_db_banking.inc index 91a1e97b..e071b9ac 100644 --- a/gl/includes/db/gl_db_banking.inc +++ b/gl/includes/db/gl_db_banking.inc @@ -20,11 +20,10 @@ function add_exchange_variation($trans_no, $date_, $acc_id, $account, // We have to calculate all the currency accounts belonging to the GL account // upto $date_ and calculate with the exchange rates. And then compare with the GL account balance. - // 2010-02-23 Joe Hunt with help of Ary Wibowo - $sql = "SELECT SUM(bt.amount) AS for_amount, ba.bank_curr_code + $sql = "SELECT SUM(bt.amount) AS for_amount, ba.bank_curr_code FROM ".TB_PREF."bank_trans bt, ".TB_PREF."bank_accounts ba WHERE ba.id = bt.bank_act AND ba.account_code = ".db_escape($account)." AND bt.trans_date<='".date2sql($date_)."' - GROUP BY ba.bank_curr_code"; + GROUP BY ba.bank_curr_code"; $result = db_query($sql, "Transactions for bank account $acc_id could not be calculated"); while ($row = db_fetch($result)) { @@ -44,19 +43,15 @@ function add_exchange_variation($trans_no, $date_, $acc_id, $account, $trans_no = get_next_trans_no(ST_JOURNAL); $ref = $Refs->get_next(ST_JOURNAL); - add_journal(ST_JOURNAL, $trans_no, $diff, $date_ , $currency, $ref, '', $rate, $date_, $date_); + add_journal(ST_JOURNAL, $trans_no, $diff, $date_ , get_company_currency(), $ref, '', 1, $date_, $date_); $Refs->save(ST_JOURNAL, $trans_no, $ref); add_audit_trail(ST_JOURNAL, $trans_no, $date_); - add_comments(ST_JOURNAL, $trans_no, $date_, $memo); if ($person_type_id == null) $person_type_id = PT_MISC; add_gl_trans(ST_JOURNAL, $trans_no, $date_, $account, 0, 0, _("Exchange Variance"), $diff, null, $person_type_id, $person_id); - // positive change in value is positive variance for AR and bank accounts, and negative for AP - $variance_act = ($diff < 0 && $person_id==PT_SUPPLIER) || ($diff > 0 && $person_id != PT_SUPPLIER) - ? 'exchange_diff_act' : 'exchange_diff_neg_act'; add_gl_trans(ST_JOURNAL, $trans_no, $date_, get_company_pref('exchange_diff_act'), 0, 0, _("Exchange Variance"), -$diff, null, $person_type_id, $person_id); commit_transaction(); @@ -65,7 +60,6 @@ function add_exchange_variation($trans_no, $date_, $acc_id, $account, return false; } -//------------- New helper functions for revaluation of customer/supplier currencies 2011-05-08 Joe Hunt. function add_cust_supp_revaluation($ledger_act, $ex_act, $date, $amount, $person_type_id, $person_id, $memo) { global $Refs; @@ -76,7 +70,7 @@ function add_cust_supp_revaluation($ledger_act, $ex_act, $date, $amount, $person $trans_no = get_next_trans_no(ST_JOURNAL); $ref = $Refs->get_next(ST_JOURNAL); - add_journal(ST_JOURNAL, $trans_no, $amount, $date, $currency, $ref, '', $rate, $date, $date); + add_journal(ST_JOURNAL, $trans_no, $amount, $date, get_company_currency(), $ref, '', 1, $date, $date); $Refs->save(ST_JOURNAL, $trans_no, $ref); add_audit_trail(ST_JOURNAL, $trans_no, $date); @@ -309,9 +303,6 @@ function check_bank_transfer( $amount, $target_amount=0) { $dbResult = get_bank_trans(ST_BANKTRANSFER, $trans_no); - if (2 != db_num_rows($dbResult)) { - // How are errors handled? Throw an exception would be nice. CP 2014-10 - } $old_from = db_fetch($dbResult); $old_to = db_fetch($dbResult); diff --git a/gl/includes/db/gl_db_rates.inc b/gl/includes/db/gl_db_rates.inc index 0980cb36..b1d58da8 100644 --- a/gl/includes/db/gl_db_rates.inc +++ b/gl/includes/db/gl_db_rates.inc @@ -62,12 +62,12 @@ function update_exchange_rate($curr_code, $date_, $buy_rate, $sell_rate) { if (is_company_currency($curr_code)) display_db_error("Exchange rates cannot be set for company currency", "", true); - + $date = date2sql($date_); - + $sql = "UPDATE ".TB_PREF."exchange_rates SET rate_buy=$buy_rate, rate_sell=".db_escape($sell_rate) ." WHERE curr_code=".db_escape($curr_code)." AND date_='$date'"; - + db_query($sql, "could not add exchange rate for $curr_code"); } @@ -79,7 +79,7 @@ function add_exchange_rate($curr_code, $date_, $buy_rate, $sell_rate) display_db_error("Exchange rates cannot be set for company currency", "", true); $date = date2sql($date_); - + $sql = "INSERT INTO ".TB_PREF."exchange_rates (curr_code, date_, rate_buy, rate_sell) VALUES (".db_escape($curr_code).", '$date', ".db_escape($buy_rate) .", ".db_escape($sell_rate).")"; @@ -143,8 +143,6 @@ function get_extern_rate($curr_b, $provider = 'ECB', $date) { $filename = "/d/quotes.csv?s={$curr_a}{$curr_b}=X&f=sl1d1t1ba&e=.csv"; // new URL's for YAHOO $site = "download.finance.yahoo.com"; - //$filename = "/q?s={$curr_a}{$curr_b}=X"; // Let old code be here for a while, Joe. - //$site = "finance.yahoo.com"; } elseif ($provider == 'GOOGLE') { @@ -161,21 +159,21 @@ function get_extern_rate($curr_b, $provider = 'ECB', $date) { // first check with curl as we can set short timeout; $retry = 1; do { - $ch = curl_init(); - curl_setopt ($ch, CURLOPT_URL, 'http://'.$site.$filename); - curl_setopt ($ch, CURLOPT_COOKIEJAR, "$path_to_root/tmp/cookie.txt"); - curl_setopt ($ch, CURLOPT_HEADER, 0); - curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); - // prevent warning while safe_mode/open_basedir on (redireciton doesn't occur at least on ECB page) - if (!ini_get('safe_mode') && !ini_get('open_basedir')) - curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); - curl_setopt ($ch, CURLOPT_TIMEOUT, 3); - $contents = curl_exec ($ch); - curl_close($ch); + $ch = curl_init(); + curl_setopt ($ch, CURLOPT_URL, 'http://'.$site.$filename); + curl_setopt ($ch, CURLOPT_COOKIEJAR, "$path_to_root/tmp/cookie.txt"); + curl_setopt ($ch, CURLOPT_HEADER, 0); + curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); + // prevent warning while safe_mode/open_basedir on (redireciton doesn't occur at least on ECB page) + if (!ini_get('safe_mode') && !ini_get('open_basedir')) + curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt ($ch, CURLOPT_TIMEOUT, 3); + $contents = curl_exec ($ch); + curl_close($ch); // due to resolver bug in some curl versions (e.g. 7.15.5) // try again for constant IP. - $site="172.230.157.137"; - } while( ($contents == '') && $retry--); + $site="172.230.157.137"; + } while( ($contents == '') && $retry--); } else { $contents = url_get_contents("http://".$site.$filename); @@ -207,14 +205,6 @@ function get_extern_rate($curr_b, $provider = 'ECB', $date) $val = $array[1]; if ($val != 0) $val = 1 / $val; - /* Let old code be here for a while, Joe. - //if (preg_match('/Last\sTrade:(.*?)Trade\sTime/s', $contents, $matches)) { - $val = strip_tags($matches[1]); - $val = str_replace(',', '', $val); - if ($val != 0) - $val = 1 / $val; - } - */ } elseif ($provider == 'GOOGLE') { @@ -249,5 +239,5 @@ function get_sql_for_exchange_rates($curr) FROM ".TB_PREF."exchange_rates " ."WHERE curr_code=".db_escape($curr)." ORDER BY date_ DESC"; - return $sql; + return $sql; } diff --git a/gl/includes/db/gl_db_trans.inc b/gl/includes/db/gl_db_trans.inc index 34b904f4..9fd072b8 100644 --- a/gl/includes/db/gl_db_trans.inc +++ b/gl/includes/db/gl_db_trans.inc @@ -387,14 +387,11 @@ function add_gl_tax_details($gl_code, $trans_type, $trans_no, $amount, $ex_rate, if(!$tax_type) return; // $gl_code is not tax account $tax = get_tax_type($tax_type); - //if ($gl_code == $tax['sales_gl_code']) if ($trans_type == ST_SALESINVOICE || $trans_type == ST_CUSTDELIVERY || $trans_type == ST_CUSTCREDIT) $amount = -$amount; // we have to restore net amount as we cannot know the base amount if ($net_amount===null) { if ($tax['rate'] == 0) { -// display_warning(_("You should not post gl transactions -// to tax account with zero tax rate.")); $net_amount = 0; } else { // calculate net amount diff --git a/gl/includes/db/gl_journal.inc b/gl/includes/db/gl_journal.inc index f3f49533..ae32414c 100644 --- a/gl/includes/db/gl_journal.inc +++ b/gl/includes/db/gl_journal.inc @@ -151,15 +151,10 @@ function void_journal_trans($type, $type_no, $use_transaction=true) $sql = "UPDATE ".TB_PREF."journal SET amount=0 WHERE type=".db_escape($type)." AND trans_no=".db_escape($type_no); - $result = db_query($sql, "could not void journal transaction for type=$type and trans_no=$type_no"); + db_query($sql, "could not void journal transaction for type=$type and trans_no=$type_no"); void_bank_trans($type, $type_no, true); -// void_gl_trans($type, $type_no, true); // this is done above -// void_trans_tax_details($type, $type_no); // ditto -// void_supp_allocations($type, $type_no); // ditto -// void_cust_allocations($type, $type_no); // ditto - if ($use_transaction) commit_transaction(); } diff --git a/gl/includes/ui/gl_bank_ui.inc b/gl/includes/ui/gl_bank_ui.inc index 8e491712..b5a0932b 100644 --- a/gl/includes/ui/gl_bank_ui.inc +++ b/gl/includes/ui/gl_bank_ui.inc @@ -11,7 +11,7 @@ ***********************************************************************/ function display_bank_header(&$order) { - global $Ajax, $Refs; + global $Ajax; $payment = $order->trans_type == ST_BANKPAYMENT; $customer_error = false; @@ -57,9 +57,6 @@ function display_bank_header(&$order) text_row_ex($payment ?_("To the Order of:"):_("Name:"), 'person_id', 40, 50); break; - //case PT_WORKORDER : - // workorders_list_row(_("Work Order:"), 'person_id', null); - // break; case PT_SUPPLIER : supplier_list_row(_("Supplier:"), 'person_id', null, false, true, false, true); break; @@ -100,9 +97,6 @@ function display_bank_header(&$order) amount_row($qid['base_desc'].":", 'totamount', price_format($qid['base_amount']), null, "  ".submit('go', _("Go"), false, false, true)); break; - //case payment_person_types::Project() : - // dimensions_list_row(_("Dimension:"), 'person_id', $_POST['person_id'], false, null, true); - // break; } table_section(3, "33%"); @@ -151,7 +145,7 @@ function display_gl_items($title, &$order) if ($dim == 2) $th = array(_("Account Code"), _("Account Description"), _("Dimension")." 1", _("Dimension")." 2", _("Amount"), _("Memo"), ""); - else if ($dim == 1) + elseif ($dim == 1) $th = array(_("Account Code"), _("Account Description"), _("Dimension"), _("Amount"), _("Memo"), ""); else @@ -176,7 +170,6 @@ function display_gl_items($title, &$order) label_cell(get_dimension_string($item->dimension_id, true)); if ($dim > 1) label_cell(get_dimension_string($item->dimension2_id, true)); - //amount_cell(abs($item->amount)); if ($order->trans_type == ST_BANKDEPOSIT) amount_cell(-$item->amount); else @@ -237,7 +230,6 @@ function gl_edit_item_controls(&$order, $dim, $Index=null) $_POST['amount'] = price_format(0); $_POST['dimension_id'] = 0; $_POST['dimension2_id'] = 0; - //$_POST['LineMemo'] = ""; // let memo go to next line Joe Hunt 2010-05-30 if(isset($_POST['_code_id_update'])) { $Ajax->activate('code_id'); } @@ -252,8 +244,6 @@ function gl_edit_item_controls(&$order, $dim, $Index=null) $acc = get_supplier_accounts($_POST['person_id']); $_POST['code_id'] = $acc['payable_account']; } - //elseif ($_POST['PayType'] == PT_WORKORDER) - // $_POST['code_id'] = get_company_pref('default_assembly_act'); else { $_POST['code_id'] = get_company_pref($payment ? 'default_cogs_act':'default_inv_sales_act'); diff --git a/gl/includes/ui/gl_journal_ui.inc b/gl/includes/ui/gl_journal_ui.inc index 67cbb155..675d8734 100644 --- a/gl/includes/ui/gl_journal_ui.inc +++ b/gl/includes/ui/gl_journal_ui.inc @@ -101,7 +101,7 @@ function display_gl_items($title, &$order) if ($dim == 2) $th = array(_("Account Code"), _("Account Description"), _("Dimension")." 1", _("Dimension")." 2", _("Debit"), _("Credit"), _("Memo"), ""); - else if ($dim == 1) + elseif ($dim == 1) $th = array(_("Account Code"), _("Account Description"), _("Dimension"), _("Debit"), _("Credit"), _("Memo"), ""); else diff --git a/gl/inquiry/balance_sheet.php b/gl/inquiry/balance_sheet.php index e3f8a454..e2cd1075 100644 --- a/gl/inquiry/balance_sheet.php +++ b/gl/inquiry/balance_sheet.php @@ -104,7 +104,6 @@ function display_type ($type, $typename, $from, $to, $convert, $dimension, $dime $parent1 = $acctype1["parent"]; if ($drilldown && $parent1 == $_POST["AccGrp"]) //END Patch#2 - //elseif ($drilldown && $type != $_POST["AccGrp"]) { $url = "