Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Popup Window For Searching Dropdown List Item #2

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion admin/gl_setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
$path_to_root="..";
include($path_to_root . "/includes/session.inc");

page(_($help_context = "System and General GL Setup"));
$js = "";
if ($use_popup_windows)
$js .= get_js_open_window(900, 500);

page(_($help_context = "System and General GL Setup"), false, false, "", $js);

include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/ui.inc");
Expand Down
144 changes: 76 additions & 68 deletions frontaccounting.php
Original file line number Diff line number Diff line change
@@ -1,89 +1,97 @@
<?php
/**********************************************************************
Copyright (C) FrontAccounting, LLC.
Released under the terms of the GNU General Public License, GPL,
as published by the Free Software Foundation, either version 3
Released under the terms of the GNU General Public License, GPL,
as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_to_root']))
die("Restricted access");
include_once($path_to_root . '/applications/application.php');
include_once($path_to_root . '/applications/customers.php');
include_once($path_to_root . '/applications/suppliers.php');
include_once($path_to_root . '/applications/inventory.php');
include_once($path_to_root . '/applications/manufacturing.php');
include_once($path_to_root . '/applications/dimensions.php');
include_once($path_to_root . '/applications/generalledger.php');
include_once($path_to_root . '/applications/setup.php');
include_once($path_to_root . '/installed_extensions.php');
include_once($path_to_root . '/applications/application.php');
include_once($path_to_root . '/applications/customers.php');
include_once($path_to_root . '/applications/suppliers.php');
include_once($path_to_root . '/applications/inventory.php');
include_once($path_to_root . '/applications/manufacturing.php');
include_once($path_to_root . '/applications/dimensions.php');
include_once($path_to_root . '/applications/generalledger.php');
include_once($path_to_root . '/applications/setup.php');
include_once($path_to_root . '/installed_extensions.php');

class front_accounting
{
var $user;
var $settings;
var $applications;
var $selected_application;
class front_accounting
{
var $user;
var $settings;
var $applications;
var $selected_application;

var $menu;
var $menu;

function front_accounting()
{
}
function add_application(&$app)
{
if ($app->enabled) // skip inactive modules
$this->applications[$app->id] = &$app;
}
function get_application($id)
{
if (isset($this->applications[$id]))
return $this->applications[$id];
return null;
}
function get_selected_application()
{
if (isset($this->selected_application))
return $this->applications[$this->selected_application];
foreach ($this->applications as $application)
return $application;
return null;
}
function display()
{
global $path_to_root;

include_once($path_to_root . "/themes/".user_theme()."/renderer.php");
function front_accounting()
{
}

$this->init();
$rend = new renderer();
$rend->wa_header();
function add_application(&$app)
{
if ($app->enabled) // skip inactive modules
$this->applications[$app->id] = &$app;
}
function get_application($id)
{
if (isset($this->applications[$id]))
return $this->applications[$id];
return null;
}

$rend->display_applications($this);
function get_selected_application()
{
if (isset($this->selected_application))
return $this->applications[$this->selected_application];
foreach ($this->applications as $application)
return $application;
return null;
}

$rend->wa_footer();
$this->renderer =& $rend;
}
function init()
{
function display()
{
global $path_to_root;

include_once($path_to_root . "/themes/".user_theme()."/renderer.php");

$this->menu = new menu(_("Main Menu"));
$this->menu->add_item(_("Main Menu"), "index.php");
$this->menu->add_item(_("Logout"), "/account/access/logout.php");
$this->applications = array();
$this->add_application(new customers_app());
$this->add_application(new suppliers_app());
$this->add_application(new inventory_app());
$this->add_application(new manufacturing_app());
$this->add_application(new dimensions_app());
$this->add_application(new general_ledger_app());
$this->init();
$rend = new renderer();
$rend->wa_header();

hook_invoke_all('install_tabs', $this);
$rend->display_applications($this);

$this->add_application(new setup_app());
$rend->wa_footer();
$this->renderer =& $rend;
}

function init()
{
# Destroy BOM session to make sure we start from empty BOM session.
if (isset($_SESSION['bom_session']))
{
unset($_SESSION['bom_session']);
}

$this->menu = new menu(_("Main Menu"));
$this->menu->add_item(_("Main Menu"), "index.php");
$this->menu->add_item(_("Logout"), "/account/access/logout.php");
$this->applications = array();
$this->add_application(new customers_app());
$this->add_application(new suppliers_app());
$this->add_application(new inventory_app());
$this->add_application(new manufacturing_app());
$this->add_application(new dimensions_app());
$this->add_application(new general_ledger_app());

hook_invoke_all('install_tabs', $this);

$this->add_application(new setup_app());
}
}
?>
76 changes: 76 additions & 0 deletions gl/inquiry/accounts_list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php
/**********************************************************************
Page for searching GL account list and select it to GL account
selection in page that has GL account dropdown list.
***********************************************************************/
$page_security = "SA_GLACCOUNT";
$path_to_root = "../..";

include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root . "/includes/ui.inc");

$js = get_js_select_combo_item();

page(_($help_context = "GL Accounts"), @$_REQUEST["popup"], false, "", $js);

// Activate Ajax on form submit
if(get_post("search")) {
$Ajax->activate("account_tbl");
}

// BEGIN: Filter form. Use query string so the client_id will not disappear
// after ajax form post.
start_form(false, false, $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']);

start_table(TABLESTYLE_NOBORDER);

start_row();

text_cells(_("Description"), "description");
submit_cells("search", _("Search"), "", _("Search GL accounts"), "default");

end_row();

end_table();

end_form();
// END: Filter form

// BEGIN: Account list
div_start("account_tbl");

start_table(TABLESTYLE);

$th = array("", _("Account Code"), _("Description"), _("Category"));

table_header($th);

// Query based on function gl_all_accounts_list in includes/ui/ui_lists.inc.
$sql = "SELECT chart.account_code, chart.account_name, type.name
FROM ".TB_PREF."chart_master chart,".TB_PREF."chart_types type
WHERE chart.account_type=type.id
AND (
chart.account_name LIKE " . db_escape("%" . get_post("description"). "%") . "
OR
chart.account_code = " . db_escape(get_post("description")) . "
)
ORDER BY chart.account_code LIMIT 0, 10"; // We only display 10 items.
$result = db_query($sql, "Failed in retreiving GL account list.");

$k = 0; //row colour counter

while ($myrow = db_fetch_assoc($result)) {
alt_table_row_color($k);
ahref_cell(_("Select"), 'javascript:void(0)', '', 'selectComboItem(window.opener.document, &quot;' . $_GET["client_id"] . '&quot;, &quot;' . $myrow["account_code"] . '&quot;)');
label_cell($myrow["account_code"]);
label_cell($myrow["account_name"]);
label_cell($myrow["name"]);
end_row();
}

end_table(1);

div_end();
// END: Account list

end_page();
8 changes: 6 additions & 2 deletions gl/manage/gl_accounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
$page_security = 'SA_GLACCOUNT';
$path_to_root = "../..";
include($path_to_root . "/includes/session.inc");

page(_($help_context = "Chart of Accounts"));

$js = "";
if ($use_popup_windows)
$js .= get_js_open_window(900, 500);

page(_($help_context = "Chart of Accounts"), false, false, "", $js);

include($path_to_root . "/includes/ui.inc");
include($path_to_root . "/gl/includes/gl_db.inc");
Expand Down
Loading