}
default_focus(($search_box && $by_id) ? $search_box : $name);
- if ($SysPrefs->use_popup_search)
+ $img = "";
+ if ($SysPrefs->use_popup_search && (!isset($opts['fixed_asset']) || !$opts['fixed_asset']))
{
- $img = "";
- $img_title = "";
- $link = "";
+ $img_title = "";
+ $link = "";
$id = $name;
if ($SysPrefs->use_popup_windows) {
- //_vd("type= $type");
switch (strtolower($type)) {
case "stock":
$link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=all&client_id=" . $id;
$link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=costable&client_id=" . $id;
$img_title = _("Search items");
break;
- case "kits":
- $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=kits&client_id=" . $id;
+ case "component":
+ $parent = $opts['parent'];
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=component&parent=".$parent."&client_id=" . $id;
$img_title = _("Search items");
break;
- case "assets":
- $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=assets&client_id=" . $id;
+ case "kits":
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=kits&client_id=" . $id;
$img_title = _("Search items");
break;
case "customer":
if ($opts['editlink'])
$selector .= ' '.$opts['editlink'];
- if ($SysPrefs->use_popup_search)
- {
- if ($search_box && $opts['cells'])
- $str = ($edit_entry!='' ? "<td>$edit_entry</td>" : '')."<td>$selector$img</td>";
- else
- $str = $edit_entry.$selector.$img;
- }
+ if ($search_box && $opts['cells'])
+ $str = ($edit_entry!='' ? "<td>$edit_entry</td>" : '')."<td>$selector$img</td>";
else
- {
- if ($search_box && $opts['cells'])
- $str = ($edit_entry!='' ? "<td>$edit_entry</td>" : '')."<td>$selector</td>";
- else
- $str = $edit_entry.$selector;
- }
+ $str = $edit_entry.$selector.$img;
return $str;
}
//-----------------------------------------------------------------------------------------------
-function currencies_list($name, $selected_id=null, $submit_on_change=false)
+function currencies_list($name, $selected_id=null, $submit_on_change=false, $exclude_home_curr=false)
{
$sql = "SELECT curr_abrev, currency, inactive FROM ".TB_PREF."currencies";
+ if ($exclude_home_curr)
+ $sql .= " WHERE curr_abrev!='".get_company_currency()."'";
// 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
+ 'async' => false
) );
}
if ($editkey)
set_editor('item', $name, $editkey);
- if (isset($opts['fixed_asset']) && $opts['fixed_asset'])
- $type = 'assets';
$ret = combo_input($name, $selected_id, $sql, 'stock_id', 's.description',
array_merge(
array(
'spec_id' => ALL_TEXT,
'search_box' => true,
'search' => array("stock_id", "c.description","s.description"),
- 'search_submit' => get_company_pref('no_item_list')!=0,
+ 'search_submit' => get_company_pref('no_item_list')!=0 && (!isset($opts['fixed_asset']) || !$opts['fixed_asset']),
'size'=>10,
'select_submit'=> $submit_on_change,
'category' => 2,
function stock_component_items_list($name, $parent_stock_id, $selected_id=null,
$all_option=false, $submit_on_change=false, $editkey = false)
{
+ $parent = db_escape($parent_stock_id);
return stock_items_list($name, $selected_id, $all_option, $submit_on_change,
- array('where'=>array("stock_id != ".db_escape($parent_stock_id))), $editkey);
+ array('where'=>array("stock_id != $parent"), 'parent'=> $parent_stock_id), $editkey, "component");
}
+
function stock_component_items_list_cells($label, $name, $parent_stock_id,
$selected_id=null, $all_option=false, $submit_on_change=false, $editkey = false)
{
if ($label != null)
echo "<td>$label</td>\n";
+ $parent = db_escape($parent_stock_id);
echo stock_items_list($name, $selected_id, $all_option, $submit_on_change,
- array('where'=>array("stock_id != ".db_escape($parent_stock_id)), 'cells'=>true),
- $editkey);
+ array('where'=>array("stock_id != '$parent_stock_id'"), 'cells'=>true, 'parent'=> $parent_stock_id), $editkey, "component");
}
//------------------------------------------------------------------------------------
{
global $payment_services;
- $services = array_combine(array_keys($payment_services), array_keys($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"),