X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_lists.inc;h=cd3be97c047a562b874810984867b9a61bf2b0d0;hb=cb27e249917456ac29e41f12a75d359c4fdad977;hp=cae9efbc5f16a34b74f1827e7f395965d515e3a7;hpb=46c5f7a65a7659a44ae8254c63152074363d3987;p=fa-stable.git diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index cae9efbc..cd3be97c 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -214,11 +214,15 @@ $opts = array( // default options } $cat = $contact_row[$opts['category']]; if ($opts['category'] !== false && $cat != $lastcat){ + if ($lastcat!==null) + $selector .= ""; $selector .= "\n"; $lastcat = $cat; } $selector .= "\n"; } + if ($lastcat!==null) + $selector .= ""; db_free_result($result); } @@ -368,7 +372,6 @@ $opts = array( // default options if ($first_id!==false) { $sel = ($found===$first_id) || ($found===false && ($spec_option===false)) ? "selected='selected'" : ''; - $selector = sprintf($first_opt, $sel).$selector; } // Prepend special option. if ($spec_option !== false) { // if special option used - add it @@ -417,6 +420,21 @@ function _format_add_curr($row) '' : (" - " . $row[2])); } +function add_edit_combo($type) +{ + global $path_to_root, $popup_editors, $use_icon_for_editkey; + + if (!isset($use_icon_for_editkey) || $use_icon_for_editkey==0) + return ""; + // Derive theme path + $theme_path = $path_to_root . '/themes/' . user_theme(); + + $key = $popup_editors[$type][1]; + $onclick = "onclick=\"javascript:callEditor($key); return false;\""; + $img = "Add/Edit"; + return "$img"; +} + function supplier_list($name, $selected_id=null, $spec_option=false, $submit_on_change=false, $all=false, $editkey = false) { @@ -429,12 +447,13 @@ function supplier_list($name, $selected_id=null, $spec_option=false, $submit_on_ if ($editkey) set_editor('supplier', $name, $editkey); - return combo_input($name, $selected_id, $sql, 'supplier_id', 'supp_name', + $ret = combo_input($name, $selected_id, $sql, 'supplier_id', 'supp_name', array( 'format' => '_format_add_curr', 'order' => array('supp_ref'), 'search_box' => $mode!=0, 'type' => 1, + 'search' => array("supp_ref","supp_name","gst_no"), 'spec_option' => $spec_option === true ? _("All Suppliers") : $spec_option, 'spec_id' => $all_items, 'select_submit'=> $submit_on_change, @@ -443,6 +462,9 @@ function supplier_list($name, $selected_id=null, $spec_option=false, $submit_on_ _('Select supplier'), 'show_inactive'=>$all )); + if ($editkey) + $ret .= add_edit_combo('supplier'); + return $ret; } function supplier_list_cells($label, $name, $selected_id=null, $all_option=false, @@ -477,13 +499,14 @@ function customer_list($name, $selected_id=null, $spec_option=false, $submit_on_ if ($editkey) set_editor('customer', $name, $editkey); - return combo_input($name, $selected_id, $sql, 'debtor_no', 'name', + $ret = combo_input($name, $selected_id, $sql, 'debtor_no', 'debtor_ref', array( 'format' => '_format_add_curr', 'order' => array('debtor_ref'), 'search_box' => $mode!=0, 'type' => 1, 'size' => 20, + 'search' => array("debtor_ref","name","tax_id"), 'spec_option' => $spec_option === true ? _("All Customers") : $spec_option, 'spec_id' => $all_items, 'select_submit'=> $submit_on_change, @@ -492,6 +515,9 @@ function customer_list($name, $selected_id=null, $spec_option=false, $submit_on_ _('Select customer'), 'show_inactive' => $show_inactive ) ); + if ($editkey) + $ret .= add_edit_combo('customer'); + return $ret; } function customer_list_cells($label, $name, $selected_id=null, $all_option=false, @@ -508,6 +534,8 @@ function customer_list_cells($label, $name, $selected_id=null, $all_option=false function customer_list_row($label, $name, $selected_id=null, $all_option = false, $submit_on_change=false, $show_inactive=false, $editkey = false) { + global $path_to_root; + echo "$label"; echo customer_list($name, $selected_id, $all_option, $submit_on_change, $show_inactive, $editkey); @@ -528,7 +556,7 @@ function customer_branches_list($customer_id, $name, $selected_id=null, set_editor('branch', $name, $editkey); $where = $enabled ? array("disable_trans = 0") : array(); - return combo_input($name, $selected_id, $sql, 'branch_code', 'br_name', + $ret = combo_input($name, $selected_id, $sql, 'branch_code', 'branch_ref', array( 'where' => $where, 'order' => array('branch_ref'), @@ -537,6 +565,11 @@ function customer_branches_list($customer_id, $name, $selected_id=null, 'select_submit'=> $submit_on_change, 'sel_hint' => _('Select customer branch') ) ); + if ($editkey) + { + $ret .= add_edit_combo('branch'); + } + return $ret; } //------------------------------------------------------------------------------------------------ @@ -645,7 +678,7 @@ return combo_input($name, $selected_id, $sql, 'id', '', function _format_fiscalyears($row) { return sql2date($row[1]) . " - " . sql2date($row[2]) - . "  " . ($row[3] ? _('Closed') : _('Active')) . "\n"; + . "  " . ($row[3] ? _('Closed') : _('Active')); } function fiscalyears_list_cells($label, $name, $selected_id=null) @@ -681,7 +714,7 @@ $options = array( if (!$showclosed) $options['where'][] = "closed=0"; if($showtype) - $options['where'][] = "type_=$showtype"; + $options['where'][] = "type_=".db_escape($showtype); return combo_input($name, $selected_id, $sql, 'id', 'ref', $options); } @@ -718,7 +751,7 @@ function stock_items_list($name, $selected_id=null, $all_option=false, if ($editkey) set_editor('item', $name, $editkey); - return combo_input($name, $selected_id, $sql, 'stock_id', 's.description', + $ret = combo_input($name, $selected_id, $sql, 'stock_id', 's.description', array_merge( array( 'format' => '_format_stock_items', @@ -732,6 +765,10 @@ function stock_items_list($name, $selected_id=null, $all_option=false, 'category' => 2, 'order' => array('c.description','stock_id') ), $opts) ); + if ($editkey) + $ret .= add_edit_combo('item'); + return $ret; + } function _format_stock_items($row) @@ -801,8 +838,11 @@ function sales_items_list($name, $selected_id=null, $all_option=false, ), $opts) ); } -function sales_items_list_cells($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false) +function sales_items_list_cells($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false, $editkey=false) { + if ($editkey) + set_editor('item', $name, $editkey); + if ($label != null) echo "$label\n"; echo sales_items_list($name, $selected_id, $all_option, $submit_on_change, @@ -857,7 +897,7 @@ function stock_component_items_list($name, $parent_stock_id, $selected_id=null, $all_option=false, $submit_on_change=false, $editkey = false) { return stock_items_list($name, $selected_id, $all_option, $submit_on_change, - array('where'=>array("stock_id != '$parent_stock_id'")), $editkey); + array('where'=>array("stock_id != ".db_escape($parent_stock_id))), $editkey); } function stock_component_items_list_cells($label, $name, $parent_stock_id, @@ -866,7 +906,7 @@ function stock_component_items_list_cells($label, $name, $parent_stock_id, if ($label != null) echo "$label\n"; echo stock_items_list($name, $selected_id, $all_option, $submit_on_change, - array('where'=>array("stock_id != '$parent_stock_id'"), 'cells'=>true), + array('where'=>array("stock_id != ".db_escape($parent_stock_id)), 'cells'=>true), $editkey); } //------------------------------------------------------------------------------------ @@ -1377,7 +1417,7 @@ function workcenter_list_row($label, $name, $selected_id=null, $all_option=false //----------------------------------------------------------------------------------------------- -function bank_accounts_list($name, $selected_id=null, $submit_on_change=false) +function bank_accounts_list($name, $selected_id=null, $submit_on_change=false, $spec_option=false) { $sql = "SELECT ".TB_PREF."bank_accounts.id, bank_account_name, bank_curr_code, inactive FROM ".TB_PREF."bank_accounts"; @@ -1386,6 +1426,8 @@ function bank_accounts_list($name, $selected_id=null, $submit_on_change=false) array( 'format' => '_format_add_curr', 'select_submit'=> $submit_on_change, + 'spec_option' => $spec_option, + 'spec_id' => '', 'async' => false ) ); } @@ -1835,11 +1877,13 @@ function pagesizes_list_row($label, $name, $value=null) echo "\n"; } -function systypes_list($name, $value=null, $spec_opt=false, $submit_on_change=false) +function systypes_list($name, $value=null, $spec_opt=false, $submit_on_change=false, $exclude=array()) { global $systypes_array; - return array_selector($name, $value, $systypes_array, + // emove non-voidable transactions if needed + $systypes = array_diff_key($systypes_array, array_flip($exclude)); + return array_selector($name, $value, $systypes, array( 'spec_option'=> $spec_opt, 'spec_id' => ALL_NUMERIC, @@ -1849,19 +1893,19 @@ function systypes_list($name, $value=null, $spec_opt=false, $submit_on_change=fa ); } -function systypes_list_cells($label, $name, $value=null, $submit_on_change=false) +function systypes_list_cells($label, $name, $value=null, $submit_on_change=false, $exclude=array()) { if ($label != null) echo "$label\n"; echo ""; - echo systypes_list($name, $value, false, $submit_on_change); + echo systypes_list($name, $value, false, $submit_on_change, $exclude); echo "\n"; } -function systypes_list_row($label, $name, $value=null, $submit_on_change=false) +function systypes_list_row($label, $name, $value=null, $submit_on_change=false, $exclude=array()) { echo "$label"; - systypes_list_cells(null, $name, $value, $submit_on_change); + systypes_list_cells(null, $name, $value, $submit_on_change, $exclude); echo "\n"; } @@ -1876,8 +1920,7 @@ function journal_types_list_cells($label, $name, $value=null, $submit_on_change= $items = $systypes_array; // exclude quotes, orders and dimensions - foreach (array(ST_PURCHORDER, ST_WORKORDER, ST_SALESORDER, ST_DIMENSION, - ST_SALESQUOTE) as $excl) + foreach (array(ST_PURCHORDER, ST_SALESORDER, ST_DIMENSION, ST_SALESQUOTE, ST_LOCTRANSFER) as $excl) unset($items[$excl]); echo array_selector($name, $value, $items, @@ -2166,7 +2209,7 @@ function security_roles_list_row($label, $name, $selected_id=null, $new_item=fal echo "\n"; } -function tab_list_row($label, $name, $selected_id=null, $all = false) +function tab_list_row($label, $name, $selected_id=null) { global $installed_extensions; @@ -2174,12 +2217,6 @@ function tab_list_row($label, $name, $selected_id=null, $all = false) foreach ($_SESSION['App']->applications as $app) { $tabs[$app->id] = access_string($app->name, true); } - if ($all) { // add also not active ext. modules - foreach ($installed_extensions as $ext) { - if ($ext['type'] == 'module' && !$ext['active']) - $tabs[$ext['tab']] = access_string($ext['title'], true); - } - } echo "\n"; echo "$label\n"; echo array_selector($name, $selected_id, $tabs); @@ -2325,4 +2362,17 @@ function coa_list_row($label, $name, $value=null) echo array_selector( $name, $value, $coas ); echo "\n"; } -?> \ No newline at end of file + +function payment_services($name) +{ + global $payment_services; + + $services = (object)array_combine(array_keys($payment_services), array_keys($payment_services)); + + return array_selector($name, null, $services, array( + 'spec_option'=> _("No payment Link"), + 'spec_id' => '', + )); +} + +?>