Cleanup comments. Small bugfixes. Second run
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 6 Nov 2015 15:33:41 +0000 (16:33 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 6 Nov 2015 15:33:41 +0000 (16:33 +0100)
36 files changed:
gl/bank_account_reconcile.php
gl/bank_transfer.php
gl/gl_bank.php
gl/gl_budget.php
gl/manage/close_period.php
gl/manage/gl_account_classes.php
gl/manage/gl_account_types.php
gl/manage/revaluate_currencies.php
gl/view/accrual_trans.php
gl/view/gl_deposit_view.php
gl/view/gl_payment_view.php
gl/view/gl_trans_view.php
includes/access_levels.inc
includes/ajax.inc
includes/current_user.inc
includes/db/connect_db_mysql.inc
includes/db/connect_db_mysqli.inc
includes/db/manufacturing_db.inc
includes/db_pager.inc
includes/errors.inc
includes/hooks.inc
includes/lang/gettext.inc
includes/packages.inc
includes/page/header.inc
includes/session.inc
includes/types.inc
includes/ui/allocation_cart.inc
includes/ui/class.reflines_crud.inc
includes/ui/contacts_view.inc
includes/ui/db_pager_view.inc
includes/ui/items_cart.inc
includes/ui/simple_crud_class.inc
includes/ui/ui_controls.inc
includes/ui/ui_input.inc
includes/ui/ui_lists.inc
includes/ui/ui_view.inc

index e7b584b1302c829e4f26e847a35247636af842fc..55481789606ef729459625a0cc0c3dd5904d9cba 100644 (file)
@@ -9,7 +9,6 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
-/* Author Rob Mallon */
 $page_security = 'SA_RECONCILE';
 $path_to_root = "..";
 include($path_to_root . "/includes/db_pager.inc");
index 3ebc24535a6947c6fabf46254c93d27706ece656..79195b5c99b6df06467232aa987338c6440c6314 100644 (file)
@@ -94,7 +94,6 @@ function gl_payment_controls($trans_no)
                        $_POST['amount'] = 0;
                }
        }
-       $home_currency = get_company_currency();
 
        start_form();
 
index 3d3f86e64e33643671549e348713a60ad0a0e7fd..71e2c0450f74f8ed5383589b8ad0c55b0f8235e3 100644 (file)
@@ -185,7 +185,6 @@ function create_cart($type, $trans_no)
                                        // so we have to restore it from original gl amounts
                                        $ex_rate = $bank_trans['amount']/$row['amount'];
                                } else {
-                                       $date = $row['tran_date'];
                                        $cart->add_gl_item( $row['account'], $row['dimension_id'],
                                                $row['dimension2_id'], $row['amount'], $row['memo_']);
                                }
index cc1a5eb48db9d0d84e093edbfa18c3631e7c8907..6c2ad64b3fc66b6e05833fcf1554957bb78f5ef1 100644 (file)
@@ -46,7 +46,6 @@ if (isset($_POST['add']) || isset($_POST['delete']))
        else
                display_notification_centered(_("The Budget has been deleted."));
 
-       //meta_forward($_SERVER['PHP_SELF']);
        $Ajax->activate('budget_tbl');
 }
 if (isset($_POST['submit']) || isset($_POST['update']))
@@ -71,7 +70,7 @@ if (db_has_gl_accounts())
                dimensions_list_row(_("Dimension")." 1", 'dim1', $_POST['dim1'], true, null, false, 1);
                dimensions_list_row(_("Dimension")." 2", 'dim2', $_POST['dim2'], true, null, false, 2);
        }
-       else if ($dim == 1)
+       elseif ($dim == 1)
        {
                dimensions_list_row(_("Dimension"), 'dim1', $_POST['dim1'], true, null, false, 1);
                hidden('dim2', 0);
index 21a6aaeee806c4d45568d826e20ba80cec781209..07d2d476eca52c98af06bc8d7d0f3ee88a4e3e9f 100644 (file)
@@ -27,7 +27,7 @@ page(_($help_context = "Closing GL Transactions"), false, false, "", $js);
 //---------------------------------------------------------------------------------------------
 function check_data()
 {
-       global $Refs, $SysPrefs;
+       global $SysPrefs;
        
        if (!is_date($_POST['date']) || date1_greater_date2($_POST['date'], Today()))
        {
index d02cfdb44674ae91b3af932dfc3f6eecb69becd8..512887816bec2fcb1bc6c5bfc4639e851c595143 100644 (file)
@@ -116,7 +116,6 @@ table_header($th);
 $k = 0;
 while ($myrow = db_fetch($result)) 
 {
-
        alt_table_row_color($k);
 
        label_cell($myrow["cid"]);
index 04f80c62305784dd4b954488eef35fb5792ee112..0a1791bc97efd5d18ef09d24c2a9202c9772243e 100644 (file)
@@ -44,7 +44,6 @@ function can_process($selected_id)
                return false;
        }
 
-       //if (strcmp($_POST['id'], $_POST['parent']) == 0) 
        if ($_POST['id'] === $_POST['parent']) 
        {
                display_error(_("You cannot set an account group to be a subgroup of itself."));
index f01414186402930604d8708593b583718a63de03..1dae7eeda932ef74c57889866f7b394691ff2f4c 100644 (file)
@@ -46,8 +46,6 @@ if (isset($_GET['AddedID']))
 //---------------------------------------------------------------------------------------------
 function check_data()
 {
-       global $Refs;
-       
        if (!is_date($_POST['date']))
        {
                display_error( _("The entered date is invalid."));
index ab5d08f671abd880c79ff5f7642714748102fd6e..72dda431ea540aac26c3fcc73a566a8c679a65b4 100644 (file)
@@ -52,7 +52,7 @@ $dim = get_company_pref('use_dimension');
 $first_cols = array(_("Type"), "#", _("Date"));
 if ($dim == 2)
        $dim_cols = array(_("Dimension")." 1", _("Dimension")." 2");
-else if ($dim == 1)
+elseif ($dim == 1)
        $dim_cols = array(_("Dimension"));
 else
        $dim_cols = array();
index 049ecdfc0dd93086dbd3051126e0e7434e010ef1..767c790c220c86421a618fb4956dc5b993f0f421 100644 (file)
@@ -103,7 +103,7 @@ else
     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
index 65587407b80f2b8ed90b8db108734212407e05e7..25f9668bae12f804765dcc09a6afe8df569f6a06 100644 (file)
@@ -102,7 +102,7 @@ else
     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
index 38ba7f265885c9b291f13f7b7631572dbea35ea9..0cda61603cf25c2449207bf6ba7f342c330d845e 100644 (file)
@@ -94,7 +94,7 @@ $dim = get_company_pref('use_dimension');
 if ($dim == 2)
        $th = array(_("Journal Date"), _("Account Code"), _("Account Name"), _("Dimension")." 1", _("Dimension")." 2",
                _("Debit"), _("Credit"), _("Memo"));
-else if ($dim == 1)
+elseif ($dim == 1)
        $th = array(_("Journal Date"), _("Account Code"), _("Account Name"), _("Dimension"),
                _("Debit"), _("Credit"), _("Memo"));
 else           
index fc3d48df8e4e4b87d3ef9521e7301e749c9cb823..aee33a6dceef5d69f7fe62a0b3368a8b1f4c1319 100644 (file)
@@ -53,26 +53,26 @@ define('SS_GL',             62<<8);
 define('SS_GL_A',      63<<8);
 
 $security_sections = array(
- SS_SADMIN => _("System administration"),
- SS_SETUP => _("Company setup"),
- SS_SPEC => _("Special maintenance"),
- SS_SALES_C => _("Sales configuration"),
- SS_SALES => _("Sales transactions"),
- SS_SALES_A => _("Sales related reports"),
- SS_PURCH_C => _("Purchase configuration"),
- SS_PURCH => _("Purchase transactions"),
- SS_PURCH_A => _("Purchase analytics"),
- SS_ITEMS_C => _("Inventory configuration"),
- SS_ITEMS => _("Inventory operations"),
- SS_ITEMS_A => _("Inventory analytics"),
- SS_MANUF_C => _("Manufacturing configuration"),
- SS_MANUF => _("Manufacturing transactions"),
- SS_MANUF_A => _("Manufacturing analytics"),
- SS_DIM_C => _("Dimensions configuration"),
- SS_DIM => _("Dimensions"),
- SS_GL_C => _("Banking & GL configuration"),
- SS_GL => _("Banking & GL transactions"),
- SS_GL_A => _("Banking & GL analytics")
      SS_SADMIN => _("System administration"),
      SS_SETUP => _("Company setup"),
      SS_SPEC => _("Special maintenance"),
      SS_SALES_C => _("Sales configuration"),
      SS_SALES => _("Sales transactions"),
      SS_SALES_A => _("Sales related reports"),
      SS_PURCH_C => _("Purchase configuration"),
      SS_PURCH => _("Purchase transactions"),
      SS_PURCH_A => _("Purchase analytics"),
      SS_ITEMS_C => _("Inventory configuration"),
      SS_ITEMS => _("Inventory operations"),
      SS_ITEMS_A => _("Inventory analytics"),
      SS_MANUF_C => _("Manufacturing configuration"),
      SS_MANUF => _("Manufacturing transactions"),
      SS_MANUF_A => _("Manufacturing analytics"),
      SS_DIM_C => _("Dimensions configuration"),
      SS_DIM => _("Dimensions"),
      SS_GL_C => _("Banking & GL configuration"),
      SS_GL => _("Banking & GL transactions"),
      SS_GL_A => _("Banking & GL analytics")
 );
 
 /*
@@ -297,23 +297,6 @@ function add_access_extensions()
                }
        }
 }
-/*
-       Helper function to retrieve extension access definitions in isolated environment.
-*/
-/*
-function get_access_extensions($id) {
-       global $path_to_root, $installed_extensions;
-       
-       $ext = $installed_extensions[$id];
-       
-       $security_sections = $security_areas = array();
-       
-       if (isset($ext['acc_file']))
-               include_once($path_to_root.'/'.$ext['path'].'/'.$ext['acc_file']);
-
-       return array($security_areas, $security_sections);
-}
-*/
 
 function check_edit_access($name)
 {
index f71aaf47c987b2773af02ce0dd0e9ff506e39974..220c008432f86311e84f0216cb44bb01b72a244a 100644 (file)
@@ -98,52 +98,37 @@ class Ajax extends JsHttpRequest {
        //
        function _addCommand($trigger, $aAttributes, $mData)
        {
-         if ($this->isActive() && ($trigger !== false)) {
-//             display_error('adding '.$trigger.':'.htmlentities($mData));
+               if ($this->isActive() && ($trigger !== false)) {
 
-               $aAttributes['why'] = $trigger;
-               $aAttributes['data'] = $mData;
-               $this->aCommands[] = $aAttributes;
-         }
+                       $aAttributes['why'] = $trigger;
+                       $aAttributes['data'] = $mData;
+                       $this->aCommands[] = $aAttributes;
+               }
        }
-       /*
-       * Register binds function with ajax call parameter
-       
-       function register($trigger, $function) 
+
+       function run() 
        {
-           if (isset($_REQUEST[$trigger])) {
-               $function(&$this);
-           }
-       }
-       */
-       function run() {
-           
            if (!$this->isActive()) return;
 
                // remove not active commands
                foreach ($this->aCommands as $idx => $com) {
 // If we should reload whole page content ignore all commands but the update.
 // This is page repost equivalent, although header and footer are not reloaded.
-                 if ($com['why'] !== true && !isset($this->triggers[$com['why']])) {
-                       unset($this->aCommands[$idx]);
-//                     display_error('unset '.$com['t']);
-                 }
-                 else
-                 if($com['n'] == 'up' && $com['t'] == '_page_body') {
-                         $cmds = array($com);
-                         foreach( $this->aCommands as $k=> $cmd) {
-                               if ($cmd['n'] == 'fc' || $cmd['n'] == 'js') {   // save focus
-                                       $cmds[] = $cmd; //break;
-                               }
-                         }
-                         $this->aCommands = $cmds;
-                         break;
-                 }
+                       if ($com['why'] !== true && !isset($this->triggers[$com['why']])) {
+                               unset($this->aCommands[$idx]);
+                       }
+                       elseif($com['n'] == 'up' && $com['t'] == '_page_body') {
+                               $cmds = array($com);
+                               foreach( $this->aCommands as $k=> $cmd) {
+                                       if ($cmd['n'] == 'fc' || $cmd['n'] == 'js') {   // save focus
+                                               $cmds[] = $cmd; //break;
+                                       }
+                               }
+                               $this->aCommands = $cmds;
+                               break;
+                       }
                }
-//             display_error('Activate:'.htmlentities(print_r($this->triggers, true)));
-//             display_error('Commands :'.htmlentities(print_r($this->aCommands, true)));
            $GLOBALS['_RESULT'] = $this->aCommands;
-//         exit();
        }
 }
 
index 62d729b628963c11f352412f549b42faa7f886bd..9a0ceddeec9969d2d0ca75ba82f0b458019895f0 100644 (file)
@@ -304,7 +304,7 @@ function number_format2($number, $decimals=0)
        global $SysPrefs;
        $tsep = $SysPrefs->thoseps[user_dec_sep()];
        $dsep = $SysPrefs->decseps[user_dec_sep()];
-       //return number_format($number, $decimals, $dsep,       $tsep);
+
        if($decimals==='max')
                $dec = 15 - floor(log10(abs($number)));
        else {
@@ -414,12 +414,12 @@ function user_numeric($input) {
        $num = str_replace( $sep, '.', $num);
 
     if (!is_numeric($num))
-         return false;
+               return false;
     $num = (float)$num;
     if ($num == (int)$num)
-         return (int)$num;
+               return (int)$num;
     else
-         return $num;
+               return $num;
 }
 
 function user_company()
index aa30740fb869ae5c19228c94398f04e8d889b63a..56e36a0ae9d95650b05c7c8f7cae3ff2328067c5 100644 (file)
@@ -33,7 +33,7 @@ function set_global_connection($company=-1)
        ///// This non empty sql_mode values can interphere with FA, so all is set empty during
        ///// our sessions.
        ///// We are, however, investigating the existing code to be compatible in the future.
-               db_query("SET sql_mode = '".SQL_MODE."'");
+       db_query("SET sql_mode = '".SQL_MODE."'");
        /////
        $SysPrefs->refresh();
        return $db;
index 30e3f6c77e455e4c5a64eba0b4719bffcd38da6f..897316d698e22e56c9dcfc8e3257971c555d81a1 100644 (file)
@@ -36,7 +36,7 @@ function set_global_connection($company=-1)
        ///// This non empty sql_mode values can interphere with FA, so all is set empty during
        ///// our sessions.
        ///// We are, however, investigating the existing code to be compatible in the future.
-               db_query("SET sql_mode = '".SQL_MODE."'");
+       db_query("SET sql_mode = '".SQL_MODE."'");
        /////
        $SysPrefs->refresh();
        return $db;
index 8adddc696142f8fe850a355c15396904d0eac473..0a4035f0ab2144a9b36321c41634ecaad5751367 100644 (file)
@@ -50,7 +50,7 @@ function load_stock_levels($location)
        return $qoh_stock;
 }
 
-// recursion fixed by Tom Moulton. Max 10 recursion levels.
+// recursion fixed. Max 10 recursion levels.
 function stock_demand_manufacture($stock_id, $qty, $demand_id, $location, $level=0) 
 {
        global $bom_list, $qoh_stock;
index 70243392f75e53096ca1c1de63af72fa901c30fc..ff31c1df97ab4960b8945fa460ea58eedb9a5d15 100644 (file)
@@ -119,11 +119,6 @@ class db_pager {
                                        }
                        }
                }
-               //_vd($this->select);
-               //_vd($this->from);
-               //_vd($this->where);
-               //_vd($this->group);
-               //_vd($this->order);
        }
        //
        //      Set additional constraint on record set
@@ -193,22 +188,22 @@ class db_pager {
            if ($result) {
                // setting field names for subsequent queries
                        $c = 0;
-                 // add result field names to column defs for 
-                 // col value retrieve and sort purposes 
-                  $cnt = min(db_num_fields($result), count($this->columns));
+                       // add result field names to column defs for 
+                       // col value retrieve and sort purposes 
+                       $cnt = min(db_num_fields($result), count($this->columns));
                        for ($c = $i = 0; $c < $cnt; $c++) {
                                if (!(isset($this->columns[$c]['insert']) && $this->columns[$c]['insert'])) {
 //                                     if (!@($this->columns[$c]['type']=='skip'))
                                                $this->columns[$c]['name']= db_field_name($result, $i);
                                        if (!@($this->columns[$c]['type']=='insert'))
-                                       $i++;
-                                       }
+                                               $i++;
+                               }
                        }
                        while ($row = db_fetch_assoc($result)) {
                                $this->data[] = $row;
                        }
                } else 
-                 return false;
+                       return false;
                return true;
        }
        //
@@ -217,29 +212,29 @@ class db_pager {
        function set_page($to) 
        {
            switch($to) {
-               case 'next':
-                   $page = $this->curr_page+1; break;
-               case 'prev':
-                   $page = $this->curr_page-1; break;
-               case 'last':
-                   $page = $this->last_page; break;
-               default:
-                   if (is_numeric($to)) {
-                        $page = $to; break;
-                   }
-               case 'first':
-                   $page = 1; break;
+                       case 'next':
+                           $page = $this->curr_page+1; break;
+                       case 'prev':
+                           $page = $this->curr_page-1; break;
+                       case 'last':
+                           $page = $this->last_page; break;
+                       default:
+                           if (is_numeric($to)) {
+                                       $page = $to; break;
+                           }
+                       case 'first':
+                           $page = 1; break;
            }
-         if ($page < 1) 
-           $page = 1;
-         $max = $this->max_page;
-         if ($page > $max) 
-           $page = $max;
-         $this->curr_page = $page;
-         $this->next_page = ($page < $max) ? $page+1 : null;
-         $this->prev_page = ($page > 1) ? ($page-1) : null;
-         $this->last_page = ($page < $max) ? $max : null;
-         $this->first_page = ($page != 1) ? 1: null;
+               if ($page < 1) 
+               $page = 1;
+               $max = $this->max_page;
+               if ($page > $max) 
+               $page = $max;
+               $this->curr_page = $page;
+               $this->next_page = ($page < $max) ? $page+1 : null;
+               $this->prev_page = ($page > 1) ? ($page-1) : null;
+               $this->last_page = ($page < $max) ? $max : null;
+               $this->first_page = ($page != 1) ? 1: null;
        }
        //
        //      Set column definitions
@@ -252,8 +247,8 @@ class db_pager {
                }
                foreach ($flds as $colnum=>$coldef) {
                        if (is_string($colnum)) {       // 'colname'=>params
-                         $h = $colnum;
-                         $c = $coldef;
+                               $h = $colnum;
+                               $c = $coldef;
                        } else {                        //  n=>params
                                if (is_array($coldef)) {
                                        $h = '';
@@ -264,10 +259,10 @@ class db_pager {
                                }
                        }
                        if (is_string($c))                      // params is simple column type
-                         $c = array('type'=>$c);
+                               $c = array('type'=>$c);
 
                        if (!isset($c['type']))
-                         $c['type'] = 'text';
+                               $c['type'] = 'text';
 
                        switch($c['type']) {
                                case 'inactive': 
@@ -307,12 +302,12 @@ class db_pager {
                if ($group) $sql.= " GROUP BY $group";
            $ord = array();
 
-                       // sort order column by priority instead of table order.
-                       $columns = array();
+               // sort order column by priority instead of table order.
+               $columns = array();
            foreach ($this->columns as $col) {
-                                       if(isset($col['ord_priority'])) {
-                                               $columns[$col['ord_priority']] = $col;
-                                       }
+                       if(isset($col['ord_priority'])) {
+                               $columns[$col['ord_priority']] = $col;
+                       }
                }
                krsort($columns);
 
@@ -435,9 +430,6 @@ class db_pager {
        function inactive_control_cell(&$row)
        {
                if ($this->inactive_ctrl) {
-//                     return inactive_control_cell($row[$this->inactive_ctrl['key']],
-//                              $row['inactive'], $this->inactive_ctrl['table'], 
-//                              $this->inactive_ctrl['key']);
                                 
                        global  $Ajax;
 
index 937270eac3f4c5149371710f5f8ba9cdd48b8458..2a1aedd9f9138afdd4ab5bd79c37fa67fbe1191a 100644 (file)
@@ -93,46 +93,45 @@ function error_handler($errno, $errstr, $file, $line) {
 function fmt_errors($center=false) {
     global $messages, $path_to_root, $SysPrefs;
 
-  $msg_class = array(
-       E_USER_ERROR => 'err_msg',
-       E_USER_WARNING =>'warn_msg', 
-       E_USER_NOTICE => 'note_msg');
-
-  $type = E_USER_NOTICE;
-  $content = '';
-//  $class = 'no_msg';
-  if (count($messages)) {
-       foreach($messages as $cnt=>$msg) {
-               if ($SysPrefs->go_debug && $msg[0]>E_USER_NOTICE)
-                       $msg[0] = E_ERROR;
-
-               if ($msg[0]>$type) continue;
-
-               if ($msg[0]<$type) { 
-                       if ($msg[0] == E_USER_WARNING) {
-                               $type = E_USER_WARNING; // user warnings 
-                               $content = '';                  // clean notices when we have errors
-                       } else  {
-                               $type = E_USER_ERROR;   // php or user errors 
-                               if($type == E_USER_WARNING)
-                                       $content = '';                  // clean other messages
+       $msg_class = array(
+               E_USER_ERROR => 'err_msg',
+               E_USER_WARNING =>'warn_msg', 
+               E_USER_NOTICE => 'note_msg');
+
+       $type = E_USER_NOTICE;
+       $content = '';
+
+       if (count($messages)) {
+               foreach($messages as $cnt=>$msg) {
+                       if ($SysPrefs->go_debug && $msg[0]>E_USER_NOTICE)
+                               $msg[0] = E_ERROR;
+
+                       if ($msg[0]>$type) continue;
+
+                       if ($msg[0]<$type) { 
+                               if ($msg[0] == E_USER_WARNING) {
+                                       $type = E_USER_WARNING; // user warnings 
+                                       $content = '';                  // clean notices when we have errors
+                               } else  {
+                                       $type = E_USER_ERROR;   // php or user errors 
+                                       if($type == E_USER_WARNING)
+                                               $content = '';                  // clean other messages
+                               }
                        }
-               }
 
-           $str = $msg[1];
-               if (!in_array($msg[0], array(E_USER_NOTICE, E_USER_ERROR, E_USER_WARNING)) && $msg[2] != null)
-                 $str .= ' '._('in file').': '.$msg[2].' '._('at line ').$msg[3];
+               $str = $msg[1];
+                       if (!in_array($msg[0], array(E_USER_NOTICE, E_USER_ERROR, E_USER_WARNING)) && $msg[2] != null)
+                               $str .= ' '._('in file').': '.$msg[2].' '._('at line ').$msg[3];
 
-               if ($SysPrefs->go_debug>1 && $type!=E_USER_NOTICE && $type!=E_USER_WARNING)
-                 $str .= '<br>'.$msg[4];
-               $content .= ($cnt ? '<hr>' : '').$str;
-       }
-       $class = $msg_class[$type];
-    $content = "<div class='$class'>$content</div>";
-  } else
-  if ($path_to_root=='.')
-       return '';
-  return $content;
+                       if ($SysPrefs->go_debug>1 && $type!=E_USER_NOTICE && $type!=E_USER_WARNING)
+                               $str .= '<br>'.$msg[4];
+                       $content .= ($cnt ? '<hr>' : '').$str;
+               }
+               $class = $msg_class[$type];
+       $content = "<div class='$class'>$content</div>";
+       } elseif ($path_to_root=='.')
+               return '';
+       return $content;
 }
 //-----------------------------------------------------------------------------
 // Error box <div> element.
@@ -142,7 +141,7 @@ function error_box() {
     
     echo "<div id='msgbox'>";
 
-// Necessary restart instead of get_contents/clean calls due to a bug in php 4.3.2
+       // Necessary restart instead of get_contents/clean calls due to a bug in php 4.3.2
        $before_box = ob_get_clean(); // save html content before error box 
     ob_start('output_html');
     echo "</div>";
@@ -173,7 +172,6 @@ function display_db_error($msg, $sql_statement=null, $exit=true)
        $warning = $msg==null;
        $db_error = db_error_no();
        
-//     $str = "<span class='errortext'><b>" . _("DATABASE ERROR :") . "</b> $msg</span><br>";
        if($warning)
                $str = "<b>" . _("Debug mode database warning:") . "</b><br>";
        else
@@ -190,7 +188,6 @@ function display_db_error($msg, $sql_statement=null, $exit=true)
                $cur_prefix = $db_connections[$_SESSION["wa_current_user"]->cur_con]['tbpref'];
 
                $str .= "sql that failed was : ".str_replace(TB_PREF, $cur_prefix, $sql_statement)."<br>";
-//             if ($SysPrefs->go_debug > 1) display_backtrace();
        }
        
        $str .= "<br><br>";
@@ -226,12 +223,12 @@ function check_db_error($msg, $sql_statement, $exit_if_error=true, $rollback_if_
        {
                
                if ($SysPrefs->go_debug || !frindly_db_error($db_error)) {
-                               display_db_error($msg, $sql_statement, false);
+                       display_db_error($msg, $sql_statement, false);
                }
                
                if ($rollback_if_error) 
                {
-                 $rollback_result = db_query("rollback");
+                       $rollback_result = db_query("rollback");
                }
                
                if ($exit_if_error) 
index cb5cddfa9db3e604635b80a3ab52023cb0dd3cbb..6c6dda32bdc2a3e5922f44884f8b8b59e0a09931 100644 (file)
@@ -203,9 +203,9 @@ class hooks {
         * more than one in  the cart.
         */
        /* Default behavior check if there is enough quantity on hand and change the css
- * class if needed */
       * class if needed */
        static function  default_get_dispatchable_quantity($line_item, $location, $date, $qoh) {
-    global $SysPrefs;
+       global $SysPrefs;
 
                if ($SysPrefs->allow_negative_stock() || ($line_item->qty_dispatched <= $qoh)) {
                        return true;
@@ -237,10 +237,10 @@ function install_hooks()
        }
        // install hooks provided by active extensions
        foreach($installed_extensions as $ext) {
-                       $hook_class = 'hooks_'.$ext['package'];
-                       if ($ext['active'] && class_exists($hook_class)) {
-                               $Hooks[$ext['package']] = new $hook_class;
-                       }
+               $hook_class = 'hooks_'.$ext['package'];
+               if ($ext['active'] && class_exists($hook_class)) {
+                       $Hooks[$ext['package']] = new $hook_class;
+               }
        }
 }
 /*
index cabd60991c180baf5afa5802624e28fc31668f95..9f1a8381739f3cd9203784cab32f234a0b2c0598 100644 (file)
@@ -20,8 +20,6 @@
 //  Authors: Laurent Bedubourg <laurent.bedubourg@free.fr>
 //  
 
-//require_once "PEAR.php";
-
 define('GETTEXT_NATIVE', 1);
 define('GETTEXT_PHP', 2);
 
@@ -72,9 +70,6 @@ class gettext_native_support
         putenv("LC_ALL=$lang_code");
         putenv("LANGUAGE=$lang_code");
 
-        //$set = setlocale(LC_ALL, "$lang_code");
-        //$set = setlocale(LC_ALL, "$encoding");
-
                // cover a couple of country/encoding variants 
                $up = strtoupper($encoding);
                $low = strtolower($encoding);
@@ -95,11 +90,8 @@ class gettext_native_support
                                return 0;
             $str = sprintf('language code "%s", encoding "%s" not supported by your system',
                 $lang_code, $encoding);
-            //$err = new GetText_Error($str);
-            //return PEAR::raise_error($err);
                        return raise_error("1 " . $str);
         }
-               //return 0;
     }
     /**
         *      Check system support for given language nedded for gettext.
@@ -193,8 +185,6 @@ class gettext_native_support
        $value = $this->_get_translation($key);
         if ($value === false) {
             $str = sprintf('Unable to locate gettext key "%s"', $key);
-            //$err = new GetText_Error($str);
-            //return PEAR::raise_error($err);
                        return raise_error("2 " . $str);
         }
         
@@ -276,9 +266,6 @@ class gettext_php_support extends gettext_native_support
             list($domain, $path) = array_shift($this->_jobs);
             $err = $this->add_domain($domain, $path);
             // error raised, break jobs
-            /*if (PEAR::is_error($err)) {
-                return $err;
-            }*/
                        if (is_error($err)) 
                        {
                 return $err;
@@ -352,8 +339,6 @@ class gettext_php_support extends gettext_native_support
         if (!file_exists($src_domain)) 
         {
             $str = sprintf('Domain file "%s" not found.', $src_domain);
-            //$err = new GetText_Error($str);
-            //return PEAR::raise_error($err);
                        return raise_error("4 " . $str);
         }
         
@@ -370,9 +355,6 @@ class gettext_php_support extends gettext_native_support
             {
                 $comp = new gettext_php_support_compiler();
                 $err  = $comp->compile($hash, $src_domain);
-                /*if (PEAR::is_error($err)) { 
-                    return $err; 
-                }*/
                        if (is_error($err)) 
                        {
                     return $err;
@@ -454,8 +436,6 @@ class gettext_php_support_parser
         if (!file_exists($file)) 
         {
             $str = sprintf('Unable to locate file "%s"', $file);
-            //$err = new GetText_Error($str);
-            //return PEAR::raise_error($err);
                        return raise_error($str);
         }
         $i = 0;
@@ -530,8 +510,6 @@ class gettext_php_support_compiler
         if (!$fp) 
         {
             $str = sprintf('Unable to open "%s" in write mode.', $dest_path);
-            //$err = new GetText_Error($str);
-            //return PEAR::raise_error($err);
                        return raise_error($str);
         }
         fwrite($fp, '<?php' . "\n");
index 2dc7bd3e46a87ac931ee5eede02ba604b7c45b58..855cb97a92fd1e6ff58950133697df888dd5f5ca 100644 (file)
@@ -671,12 +671,6 @@ function install_extension($pkg_name)
                                'active' => @$pkg['DefaultStatus'] == 'active' ? true : false,
                                'path' => $pkg['InstallPath'],
                        );
-//                     if (isset($pkg['MenuTabs']))
-//                             $ext['tabs'] = $pkg['MenuTabs'];
-//                     if (isset($pkg['MenuEntries']))
-//                             $ext['entries'] = $pkg['MenuEntries'];
-//                     if (isset($pkg['AccessExtensions']))
-//                             $ext['acc_file'] = $pkg['AccessExtensions'];
                        if (isset($pkg['SqlScript']))
                                $ext['sql'] = $pkg['SqlScript'];
 
index 3661c7cf7b1240de475bead083d6fcbfb1bcd170..793adc030678f06265548dc5768dde38a5810a45 100644 (file)
@@ -78,11 +78,6 @@ function page_header($title, $no_menu=false, $is_index=false, $onload="", $js=""
        if (in_ajax())
                return; // just for speed up
 
-//     $jsext = substr_replace($_SERVER['PHP_SELF'], '.js', -4);
-
-//     if (file_exists($_SERVER['DOCUMENT_ROOT'].$jsext))
-//             add_js_ufile($jsext);
-
        $theme = user_theme();
 
        if ($SysPrefs->help_base_url != null && $SysPrefs->use_popup_windows && $js == '')
@@ -94,7 +89,7 @@ function page_header($title, $no_menu=false, $is_index=false, $onload="", $js=""
                add_js_source(get_js_open_window(900, 500));
        }
        if ($js!='')
-         add_js_source($js);
+               add_js_source($js);
 
        if (!isset($no_menu))
        {
index e2a7fca2f2e65f1bcb11684265e942697bb22e33..3ec67df1be0134276def5c0b1ad0f0539f5478a0 100644 (file)
@@ -148,12 +148,12 @@ function password_reset_fail()
 {
        global $path_to_root;
        
-  echo "<center><br><br><font size='5' color='red'><b>" . _("Incorrect Email") . "<b></font><br><br>";
-  echo "<b>" . _("The email address does not exist in the system, or is used by more than one user.") . "<b><br><br>";
+       echo "<center><br><br><font size='5' color='red'><b>" . _("Incorrect Email") . "<b></font><br><br>";
+       echo "<b>" . _("The email address does not exist in the system, or is used by more than one user.") . "<b><br><br>";
 
-  echo _("Plase try again or contact your system administrator to obtain new password.");
-  echo "<br><a href='$path_to_root/index.php?reset=1'>" . _("Try again") . "</a>";
-  echo "</center>";
+       echo _("Plase try again or contact your system administrator to obtain new password.");
+       echo "<br><a href='$path_to_root/index.php?reset=1'>" . _("Try again") . "</a>";
+       echo "</center>";
 
        kill_login();
        die();
@@ -163,11 +163,11 @@ function password_reset_success()
 {
        global $path_to_root;
 
-  echo "<center><br><br><font size='5' color='green'><b>" . _("New password sent") . "<b></font><br><br>";
-  echo "<b>" . _("A new password has been sent to your mailbox.") . "<b><br><br>";
+       echo "<center><br><br><font size='5' color='green'><b>" . _("New password sent") . "<b></font><br><br>";
+       echo "<b>" . _("A new password has been sent to your mailbox.") . "<b><br><br>";
 
-  echo "<br><a href='$path_to_root/index.php'>" . _("Login here") . "</a>";
-  echo "</center>";
+       echo "<br><a href='$path_to_root/index.php'>" . _("Login here") . "</a>";
+       echo "</center>";
        
        kill_login();
        die();
index e1206bcf59f5f33c062afe1e6108bca38d1fb669..b3d4c71aa3bb19b8b180403bce388854baf9e709 100644 (file)
@@ -131,8 +131,6 @@ function payment_person_name($type, $person_id, $full=true) {
                case PT_SUPPLIER :
                        return ($full ? $payment_person_types[$type] . " ":"") . sprintf("[%05s] %s", $person_id, get_supplier_name($person_id));
                default :
-                       //DisplayDBerror("Invalid type sent to person_name");
-                       //return;
                        return '';
        }
 }
index 954209a6b0ff64dc0eb354ff9ae344045b027e4a..4519db73e5af4f57231f119345d94f7d2d4f6b98 100644 (file)
@@ -278,15 +278,14 @@ function show_allocatable($show_totals) {
 
        global $systypes_array;
        
-    $k = $counter = $total_allocated = 0;
+    $k = $total_allocated = 0;
 
        $cart = $_SESSION['alloc'];
        $supp_ref = in_array($cart->type, array(ST_SUPPCREDIT, ST_SUPPAYMENT, ST_BANKPAYMENT));
 
        if (count($cart->allocs)) 
        {
-//             if ($cart->currency != $cart->person_curr)
-                       display_heading(sprintf(_("Allocated amounts in %s:"), $cart->person_curr));
+               display_heading(sprintf(_("Allocated amounts in %s:"), $cart->person_curr));
                start_table(TABLESTYLE, "width='60%'");
                $th = array(_("Transaction Type"), _("#"), $supp_ref ? _("Supplier Ref"): _("Ref"), _("Date"), _("Due Date"), _("Amount"),
                        _("Other Allocations"), _("Left to Allocate"), _("This Allocation"),'','');
@@ -324,15 +323,7 @@ function show_allocatable($show_totals) {
                if ($show_totals) {
                label_row(_("Total Allocated"), price_format($total_allocated),
                        "colspan=8 align=right", "align=right id='total_allocated'", 3);
-/*
-                       $amount = $_SESSION['alloc']->amount;
 
-                       if ($_SESSION['alloc']->type == ST_SUPPCREDIT
-                               || $_SESSION['alloc']->type == ST_SUPPAYMENT
-                               ||  $_SESSION['alloc']->type == ST_BANKPAYMENT || 
-                               ($_SESSION['alloc']->type == ST_JOURNAL && $_SESSION['alloc']->person_type == PT_SUPPLIER))
-                               $amount = -$amount;
-*/
                        $amount = abs($cart->amount);
 
                        if (floatcmp($amount, $total_allocated) < 0)
@@ -384,13 +375,7 @@ function check_allocations()
 
                 $total_allocated += input_num('amount' . $counter);
        }
-/*
-       $amount = $_SESSION['alloc']->amount;
 
-       if (in_array($_SESSION['alloc']->type, array(ST_BANKPAYMENT, ST_SUPPCREDIT, ST_SUPPAYMENT)) || 
-               ($_SESSION['alloc']->type==ST_JOURNAL && $_SESSION['alloc']->person_type == PT_SUPPLIER))
-               $amount = -$amount;
-*/
        $amount = abs($_SESSION['alloc']->amount);
 
        if ($total_allocated - ($amount + input_num('discount'))  > $SysPrefs->allocation_settled_allowance())
index 46b4d4dc00b9d709053f88fe77b7055ae306cc42..5871e489b462f61079d1d052a4eb187c1351ff7f 100644 (file)
@@ -30,7 +30,7 @@ class fa_reflines extends simple_crud_view {
 
        function list_view($Mode)
        {
-               global $Ajax, $systypes_array;
+               global $systypes_array;
 
                start_table(TABLESTYLE);
 
index bd25e2820e5003bfbbf51b3bf8f8dd8710c3d3f3..d27b8faa06bf996284397ea5b4168e2d65ac2ca0 100644 (file)
@@ -35,13 +35,11 @@ class contacts extends simple_crud {
                br();
 
                        $contacts = get_crm_persons($this->class, $this->subclass, $this->entity);
-//                             check_value('show_inactive'));
                        start_table(TABLESTYLE, "width='80%'");
 
                        $th = array(_('Assignment'), _("Reference"), _("Full Name"), _("Phone"), _("Sec Phone"), _("Fax"),
                                _("email"),  '',
                                "&nbsp;");
-               //      inactive_control_column($th);
 
                        table_header($th);
                        $k = 0; 
@@ -59,11 +57,10 @@ class contacts extends simple_crud {
                                        label_cell($last["phone2"]);
                                        label_cell($last["fax"]);
                                        email_cell($last["email"]);
-               //      inactive_control_cell($myrow["id"], $myrow["inactive"], 'crm_contacts', 'id');
 
                                        edit_button_cell("{$this->name}Edit[{$last['id']}]", _("Edit"));
 
-                       // delete button removes only category unless this is the last contact for this person
+                                       // delete button removes only category unless this is the last contact for this person
                                        delete_button_cell("{$this->name}Delete[{$last['id']}]", _("Delete"));
                                        end_row();
                                        $description = array();
@@ -76,7 +73,7 @@ class contacts extends simple_crud {
                                }
                        }
 
-//inactive_control_row($th);
+                       //inactive_control_row($th);
                        end_table(1);
        }
        
index bb6574bef14ffbe24d0074bb5356435aa3893890..28c2b38d4a0ef6b3412a463350b525b5ca461ad8 100644 (file)
@@ -132,7 +132,6 @@ function display_db_pager(&$pager) {
                                if(get_post('show_inactive'))
                                        $pager->inactive_control_cell($row); break;
                    default:
-//                 case 'text':
                          if (isset( $col['align']))
                                  label_cell($cell, "align='" . $col['align'] . "'");
                          else
@@ -188,7 +187,7 @@ function display_db_pager(&$pager) {
                echo $inact;
                echo "</td>";
        } else {
-         label_cell( _('No records') . $inact, "colspan=$colspan class='navibar'");
+               label_cell( _('No records') . $inact, "colspan=$colspan class='navibar'");
        }
 
        end_row();
index f517edd973ce3241dd10107d1c66442f770d9047..1b61f5a1e59da0e79187e723a1a4254adc48f203 100644 (file)
@@ -379,8 +379,7 @@ class items_cart
                                // do not post exchange variations to AR/AP (journal in not customer/supplier currency)
                        if ($gl->person_type_id==PT_SUPPLIER && (get_supplier_currency($gl->person_id) == $this->currency || $this->currency != $home_currency))
                                        $supp_trans[$gl->person_id] = @$supp_trans[$gl->person_id] + $gl->amount;
-                       else
-                       if ($gl->person_type_id==PT_CUSTOMER && (get_customer_currency(null, $gl->branch_id) == $this->currency || $this->currency != $home_currency))
+                       elseif ($gl->person_type_id==PT_CUSTOMER && (get_customer_currency(null, $gl->branch_id) == $this->currency || $this->currency != $home_currency))
                                        $cust_trans[$gl->branch_id] = @$cust_trans[$gl->branch_id] + $gl->amount;
                }
 
index daf93321989c0225d5c76e627ea28476b5790519..05d9280135e9e57a67509edc11475da0a0d5b5bc 100644 (file)
@@ -106,8 +106,6 @@ class simple_crud {
        {
                global $Ajax;
 
-               $sel_name = $this->name.'_id';
-
                // list controls lookup
                foreach (array_keys($this->pre_handlers) as $m) {
                        if (isset($_POST[$this->name.$m])) {
@@ -211,9 +209,9 @@ class simple_crud {
                if ($async === 'both') {
                        $async = 'default'; $cancel = 'cancel';
                } 
-               else if ($async === 'default')
+               elseif ($async === 'default')
                        $cancel = true;
-               else if ($async === 'cancel')
+               elseif ($async === 'cancel')
                        $async = true;
                echo "<center>";
 
index b3107a1d59b7b4088d122d4eaf798d452db30966..54712f9c8ab76bb2f902943be21b14476abaa043 100644 (file)
@@ -134,7 +134,6 @@ function table_section($number=1, $width=false)
                echo "</table>\n";
                output_hidden();
                $width = ($width ? "width='$width'" : "");
-               //echo "</td><td class='tableseparator' $width>\n"; // outer table
                echo "</td><td style='border-left:1px solid #cccccc;' $width>\n"; // outer table
        }
        echo "<table class='tablestyle_inner'>\n";
index aa57475ccd8d474ec2d602140e285a6b259c283e..feb136ffdfd64600bec9a97aa1abf9a9374c71fb 100644 (file)
@@ -215,9 +215,9 @@ function submit_add_or_update($add=true, $title=false, $async=false, $clone=fals
        elseif ($async === 'upgrade') {
                $async = 'default nonajax process'; $cancel = 'cancel';
        }
-       else if ($async === 'default')
+       elseif ($async === 'default')
                $cancel = true;
-       else if ($async === 'cancel')
+       elseif ($async === 'cancel')
                $async = true;
        
        if ($add)
@@ -928,26 +928,6 @@ function textarea_row($label, $name, $value, $cols, $rows, $title=null, $params=
        echo "</tr>\n";
 }
 
-//-----------------------------------------------------------------------------------
-/*
-function text_row_with_submit($label, $name, $value, $size, $max, $input_name, $input_value)
-{
-       global $Ajax;
-
-       default_focus($name);
-       echo "<tr><td>$label</td>\n";
-       echo "<td>";
-
-       if ($value == null)
-               $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
-       echo "<input type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"$value\">   ";
-
-       submit($input_name, $input_value);
-
-       echo "</td></tr>\n";
-       $Ajax->addUpdate($name, $name, $value);
-}
-*/
 //-----------------------------------------------------------------------------------
 //
 //     When show_inactive page option is set 
index d108986fe46e84c4939cdf888bc2a41a7234f7f5..4fc34b919a9acbacdef88bcbc72d1479b4608b21 100644 (file)
@@ -180,8 +180,6 @@ $opts = array(              // default options
        $found = false;
        $lastcat = null;
        $edit = false;
-//if($name=='stock_id')        display_notification('<pre>'.print_r($_POST, true).'</pre>');
-//if($name=='curr_default') display_notification($opts['search_submit']);
        if($result = db_query($sql)) {
                while ($contact_row = db_fetch($result)) {
                        $value = $contact_row[0];
@@ -229,8 +227,6 @@ $opts = array(              // default options
        if ($spec_option !== false) { // if special option used - add it
                $first_id = $spec_id;
                $first_opt = $spec_option;
-//     }
-//     if($first_id !== false) {
                $sel = $found===false ? 'selected' : '';
                $optclass = @$contact_row['inactive'] ? "class='inactive'" : '';
                $selector = "<option $sel value='$first_id'>$first_opt</option>\n"
@@ -356,19 +352,18 @@ $opts = array(            // default options
        $selector = $first_opt = '';
        $first_id = false;
        $found = false;
-//if($name=='SelectStockFromList') display_error($sql);
-               foreach($items as $value=>$descr) {
-                       $sel = '';
-                       if (in_array((string)$value, $selected_id, true)) {
-                               $sel = 'selected';
-                               $found = $value;
-                       }
-                       if ($first_id === false) {
-                               $first_id = $value;
-                               $first_opt = $descr;
-                       }
-                       $selector .= "<option $sel value='$value'>$descr</option>\n";
+       foreach($items as $value=>$descr) {
+               $sel = '';
+               if (in_array((string)$value, $selected_id, true)) {
+                       $sel = 'selected';
+                       $found = $value;
+               }
+               if ($first_id === false) {
+                       $first_id = $value;
+                       $first_opt = $descr;
                }
+               $selector .= "<option $sel value='$value'>$descr</option>\n";
+       }
 
        if ($first_id!==false) {
                $sel = ($found===$first_id) || ($found===false && ($spec_option===false)) ? "selected='selected'" : '';
@@ -590,12 +585,12 @@ function locations_list($name, $selected_id=null, $all_option=false, $submit_on_
 
        $sql = "SELECT loc_code, location_name, inactive FROM ".TB_PREF."locations";
 
-return combo_input($name, $selected_id, $sql, 'loc_code', 'location_name',
-       array(
-               'spec_option' => $all_option === true ? _("All Locations") : $all_option,
-               'spec_id' => ALL_TEXT,
-               'select_submit'=> $submit_on_change
-       ) );
+       return combo_input($name, $selected_id, $sql, 'loc_code', 'location_name',
+               array(
+                       'spec_option' => $all_option === true ? _("All Locations") : $all_option,
+                       'spec_id' => ALL_TEXT,
+                       'select_submit'=> $submit_on_change
+               ) );
 }
 
 function locations_list_cells($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false)
@@ -620,13 +615,13 @@ function currencies_list($name, $selected_id=null, $submit_on_change=false)
 {
        $sql = "SELECT curr_abrev, currency, inactive FROM ".TB_PREF."currencies";
 
-// default to the company currency
-return combo_input($name, $selected_id, $sql, 'curr_abrev', 'currency',
-       array(
-               'select_submit'=> $submit_on_change,
-               'default' => get_company_currency(),
-               'async' => false                
-       ) );
+       // default to the company currency
+       return combo_input($name, $selected_id, $sql, 'curr_abrev', 'currency',
+               array(
+                       'select_submit'=> $submit_on_change,
+                       'default' => get_company_currency(),
+                       'async' => false                
+               ) );
 }
 
 function currencies_list_cells($label, $name, $selected_id=null, $submit_on_change=false)
@@ -652,16 +647,16 @@ function fiscalyears_list($name, $selected_id=null, $submit_on_change=false)
 
        $sql = "SELECT * FROM ".TB_PREF."fiscal_year";
 
-// default to the company current fiscal year
+       // default to the company current fiscal year
 
-return combo_input($name, $selected_id, $sql, 'id', '',
-       array(
-               'order' => 'begin',
-               'default' => get_company_pref('f_year'),
-               'format' => '_format_fiscalyears',
-               'select_submit'=> $submit_on_change,
-               'async' => false
-       ) );
+       return combo_input($name, $selected_id, $sql, 'id', '',
+               array(
+                       'order' => 'begin',
+                       'default' => get_company_pref('f_year'),
+                       'format' => '_format_fiscalyears',
+                       'select_submit'=> $submit_on_change,
+                       'async' => false
+               ) );
 }
 
 function _format_fiscalyears($row)
@@ -690,14 +685,14 @@ function fiscalyears_list_row($label, $name, $selected_id=null)
 function dimensions_list($name, $selected_id=null, $no_option=false, $showname=' ',
        $submit_on_change=false, $showclosed=false, $showtype=1)
 {
-$sql = "SELECT id, CONCAT(reference,'  ',name) as ref FROM ".TB_PREF."dimensions";
+       $sql = "SELECT id, CONCAT(reference,'  ',name) as ref FROM ".TB_PREF."dimensions";
 
-$options = array(
-       'order' => 'reference',
-       'spec_option'=>$no_option ? $showname : false,
-       'spec_id' => 0,
-       'select_submit'=> $submit_on_change,
-       'async' => false,
+       $options = array(
+               'order' => 'reference',
+               'spec_option'=>$no_option ? $showname : false,
+               'spec_id' => 0,
+               'select_submit'=> $submit_on_change,
+               'async' => false,
        );
 
        if (!$showclosed)
@@ -740,22 +735,22 @@ function stock_items_list($name, $selected_id=null, $all_option=false,
                set_editor('item', $name, $editkey);
 
        $ret = combo_input($name, $selected_id, $sql, 'stock_id', 's.description',
-       array_merge(
-         array(
-               'format' => '_format_stock_items',
-               'spec_option' => $all_option===true ?  _("All Items") : $all_option,
-               'spec_id' => ALL_TEXT,
-               'search_box' => true,
-               'search' => array("stock_id", "c.description","s.description"),
-               'search_submit' => get_company_pref('no_item_list')!=0,
-               'size'=>10,
-               'select_submit'=> $submit_on_change,
-               'category' => 2,
-               'order' => array('c.description','stock_id'),
-               'editlink' => $editkey ? add_edit_combo('item') : false,
-               'editable' => false,
-               'max' => 255
-         ), $opts) );
+               array_merge(
+                 array(
+                       'format' => '_format_stock_items',
+                       'spec_option' => $all_option===true ?  _("All Items") : $all_option,
+                       'spec_id' => ALL_TEXT,
+                       'search_box' => true,
+                       'search' => array("stock_id", "c.description","s.description"),
+                       'search_submit' => get_company_pref('no_item_list')!=0,
+                       'size'=>10,
+                       'select_submit'=> $submit_on_change,
+                       'category' => 2,
+                       'order' => array('c.description','stock_id'),
+                       'editlink' => $editkey ? add_edit_combo('item') : false,
+                       'editable' => false,
+                       'max' => 255
+                 ), $opts) );
        return $ret;
 }
 
@@ -808,21 +803,21 @@ function sales_items_list($name, $selected_id=null, $all_option=false,
        $sql .= " GROUP BY i.item_code";
 
        return combo_input($name, $selected_id, $sql, 'i.item_code', 'c.description',
-       array_merge(
-         array(
-               'format' => '_format_stock_items',
-               'spec_option' => $all_option===true ?  _("All Items") : $all_option,
-               'spec_id' => ALL_TEXT,
-               'search_box' => true,
-               'search' => array("i.item_code", "c.description", "i.description"),
-               'search_submit' => get_company_pref('no_item_list')!=0,
-               'size'=>15,
-               'select_submit'=> $submit_on_change,
-               'category' => 2,
-               'order' => array('c.description','i.item_code'),
-               'editable' => 30,
-               'max' => 255
-         ), $opts) );
+               array_merge(
+                 array(
+                       'format' => '_format_stock_items',
+                       'spec_option' => $all_option===true ?  _("All Items") : $all_option,
+                       'spec_id' => ALL_TEXT,
+                       'search_box' => true,
+                       'search' => array("i.item_code", "c.description", "i.description"),
+                       'search_submit' => get_company_pref('no_item_list')!=0,
+                       'size'=>15,
+                       'select_submit'=> $submit_on_change,
+                       'category' => 2,
+                       'order' => array('c.description','i.item_code'),
+                       'editable' => 30,
+                       'max' => 255
+                 ), $opts) );
 }
 
 function sales_items_list_cells($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false, $editkey=false)
@@ -935,16 +930,7 @@ function stock_purchasable_items_list_cells($label, $name, $selected_id=null,
                         'editable' => 30,
                         'cells'=>true), $editkey);
 }
-/*
-function stock_purchasable_items_list_row($label, $name, $selected_id=null,
-                       $all_option=false, $submit_on_change=false, $editkey=false)
-{
-       echo "<tr><td class='label'>$label</td>";
-       stock_purchasable_items_list_cells(null, $name, $selected_id=null,
-               $all_option, $submit_on_change, $editkey);
-       echo "</tr>\n";
-}
-*/
+
 //------------------------------------------------------------------------------------
 
 function stock_item_types_list_row($label, $name, $selected_id=null, $enabled=true)
@@ -986,12 +972,12 @@ function tax_types_list($name, $selected_id=null, $none_option=false, $submit_on
        $sql = "SELECT id, CONCAT(name, ' (',rate,'%)') as name FROM ".TB_PREF."tax_types";
 
        return combo_input($name, $selected_id, $sql, 'id', 'name',
-       array(
-               'spec_option' => $none_option,
-               'spec_id' => ALL_NUMERIC,
-               'select_submit'=> $submit_on_change,
-               'async' => false,
-       ) );
+               array(
+                       'spec_option' => $none_option,
+                       'spec_id' => ALL_NUMERIC,
+                       'select_submit'=> $submit_on_change,
+                       'async' => false,
+               ) );
 }
 
 function tax_types_list_cells($label, $name, $selected_id=null, $none_option=false,
@@ -1020,13 +1006,13 @@ function tax_groups_list($name, $selected_id=null,
        $sql = "SELECT id, name FROM ".TB_PREF."tax_groups";
 
        return combo_input($name, $selected_id, $sql, 'id', 'name',
-       array(
-               'order' => 'id',
-               'spec_option' => $none_option,
-               'spec_id' => ALL_NUMERIC,
-               'select_submit'=> $submit_on_change,
-               'async' => false,
-       ) );
+               array(
+                       'order' => 'id',
+                       'spec_option' => $none_option,
+                       'spec_id' => ALL_NUMERIC,
+                       'select_submit'=> $submit_on_change,
+                       'async' => false,
+               ) );
 }
 
 function tax_groups_list_cells($label, $name, $selected_id=null, $none_option=false, $submit_on_change=false)
@@ -1290,7 +1276,6 @@ function sales_types_list($name, $selected_id=null, $submit_on_change=false, $sp
                'spec_option' => $special_option===true ? _("All Sales Types") : $special_option,
                'spec_id' => 0,
                'select_submit'=> $submit_on_change,
-       //        'async' => false,
        ) );
 }
 
@@ -1323,12 +1308,12 @@ function bank_reconciliation_list($account, $name, $selected_id=null, $submit_on
                WHERE bank_act=".db_escape($account)." AND reconciled IS NOT NULL
                GROUP BY reconciled";
        return combo_input($name, $selected_id, $sql, 'id', 'reconciled',
-       array(
-               'spec_option' => $special_option,
-               'format' => '_format_date',
-               'spec_id' => '',
-               'select_submit'=> $submit_on_change
-       ) );
+               array(
+                       'spec_option' => $special_option,
+                       'format' => '_format_date',
+                       'spec_id' => '',
+                       'select_submit'=> $submit_on_change
+               ) );
 }
 
 function bank_reconciliation_list_cells($label,$account, $name, $selected_id=null, $submit_on_change=false, $special_option=false)
@@ -1355,10 +1340,10 @@ function workcenter_list($name, $selected_id=null, $all_option=false)
        $sql = "SELECT id, name, inactive FROM ".TB_PREF."workcentres";
 
        return combo_input($name, $selected_id, $sql, 'id', 'name',
-       array(
-               'spec_option' =>$all_option===true ? _("All Suppliers") : $all_option,
-               'spec_id' => ALL_TEXT,
-       ) );
+               array(
+                       'spec_option' =>$all_option===true ? _("All Suppliers") : $all_option,
+                       'spec_id' => ALL_TEXT,
+               ) );
 }
 
 function workcenter_list_cells($label, $name, $selected_id=null, $all_option=false)
@@ -1386,13 +1371,13 @@ function bank_accounts_list($name, $selected_id=null, $submit_on_change=false, $
                FROM ".TB_PREF."bank_accounts";
 
        return combo_input($name, $selected_id, $sql, 'id', 'bank_account_name',
-       array(
-               'format' => '_format_add_curr',
-               'select_submit'=> $submit_on_change,
-               'spec_option' => $spec_option,
-               'spec_id' => '',
-               'async' => false
-       ) );
+               array(
+                       'format' => '_format_add_curr',
+                       'select_submit'=> $submit_on_change,
+                       'spec_option' => $spec_option,
+                       'spec_id' => '',
+                       'async' => false
+               ) );
 }
 
 function bank_accounts_list_cells($label, $name, $selected_id=null, $submit_on_change=false)
@@ -1423,13 +1408,13 @@ function cash_accounts_list_row($label, $name, $selected_id=null, $submit_on_cha
                echo "<tr><td class='label'>$label</td>\n";
        echo "<td>";
        echo combo_input($name, $selected_id, $sql, 'id', 'bank_account_name',
-       array(
-               'spec_option' => $all_option,
-               'spec_id' => ALL_TEXT,
-               'format' => '_format_add_curr',
-               'select_submit'=> $submit_on_change,
-               'async' => true
-       ) );
+               array(
+                       'spec_option' => $all_option,
+                       'spec_id' => ALL_TEXT,
+                       'format' => '_format_add_curr',
+                       'select_submit'=> $submit_on_change,
+                       'async' => true
+               ) );
        echo "</td></tr>\n";
 }
 //-----------------------------------------------------------------------------------------------
@@ -1445,13 +1430,13 @@ function pos_list_row($label, $name, $selected_id=null, $spec_option=false, $sub
        echo "<td>";
 
        echo combo_input($name, $selected_id, $sql, 'id', 'pos_name',
-       array(
-               'select_submit'=> $submit_on_change,
-               'async' => true,
-               'spec_option' =>$spec_option,
-               'spec_id' => -1,
-               'order'=> array('pos_name')
-       ) );
+               array(
+                       'select_submit'=> $submit_on_change,
+                       'async' => true,
+                       'spec_option' =>$spec_option,
+                       'spec_id' => -1,
+                       'order'=> array('pos_name')
+               ) );
        echo "</td></tr>\n";
 
 }
@@ -1470,10 +1455,10 @@ function sale_payment_list($name, $category, $selected_id=null, $submit_on_chang
                        $sql .= " WHERE days_before_due>=0";
 
        return combo_input($name, $selected_id, $sql, 'terms_indicator', 'terms',
-       array(
-               'select_submit'=> $submit_on_change,
-               'async' => true
-       ) );
+               array(
+                       'select_submit'=> $submit_on_change,
+                       'async' => true
+               ) );
 
 }
 
@@ -1494,10 +1479,10 @@ function class_list($name, $selected_id=null, $submit_on_change=false)
        $sql = "SELECT cid, class_name FROM ".TB_PREF."chart_class";
 
        return combo_input($name, $selected_id, $sql, 'cid', 'class_name',
-       array(
-               'select_submit'=> $submit_on_change,
-               'async' => false
-       ) );
+               array(
+                       'select_submit'=> $submit_on_change,
+                       'async' => false
+               ) );
 
 }
 
@@ -1522,12 +1507,12 @@ function stock_categories_list($name, $selected_id=null, $spec_opt=false, $submi
 {
        $sql = "SELECT category_id, description, inactive FROM ".TB_PREF."stock_category";
        return combo_input($name, $selected_id, $sql, 'category_id', 'description',
-       array('order'=>'category_id',
-               'spec_option' => $spec_opt,
-               'spec_id' => -1,
-               'select_submit'=> $submit_on_change,
-               'async' => true
-       ));
+               array('order'=>'category_id',
+                       'spec_option' => $spec_opt,
+                       'spec_id' => -1,
+                       'select_submit'=> $submit_on_change,
+                       'async' => true
+               ));
 }
 
 function stock_categories_list_cells($label, $name, $selected_id=null, $spec_opt=false, $submit_on_change=false)
@@ -1554,12 +1539,12 @@ function gl_account_types_list($name, $selected_id=null, $all_option=false, $all
        $sql = "SELECT id, name FROM ".TB_PREF."chart_types";
 
        return combo_input($name, $selected_id, $sql, 'id', 'name',
-       array(
-               'format' => '_format_account',
-               'order' => array('class_id', 'id', 'parent'),
-               'spec_option' =>$all_option,
-               'spec_id' => ALL_TEXT
-       ) );
+               array(
+                       'format' => '_format_account',
+                       'order' => array('class_id', 'id', 'parent'),
+                       'spec_option' =>$all_option,
+                       'spec_id' => ALL_TEXT
+               ) );
 }
 
 function gl_account_types_list_cells($label, $name, $selected_id=null, $all_option=false, $all=false)
@@ -1596,28 +1581,27 @@ function gl_all_accounts_list($name, $selected_id=null, $skip_bank_accounts=fals
                        WHERE chart.account_type=type.id";
 
        return combo_input($name, $selected_id, $sql, 'chart.account_code', 'chart.account_name',
-       array(
-               'format' => '_format_account',
-               'spec_option' => $all_option===true ?  _("Use Item Sales Accounts") : $all_option,
-               'spec_id' => '',
-               'type' => 2,
-               'order' => array('type.class_id','type.id','account_code'),
-               'search_box' => $cells,
+               array(
+                       'format' => '_format_account',
+                       'spec_option' => $all_option===true ?  _("Use Item Sales Accounts") : $all_option,
+                       'spec_id' => '',
+                       'type' => 2,
+                       'order' => array('type.class_id','type.id','account_code'),
+                       'search_box' => $cells,
                        'search_submit' => false,
                        'size' => 12,
                        'max' => 10,
                        'cells' => true,
-               'select_submit'=> $submit_on_change,
-               'async' => false,
-               'category' => 2,
-               'show_inactive' => $all
-       ) );
-
+                       'select_submit'=> $submit_on_change,
+                       'async' => false,
+                       'category' => 2,
+                       'show_inactive' => $all
+               ) );
 }
 
 function _format_account($row)
 {
-               return $row[0] .  "&nbsp;&nbsp;&nbsp;&nbsp;" . $row[1];
+       return $row[0] .  "&nbsp;&nbsp;&nbsp;&nbsp;" . $row[1];
 }
 
 function gl_all_accounts_list_cells($label, $name, $selected_id=null, 
@@ -1977,9 +1961,9 @@ function credit_type_list_cells($label, $name, $selected=null, $submit_on_change
                label_cell($label);
        echo "<td>\n";
        echo array_selector($name, $selected, 
-                               array( 'Return' => _("Items Returned to Inventory Location"),
-                                       'WriteOff' => _("Items Written Off")),
-                               array( 'select_submit'=> $submit_on_change ) );
+                       array( 'Return' => _("Items Returned to Inventory Location"),
+                               'WriteOff' => _("Items Written Off")),
+                       array( 'select_submit'=> $submit_on_change ) );
        echo "</td>\n";
 }
 
@@ -1997,8 +1981,8 @@ function number_list($name, $selected, $from, $to, $no_option=false)
                $items[$i] = "$i";
 
        return array_selector($name, $selected, $items,
-                               array(  'spec_option' => $no_option,
-                                               'spec_id' => ALL_NUMERIC) );
+                       array(  'spec_option' => $no_option,
+                                       'spec_id' => ALL_NUMERIC) );
 }
 
 function number_list_cells($label, $name, $selected, $from, $to, $no_option=false)
@@ -2145,13 +2129,13 @@ function security_roles_list($name, $selected_id=null, $new_item=false, $submit_
 
        $sql = "SELECT id, role, inactive FROM ".TB_PREF."security_roles";
 
-return combo_input($name, $selected_id, $sql, 'id', 'description',
-       array(
-               'spec_option'=>$new_item ? _("New role") : false,
-               'spec_id' => '',
-               'select_submit'=> $submit_on_change,
-               'show_inactive' => $show_inactive
-       ) );
+       return combo_input($name, $selected_id, $sql, 'id', 'description',
+               array(
+                       'spec_option'=>$new_item ? _("New role") : false,
+                       'spec_id' => '',
+                       'select_submit'=> $submit_on_change,
+                       'show_inactive' => $show_inactive
+               ) );
 }
 
 function security_roles_list_cells($label, $name, $selected_id=null, $new_item=false, $submit_on_change=false,
index 9c2b594f242041460dd7c1cb8438b600c5281191..cf4b4880f4d187958990369b427f4cc0046b2f20 100644 (file)
@@ -385,10 +385,8 @@ function view_stock_status($stock_id, $description=null, $echo=true)
 {
        global $path_to_root;
        if ($description)
-               //hyperlink_params_separate($path_to_root . "/inventory/inquiry/stock_status.php", (user_show_codes()?$stock_id . " - ":"") . $description, "stock_id=$stock_id");
                $preview_str = "<a target='_blank' href='$path_to_root/inventory/inquiry/stock_status.php?stock_id=$stock_id&popup=1' onclick=\"javascript:openWindow(this.href,this.target); return false;\" >". (user_show_codes()?$stock_id . " - ":"") . $description."</a>";
        else
-               //hyperlink_params_separate($path_to_root . "/inventory/inquiry/stock_status.php", $stock_id, "stock_id=$stock_id");
                $preview_str = "<a target='_blank' href='$path_to_root/inventory/inquiry/stock_status.php?stock_id=$stock_id&popup=1' onclick=\"javascript:openWindow(this.href,this.target); return false;\" >$stock_id</a>";
        if($echo)
                echo $preview_str;