Some additional fixes to last big committment
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 9 Jun 2008 07:39:51 +0000 (07:39 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 9 Jun 2008 07:39:51 +0000 (07:39 +0000)
CHANGELOG.txt
gl/gl_journal.php
includes/ajax.inc
includes/ui/ui_lists.inc
includes/ui/ui_view.inc
js/inserts.js
js/utils.js
sales/includes/ui/sales_order_ui.inc
themes/default/default.css

index 5b9821fc8e4cf9df6503015c6e28ca1aa80bdfee..b1d2c11e7841238f04cecd396011017cb65febd8 100644 (file)
@@ -20,6 +20,17 @@ Legend:
 $ -> Affected files
 
 ---------------------------------------Release Candidate 1-------------------------------
+09-Jun-2008 Janusz Dobrowolski
+# Some additional fixes related to last big committment
+$ /gl/gl_journal.php
+  /includes/ajax.inc
+  /includes/ui/ui_lists.inc
+  /includes/ui/ui_view.inc
+  /js/inserts.js
+  /js/utils.js
+  /sales/includes/ui/sales_order_ui.inc
+  /themes/default/default.css
+
 08-Jun-2008 Joe Hunt
 ! Preparing for release candidate 1
 $ config.php
index 5c974d29d61f86a48afc600134c1825c1dbc96c4..c7ad55c05464a8369f628469d9603efcf0ab23b4 100644 (file)
@@ -19,7 +19,7 @@ if ($use_popup_windows)
 if ($use_date_picker)
        $js .= get_js_date_picker();
 
-set_focus('CodeID2');
+set_focus('_code_id_edit');
 
 page(_("Journal Entry"), false, false,'', $js);
 
index 5625fc900c3ba1c3bbda674de07d90f70cf26e30..3ad2966e821ea4236ff6d2ae60b6119c4dd42217 100644 (file)
@@ -106,17 +106,19 @@ class Ajax extends JsHttpRequest {
 
                // remove not active commands
                foreach ($this->aCommands as $idx => $com) {
-               // display_error( $idx.':'.var_dump($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') {
                          $this->aCommands = array($com);
                          break;
                  }
-                 else
-                 if ($com['why'] !== true && !isset($this->triggers[$com['why']]))
-                       unset($this->aCommands[$idx]);
                }
+//             display_error(htmlentities(print_r($this->aCommands, true)));
            $GLOBALS['_RESULT'] = $this->aCommands;
 //         exit();
        }
index c29729326aba00e1039f69c72d38b497b0be878f..785ab74604515bae2e260e1fe6599615bf692faf 100644 (file)
@@ -45,10 +45,6 @@ $opts = array(               // default options
        'max' => 50,
        'cells' => false,       // combo displayed as 2 <td></td> cells
        'search' => array(), // sql field names to search
-               // if _focus is not set on next field before combo_input call
-               // set this to false to avoid deadlock via onblur handler
-       'next_focus' => (!isset($_POST['_focus']) ||
-       (isset($_POST["_{$name}_button"]) && $_POST['_focus']==$name)) ? false : $_POST['_focus'],
        'format' => null,        // format functions for regular options
        'disabled' => false, // FIX todo
        'box_hint' => null // box/selectors hints; null = std see below
@@ -89,17 +85,15 @@ $opts = array(              // default options
                        $Ajax->activate('_page_body');
                else
                        $Ajax->activate($name);
-               set_focus($opts['next_focus']);
        }
-       if ($search_box && $opts['search_submit']) {
+       if ($search_box) {
                // search related sql modifications
 
        $rel = "rel='$search_box'"; // set relation to list
-
+   if ($opts['search_submit']) {
        // if selected from list - set focus on next field
        if (isset($_POST[$search_submit])) {
                $Ajax->activate($name);
-               set_focus($name);
        }
        if ($txt == '') {
                if ($spec_option === false)
@@ -115,6 +109,7 @@ $opts = array(              // default options
                $opts['where'][] = '('. implode($opts['search'], ' OR ') . ')';
                }
        }
+   }
        // sql completion
        if (count($opts['where'])) {
                $sql .= strpos($sql, 'WHERE')==false ? ' WHERE ':' AND ';
@@ -210,11 +205,10 @@ $edit_entry = '';
        if ($search_box != false) {
                $edit_entry = "<input type='text' name='$search_box' id='$search_box' size='".
                        $opts['size']."' maxlength='".$opts['max'].
-                       "' value='$txt' class='$class' rel='$name' title='"
+                       "' value='$txt' class='$class' rel='$name' autocomplete='off' title='"
                        .$opts['box_hint']."'"
                        .(in_ajax() && !$by_id ? " style=display:none;":'')
                        .">\n";
-//     default_focus($search_box);
                if ($search_submit != false) {
                        global $_search_button;
                        $edit_entry .= sprintf($_search_button, user_theme(),
@@ -1277,7 +1271,7 @@ function gl_all_accounts_list($name, $selected_id, $skip_bank_accounts=false,
                'format' => '_format_account' .  ($show_group ? '2' : ''),
                'order' => 'account_code',
                'search_box' => $cells,
-                       'search_submit' => true,
+                       'search_submit' => false,
                        'size' => 12,
                        'max' => 10,
                        'cells' => true
index dce9fff41c88066886ef9d0b4664c0302c9ab7b6..65a9f39341ab8cfcb491ee0aa7b9857d678ff006 100644 (file)
@@ -548,6 +548,8 @@ function get_js_open_window($width, $height)
   If $form<0 $name is element id.
 */
 function set_focus($name, $form_no=0) {
+  global $Ajax;
+       $Ajax->addFocus(true, $name);
     $_POST['_focus'] = $name;
 }
 //
index c6c047f77f8a2238a88fd55319f7ed5aa48f40a7..43b5f43ba2ed1511723b12d48936863d456b0bca 100644 (file)
@@ -1,9 +1,8 @@
-
 var _focus;
 
 function debug(msg) {
-    document.getElementById('msgbox').innerHTML=
-       document.getElementById('msgbox').innerHTML+'<br>'+msg
+    box = document.getElementById('msgbox')
+       box.innerHTML= box.innerHTML+'<br>'+msg
 }
 
 function progbar(container) {
@@ -13,7 +12,6 @@ function progbar(container) {
 }
 
 function save_focus(e) {
-//  document.getElementsByName('_focus')[0].value = e.name;
   _focus = e.name||e.id;
   var h = document.getElementById('hints');
   if (h) {
@@ -44,18 +42,16 @@ function expandtab(tabcontentid, tabnumber) {
 }
 
 function _set_combo_input(e) {
-                 e.onblur=function() { 
-//                     if(!this.back) {
-                         var but_name = this.name.substring(0, this.name.length-4)+'button';
-                         var button = document.getElementsByName(but_name)[0];
-                         var select = document.getElementsByName(this.getAttribute('rel'))[0];
-                         save_focus(select);
+               e.onblur=function() { 
+                 var but_name = this.name.substring(0, this.name.length-4)+'button';
+                 var button = document.getElementsByName(but_name)[0];
+                 var select = document.getElementsByName(this.getAttribute('rel'))[0];
+                 save_focus(select);
 //             this.style.display='none';
-                         if(button) { // if *_button set submit search request
-                           JsHttpRequest.request(but_name);
-                         }
-                         return false;
-//                     }
+                 if(button) { // if *_button set submit search request
+                       JsHttpRequest.request(but_name);
+                 }
+                 return false;
                };
                e.onkeyup = function(ev) {
                        var select = document.getElementsByName(this.getAttribute('rel'))[0];
@@ -73,14 +69,13 @@ function _set_combo_input(e) {
                          }
                        }
                  };
-               e.onkeydown = function(ev) { 
+         e.onkeydown = function(ev) { 
                        ev = ev||window.event;
                        key = ev.keyCode||ev.which;
                        if(key == 13) {
                          this.blur();
                          return false;
                        }
-//         this.back = ev.shiftKey; // save shift state for onblur handler
                  }
 }
 
@@ -97,6 +92,10 @@ function _update_box(s) {
 }
 
 function _set_combo_select(e) {
+               e.onblur = function() {
+                       if(this.className=='combo')
+                           _update_box(this);
+               }
                e.onchange = function() {
                        var s = this;
                        
@@ -111,22 +110,14 @@ function _set_combo_select(e) {
                        }
                        return true;
                }
-//             e.onblur = function() {
-//                     if (this.className == 'combo')
-//                       _update_box(this);
-//             },
                e.onkeydown = function(event) {
                    event = event||window.event;
-//                 this.back = event.shiftKey; // save shift state for onblur handler
                    key = event.keyCode||event.which;
                    var box = document.getElementsByName(this.getAttribute('rel'))[0];
                    if (box && key == 32 && this.className == 'combo2') {
                            this.style.display = 'none';
                            box.style.display = 'inline';
                                box.value='';
-  // Konq does not like short syntax for nonstd attr
-//                             this.setAttribute('back', 'true');
-//                         this.back=true;
                                setFocus(box.name);
                            return false;
                         }
@@ -152,7 +143,16 @@ var inserts = {
            // this hides search button for js enabled browsers
            e.style.display = 'none';
        },
-       'input.ajaxsubmit,input.editbutton,input.navibutton': 
+/*     'select.combo,select.combo2':
+       function(e) {
+               var box = document.getElementsByName(e.getAttribute('rel'))[0];
+               if(box) {
+                 box.style.width = 200+'px';
+                 e.style.width = 200+'px';
+                 debug(e.name+':'+e.style.width)
+               }
+       },
+*/     'input.ajaxsubmit,input.editbutton,input.navibutton': 
        function(e) {
            e.onclick = function() {
                JsHttpRequest.request(this.name);
@@ -172,11 +172,6 @@ var inserts = {
                        e.onfocus = function() {
                            save_focus(this);
                        };
-                       e.onkeydown = function(event) { 
-                         event = event||window.event;
-                         this.back = event.shiftKey; // save shift state for onblur handler
-                         this.lastkey = event.keyCode; 
-                       };
                  var c = e.className;
                  if (c == 'combo' || c == 'combo2')
                        _set_combo_select(e);
@@ -202,6 +197,10 @@ var inserts = {
                    }
                }
            }
+       },
+       '#msgbox': function(e) {
+       // this is to avoid changing div height after ajax update in IE7
+         e.style.display = e.innerHTML.length ? 'block' : 'none';
        }
 /* TODO
        'a.date_picker':  function(e) {
index cb1c0db3a4aef078ae75c9032e14b17c9493c696..2bd2cfa5e7c28a1e8a2c920c70963ed0f7614829 100644 (file)
                        
             // Function is called when an answer arrives. 
            function(result, errors) {
-                       // Write errors to the debug div.
-            document.getElementById('msgbox').innerHTML = errors; 
-
                 // Write the answer.
                if (result) {
                          for(var i in result ) { 
                          atom = result[i];
-                       
                          cmd = atom['n'];
                          property = atom['p'];
                          type = atom['c'];
                          } else {
                                  errors = errors+'<br>Unknown ajax function: '+cmd;
                        }
-               }
-               Behaviour.apply();
+                 }
+        // Write errors to the debug div.
+                 document.getElementById('msgbox').innerHTML = errors;
+
+                 Behaviour.apply();
                  if (errors.length>0)
                        window.scrollTo(0,0);
                        //document.getElementById('msgbox').scrollIntoView(true);
          // Restore focus if we've just lost focus because of DOM element refresh
-               setFocus();
+                 setFocus();
                }
             },
             false  // do not disable caching
@@ -168,6 +167,7 @@ function setFocus(name, byId) {
        el = document.getElementById(name);
   else
        el = document.getElementsByName(name)[0];
+
   if(el && el.focus) {
     // The timeout is needed to prevent unpredictable behaviour on IE & Gecko.
     // Using tmp var prevents crash on IE5
index bf08381ce1949b836e7eff5dffa8d8f7ae1f2142..1df65425ab1da1f74faceeb4e8e1448c7416bdae 100644 (file)
@@ -159,8 +159,6 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group
 
        $customer_error = "";
        $change_prices = 0;
-       $newcust = ($order->customer_id != get_post('customer_id', -1));
-       $newbranch = ($order->Branch != get_post('branch_id', -1)) || $newcust;
 
        if (isset($order) && !$editable)
        {
@@ -174,7 +172,7 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group
        {
                customer_list_row(_("Customer:"), 'customer_id', null, false, true);
 
-               if ($newcust)
+               if ($order->customer_id != get_post('customer_id', -1))
                {
                        // customer has changed
                        // clear the branch selection
@@ -195,7 +193,9 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group
                    $order->Branch = 0;
                } else
                {
-                       if($newcust || $newbranch) {
+               if( ($order->customer_id != get_post('customer_id', -1)) ||
+                       ($order->Branch != get_post('branch_id', -1))) {
+
                                $old_order = (PHP_VERSION<5) ? $order : clone( $order );
                                $customer_error = get_customer_details_to_order($order, $_POST['customer_id'], $_POST['branch_id']);
 
index 635f419c0eb38424064e51de5709f511499c1146..a32fa4e9e6552bfeca531bd9c34f180e463cd3fa 100644 (file)
@@ -440,20 +440,6 @@ ul.ajaxtabs li input.current, ul.ajaxtabs li input.current:hover{
   border-bottom: 1px solid #8cacbb;
   margin: -4px -2px -2px;
   border: 1px solid #8cacbb;
-/*  display: none;*/
   background-color: #FFFFE0;
   white-space: nowrap;
-/*
-  position: absolute;
-  left: 0;
-  left: -900px;
-  filter:alpha(opacity=0);
-  -moz-opacity:0; 
-  border: 1px solid black;
-  height: 200px;
-  text-align: center;
-  width:200px;
-  z-index: 100;
-  padding: 5px;
-*/
-}
\ No newline at end of file
+}