Minor bug fix in Quick Entry tax account choice for Journal Entry.
[fa-stable.git] / includes / ui / ui_input.inc
index 588f867c31ddd381387a3c6a90478d6457a6cc24..3da07206ac88c05321bf6260661bc22f5f0839c5 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 /**********************************************************************
     Copyright (C) FrontAccounting, LLC.
-       Released under the terms of the GNU Affero General Public License,
-       AGPL, as published by the Free Software Foundation, either version 
-       of the License, or (at your option) any later version.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-    See the License here <http://www.gnu.org/licenses/agpl-3.0.html>.
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
 
 function get_post($name, $dflt='')
@@ -221,7 +221,7 @@ function button($name, $value, $title=false, $icon=false)
                        $icon = ICON_DELETE;
                return "<button type='submit' class='editbutton' name='".
                        htmlentities(strtr($name, array('.'=>'=2E',' '=>'=20','='=>'=3D','['=>'=5B'))).
-                       "' value=''" . ($title ? " title='$title'":" title='$value'")." />".set_icon($icon)."\n";
+                       "' value='1'" . ($title ? " title='$title'":" title='$value'")." />".set_icon($icon)."\n";
        }
        else
                return "<input type='submit' class='editbutton' name='"
@@ -255,24 +255,36 @@ function check_value($name)
        return 1;
 }
 
-function check($label, $name, $value=null, $submit_on_change=false, $title=false)
+function checkbox($label, $name, $value=null, $submit_on_change=false, $title=false)
 {
        global $Ajax;
 
+       $str = '';      
        default_focus($name);
        if ($label)
-               echo $label . "  ";
-
+               $str .= $label . "  ";
+       if ($submit_on_change !== false) {
+               if ($submit_on_change === true)
+                       $submit_on_change = 
+                               "JsHttpRequest.request(\"_{$name}_update\", this.form);";
+       }
        if ($value === null)
                $value = get_post($name,0);
 
-               echo "<input"
-                   .($value == 1 ? ' checked':'')
-                   ." type='checkbox' name='$name' value='1'"
-                   .($submit_on_change ? " onclick='JsHttpRequest.request(\"_{$name}_update\", this.form);'" : '')
-                   .($title ? " title='$title'" : '')
-                   ." >\n";
+       $str .= "<input"
+           .($value == 1 ? ' checked':'')
+           ." type='checkbox' name='$name' value='1'"
+           .($submit_on_change ? " onclick='$submit_on_change'" : '')
+           .($title ? " title='$title'" : '')
+           ." >\n";
+
        $Ajax->addUpdate($name, $name, $value);
+       return $str;
+}
+
+function check($label, $name, $value=null, $submit_on_change=false, $title=false)
+{
+       echo checkbox($label, $name, $value, $submit_on_change, $title);
 }
 
 function check_cells($label, $name, $value, $submit_on_change=false, $title=false)
@@ -280,14 +292,14 @@ function check_cells($label, $name, $value, $submit_on_change=false, $title=fals
        if ($label != null)
                echo "<td>$label</td>\n";
        echo "<td>";
-       check(null, $name, $value, $submit_on_change, $title);
+       echo check(null, $name, $value, $submit_on_change, $title);
        echo "</td>";
 }
 
 function check_row($label, $name, $value, $submit_on_change=false, $title=false)
 {
        echo "<tr>";
-       check_cells($label, $name, $value, $submit_on_change, $title);
+       echo check_cells($label, $name, $value, $submit_on_change, $title);
        echo "</tr>\n";
 }
 
@@ -444,6 +456,16 @@ function email_row_ex($label, $name, $size, $max=null, $title=null, $value=null,
        text_row_ex("<a href='Mailto:".$_POST[$name]."'>$label</a>", $name, $size, $max, $title, $value, $params, $post_label);
 }
 
+function link_row($label, $name, $value, $size, $max, $title=null, $params="", $post_label="")
+{
+       text_row("<a href='".$_POST[$name]."' target='_blank'>$label</a>", $name, $value, $size, $max, $title, $params, $post_label);
+}
+
+function link_row_ex($label, $name, $size, $max=null, $title=null, $value=null, $params=null, $post_label=null)
+{
+       text_row_ex("<a href='".$_POST[$name]."' target='_blank'>$label</a>", $name, $size, $max, $title, $value, $params, $post_label);
+}
+
 //-----------------------------------------------------------------------------------
 
 function date_cells($label, $name, $title = null, $init=null, $inc_days=0,