Example #1
0
 public function __construct($name)
 {
     parent::__construct($name);
     $this->attrs['type'] = 'hidden';
 }
Example #2
0
function credit_render_invoiceselect($type, $id, $processpage)
{
    log_debug("inc_credits", "credit_render_summarybox({$type}, {$id})");
    // fetch credit information
    $sql_obj = new sql_query();
    $sql_obj->prepare_sql_settable("account_{$type}");
    if ($type == "ar_credit") {
        $sql_obj->prepare_sql_addfield("date_sent");
        $sql_obj->prepare_sql_addfield("sentmethod");
    }
    $sql_obj->prepare_sql_addfield("code_credit");
    $sql_obj->prepare_sql_addfield("amount_total");
    $sql_obj->prepare_sql_addfield("invoiceid");
    $sql_obj->prepare_sql_addfield("locked");
    $sql_obj->prepare_sql_addwhere("id='{$id}'");
    $sql_obj->prepare_sql_setlimit("1");
    $sql_obj->generate_sql();
    $sql_obj->execute();
    if ($sql_obj->num_rows()) {
        $sql_obj->fetch_array();
        if ($sql_obj->data[0]["locked"]) {
            // credit note is locked, nothing todo
            return 1;
        }
        /*
        	Select Invoice Items
        */
        $invoice_type = "unknown";
        if ($type == "ar_credit") {
            $invoice_type = "ar";
        } elseif ($type == "ap_credit") {
            $invoice_type = "ap";
        }
        $sql_invoice_obj = new sql_query();
        $sql_invoice_obj->string = "SELECT id as itemid, type, customid, chartid, quantity, units, price, amount, description FROM account_items WHERE invoiceid='" . $sql_obj->data[0]["invoiceid"] . "' AND invoicetype='" . $invoice_type . "' AND type!='payment' AND type!='tax'";
        $sql_invoice_obj->execute();
        if ($sql_invoice_obj->num_rows()) {
            $sql_invoice_obj->fetch_array();
        }
        /*
        	Create Form
        */
        $obj_invoice_form = new form_input();
        $obj_invoice_form->formname = $type . "_invoiceselect";
        $obj_invoice_form->language = $_SESSION["user"]["lang"];
        $obj_invoice_form->action = "index.php";
        $obj_invoice_form->method = "GET";
        // ID
        $structure = NULL;
        $structure["fieldname"] = "id";
        $structure["type"] = "hidden";
        $structure["defaultvalue"] = $id;
        $obj_invoice_form->add_input($structure);
        $structure = NULL;
        $structure["fieldname"] = "page";
        $structure["type"] = "hidden";
        $structure["defaultvalue"] = $processpage;
        $obj_invoice_form->add_input($structure);
        // submit
        $structure = NULL;
        $structure["fieldname"] = "submit";
        $structure["type"] = "submit";
        $structure["defaultvalue"] = "submit_add_credit_item";
        $obj_invoice_form->add_input($structure);
        /*
        	Generate Items Radio Array
        */
        if ($sql_invoice_obj->num_rows()) {
            $structure = NULL;
            $structure["fieldname"] = "invoice_item";
            $structure["type"] = "radio";
            foreach ($sql_invoice_obj->data as $data_invoice) {
                $description = $data_invoice["description"];
                switch ($data_invoice["type"]) {
                    case "standard":
                        $description = sql_get_singlevalue("SELECT CONCAT_WS('--', code_chart, description) as value FROM account_charts WHERE id='" . $data_invoice["chartid"] . "' LIMIT 1");
                        break;
                    case "product":
                        $description = sql_get_singlevalue("SELECT CONCAT_WS('--', code_product, name_product) as value FROM products WHERE id='" . $data_invoice["customid"] . "' LIMIT 1");
                        break;
                    case "service":
                    case "service_usage":
                        $description = sql_get_singlevalue("SELECT name_service as value FROM services WHERE id='" . $data_invoice["customid"] . "' LIMIT 1");
                        break;
                    default:
                        $description = "unknown item";
                        break;
                }
                $description .= " <i>" . $data_invoice["description"] . "</i>";
                $description .= " [" . format_money($data_invoice["amount"]) . " exc tax]";
                $structure["values"][] = $data_invoice["itemid"];
                $structure["translations"][$data_invoice["itemid"]] = $description;
            }
            $obj_invoice_form->add_input($structure);
        }
        /*
        	Render Form
        */
        if ($sql_invoice_obj->num_rows()) {
            print "<table width=\"100%\" class=\"table_highlight_info\">";
            print "<tr>";
            print "<td>";
            print "<p><b>Select an item to be credited from the selected invoice - note that amounts can be varied once selected:</b></p>";
            print "<form method=\"" . $obj_invoice_form->method . "\" action=\"" . $obj_invoice_form->action . "\">";
            $obj_invoice_form->render_field("invoice_item");
            print "<br>";
            $obj_invoice_form->render_field("id");
            $obj_invoice_form->render_field("page");
            $obj_invoice_form->render_field("submit");
            print "</form>";
            print "</td>";
            print "</tr>";
            print "</table>";
        } else {
            /*
            	No invoice items!
            */
            format_msgbox("important", "<p>Unable to add any items to this credit note - the selected invoice has no items on it.</p>");
        }
        print "<br>";
    }
}
Example #3
0
 function render_options_form()
 {
     log_debug("journal_display", "Executing render_options_form()");
     // if the user has not configured any default options, display the dropdown
     // link bar instead of the main options table.
     if (isset($_SESSION["form"][$this->journalname]["custom_options_active"])) {
         if ($_SESSION["user"]["shrink_tableoptions"] == "on") {
             print "<div id=\"" . $this->journalname . "_link\">";
             print "<table width=\"100%\" class=\"table_options_dropdown\">";
             print "<tr bgcolor=\"#666666\">";
             print "<td width=\"100%\" onclick=\"obj_show('" . $this->journalname . "_form'); obj_hide('" . $this->journalname . "_link');\">";
             print "<b style=\"color: #ffffff; text-decoration: none\">ADJUST JOURNAL OPTIONS &gt;&gt;</b>";
             print "</td>";
             print "</tr>";
             print "</table><br>";
             print "</div>";
         }
     }
     // border table / div object
     print "<div id=\"" . $this->journalname . "_form\">";
     print "<table width=\"100%\" style=\"border: 1px solid #666666;\" bgcolor=\"#e7e7e7\"><tr><td>";
     // start the form
     print "<form method=\"get\" class=\"form_standard\">";
     $form = new form_input();
     $form->formname = $this->journalname;
     $form->language = $this->language;
     // include page name
     $structure = NULL;
     $structure["fieldname"] = "page";
     $structure["type"] = "hidden";
     $structure["defaultvalue"] = $_GET["page"];
     $form->add_input($structure);
     $form->render_field("page");
     // include any other fixed options
     foreach (array_keys($this->option) as $fieldname) {
         $structure = NULL;
         $structure["fieldname"] = $fieldname;
         $structure["type"] = "hidden";
         $structure["defaultvalue"] = $this->option[$fieldname];
         $form->add_input($structure);
         $form->render_field($fieldname);
     }
     // flag this form as the journal_display_options form
     $structure = NULL;
     $structure["fieldname"] = "journal_display_options";
     $structure["type"] = "hidden";
     $structure["defaultvalue"] = $this->journalname;
     $form->add_input($structure);
     $form->render_field("journal_display_options");
     print "<table width=\"100%\"><tr>";
     /*
     	Filter Options
     */
     print "<td width=\"100%\" valign=\"top\" style=\"padding: 4px; background-color: #e7e7e7;\">";
     print "<b>Filter/Search Options:</b><br><br>";
     print "<table width=\"100%\">";
     if ($this->filter) {
         foreach (array_keys($this->filter) as $fieldname) {
             if ($this->filter[$fieldname]["type"] == "dropdown") {
                 $this->filter[$fieldname]["options"]["width"] = 150;
             }
             $form->add_input($this->filter[$fieldname]);
             $form->render_row($fieldname);
         }
     }
     print "</table>";
     print "</td>";
     // new row
     print "</tr>";
     print "<tr>";
     /* Order By Options 
     		print "<td width=\"100%\" colspan=\"4\" valign=\"top\" style=\"padding: 4px; background-color: #e7e7e7;\">";
     
     			print "<br><b>Order By:</b><br>";
     
     			// limit the number of order boxes to 4
     			$num_cols = count($columns_available);
     
     			if ($num_cols > 4)
     				$num_cols = 4;
     
     			
     			for ($i=0; $i < $num_cols; $i++)
     			{
     				// define dropdown
     				$structure = NULL;
     				$structure["fieldname"]		= "order_$i";
     				$structure["type"]		= "dropdown";
     				$structure["options"]["width"]	= 150;
     				
     				if ($this->columns_order[$i])
     					$structure["defaultvalue"] = $this->columns_order[$i];
     
     				$structure["values"] = $columns_available;
     
     				$form->add_input($structure);
     
     				// display drop down
     				$form->render_field($structure["fieldname"]);
     
     				if ($i < ($num_cols - 1))
     				{
     					print " then ";
     				}
     			}
     			
     		print "</td>";
     */
     /*
     	Submit Row
     */
     print "<tr>";
     print "<td colspan=\"1\" valign=\"top\" style=\"padding: 4px; background-color: #e7e7e7;\">";
     print "<table>";
     print "<tr><td>";
     // submit button
     $structure = NULL;
     $structure["fieldname"] = "submit";
     $structure["type"] = "submit";
     $structure["defaultvalue"] = "Apply Options";
     $form->add_input($structure);
     $form->render_field("submit");
     print "</form>";
     print "</td>";
     print "<td>";
     /*
     	Include a reset button - this reset button is an independent form
     	which passes any required fixed options and also a reset option back to the page.
     
     	The load_options_form function then detects this reset value and erases the session
     	data for the options belonging to this table, resetting the options form to the original
     	defaults.
     */
     // start the form
     print "<form method=\"get\" class=\"form_standard\">";
     $form = new form_input();
     $form->formname = "reset";
     $form->language = $this->language;
     // include page name
     $structure = NULL;
     $structure["fieldname"] = "page";
     $structure["type"] = "hidden";
     $structure["defaultvalue"] = $_GET["page"];
     $form->add_input($structure);
     $form->render_field("page");
     // include any other fixed options
     foreach (array_keys($this->option) as $fieldname) {
         $structure = NULL;
         $structure["fieldname"] = $fieldname;
         $structure["type"] = "hidden";
         $structure["defaultvalue"] = $this->option[$fieldname];
         $form->add_input($structure);
         $form->render_field($fieldname);
     }
     // flag as the reset form
     $structure = NULL;
     $structure["fieldname"] = "reset";
     $structure["type"] = "hidden";
     $structure["defaultvalue"] = "yes";
     $form->add_input($structure);
     $form->render_field("reset");
     $structure = NULL;
     $structure["fieldname"] = "submit";
     $structure["type"] = "submit";
     $structure["defaultvalue"] = "Reset Options";
     $form->add_input($structure);
     $form->render_field("submit");
     print "</form></td>";
     print "</tr></table>";
     print "</td>";
     print "</tr>";
     // end of structure table
     print "</table>";
     // end of border table
     print "</td></tr></table><br>";
     print "</div>";
     // auto-hide options at startup
     if (!isset($_SESSION["form"][$this->journalname]["custom_options_active"])) {
         if ($_SESSION["user"]["shrink_tableoptions"] == "on") {
             print "<script type=\"text/javascript\">";
             print "obj_hide('" . $this->journalname . "_form');";
             print "</script>";
         }
     }
 }
Example #4
0
 function render_options_form()
 {
     log_debug("table", "Executing render_options_form()");
     // if the user has not configured any default options, display the dropdown
     // link bar instead of the main options table.
     if (!isset($_SESSION["form"][$this->tablename]["custom_options_active"])) {
         if (isset($_SESSION["user"]["shrink_tableoptions"]) && $_SESSION["user"]["shrink_tableoptions"] == "on") {
             print "<div id=\"" . $this->tablename . "_link\">";
             print "<table class=\"table_options_dropdown\">";
             print "<tr>";
             print "<td onclick=\"obj_show('" . $this->tablename . "_form'); obj_hide('" . $this->tablename . "_link');\">";
             print "ADJUST TABLE OPTIONS &gt;&gt;";
             print "</td>";
             print "</tr>";
             print "</table><br>";
             print "</div>";
         }
     }
     // border table / div object
     print "<div id=\"" . $this->tablename . "_form\">";
     print "<table class=\"table_options\"><tr><td>";
     // create tmp array to prevent excessive use of array_keys
     $columns_available = array_keys($this->structure);
     // get labels for all the columns
     $labels = language_translate($this->language, $columns_available);
     // start the form
     print "<form method=\"get\" class=\"form_standard\">";
     $form = new form_input();
     $form->formname = $this->tablename;
     $form->language = $this->language;
     // include page name
     $structure = NULL;
     $structure["fieldname"] = "page";
     $structure["type"] = "hidden";
     $structure["defaultvalue"] = $_GET["page"];
     $form->add_input($structure);
     $form->render_field("page");
     // include any other fixed options
     foreach (array_keys($this->option) as $fieldname) {
         $structure = NULL;
         $structure["fieldname"] = $fieldname;
         $structure["type"] = "hidden";
         $structure["defaultvalue"] = $this->option[$fieldname];
         $form->add_input($structure);
         $form->render_field($fieldname);
     }
     // flag this form as the table_display_options form
     $structure = NULL;
     $structure["fieldname"] = "table_display_options";
     $structure["type"] = "hidden";
     $structure["defaultvalue"] = $this->tablename;
     $form->add_input($structure);
     $form->render_field("table_display_options");
     /*
     	Check box options
     */
     // configure all the checkboxes
     $num_cols = count($columns_available);
     $num_cols_half = sprintf("%d", $num_cols / 2);
     for ($i = 0; $i < $num_cols; $i++) {
         $column = $columns_available[$i];
         // define the checkbox
         $structure = NULL;
         $structure["fieldname"] = $column;
         $structure["type"] = "checkbox";
         if (isset($this->structure[$column]["custom"]["label"])) {
             $structure["options"]["label"] = lang_trans($this->structure[$column]["custom"]["label"]);
         }
         if (in_array($column, $this->columns)) {
             $structure["defaultvalue"] = "on";
         }
         $form->add_input($structure);
         // split the column options boxes into two different columns
         if ($i < $num_cols_half) {
             $column_a1[] = $column;
         } else {
             $column_a2[] = $column;
         }
     }
     // structure table
     print "<table width=\"100%\"><tr>";
     print "<td width=\"50%\" valign=\"top\"  style=\"padding: 4px;\">";
     print "<b>Fields to display:</b><br><br>";
     print "<table width=\"100%\">";
     print "<td width=\"50%\" valign=\"top\">";
     // display the checkbox(s)
     foreach ($column_a1 as $column) {
         $form->render_field($column);
         print "<br>";
     }
     print "</td>";
     print "<td width=\"50%\" valign=\"top\">";
     // display the checkbox(s)
     foreach ($column_a2 as $column) {
         $form->render_field($column);
         print "<br>";
     }
     print "</td>";
     print "</table>";
     print "</td>";
     /*
     	Filter Options
     */
     print "<td width=\"50%\" valign=\"top\" style=\"padding: 4px;\">";
     print "<b>Filter/Search Options:</b><br><br>";
     print "<table width=\"100%\">";
     if ($this->filter) {
         foreach (array_keys($this->filter) as $fieldname) {
             if ($this->filter[$fieldname]["type"] == "dropdown") {
                 $this->filter[$fieldname]["options"]["width"] = 300;
             }
             $form->add_input($this->filter[$fieldname]);
             $form->render_row($fieldname);
         }
     }
     print "</table>";
     print "</td>";
     // new row
     print "</tr>";
     print "<tr>";
     /* Order By Options */
     if ($this->columns_order_options) {
         print "<td width=\"100%\" colspan=\"4\" valign=\"top\" style=\"padding: 4px;\">";
         print "<br><b>Order By:</b><br>";
         // limit the number of order boxes to 4
         $num_cols = count($this->columns_order_options);
         if ($num_cols > 4) {
             $num_cols = 4;
         }
         for ($i = 0; $i < $num_cols; $i++) {
             // define dropdown
             $structure = NULL;
             $structure["fieldname"] = "order_{$i}";
             $structure["type"] = "dropdown";
             $structure["options"]["width"] = 150;
             if (isset($this->columns_order[$i])) {
                 $structure["defaultvalue"] = $this->columns_order[$i];
             }
             $structure["values"] = $this->columns_order_options;
             $form->add_input($structure);
             // display drop down
             $form->render_field($structure["fieldname"]);
             if ($i < $num_cols - 1) {
                 print " then ";
             }
         }
         print "</td>";
     }
     /*
     	Submit Row
     */
     print "<tr>";
     print "<td colspan=\"4\" valign=\"top\" style=\"padding: 4px;\">";
     print "<table>";
     print "<tr><td>";
     // submit button
     $structure = NULL;
     $structure["fieldname"] = "submit";
     $structure["type"] = "submit";
     $structure["defaultvalue"] = "Apply Options";
     $form->add_input($structure);
     $form->render_field("submit");
     print "</form>";
     print "</td>";
     print "<td>";
     /*
     	Include a reset button - this reset button is an independent form
     	which passes any required fixed options and also a reset option back to the page.
     
     	The load_options_form function then detects this reset value and erases the session
     	data for the options belonging to this table, resetting the options form to the original
     	defaults.
     */
     // start the form
     print "<form method=\"get\" class=\"form_standard\">";
     $form = new form_input();
     $form->formname = "reset";
     $form->language = $this->language;
     // include page name
     $structure = NULL;
     $structure["fieldname"] = "page";
     $structure["type"] = "hidden";
     $structure["defaultvalue"] = $_GET["page"];
     $form->add_input($structure);
     $form->render_field("page");
     // include any other fixed options
     foreach (array_keys($this->option) as $fieldname) {
         $structure = NULL;
         $structure["fieldname"] = $fieldname;
         $structure["type"] = "hidden";
         $structure["defaultvalue"] = $this->option[$fieldname];
         $form->add_input($structure);
         $form->render_field($fieldname);
     }
     // flag as the reset form
     $structure = NULL;
     $structure["fieldname"] = "reset";
     $structure["type"] = "hidden";
     $structure["defaultvalue"] = "yes";
     $form->add_input($structure);
     $form->render_field("reset");
     $structure = NULL;
     $structure["fieldname"] = "submit";
     $structure["type"] = "submit";
     $structure["defaultvalue"] = "Reset Options";
     $form->add_input($structure);
     $form->render_field("submit");
     print "</form></td>";
     print "</tr></table>";
     print "</td>";
     print "</tr>";
     // end of structure table
     print "</table>";
     // end of border table
     print "</td></tr></table><br>";
     print "</div>";
     // auto-hide options at startup
     if (!isset($_SESSION["form"][$this->tablename]["custom_options_active"])) {
         if (isset($_SESSION["user"]["shrink_tableoptions"]) && $_SESSION["user"]["shrink_tableoptions"] == "on") {
             print "<script type=\"text/javascript\">";
             print "obj_hide('" . $this->tablename . "_form');";
             print "</script>";
         }
     }
 }
Example #5
0
/*
	language/translate.php

	access:
		translation_edit
		translation_add_new

	Support file included by the primary application that defines the translation form/window for
	the popup application translation function
*/
if (user_permissions_get("devel_translate")) {
    /*
    	Design Form Structure
    */
    // header
    $obj_form = new form_input();
    $obj_form->formname = "translate";
    $obj_form->language = $_SESSION["user"]["lang"];
    $obj_form->action = "";
    $obj_form->method = "none";
    // form elements
    $structure = NULL;
    $structure["fieldname"] = "trans_label";
    $structure["type"] = "input";
    $structure["options"]["req"] = "yes";
    $obj_form->add_input($structure);
    $structure = NULL;
    $structure["fieldname"] = "trans_translation";
    $structure["type"] = "input";
    $structure["options"]["req"] = "yes";
    $obj_form->add_input($structure);
function form_zmien_haslo()
{
    $pole = new form_input();
    $pole->set_params('passold', in_type::text, 'passold', 'stare hasło', null, null);
    $tab[] = $pole;
    $pole = new form_input();
    $pole->set_params('pass1', in_type::password, 'pass1', 'nowe hasło', null, null);
    $tab[] = $pole;
    $pole = new form_input();
    $pole->set_params('pass2', in_type::password, 'pass2', 'powtórz hasło', null, null);
    $tab[] = $pole;
    return $tab;
}