133 lines
6.2 KiB
PHP
133 lines
6.2 KiB
PHP
<?php
|
|
/** \file scripts\page\menu_cust_info.php
|
|
* \brief DI webinterface menu customer script.
|
|
* \author Rob Schalken, Core|Vision
|
|
* \version 1.0
|
|
* \date 17-10-2008
|
|
*
|
|
* This file contains the menu customer info script. This file displays customer info.
|
|
*/
|
|
|
|
//== Required settings ======================
|
|
if (is_valid_action("cust_info")) {
|
|
$_PAGE_INFO['page_title'] = _("company info menu");
|
|
|
|
if ((isset($_GET['login'])) && (isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['id']))) {
|
|
$_PAGE_INFO['shortcut_menu_buttons']= array(_("Project overview"), $_PAGE_INFO['HIST_MAIN'], _("Realtime status"), _("Use equipment"), _("Project report"), _("GPS track"));
|
|
$_PAGE_INFO['shortcut_menu_links'] = array("page/project", "page/menu&page_project=" . $_GET['page_project'], "page/menu_rt&action=lance_rt&page_project=" . $_GET['page_project'], "page/menu_lance_use&action=lance_use&page_project=" . $_GET['page_project'], "page/menu_report_info&action=project_report&page_project=" . $_GET['page_project'], "page/menu_report_info&action=gps_report&page_project=" . $_GET['page_project']);
|
|
$_PAGE_INFO['shortcut_menu_rights'] = array("", "", "menu:realtime_status", "menu:lans", "menu:rapportages&menu:rapportages:projecten,menu:rapportages:root", "menu:rapportages&menu:rapportages:gps,menu:rapportages:root");
|
|
}
|
|
else if (isset($_SESSION[$_PAGE_INFO['id']]['main_menu'])) {
|
|
$_PAGE_INFO['history_menu_buttons'] = array(_("Project overview"), $_PAGE_INFO['HIST_MAIN'], _("Company maintenance"), _("Company search (info)"));
|
|
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu", "page/menu_cust", "page/menu_cust_search");
|
|
}
|
|
else {
|
|
$_PAGE_INFO['history_menu_buttons'] = array(_("Project overview"));
|
|
$_PAGE_INFO['history_menu_links'] = array("page/project");
|
|
}
|
|
|
|
$menu = "menu:klanten:overzicht";
|
|
$rights = "menu:klanten:root,menu:klanten&menu:klanten:zoeken";
|
|
$title = _("Company info");
|
|
}
|
|
else if (is_valid_action("cust_new")) {
|
|
$_PAGE_INFO['page_title'] = _("company new menu");
|
|
|
|
$_PAGE_INFO['history_menu_buttons'] = array(_("Project overview"), $_PAGE_INFO['HIST_MAIN'], _("Company maintenance"));
|
|
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu", "page/menu_cust");
|
|
|
|
$menu = "menu:klanten:nieuw";
|
|
$rights = "menu:klanten:root,menu:klanten&menu:klanten:wijzigen";
|
|
$title = _("Add company");
|
|
}
|
|
else if (is_valid_action("cust_change")) {
|
|
$_PAGE_INFO['page_title'] = _("company change menu");
|
|
|
|
$_PAGE_INFO['history_menu_buttons'] = array(_("Project overview"), $_PAGE_INFO['HIST_MAIN'], _("Company maintenance"), _("Company search (change)"));
|
|
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu", "page/menu_cust", "page/menu_cust_search");
|
|
|
|
$menu = "menu:klanten:wijzigen";
|
|
$rights = "menu:klanten:root,menu:klanten&menu:klanten:wijzigen";
|
|
$title = _("Change company");
|
|
}
|
|
//===========================================
|
|
|
|
// Verify project/rights and log
|
|
if (Ver_Rights_Project_Log($rights, $menu)) {
|
|
// Remove search result when no back action for new lance
|
|
if (is_valid_action("cust_new")) {
|
|
if (strtolower($_SESSION[$_PAGE_INFO['id']]['href_history_prev']) != strtolower("page/menu_user_info")) {
|
|
unset($_SESSION[$_PAGE_INFO['id']]['search']['customer']);
|
|
}
|
|
|
|
// Valid id?
|
|
if (!$_SESSION[$_PAGE_INFO['id']]['recall_counter']) {
|
|
if (isset($_SESSION[$_PAGE_INFO['id']]['search']['customer']['id'])) {
|
|
// Retrieve lance data
|
|
$row_cust = db_fetch_customer($_SESSION[$_PAGE_INFO['id']]['search']['customer']['id'], 1);
|
|
|
|
if (is_array($row_cust)) {
|
|
$_SESSION[$_PAGE_INFO['id']]['customer_info'] = $row_cust;
|
|
}
|
|
else {
|
|
// ID not valid!!! => Redirect back to search menu
|
|
header("Location: ?id=" . $_PAGE_INFO['id'] . "&href=page/menu_cust_search");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Check action
|
|
if (is_valid_action("cust_info", "cust_change")) {
|
|
// Check if this is a recall action
|
|
if ((is_valid_action("cust_info", "cust_change")) && ((!$_SESSION[$_PAGE_INFO['id']]['recall_counter']) || (isset($_GET['login'])))) {
|
|
// Login info redirect?
|
|
if (isset($_GET['login'])) {
|
|
// Login info and clear all search filters
|
|
$_SESSION[$_PAGE_INFO['id']]['search']['customer'] = array();
|
|
$_SESSION[$_PAGE_INFO['id']]['search']['customer']['id'] = $_SESSION[$_PAGE_INFO['id']]['login']['customer']['id'];
|
|
}
|
|
|
|
if (isset($_SESSION[$_PAGE_INFO['id']]['search']['customer']['id'])) {
|
|
// Log user-customer action (use log entry from Ver_Rights_Project_Log function)
|
|
db_log_user_customer($_SESSION[$_PAGE_INFO['id']]['search']['customer']['id']);
|
|
|
|
// Retrieve customer data
|
|
$row_cust = db_fetch_customer($_SESSION[$_PAGE_INFO['id']]['search']['customer']['id'], 1);
|
|
|
|
if (is_array($row_cust)) {
|
|
$_SESSION[$_PAGE_INFO['id']]['customer_info'] = $row_cust;
|
|
|
|
// Customer options
|
|
$options = split(",", $_SESSION[$_PAGE_INFO['id']]['customer_info']['klant_status']);
|
|
if (is_array($options)) {
|
|
foreach ($options as $item) {
|
|
$_SESSION[$_PAGE_INFO['id']]['customer_info'][str_replace(" " , "_", $item)] = 1;
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
// ID not valid!!! => Redirect back to search menu
|
|
header("Location: ?id=" . $_PAGE_INFO['id'] . "&href=page/menu_cust_search");
|
|
}
|
|
}
|
|
else {
|
|
// ID not valid!!! => Redirect back to search menu
|
|
header("Location: ?id=" . $_PAGE_INFO['id'] . "&href=page/menu_cust_search");
|
|
}
|
|
}
|
|
}
|
|
|
|
// Store title
|
|
$_SESSION[$_PAGE_INFO['id']]['title'] = $title;
|
|
|
|
// Show page header
|
|
print_xml_header();
|
|
|
|
// Include info content
|
|
include("menu_cust_info_content.php");
|
|
|
|
// Show page footer
|
|
print_page_footer();
|
|
}
|
|
?>
|