if ($Mode == 'ADD_ITEM' || $Mode == 'UPDATE_ITEM')
{
- if($_POST['filterType'] == ST_CUSTOMER){
- $_POST['trans_no'] = $_POST['customer_id'];
- }elseif($_POST['filterType'] == ST_SUPPLIER){
- $_POST['trans_no'] = $_POST['supplier_id'];
- }
-
if (!transaction_exists($_POST['filterType'], $_POST['trans_no']))
display_error(_("Selected transaction does not exists."));
elseif ($Mode == 'ADD_ITEM' && !isset($_FILES['filename']))
if ($Mode == 'RESET')
{
- unset($_POST['trans_no']);
unset($_POST['description']);
$selected_id = -1;
}
$selected_id = -1;
if(get_post('filterType') == ST_CUSTOMER ){
- customer_list_cells(_("Select a customer: "), 'customer_id', null, _('Select customer'), true, true);
+ customer_list_cells(_("Select a customer: "), 'trans_no', null, false, true, true);
} elseif(get_post('filterType') == ST_SUPPLIER){
- supplier_list_cells(_("Select a supplier: "), 'supplier_id', null, _('Select supplier'), true,true);
+ supplier_list_cells(_("Select a supplier: "), 'trans_no', null, false, true,true);
}
end_row();
return button('Delete'.$row["id"], _("Delete"), _("Delete"), ICON_DELETE);
}
-function display_rows($type, $id_no)
+function display_rows($type, $trans_no)
{
- $sql = get_sql_for_attached_documents($type, $id_no);
+ $sql = get_sql_for_attached_documents($type, $type==ST_SUPPLIER || $type==ST_CUSTOMER ? $trans_no : 0);
$cols = array(
- _("#") => array('fun'=>'trans_view', 'ord'=>''),
+ _("#") => $type == ST_SUPPLIER || $type == ST_CUSTOMER? 'skip' : array('fun'=>'trans_view', 'ord'=>''),
_("Description") => array('name'=>'description'),
_("Filename") => array('name'=>'filename'),
_("Size") => array('name'=>'filesize'),
array('insert'=>true, 'fun'=>'download_link'),
array('insert'=>true, 'fun'=>'delete_link')
);
- $table =& new_db_pager('trans_tbl', $sql, $cols);
- $table->width = "60%";
+ $table =& new_db_pager('trans_tbl', $sql, $cols);
+
+ $table->width = "60%";
- display_db_pager($table);
+ display_db_pager($table);
}
//----------------------------------------------------------------------------------------
+if (list_updated('filterType') || list_updated('trans_no'))
+ $Ajax->activate('_page_body');
start_form(true);
viewing_controls();
-$id_no = ($_POST['filterType'] == ST_CUSTOMER) ? get_post('customer_id') : get_post('supplier_id');
-display_rows($_POST['filterType'], $id_no);
+
+$type = get_post('filterType');
+
+display_rows($type, get_post('trans_no'));
br(2);
$_POST['description'] = $row["description"];
hidden('trans_no', $row['trans_no']);
hidden('unique_name', $row['unique_name']);
- label_row(_("Transaction #"), $row['trans_no']);
+ if ($type != ST_SUPPLIER && $type != ST_CUSTOMER)
+ label_row(_("Transaction #"), $row['trans_no']);
}
hidden('selected_id', $selected_id);
}
else {
- if( $id_no == 0 )
+ if ($type != ST_SUPPLIER && $type != ST_CUSTOMER)
text_row_ex(_("Transaction #").':', 'trans_no', 10);
- else
- hidden('trans_no', $id_no);
}
text_row_ex(_("Description").':', 'description', 40);
file_row(_("Attached File") . ":", 'filename', 'filename');
$path_to_root = "../..";
include($path_to_root . "/includes/db_pager.inc");
include_once($path_to_root . "/includes/session.inc");
-include_once($path_to_root . "/includes/ui/attachment.inc");
+
$js = "";
if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(900, 500);
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/includes/ui/contacts_view.inc");
+include_once($path_to_root . "/includes/ui/attachment.inc");
check_db_has_tax_groups(_("There are no tax groups defined in the system. At least one tax group is required before proceeding."));
if ($supplier_id)
{
submit_center_first('submit', _("Update Supplier"),
- _('Update supplier data'), $page_nested ? true : 'false');
+ _('Update supplier data'), $page_nested ? true : false);
submit_return('select', get_post('supplier_id'), _("Select this supplier and return to document entry."));
submit_center_last('delete', _("Delete Supplier"),
_('Delete supplier data if have been never used'), true);
}
else
{
- submit_center('submit', _("Add New Supplier Details"), true, '', 'false');
+ submit_center('submit', _("Add New Supplier Details"), true, '', false);
}
div_end();
}