'spec_id' => 0, // option id
// submit on select parameters
'default' => '', // default value when $_POST is not set
+ 'multi' => false, // multiple select
'select_submit' => false, //submit on select: true/false
'async' => true, // select update via ajax (true) vs _page_body reload
// search box parameters
'disabled' => false,
'box_hint' => null, // box/selectors hints; null = std see below
'category' => false, // category column name or false
- 'show_inactive' => false // show inactive records.
+ 'show_inactive' => false, // show inactive records.
+ 'editable' => false // false, or length of editable entry field
);
// ------ merge options with defaults ----------
if($options != null)
if (!is_array($opts['where'])) $opts['where'] = array($opts['where']);
$search_box = $opts['search_box']===true ? '_'.$name.'_edit' : $opts['search_box'];
+ // select content filtered by search field:
$search_submit = $opts['search_submit']===true ? '_'.$name.'_button' : $opts['search_submit'];
+ // select set by select content field
+ $search_button = $opts['editable'] ? '_'.$name.'_button' : ($search_box ? $search_submit : false);
+
$select_submit = $opts['select_submit'];
$spec_id = $opts['spec_id'];
$spec_option = $opts['spec_option'];
$by_id = ($opts['type'] == 0);
$class = $by_id ? 'combo':'combo2';
$disabled = $opts['disabled'] ? "disabled" : '';
-
+ $multi = $opts['multi'];
+
if(!count($opts['search'])) {
$opts['search'] = array($by_id ? $valfield : $namefield);
}
$opts['sel_hint'] = $by_id || $search_box==false ?
'' : _('Press Space tab for search pattern entry');
- if ($opts['box_hint'] === null)
+ if ($opts['box_hint'] === null) // dodaƦ hint dla pustego ****
$opts['box_hint'] = $search_box && $search_submit != false ?
($by_id ? _('Enter code fragment to search or * for all')
: _('Enter description fragment to search or * for all')) :'';
if ($selected_id == null) {
$selected_id = get_post($name, $opts['default']);
}
+ if(!is_array($selected_id))
+ $selected_id = array($selected_id); // code is generalized for multiple selection support
+
$txt = get_post($search_box);
$rel = '';
$limit = '';
- if (isset($_POST['_'.$name.'_update'])) {
+ if (isset($_POST['_'.$name.'_update'])) { // select list or search box change
if ($by_id) $txt = $_POST[$name];
if (!$opts['async'])
else
$Ajax->activate($name);
}
- if ($search_box) {
- // search related sql modifications
-
- $rel = "rel='$search_box'"; // set relation to list
- if ($opts['search_submit']) {
- if (isset($_POST[$search_submit])) {
- $selected_id = ''; // ignore selected_id while search
+ if (isset($_POST[$search_button])) {
if (!$opts['async'])
$Ajax->activate('_page_body');
else
$Ajax->activate($name);
}
- if ($txt == '') {
- if ($spec_option === false && $selected_id==null)
- $limit = ' LIMIT 1';
- else
- $opts['where'][] = $valfield . "='". get_post($name, $spec_id)."'";
- }
- else
- if ($txt != '*') {
+ if ($search_box) {
+ // search related sql modifications
- foreach($opts['search'] as $i=> $s)
- $opts['search'][$i] = $s . " LIKE '%{$txt}%'";
- $opts['where'][] = '('. implode($opts['search'], ' OR ') . ')';
+ $rel = "rel='$search_box'"; // set relation to list
+ if ($opts['search_submit']) {
+ if (isset($_POST[$search_button])) {
+ $selected_id = array(); // ignore selected_id while search
+ if (!$opts['async'])
+ $Ajax->activate('_page_body');
+ else
+ $Ajax->activate($name);
+ }
+ if ($txt == '') {
+ if ($spec_option === false && $selected_id == array())
+ $limit = ' LIMIT 1';
+ else
+ $opts['where'][] = $valfield . "='". get_post($name, $spec_id)."'";
+ }
+ else
+ if ($txt != '*') {
+
+ foreach($opts['search'] as $i=> $s)
+ $opts['search'][$i] = $s . " LIKE '%{$txt}%'";
+ $opts['where'][] = '('. implode($opts['search'], ' OR ') . ')';
+ }
}
}
- }
// sql completion
if (count($opts['where'])) {
$where = strpos($sql, 'WHERE')==false ? ' WHERE ':' AND ';
$first_id = false;
$found = false;
$lastcat = null;
-//if($name=='stock_id') display_error($sql);
+ $edit = false;
+//if($name=='stock_id') display_notification('<pre>'.print_r($_POST, true).'</pre>');
+//if($name=='curr_default') display_notification($opts['search_submit']);
if($result = db_query($sql)) {
while ($contact_row = db_fetch($result)) {
$value = $contact_row[0];
$descr = $opts['format']==null ? $contact_row[1] :
- call_user_func($opts['format'], $contact_row);
+ call_user_func($opts['format'], $contact_row);
$sel = '';
- if (get_post($search_submit) && ($txt === $value)) {
- $selected_id = $value;
+ if (get_post($search_button) && ($txt == $value)) {
+ $selected_id[] = $value;
}
- if ((string)($selected_id) === $value) {
+ if (in_array($value, $selected_id)) {
$sel = 'selected';
$found = $value;
+ $edit = $opts['editable'] && $contact_row['editable']
+ && (@$_POST[$search_box] == $value)
+ ? $descr : false;
+ if ($edit)
+ break; // selected field is editable - abandon list construction
}
// show selected option even if inactive
if (!$opts['show_inactive'] && @$contact_row['inactive'] && $sel==='') {
. $selector;
}
- if ($found === false) {
- $selected_id = $first_id;
+ if ($found===false) {
+ $selected_id = array($first_id);
}
- $_POST[$name] = $selected_id;
+
+ $_POST[$name] = $multi ? $selected_id : $selected_id[0];
- if ($by_id && $search_box != false) {
- $txt = $found;
- $Ajax->addUpdate($name, $search_box, $txt ? $txt : '');
- }
- $selector = "<select ".(strpos($name,'[]')!==false ? "multiple" : '')
+ $selector = "<select ".($multi ? "multiple" : '')
. ($opts['height']!==false ? ' size="'.$opts['height'].'"' : '')
- . "$disabled name='$name' class='$class' title='"
+ . "$disabled name='$name".($multi ? '[]':'')."' class='$class' title='"
. $opts['sel_hint']."' $rel>".$selector."</select>\n";
+ if ($by_id && ($search_box != false || $opts['editable']) ) {
+ // on first display show selector list
+ if (isset($_POST[$search_box]) && $opts['editable'] && $edit) {
+ $selector = "<input type='hidden' name='$name' value='".$_POST[$name]."'>"
+ ."<input type='text' $disabled name='{$name}_text' id='{$name}_text' size='".
+ $opts['editable']."' maxlength='".$opts['max']."' $rel value='$edit'>\n";
+ set_focus($name.'_text'); // prevent lost focus
+ } else if (get_post($search_submit ? $search_submit : "_{$name}_button"))
+ set_focus($name); // prevent lost focus
+ if (!$opts['editable'])
+ $txt = $found;
+ $Ajax->addUpdate($name, $search_box, $txt ? $txt : '');
+ }
+
$Ajax->addUpdate($name, "_{$name}_sel", $selector);
- // because of bug which M$ cannot fix since IE 5.0
- // we must embed whole selector in span tags to enable proper ajax update
+ // span for select list/input field update
$selector = "<span id='_{$name}_sel'>".$selector."</span>\n";
- if ($select_submit != false) { // if submit on change is used - add select button
+ // if selectable or editable list is used - add select button
+ if ($select_submit != false || $search_button) {
global $_select_button;
// button class selects form reload/ajax selector update
$selector .= sprintf($_select_button, $disabled, user_theme(),
'_'.$name.'_update')."\n";
}
// ------ make combo ----------
-
$edit_entry = '';
if ($search_box != false) {
$edit_entry = "<input $disabled type='text' name='$search_box' id='$search_box' size='".
.$opts['box_hint']."'"
.(!fallback_mode() && !$by_id ? " style=display:none;":'')
.">\n";
- if ($search_submit != false) {
+ if ($search_submit != false || $opts['editable']) {
global $_search_button;
$edit_entry .= sprintf($_search_button, $disabled, user_theme(),
(fallback_mode() ? '' : 'display:none;'),
- $search_submit)."\n";
+ $search_submit ? $search_submit : "_{$name}_button")."\n";
}
}
default_focus(($search_box && $by_id) ? $search_box : $name);
- $str = $selector;
+
if ($search_box && $opts['cells'])
- echo ($edit_entry!='' ? "<td>$edit_entry</td>" : '')."<td>$selector</td>";
+ $str = ($edit_entry!='' ? "<td>$edit_entry</td>" : '')."<td>$selector</td>";
else
- echo $edit_entry.$selector;
-
+ $str = $edit_entry.$selector;
return $str;
}
'select_submit' => false, //submit on select: true/false
'async' => true, // select update via ajax (true) vs _page_body reload
'default' => '', // default value when $_POST is not set
+ 'multi'=>false, // multiple select
// search box parameters
+ 'height' => false, // number of lines in select box
'sel_hint' => null,
'disabled' => false
);
$spec_id = $opts['spec_id'];
$spec_option = $opts['spec_option'];
$disabled = $opts['disabled'] ? "disabled" : '';
+ $multi = $opts['multi'];
if ($selected_id == null) {
$selected_id = get_post($name, $opts['default']);
}
+ if(!is_array($selected_id))
+ $selected_id = array($selected_id); // code is generalized for multiple selection support
if (isset($_POST[ '_'.$name.'_update'])) {
if (!$opts['async'])
//if($name=='SelectStockFromList') display_error($sql);
foreach($items as $value=>$descr) {
$sel = '';
- if ((string)$selected_id === (string)$value) {
+ if (in_array((string)$value, $selected_id)) {
$sel = 'selected';
$found = $value;
}
. $selector;
}
- if ($found === false) {
- $selected_id = $first_id;
+ if ($found===false) {
+ $selected_id = array($first_id);
}
- $_POST[$name] = $selected_id;
-
- $selector = "<select $disabled name='$name' class='combo' title='"
+ $_POST[$name] = $multi ? $selected_id : $selected_id[0];
+ $selector = "<select ".($multi ? "multiple" : '')
+ . ($opts['height']!==false ? ' size="'.$opts['height'].'"' : '')
+ . "$disabled name='$name".($multi ? '[]' : '')."' class='combo' title='"
. $opts['sel_hint']."'>".$selector."</select>\n";
$Ajax->addUpdate($name, "_{$name}_sel", $selector);
'_'.$name.'_update')."\n";
}
default_focus($name);
- echo $selector;
return $selector;
}
{
if ($label != null)
echo "<td>$label</td><td>\n";
- $str = supplier_list($name, $selected_id, $all_option, $submit_on_change,
+ echo supplier_list($name, $selected_id, $all_option, $submit_on_change,
$all, $editkey);
echo "</td>\n";
- return $str;
}
function supplier_list_row($label, $name, $selected_id=null, $all_option = false,
$submit_on_change=false, $all=false, $editkey = false)
{
-echo "<tr><td>$label</td><td>";
- $str = supplier_list($name, $selected_id, $all_option, $submit_on_change,
+ echo "<tr><td>$label</td><td>";
+ echo supplier_list($name, $selected_id, $all_option, $submit_on_change,
$all, $editkey);
-echo "</td></tr>\n";
-return $str;
+ echo "</td></tr>\n";
}
//----------------------------------------------------------------------------------------------
if ($editkey)
set_editor('customer', $name, $editkey);
-return combo_input($name, $selected_id, $sql, 'debtor_no', 'name',
+ return combo_input($name, $selected_id, $sql, 'debtor_no', 'name',
array(
'format' => '_format_add_curr',
'order' => array('debtor_ref'),
if ($label != null)
echo "<td>$label</td>\n";
echo "<td nowrap>";
- $str = customer_list($name, $selected_id, $all_option, $submit_on_change,
+ echo customer_list($name, $selected_id, $all_option, $submit_on_change,
$show_inactive, $editkey);
echo "</td>\n";
- return $str;
}
function customer_list_row($label, $name, $selected_id=null, $all_option = false,
$submit_on_change=false, $show_inactive=false, $editkey = false)
{
echo "<tr><td>$label</td><td nowrap>";
- $str = customer_list($name, $selected_id, $all_option, $submit_on_change,
+ echo customer_list($name, $selected_id, $all_option, $submit_on_change,
$show_inactive, $editkey);
echo "</td>\n</tr>\n";
- return $str;
}
//------------------------------------------------------------------------------------------------
set_editor('branch', $name, $editkey);
$where = $enabled ? array("disable_trans = 0") : array();
-return combo_input($name, $selected_id, $sql, 'branch_code', 'br_name',
+ return combo_input($name, $selected_id, $sql, 'branch_code', 'br_name',
array(
'where' => $where,
'order' => array('branch_ref'),
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $ret = customer_branches_list($customer_id, $name, $selected_id, $all_option, $enabled,
+ echo customer_branches_list($customer_id, $name, $selected_id, $all_option, $enabled,
$submit_on_change, $editkey);
echo "</td>\n";
- return $ret;
}
function customer_branches_list_row($label, $customer_id, $name, $selected_id=null,
$all_option = true, $enabled=true, $submit_on_change=false, $editkey = false)
{
echo "<tr>";
- $ret = customer_branches_list_cells($label, $customer_id, $name, $selected_id,
+ customer_branches_list_cells($label, $customer_id, $name, $selected_id,
$all_option, $enabled, $submit_on_change, $editkey);
echo "</tr>";
- return $ret;
}
//------------------------------------------------------------------------------------------------
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $str = locations_list($name, $selected_id, $all_option, $submit_on_change);
+ echo locations_list($name, $selected_id, $all_option, $submit_on_change);
echo "</td>\n";
- return $str;
}
function locations_list_row($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false)
{
echo "<tr>";
- $str = locations_list_cells($label, $name, $selected_id, $all_option, $submit_on_change);
+ locations_list_cells($label, $name, $selected_id, $all_option, $submit_on_change);
echo "</tr>\n";
- return $str;
}
//-----------------------------------------------------------------------------------------------
$sql = "SELECT curr_abrev, currency, inactive FROM ".TB_PREF."currencies";
// default to the company currency
-
return combo_input($name, $selected_id, $sql, 'curr_abrev', 'currency',
array(
'select_submit'=> $submit_on_change,
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $str = currencies_list($name, $selected_id, $submit_on_change);
+ echo currencies_list($name, $selected_id, $submit_on_change);
echo "</td>\n";
- return $str;
}
function currencies_list_row($label, $name, $selected_id=null, $submit_on_change=false)
{
echo "<tr>\n";
- $str = currencies_list_cells($label, $name, $selected_id, $submit_on_change);
+ currencies_list_cells($label, $name, $selected_id, $submit_on_change);
echo "</tr>\n";
- return $str;
}
//---------------------------------------------------------------------------------------------------
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $str = fiscalyears_list($name, $selected_id);
+ echo fiscalyears_list($name, $selected_id);
echo "</td>\n";
- return $str;
}
function fiscalyears_list_row($label, $name, $selected_id=null)
{
echo "<tr>\n";
- $str = fiscalyears_list_cells($label, $name, $selected_id);
+ fiscalyears_list_cells($label, $name, $selected_id);
echo "</tr>\n";
- return $str;
}
//------------------------------------------------------------------------------------
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $str = dimensions_list($name, $selected_id, $no_option, $showname, $submit_on_change, $showclosed, $showtype);
+ echo dimensions_list($name, $selected_id, $no_option, $showname, $submit_on_change, $showclosed, $showtype);
echo "</td>\n";
- return $str;
}
function dimensions_list_row($label, $name, $selected_id=null, $no_option=false, $showname=null,
$showclosed=false, $showtype=0, $submit_on_change=false)
{
echo "<tr>\n";
- $str = dimensions_list_cells($label, $name, $selected_id, $no_option, $showname,
+ dimensions_list_cells($label, $name, $selected_id, $no_option, $showname,
$showclosed, $showtype, $submit_on_change);
echo "</tr>\n";
- return $str;
}
//---------------------------------------------------------------------------------------------------
{
global $all_items;
- $sql = "SELECT stock_id, s.description, c.description, s.inactive
+ $sql = "SELECT stock_id, s.description, c.description, s.inactive, s.editable
FROM ".TB_PREF."stock_master s,".TB_PREF."stock_category c WHERE s.category_id=c.category_id";
if ($editkey)
{
if ($label != null)
echo "<td>$label</td>\n";
- $str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
+ echo stock_items_list($name, $selected_id, $all_option, $submit_on_change,
array('cells'=>true, 'show_inactive'=>$all), $editkey);
- return $str;
}
/*
function stock_items_list_row($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false)
{
echo "<tr>\n";
- $str = stock_items_list_cells($label, $name, $selected_id, $all_option, $submit_on_change);
+ stock_items_list_cells($label, $name, $selected_id, $all_option, $submit_on_change);
echo "</tr>\n";
- return $str;
}
*/
//---------------------------------------------------------------------------------------------------
global $all_items;
// all sales codes
$sql = "SELECT i.item_code, i.description, c.description, count(*)>1 as kit,
- i.inactive
+ i.inactive, if(count(*)>1, '0', s.editable) as editable
FROM
".TB_PREF."stock_master s,
".TB_PREF."item_codes i
'spec_option' => $all_option===true ? _("All Items") : $all_option,
'spec_id' => $all_items,
'search_box' => true,
- 'search' => array("i.item_code", "i.description"),
+ 'search' => array("i.item_code", "c.description", "i.description"),
'search_submit' => get_company_pref('no_item_list')!=0,
'size'=>15,
'select_submit'=> $submit_on_change,
'category' => 2,
- 'order' => array('c.description','i.item_code')
+ 'order' => array('c.description','i.item_code'),
+ 'editable' => 30,
+ 'max' => 255
), $opts) );
}
{
if ($label != null)
echo "<td>$label</td>\n";
- $str = sales_items_list($name, $selected_id, $all_option, $submit_on_change,
+ echo sales_items_list($name, $selected_id, $all_option, $submit_on_change,
'', array('cells'=>true));
- return $str;
}
function sales_kits_list($name, $selected_id=null, $all_option=false, $submit_on_change=false)
{
- $str = sales_items_list($name, $selected_id, $all_option, $submit_on_change,
- 'kits', array('cells'=>false));
- return $str;
+ return sales_items_list($name, $selected_id, $all_option, $submit_on_change,
+ 'kits', array('cells'=>false, 'editable' => false));
}
function sales_local_items_list_row($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false)
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $str = sales_items_list($name, $selected_id, $all_option, $submit_on_change,
- 'local', array('cells'=>false));
+ echo sales_items_list($name, $selected_id, $all_option, $submit_on_change,
+ 'local', array('cells'=>false, 'editable' => false));
echo "</td></tr>";
- return $str;
}
//------------------------------------------------------------------------------------
function stock_manufactured_items_list($name, $selected_id=null,
$all_option=false, $submit_on_change=false)
{
- $str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
+ return stock_items_list($name, $selected_id, $all_option, $submit_on_change,
array('where'=>array("mb_flag= 'M'")));
- return $str;
}
function stock_manufactured_items_list_cells($label, $name, $selected_id=null,
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $str = stock_manufactured_items_list($name, $selected_id, $all_option, $submit_on_change);
+ echo stock_manufactured_items_list($name, $selected_id, $all_option, $submit_on_change);
echo "</td>\n";
- return $str;
}
function stock_manufactured_items_list_row($label, $name, $selected_id=null,
$all_option=false, $submit_on_change=false)
{
echo "<tr>\n";
- $str = stock_manufactured_items_list_cells($label, $name, $selected_id, $all_option, $submit_on_change);
+ stock_manufactured_items_list_cells($label, $name, $selected_id, $all_option, $submit_on_change);
echo "</tr>\n";
- return $str;
}
//------------------------------------------------------------------------------------
function stock_component_items_list($name, $parent_stock_id, $selected_id=null,
$all_option=false, $submit_on_change=false, $editkey = false)
{
- $str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
+ return stock_items_list($name, $selected_id, $all_option, $submit_on_change,
array('where'=>array("stock_id != '$parent_stock_id'")), $editkey);
- return $str;
}
function stock_component_items_list_cells($label, $name, $parent_stock_id,
{
if ($label != null)
echo "<td>$label</td>\n";
- $str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
+ echo stock_items_list($name, $selected_id, $all_option, $submit_on_change,
array('where'=>array("stock_id != '$parent_stock_id'"), 'cells'=>true),
$editkey);
- return $str;
}
//------------------------------------------------------------------------------------
function stock_costable_items_list($name, $selected_id=null,
$all_option=false, $submit_on_change=false)
{
- $str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
+ return stock_items_list($name, $selected_id, $all_option, $submit_on_change,
array('where'=>array("mb_flag!='D'")));
- return $str;
}
function stock_costable_items_list_cells($label, $name, $selected_id=null,
{
if ($label != null)
echo "<td>$label</td>\n";
- $str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
+ echo stock_items_list($name, $selected_id, $all_option, $submit_on_change,
array('where'=>array("mb_flag!='D'"), 'cells'=>true));
- return $str;
}
//------------------------------------------------------------------------------------
function stock_purchasable_items_list($name, $selected_id=null,
$all_option=false, $submit_on_change=false, $all=false, $editkey=false)
{
- $str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
+ return stock_items_list($name, $selected_id, $all_option, $submit_on_change,
array('where'=>array("mb_flag!= 'M'"),
'show_inactive'=>$all), $editkey);
- return $str;
}
-
+//
+// This helper is used in PO/GRN/PI entry and supports editable descriptions.
+//
function stock_purchasable_items_list_cells($label, $name, $selected_id=null,
$all_option=false, $submit_on_change=false, $editkey=false)
{
if ($label != null)
echo "<td>$label</td>\n";
- $str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
+ echo stock_items_list($name, $selected_id, $all_option, $submit_on_change,
array('where'=>array("mb_flag!= 'M'"),
+ 'editable' => 30,
'cells'=>true), $editkey);
- return $str;
}
-
+/*
function stock_purchasable_items_list_row($label, $name, $selected_id=null,
$all_option=false, $submit_on_change=false, $editkey=false)
{
echo "<tr>\n";
- $ret = stock_purchasable_items_list_cells($label, $name, $selected_id=null,
+ stock_purchasable_items_list_cells($label, $name, $selected_id=null,
$all_option, $submit_on_change, $editkey);
echo "</tr>\n";
- return $ret;
}
-
+*/
//------------------------------------------------------------------------------------
function stock_item_types_list_row($label, $name, $selected_id=null, $enabled=true)
echo "<td>$label</td>\n";
echo "<td>";
- array_selector($name, $selected_id, $stock_types,
+ echo array_selector($name, $selected_id, $stock_types,
array(
'select_submit'=> true,
'disabled' => !$enabled) );
while($unit = db_fetch($result))
$units[$unit['abbr']] = $unit['name'];
- array_selector($name, $value, $units, array( 'disabled' => !$enabled) );
+ echo array_selector($name, $value, $units, array( 'disabled' => !$enabled) );
echo "</td></tr>\n";
}
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $str = tax_types_list($name, $selected_id, $none_option, $submit_on_change);
+ echo tax_types_list($name, $selected_id, $none_option, $submit_on_change);
echo "</td>\n";
- return $str;
}
function tax_types_list_row($label, $name, $selected_id=null, $none_option=false,
$submit_on_change=false)
{
echo "<tr>\n";
- $str = tax_types_list_cells($label, $name, $selected_id, $none_option, $submit_on_change);
+ tax_types_list_cells($label, $name, $selected_id, $none_option, $submit_on_change);
echo "</tr>\n";
- return $str;
}
//------------------------------------------------------------------------------------
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $str = tax_groups_list($name, $selected_id, $none_option, $submit_on_change);
+ echo tax_groups_list($name, $selected_id, $none_option, $submit_on_change);
echo "</td>\n";
- return $str;
}
function tax_groups_list_row($label, $name, $selected_id=null, $none_option=false, $submit_on_change=false)
{
echo "<tr>\n";
- $str = tax_groups_list_cells($label, $name, $selected_id, $none_option, $submit_on_change);
+ tax_groups_list_cells($label, $name, $selected_id, $none_option, $submit_on_change);
echo "</tr>\n";
- return $str;
}
//------------------------------------------------------------------------------------
function item_tax_types_list($name, $selected_id=null)
{
$sql ="SELECT id, name FROM ".TB_PREF."item_tax_types";
- combo_input($name, $selected_id, $sql, 'id', 'name', array('order' => 'id') );
+ return combo_input($name, $selected_id, $sql, 'id', 'name', array('order' => 'id') );
}
function item_tax_types_list_cells($label, $name, $selected_id=null)
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- item_tax_types_list($name, $selected_id);
+ echo item_tax_types_list($name, $selected_id);
echo "</td>\n";
}
function shippers_list($name, $selected_id=null)
{
$sql = "SELECT shipper_id, shipper_name, inactive FROM ".TB_PREF."shippers";
- combo_input($name, $selected_id, $sql, 'shipper_id', 'shipper_name',
+ return combo_input($name, $selected_id, $sql, 'shipper_id', 'shipper_name',
array('order'=>array('shipper_name')));
}
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- shippers_list($name, $selected_id);
+ echo shippers_list($name, $selected_id);
echo "</td>\n";
}
//-------------------------------------------------------------------------------------
-function sales_persons_list($name, $selected_id=null)
+function sales_persons_list($name, $selected_id=null, $spec_opt=false)
{
$sql = "SELECT salesman_code, salesman_name, inactive FROM ".TB_PREF."salesman";
- combo_input($name, $selected_id, $sql, 'salesman_code', 'salesman_name',
- array('order'=>array('salesman_name')));
+ return combo_input($name, $selected_id, $sql, 'salesman_code', 'salesman_name',
+ array('order'=>array('salesman_name'),
+ 'spec_option' => $spec_opt,
+ 'spec_id' => ALL_NUMERIC));
}
-function sales_persons_list_cells($label, $name, $selected_id=null)
+function sales_persons_list_cells($label, $name, $selected_id=null, $spec_opt=false)
{
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>\n";
- sales_persons_list($name, $selected_id);
+ echo sales_persons_list($name, $selected_id, $spec_opt);
echo "</td>\n";
}
-function sales_persons_list_row($label, $name, $selected_id=null, $submit_on_change=false)
+function sales_persons_list_row($label, $name, $selected_id=null, $spec_opt=false)
{
echo "<tr>\n";
- sales_persons_list_cells($label, $name, $selected_id, $submit_on_change=false);
+ sales_persons_list_cells($label, $name, $selected_id, $spec_opt);
echo "</tr>\n";
}
function sales_areas_list($name, $selected_id=null)
{
$sql = "SELECT area_code, description, inactive FROM ".TB_PREF."areas";
- combo_input($name, $selected_id, $sql, 'area_code', 'description', array());
+ return combo_input($name, $selected_id, $sql, 'area_code', 'description', array());
}
function sales_areas_list_cells($label, $name, $selected_id=null)
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- sales_areas_list($name, $selected_id);
+ echo sales_areas_list($name, $selected_id);
echo "</td>\n";
}
function sales_groups_list($name, $selected_id=null, $special_option=false)
{
$sql = "SELECT id, description, inactive FROM ".TB_PREF."groups";
- combo_input($name, $selected_id, $sql, 'id', 'description', array(
+ return combo_input($name, $selected_id, $sql, 'id', 'description', array(
'spec_option' => $special_option===true ? ' ' : $special_option,
'order' => 'description', 'spec_id' => 0,
));
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- sales_groups_list($name, $selected_id, $special_option);
+ echo sales_groups_list($name, $selected_id, $special_option);
echo "</td>\n";
}
$sql = "SELECT sorder.order_no, Sum(line.unit_price*line.quantity*(1-line.discount_percent)) AS OrderValue
FROM ".TB_PREF."sales_orders as sorder, ".TB_PREF."sales_order_details as line
WHERE sorder.order_no = line.order_no AND sorder.type = 1 GROUP BY line.order_no";
- combo_input($name, $selected_id, $sql, 'order_no', 'OrderValue', array(
+ return combo_input($name, $selected_id, $sql, 'order_no', 'OrderValue', array(
'format' => '_format_template_items',
'spec_option' => $special_option===true ? ' ' : $special_option,
'order' => 'order_no', 'spec_id' => 0,
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- templates_list($name, $selected_id, $special_option);
+ echo templates_list($name, $selected_id, $special_option);
echo "</td>\n";
}
function workorders_list($name, $selected_id=null)
{
$sql = "SELECT id, wo_ref FROM ".TB_PREF."workorders WHERE closed=0";
- combo_input($name, $selected_id, $sql, 'id', 'wo_ref', array());
+ return combo_input($name, $selected_id, $sql, 'id', 'wo_ref', array());
}
function workorders_list_cells($label, $name, $selected_id=null)
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- workorders_list($name, $selected_id);
+ echo workorders_list($name, $selected_id);
echo "</td>\n";
}
function payment_terms_list($name, $selected_id=null)
{
$sql = "SELECT terms_indicator, terms, inactive FROM ".TB_PREF."payment_terms";
- combo_input($name, $selected_id, $sql, 'terms_indicator', 'terms', array());
+ return combo_input($name, $selected_id, $sql, 'terms_indicator', 'terms', array());
}
function payment_terms_list_cells($label, $name, $selected_id=null)
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- payment_terms_list($name, $selected_id);
+ echo payment_terms_list($name, $selected_id);
echo "</td>\n";
}
function credit_status_list($name, $selected_id=null)
{
$sql ="SELECT id, reason_description, inactive FROM ".TB_PREF."credit_status";
- combo_input($name, $selected_id, $sql, 'id', 'reason_description', array());
+ return combo_input($name, $selected_id, $sql, 'id', 'reason_description', array());
}
function credit_status_list_cells($label, $name, $selected_id=null)
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- credit_status_list($name, $selected_id);
+ echo credit_status_list($name, $selected_id);
echo "</td>\n";
}
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $str = sales_types_list($name, $selected_id, $submit_on_change, $special_option);
+ echo sales_types_list($name, $selected_id, $submit_on_change, $special_option);
echo "</td>\n";
- return $str;
}
function sales_types_list_row($label, $name, $selected_id=null, $submit_on_change=false, $special_option=false)
{
echo "<tr>\n";
- $str = sales_types_list_cells($label, $name, $selected_id, $submit_on_change, $special_option);
+ sales_types_list_cells($label, $name, $selected_id, $submit_on_change, $special_option);
echo "</tr>\n";
- return $str;
}
//-----------------------------------------------------------------------------------------------
function movement_types_list($name, $selected_id=null)
{
$sql = "SELECT id, name FROM ".TB_PREF."movement_types";
- combo_input($name, $selected_id, $sql, 'id', 'name', array());
+ return combo_input($name, $selected_id, $sql, 'id', 'name', array());
}
function movement_types_list_cells($label, $name, $selected_id=null)
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- movement_types_list($name, $selected_id);
+ echo movement_types_list($name, $selected_id);
echo "</td>\n";
}
$sql = "SELECT reconciled, reconciled FROM ".TB_PREF."bank_trans
WHERE bank_act=".db_escape($account)." AND reconciled IS NOT NULL
GROUP BY reconciled";
- combo_input($name, $selected_id, $sql, 'id', 'reconciled',
+ return combo_input($name, $selected_id, $sql, 'id', 'reconciled',
array(
'spec_option' => $special_option,
'format' => '_format_date',
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- bank_reconciliation_list($account, $name, $selected_id, $submit_on_change, $special_option);
+ echo bank_reconciliation_list($account, $name, $selected_id, $submit_on_change, $special_option);
echo "</td>\n";
}
/*
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- workcenter_list($name, $selected_id, $all_option);
+ echo workcenter_list($name, $selected_id, $all_option);
echo "</td>\n";
}
{
$sql = "SELECT ".TB_PREF."bank_accounts.id, bank_account_name, bank_curr_code, inactive
FROM ".TB_PREF."bank_accounts";
-// , ".TB_PREF."chart_master
-// WHERE ".TB_PREF."bank_accounts.account_code=".TB_PREF."chart_master.account_code";
return combo_input($name, $selected_id, $sql, 'id', 'bank_account_name',
array(
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $str = bank_accounts_list($name, $selected_id, $submit_on_change);
+ echo bank_accounts_list($name, $selected_id, $submit_on_change);
echo "</td>\n";
- return $str;
}
function bank_accounts_list_row($label, $name, $selected_id=null, $submit_on_change=false)
{
echo "<tr>\n";
- $str = bank_accounts_list_cells($label, $name, $selected_id, $submit_on_change);
+ bank_accounts_list_cells($label, $name, $selected_id, $submit_on_change);
echo "</tr>\n";
- return $str;
}
//-----------------------------------------------------------------------------------------------
if ($label != null)
echo "<tr><td>$label</td>\n";
echo "<td>";
- $str = combo_input($name, $selected_id, $sql, 'id', 'bank_account_name',
+ echo combo_input($name, $selected_id, $sql, 'id', 'bank_account_name',
array(
'format' => '_format_add_curr',
'select_submit'=> $submit_on_change,
'async' => true
) );
echo "</td></tr>\n";
- return $str;
}
//-----------------------------------------------------------------------------------------------
echo "<td>$label</td>\n";
echo "<td>";
- $str = combo_input($name, $selected_id, $sql, 'id', 'pos_name',
+ echo combo_input($name, $selected_id, $sql, 'id', 'pos_name',
array(
'select_submit'=> $submit_on_change,
'async' => true,
) );
echo "</td></tr>\n";
- return $str;
}
//-----------------------------------------------------------------------------------------------
+// Payment type selector for current user.
+//
+function sale_payment_list($name, $selected_id=null, $submit_on_change=true)
+{
+ $sql = "SELECT terms_indicator, terms, inactive FROM ".TB_PREF."payment_terms";
+ $paym = get_sales_point(user_pos());
+
+ if (!$paym['cash_sale'] || !$paym['credit_sale']) {
+ if ($paym['cash_sale']) // only cash
+ $sql .= " WHERE days_before_due=0 AND day_in_following_month=0";
+ else
+ $sql .= " WHERE days_before_due!=0 OR day_in_following_month!=0";
+ }
-function sale_payment_list_cells($label, $name, $selected_id=null, $submit_on_change=false)
+ return combo_input($name, $selected_id, $sql, 'terms_indicator', 'terms',
+ array(
+ 'select_submit'=> $submit_on_change,
+ 'async' => true
+ ) );
+
+}
+
+function sale_payment_list_cells($label, $name, $selected_id=null, $submit_on_change=true)
{
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $str = yesno_list($name, $selected_id, _('Cash'), _('Delayed'), $submit_on_change);
+
+ echo sale_payment_list($name, $selected_id, $submit_on_change);
+
echo "</td>\n";
- return $str;
}
//-----------------------------------------------------------------------------------------------
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $str = class_list($name, $selected_id, $submit_on_change);
+ echo class_list($name, $selected_id, $submit_on_change);
echo "</td>\n";
- return $str;
}
function class_list_row($label, $name, $selected_id=null, $submit_on_change=false)
{
echo "<tr>\n";
- $str = class_list_cells($label, $name, $selected_id, $submit_on_change);
+ class_list_cells($label, $name, $selected_id, $submit_on_change);
echo "</tr>\n";
- return $str;
}
//-----------------------------------------------------------------------------------------------
-
-function stock_categories_list($name, $selected_id=null, $submit_on_change=false)
+function stock_categories_list($name, $selected_id=null, $spec_opt=false, $submit_on_change=false)
{
$sql = "SELECT category_id, description, inactive FROM ".TB_PREF."stock_category";
- combo_input($name, $selected_id, $sql, 'category_id', 'description',
+ return combo_input($name, $selected_id, $sql, 'category_id', 'description',
array('order'=>'category_id',
+ 'spec_option' => $spec_opt,
+ 'spec_id' => -1,
'select_submit'=> $submit_on_change,
'async' => true
));
}
-function stock_categories_list_cells($label, $name, $selected_id=null, $submit_on_change=false)
+function stock_categories_list_cells($label, $name, $selected_id=null, $spec_opt=false, $submit_on_change=false)
{
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- stock_categories_list($name, $selected_id, $submit_on_change);
+ echo stock_categories_list($name, $selected_id, $spec_opt, $submit_on_change);
echo "</td>\n";
}
-function stock_categories_list_row($label, $name, $selected_id=null, $submit_on_change=false)
+function stock_categories_list_row($label, $name, $selected_id=null, $spec_opt=false, $submit_on_change=false)
{
echo "<tr>\n";
- stock_categories_list_cells($label, $name, $selected_id, $submit_on_change);
+ stock_categories_list_cells($label, $name, $selected_id, $spec_opt, $submit_on_change);
echo "</tr>\n";
}
//-----------------------------------------------------------------------------------------------
-function gl_account_types_list($name, $selected_id=null, $all_option, $all_option_numeric)
+function gl_account_types_list($name, $selected_id=null, $all_option=false, $all_option_numeric=true)
{
global $all_items;
$sql = "SELECT id, name FROM ".TB_PREF."chart_types";
- combo_input($name, $selected_id, $sql, 'id', 'name',
+ return combo_input($name, $selected_id, $sql, 'id', 'name',
array(
- 'order' => 'id',
+ 'order' => 'class_id', 'id',
'spec_option' =>$all_option,
'spec_id' => $all_option_numeric ? 0 : $all_items
) );
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- gl_account_types_list($name, $selected_id, $all_option, $all_option_numeric);
+ echo gl_account_types_list($name, $selected_id, $all_option, $all_option_numeric);
echo "</td>\n";
}
FROM ".TB_PREF."chart_master chart,".TB_PREF."chart_types type
WHERE chart.account_type=type.id";
- combo_input($name, $selected_id, $sql, 'chart.account_code', 'chart.account_name',
+ return combo_input($name, $selected_id, $sql, 'chart.account_code', 'chart.account_name',
array(
'format' => '_format_account',
'spec_option' => $all_option===true ? _("Use Item Sales Accounts") : $all_option,
'spec_id' => '',
- 'order' => array('type.id','account_code'),
+ 'order' => array('type.class_id','type.id','account_code'),
'search_box' => $cells,
'search_submit' => false,
'size' => 12,
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- gl_all_accounts_list($name, $selected_id,
+ echo gl_all_accounts_list($name, $selected_id,
$skip_bank_accounts, $cells, $all_option, $submit_on_change, $all);
echo "</td>\n";
}
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $str = yesno_list($name, $selected_id, $name_yes, $name_no, $submit_on_change);
+ echo yesno_list($name, $selected_id, $name_yes, $name_no, $submit_on_change);
echo "</td>\n";
- return $str;
}
function yesno_list_row($label, $name, $selected_id=null, $name_yes="", $name_no="", $submit_on_change=false)
{
echo "<tr>\n";
- $str = yesno_list_cells($label, $name, $selected_id, $name_yes, $name_no, $submit_on_change);
+ yesno_list_cells($label, $name, $selected_id, $name_yes, $name_no, $submit_on_change);
echo "</tr>\n";
- return $str;
}
//------------------------------------------------------------------------------------------------
foreach ($installed_languages as $lang)
$items[$lang['code']] = $lang['name'];
- return array_selector($name, $selected_id, $items );
+ return array_selector($name, $selected_id, $items);
}
function languages_list_cells($label, $name, $selected_id=null)
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- languages_list($name, $selected_id);
+ echo languages_list($name, $selected_id);
echo "</td>\n";
}
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- bank_account_types_list($name, $selected_id);
+ echo bank_account_types_list($name, $selected_id);
echo "</td>\n";
}
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $str = payment_person_types_list($name, $selected_id, $related);
+ echo payment_person_types_list($name, $selected_id, $related);
echo "</td>\n";
- return $str;
}
function payment_person_types_list_row($label, $name, $selected_id=null, $related=null)
{
echo "<tr>\n";
- $str = payment_person_types_list_cells($label, $name, $selected_id, $related);
+ payment_person_types_list_cells($label, $name, $selected_id, $related);
echo "</tr>\n";
- return $str;
}
//------------------------------------------------------------------------------------------------
function wo_types_list_row($label, $name, $selected_id=null)
{
echo "<tr><td>$label</td><td>\n";
- $str = wo_types_list($name, $selected_id);
+ echo wo_types_list($name, $selected_id);
echo "</td></tr>\n";
- return $str;
}
//------------------------------------------------------------------------------------------------
global $dateformats;
echo "<tr><td>$label</td>\n<td>";
- array_selector( $name, $value, $dateformats );
+ echo array_selector( $name, $value, $dateformats );
echo "</td></tr>\n";
}
global $dateseps;
echo "<tr><td>$label</td>\n<td>";
- array_selector( $name, $value, $dateseps );
+ echo array_selector( $name, $value, $dateseps );
echo "</td></tr>\n";
}
global $thoseps;
echo "<tr><td>$label</td>\n<td>";
- array_selector( $name, $value, $thoseps );
+ echo array_selector( $name, $value, $thoseps );
echo "</td></tr>\n";
}
global $decseps;
echo "<tr><td>$label</td>\n<td>";
- array_selector( $name, $value, $decseps );
+ echo array_selector( $name, $value, $decseps );
echo "</td></tr>\n";
}
ksort($themes);
echo "<tr><td>$label</td>\n<td>";
- array_selector( $name, $value, $themes );
+ echo array_selector( $name, $value, $themes );
echo "</td></tr>\n";
}
$items[$pz] = $pz;
echo "<tr><td>$label</td>\n<td>";
- array_selector( $name, $value, $items );
+ echo array_selector( $name, $value, $items );
echo "</td></tr>\n";
}
-function systypes_list_cells($label, $name, $value=null, $submit_on_change=false)
+function systypes_list($name, $value=null, $spec_opt=false, $submit_on_change=false)
{
global $systypes_array;
- if ($label != null)
- echo "<td>$label</td>\n";
- echo "<td>";
-
- $str = array_selector($name, $value, $systypes_array,
+ return array_selector($name, $value, $systypes_array,
array(
+ 'spec_option'=> $spec_opt,
+ 'spec_id' => ALL_NUMERIC,
'select_submit'=> $submit_on_change,
- 'async' => false
+ 'async' => false,
)
);
+}
+
+function systypes_list_cells($label, $name, $value=null, $submit_on_change=false)
+{
+ if ($label != null)
+ echo "<td>$label</td>\n";
+ echo "<td>";
+ echo systypes_list($name, $value, false, $submit_on_change);
echo "</td>\n";
- return $str;
+}
+
+function systypes_list_row($label, $name, $value=null, $submit_on_change=false)
+{
+ echo "<tr>\n";
+ systypes_list_cells($label, $name, $value, false, $submit_on_change);
+ echo "</tr>\n";
}
function journal_types_list_cells($label, $name, $value=null, $submit_on_change=false)
ST_SALESQUOTE) as $excl)
unset($items[$excl]);
- $str = array_selector($name, $value, $items,
+ echo array_selector($name, $value, $items,
array(
'spec_option'=> _("All"),
'spec_id' => -1,
)
);
echo "</td>\n";
- return $str;
-}
-
-function systypes_list_row($label, $name, $value=null, $submit_on_change=false)
-{
- echo "<tr>\n";
- $str = systypes_list_cells($label, $name, $value, $submit_on_change);
- echo "</tr>\n";
- return $str;
}
function cust_allocations_list_cells($label, $name, $selected=null)
'4' => _("Credit Notes"),
'5' => _("Delivery Notes")
);
- $str = array_selector($name, $selected, $allocs);
+ echo array_selector($name, $selected, $allocs);
echo "</td>\n";
- return $str;
}
function supp_allocations_list_cell($name, $selected=null)
'4' => _("Credit Notes"),
'5' => _("Overdue Credit Notes")
);
- $str = array_selector($name, $selected, $allocs);
+ echo array_selector($name, $selected, $allocs);
echo "</td>\n";
- return $str;
}
function policy_list_cells($label, $name, $selected=null)
if ($label != null)
label_cell($label);
echo "<td>\n";
- $str = array_selector($name, $selected,
+ echo array_selector($name, $selected,
array( '' => _("Automatically put balance on back order"),
'CAN' => _("Cancel any quantites not delivered")) );
echo "</td>\n";
- return $str;
}
function policy_list_row($label, $name, $selected=null)
if ($label != null)
label_cell($label);
echo "<td>\n";
- $str = array_selector($name, $selected,
+ echo array_selector($name, $selected,
array( 'Return' => _("Items Returned to Inventory Location"),
'WriteOff' => _("Items Written Off")),
array( 'select_submit'=> $submit_on_change ) );
echo "</td>\n";
- return $str;
}
function credit_type_list_row($label, $name, $selected=null, $submit_on_change=false)
{
echo "<tr>\n";
- $str = credit_type_list_cells($label, $name, $selected, $submit_on_change);
+ credit_type_list_cells($label, $name, $selected, $submit_on_change);
echo "</tr>\n";
- return $str;
}
function number_list($name, $selected, $from, $to, $no_option=false)
if ($label != null)
label_cell($label);
echo "<td>\n";
- number_list($name, $selected, $from, $to, $no_option);
+ echo number_list($name, $selected, $from, $to, $no_option);
echo "</td>\n";
}
function number_list_row($label, $name, $selected, $from, $to, $no_option=false)
{
echo "<tr>\n";
- number_list_cells($label, $name, $selected, $from, $to, $no_option);
+ echo number_list_cells($label, $name, $selected, $from, $to, $no_option);
echo "</tr>\n";
}
echo "<td>$label</td>\n";
echo "<td>";
- array_selector($name, $selected_id, $profiles,
+ echo array_selector($name, $selected_id, $profiles,
array( 'select_submit'=> $submit_on_change,
'spec_option'=>$spec_opt,
'spec_id' => ''
$printers[$myrow['id']] = $myrow['name'].' - '.$myrow['description'];
}
}
- array_selector($name, $selected_id, $printers,
+ return array_selector($name, $selected_id, $printers,
array( 'select_submit'=> $submit_on_change,
'spec_option'=>$spec_opt,
'spec_id' => ''
if ($type != null)
$sql .= " WHERE type=$type";
- combo_input($name, $selected_id, $sql, 'id', 'description',
+ return combo_input($name, $selected_id, $sql, 'id', 'description',
array(
'spec_id' => '',
'order' => 'description',
function quick_entries_list_cells($label, $name, $selected_id=null, $type, $submit_on_change=false)
{
echo "<td>$label</td><td>\n";
- quick_entries_list($name, $selected_id, $type, $submit_on_change);
+ echo quick_entries_list($name, $selected_id, $type, $submit_on_change);
echo "</td>";
}
global $quick_actions;
echo "<tr><td>$label</td><td>";
- array_selector($name, $selected_id, $quick_actions,
+ echo array_selector($name, $selected_id, $quick_actions,
array(
'select_submit'=> $submit_on_change
) );
global $quick_entry_types;
echo "<tr><td>$label</td><td>";
- array_selector($name, $selected_id, $quick_entry_types,
+ echo array_selector($name, $selected_id, $quick_entry_types,
array(
'select_submit'=> $submit_on_change
) );
global $class_types;
echo "<tr><td>$label</td><td>";
- array_selector($name, $selected_id, $class_types,
+ echo array_selector($name, $selected_id, $class_types,
array(
'select_submit'=> $submit_on_change
) );
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $str = security_roles_list($name, $selected_id, $new_item, $submit_on_change, $show_inactive);
+ echo security_roles_list($name, $selected_id, $new_item, $submit_on_change, $show_inactive);
echo "</td>\n";
- return $str;
}
function security_roles_list_row($label, $name, $selected_id=null, $new_item=false, $submit_on_change=false,
$show_inactive = false)
{
echo "<tr>";
- $str = security_roles_list_cells($label, $name, $selected_id, $new_item, $submit_on_change, $show_inactive);
+ security_roles_list_cells($label, $name, $selected_id, $new_item, $submit_on_change, $show_inactive);
echo "</tr>\n";
- return $str;
}
-function tab_list_row($label, $name, $selected_id=null)
+function tab_list_row($label, $name, $selected_id=null, $all = false)
{
- global $tabs;
+ global $installed_extensions;
+
+ $tabs = array();
+ 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 "<tr>\n";
echo "<td>$label</td><td>\n";
+ echo array_selector($name, $selected_id, $tabs);
+ echo "</td></tr>\n";
+}
- $items = array();
+//-----------------------------------------------------------------------------------------------
- array_selector($name, $selected_id, $tabs);
+function tag_list($name, $height, $type, $multi=false, $all=false, $spec_opt = false)
+{
+ // Get tags
+ global $path_to_root;
+ include_once($path_to_root . "/admin/db/tags_db.inc");
+ $results = get_tags($type, $all);
- echo "</td></tr>\n";
+ while ($tag = db_fetch($results))
+ $tags[$tag['id']] = $tag['name'];
+
+ if (!isset($tags)) {
+ $tags[''] = $all ? _("No tags defined.") : _("No active tags defined.");
+ $spec_opt = false;
+ }
+ return array_selector($name, null, $tags,
+ array(
+ 'multi' => $multi,
+ 'height' => $height,
+ 'spec_option'=> $spec_opt,
+ 'spec_id' => -1,
+ ) );
+}
+
+function tag_list_cells($label, $name, $height, $type, $mult=false, $all=false, $spec_opt = false)
+{
+ if ($label != null)
+ echo "<td>$label</td>\n";
+ echo "<td>\n";
+ echo tag_list($name, $height, $type, $mult, $all, $spec_opt);
+ echo "</td>\n";
+
+}
+
+function tag_list_row($label, $name, $height, $type, $mult=false, $all=false, $spec_opt = false)
+{
+ echo "<tr>\n";
+ tag_list_cells($label, $name, $height, $type, $mult, $all, $spec_opt);
+ echo "</tr>\n";
}
//---------------------------------------------------------------------------------------------
$items = array();
foreach ($db_connections as $comp)
$items[] = sprintf(_("Activated for '%s'"), $comp['name']);
- array_selector( $name, $value, $items,
+ return array_selector( $name, $value, $items,
array(
- 'spec_option'=> _("Installed on system"),
+ 'spec_option'=> _("Available and/or installed"),
'spec_id' => -1,
'select_submit'=> $submit_on_change,
'async' => true