<?php // Load the Supplier classes require_once 'include.php'; // Load the Translation for this Module if (!xml2php('supplier')) { $smarty->assign('error_msg', "Error in language file"); } // Assign the arrays $smarty->assign('supplier_details', display_supplier_info($db, $VAR['supplierID'])); $smarty->display('supplier' . SEP . 'supplier_details.tpl');
<?php if (!xml2php("core")) { $smarty->assign('error_msg', "Error in language file"); } //$employee_id = $VAR['employee_id']; $sch_id = $VAR['sch_id']; $today2 = Date("d"); if ($cur_date > 0) { $y1 = $VAR['y']; $m1 = $VAR['m']; $d1 = $VAR['d']; } else { $y1 = Date("Y"); $m1 = Date("m"); $d1 = Date("d"); } $smarty->assign('y1', $y1); $smarty->assign('m1', $m1); $smarty->assign('d1', $d1); $smarty->assign('Y', $Y); $smarty->assign('m', $m); $smarty->assign('d', $d); $smarty->assign('today2', $today2); if ($VAR['wo_id'] == '' || $VAR['wo_id'] < "1") { $wo_id = 0; } else { $wo_id = $VAR['wo_id']; $woid = $VAR['wo_id']; } /*if ($VAR['woid'] == '' || $VAR['woid'] < "1" )
<?php // Load the customer classes require_once "include.php"; /* load translation for this module */ if (!xml2php("customer")) { $smarty->assign('error_msg', "Error in language file"); } $alpha = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'); if (!isset($VAR["page_no"])) { $page_no = 1; } else { $page_no = $VAR['page_no']; } $customer_search_result = display_customer_search($db, $name = $VAR['name'], $page_no, $smarty); $smarty->assign('alpha', $alpha); $smarty->assign('customer_search_result', $customer_search_result); $smarty->display('customer' . SEP . 'search.tpl');
<?php require_once "include.php"; if (!xml2php("schedule")) { $smarty->assign('error_msg', "Error in language file"); } if (!xml2php("workorder")) { $smarty->assign('error_msg', "Error in language file"); } //Schedule Due Date $date_part2 = explode("/", $VAR['day']); //$timestamp2 = mktime(0,0,0,$date_part2[1],$date_part2[0],$date_part2[2]); if ($date_format == "%d/%m/%Y") { $cur_date = $d . "/" . $m . "/" . $Y; } if ($date_format == "%m/%d/%Y") { $cur_date = $m . "/" . $d . "/" . $Y; } $smarty->assign('Y', $Y); $smarty->assign('m', $m); $smarty->assign('d', $d); /* display new Workorders */ $where = "WHERE " . PRFX . "TABLE_WORK_ORDER.WORK_ORDER_CURRENT_STATUS= " . $db->qstr(1); $smarty->assign('new', display_workorders($db, $page_no, $where)); /* display new Workorders */ $where = "WHERE " . PRFX . "TABLE_WORK_ORDER.WORK_ORDER_CURRENT_STATUS= " . $db->qstr(2); $smarty->assign('assigned', display_workorders($db, $page_no, $where)); /* display new Workorders */ $where = "WHERE " . PRFX . "TABLE_WORK_ORDER.WORK_ORDER_CURRENT_STATUS= " . $db->qstr(3); $smarty->assign('awaiting', display_workorders($db, $page_no, $where)); if (isset($VAR['submit'])) {
<?php #################################################### # IN # # # # # # This program is distributed under the terms and # # conditions of the GPL # # Print Results # # Version 0.0.1 Sat Nov 26 20:46:40 PST 2005 # # # #################################################### if (!xml2php("parts")) { $smarty->assign('error_msg', "Error in language file"); } $q = "SELECT * FROM " . PRFX . "ORDERS WHERE WO_ID=" . $db->qstr($VAR['wo_id']); if (!($rs = $db->execute($q))) { force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database'); exit; } $order = $rs->FetchRow(); $order_id = $order['ORDER_ID']; $q = "SELECT * FROM " . PRFX . "ORDERS_DETAILS WHERE ORDER_ID=" . $db->qstr($order_id); if (!($rs = $db->execute($q))) { force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database'); exit; } $order_details = $rs->GetArray(); $smarty->assign('order', $order); $smarty->assign('details', $order_details); $smarty->display('parts' . SEP . 'print_results.tpl');
<?php // Load the Refund Functions require_once 'include.php'; // Load the Translation for this Module if (!xml2php('refund')) { $smarty->assign('error_msg', "Error in language file"); } // This sets page to number. goto_page-->page--> sets as 1 if no value if (isset($VAR['goto_page_no'])) { $page_no = $VAR['goto_page_no']; } else { if (isset($VAR['page_no'])) { $page_no = $VAR['page_no']; } else { $page_no = 1; } } // this allows the intial page display which is a search if (!isset($VAR['refund_search_category'])) { $refund_search_category = "ID"; } else { $refund_search_category = $VAR['refund_search_category']; } $refund_search_term = $VAR['refund_search_term']; // Search term validator (refund gateway), changes some variables appropiate to database values $refund_gateway_search_term = refund_search_gateway($db, $refund_search_category, $refund_search_term); // perform search with modified search term value - WORKS -for view page $refund_search_result = display_refund_search($db, $refund_search_category, $refund_gateway_search_term, $page_no, $smarty); $smarty->assign('refund_search_term', $refund_search_term); $smarty->assign('refund_search_result', $refund_search_result);
/** * Parse rss URL * * @param string $urlRSS Url to parse * @param int $maxNb Max nb of records to get (0 for no limit) * @param int $cachedelay 0=No cache, nb of seconds we accept cache files (cachedir must also be defined) * @param string $cachedir Directory where to save cache file * @return int <0 if KO, >0 if OK */ public function parser($urlRSS, $maxNb = 0, $cachedelay = 60, $cachedir = '') { global $conf; include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $rss = ''; $str = ''; // This will contain content of feed // Check parameters if (!dol_is_url($urlRSS)) { $this->error = "ErrorBadUrl"; return -1; } $this->_urlRSS = $urlRSS; $newpathofdestfile = $cachedir . '/' . dol_hash($this->_urlRSS, 3); // Force md5 hash (does not contains special chars) $newmask = '0644'; //dol_syslog("RssPArser::parser parse url=".$urlRSS." => cache file=".$newpathofdestfile); $nowgmt = dol_now(); // Search into cache $foundintocache = 0; if ($cachedelay > 0 && $cachedir) { $filedate = dol_filemtime($newpathofdestfile); if ($filedate >= $nowgmt - $cachedelay) { //dol_syslog("RssParser::parser cache file ".$newpathofdestfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we use it."); $foundintocache = 1; $this->_lastfetchdate = $filedate; } else { dol_syslog(get_class($this) . "::parser cache file " . $newpathofdestfile . " is not found or older than now - cachedelay (" . $nowgmt . " - " . $cachedelay . ") so we can't use it."); } } // Load file into $str if ($foundintocache) { $str = file_get_contents($newpathofdestfile); } else { try { ini_set("user_agent", "Dolibarr ERP-CRM RSS reader"); ini_set("max_execution_time", $conf->global->MAIN_USE_RESPONSE_TIMEOUT); ini_set("default_socket_timeout", $conf->global->MAIN_USE_RESPONSE_TIMEOUT); $opts = array('http' => array('method' => "GET")); if (!empty($conf->global->MAIN_USE_CONNECT_TIMEOUT)) { $opts['http']['timeout'] = $conf->global->MAIN_USE_CONNECT_TIMEOUT; } if (!empty($conf->global->MAIN_PROXY_USE)) { $opts['http']['proxy'] = 'tcp://' . $conf->global->MAIN_PROXY_HOST . ':' . $conf->global->MAIN_PROXY_PORT; } //var_dump($opts);exit; $context = stream_context_create($opts); $str = file_get_contents($this->_urlRSS, false, $context); } catch (Exception $e) { print 'Error retrieving URL ' . $this->urlRSS . ' - ' . $e->getMessage(); } } if ($str !== false) { // Convert $str into xml if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { //print 'xx'.LIBXML_NOCDATA; libxml_use_internal_errors(false); $rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA); } else { $xmlparser = xml_parser_create(''); if (!is_resource($xmlparser)) { $this->error = "ErrorFailedToCreateParser"; return -1; } xml_set_object($xmlparser, $this); xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element'); xml_set_character_data_handler($xmlparser, 'feed_cdata'); $status = xml_parse($xmlparser, $str); xml_parser_free($xmlparser); $rss = $this; //var_dump($rss->_format);exit; } } // If $rss loaded if ($rss) { // Save file into cache if (empty($foundintocache) && $cachedir) { dol_syslog(get_class($this) . "::parser cache file " . $newpathofdestfile . " is saved onto disk."); if (!dol_is_dir($cachedir)) { dol_mkdir($cachedir); } $fp = fopen($newpathofdestfile, 'w'); fwrite($fp, $str); fclose($fp); if (!empty($conf->global->MAIN_UMASK)) { $newmask = $conf->global->MAIN_UMASK; } @chmod($newpathofdestfile, octdec($newmask)); $this->_lastfetchdate = $nowgmt; } unset($str); // Free memory if (empty($rss->_format)) { $rss->_format = 'rss'; if (empty($rss->channel)) { $rss->_format = 'atom'; } } $items = array(); // Save description entries if ($rss->_format == 'rss') { //var_dump($rss); if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { if (!empty($rss->channel->language)) { $this->_language = (string) $rss->channel->language; } if (!empty($rss->channel->generator)) { $this->_generator = (string) $rss->channel->generator; } if (!empty($rss->channel->copyright)) { $this->_copyright = (string) $rss->channel->copyright; } if (!empty($rss->channel->lastbuilddate)) { $this->_lastbuilddate = (string) $rss->channel->lastbuilddate; } if (!empty($rss->channel->image->url[0])) { $this->_imageurl = (string) $rss->channel->image->url[0]; } if (!empty($rss->channel->link)) { $this->_link = (string) $rss->channel->link; } if (!empty($rss->channel->title)) { $this->_title = (string) $rss->channel->title; } if (!empty($rss->channel->description)) { $this->_description = (string) $rss->channel->description; } } else { //var_dump($rss->channel); if (!empty($rss->channel['language'])) { $this->_language = (string) $rss->channel['language']; } if (!empty($rss->channel['generator'])) { $this->_generator = (string) $rss->channel['generator']; } if (!empty($rss->channel['copyright'])) { $this->_copyright = (string) $rss->channel['copyright']; } if (!empty($rss->channel['lastbuilddate'])) { $this->_lastbuilddate = (string) $rss->channel['lastbuilddate']; } if (!empty($rss->image['url'])) { $this->_imageurl = (string) $rss->image['url']; } if (!empty($rss->channel['link'])) { $this->_link = (string) $rss->channel['link']; } if (!empty($rss->channel['title'])) { $this->_title = (string) $rss->channel['title']; } if (!empty($rss->channel['description'])) { $this->_description = (string) $rss->channel['description']; } } if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { $items = $rss->channel->item; } else { $items = $rss->items; } // With xmlparse //var_dump($items);exit; } else { if ($rss->_format == 'atom') { //var_dump($rss); if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { if (!empty($rss->generator)) { $this->_generator = (string) $rss->generator; } if (!empty($rss->lastbuilddate)) { $this->_lastbuilddate = (string) $rss->modified; } if (!empty($rss->link->href)) { $this->_link = (string) $rss->link->href; } if (!empty($rss->title)) { $this->_title = (string) $rss->title; } if (!empty($rss->description)) { $this->_description = (string) $rss->description; } } else { //if (!empty($rss->channel['rss_language'])) $this->_language = (string) $rss->channel['rss_language']; if (!empty($rss->channel['generator'])) { $this->_generator = (string) $rss->channel['generator']; } //if (!empty($rss->channel['rss_copyright'])) $this->_copyright = (string) $rss->channel['rss_copyright']; if (!empty($rss->channel['modified'])) { $this->_lastbuilddate = (string) $rss->channel['modified']; } //if (!empty($rss->image['rss_url'])) $this->_imageurl = (string) $rss->image['rss_url']; if (!empty($rss->channel['link'])) { $this->_link = (string) $rss->channel['link']; } if (!empty($rss->channel['title'])) { $this->_title = (string) $rss->channel['title']; } //if (!empty($rss->channel['rss_description'])) $this->_description = (string) $rss->channel['rss_description']; } if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { $tmprss = xml2php($rss); $items = $tmprss['entry']; } else { $items = $rss->items; } // With xmlparse //var_dump($items);exit; } } $i = 0; // Loop on each record if (is_array($items)) { foreach ($items as $item) { //var_dump($item);exit; if ($rss->_format == 'rss') { if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { $itemLink = (string) $item->link; $itemTitle = (string) $item->title; $itemDescription = (string) $item->description; $itemPubDate = (string) $item->pubDate; $itemId = ''; $itemAuthor = ''; } else { $itemLink = (string) $item['link']; $itemTitle = (string) $item['title']; $itemDescription = (string) $item['description']; $itemPubDate = (string) $item['pubdate']; $itemId = (string) $item['guid']; $itemAuthor = (string) $item['author']; } // Loop on each category $itemCategory = array(); if (is_array($item->category)) { foreach ($item->category as $cat) { $itemCategory[] = (string) $cat; } } } else { if ($rss->_format == 'atom') { if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { $itemLink = isset($item['link']['href']) ? (string) $item['link']['href'] : ''; $itemTitle = (string) $item['title']; $itemDescription = (string) $item['summary']; $itemPubDate = (string) $item['created']; $itemId = (string) $item['id']; $itemAuthor = (string) ($item['author'] ? $item['author'] : $item['author_name']); } else { $itemLink = isset($item['link']['href']) ? (string) $item['link']['href'] : ''; $itemTitle = (string) $item['title']; $itemDescription = (string) $item['summary']; $itemPubDate = (string) $item['created']; $itemId = (string) $item['id']; $itemAuthor = (string) ($item['author'] ? $item['author'] : $item['author_name']); } } else { print 'ErrorBadFeedFormat'; } } // Add record to result array $this->_rssarray[$i] = array('link' => $itemLink, 'title' => $itemTitle, 'description' => $itemDescription, 'pubDate' => $itemPubDate, 'category' => $itemCategory, 'id' => $itemId, 'author' => $itemAuthor); //var_dump($this->_rssarray); $i++; if ($i > $maxNb) { break; } // We get all records we want } } return 1; } else { $this->error = 'ErrorFailedToLoadRSSFile'; return -1; } }
<?php require_once 'include.php'; if (!xml2php("invoice")) { $smarty->assign('error_msg', "Error in language file"); } // Grab customers Information $wo_id = $VAR['wo_id']; $customer_id = $VAR['customer_id']; $submit = $VAR['submit']; $desc = $VAR['desc']; $smarty->assign('customer_id', $VAR['customer_id']); //$smarty->assign('invoice_id', $VAR['invoice_id']); /* get Date Formatting value from database and assign it to $format*/ $q = 'SELECT * FROM ' . PRFX . 'TABLE_COMPANY'; if (!($rs = $db->execute($q))) { force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database'); exit; } else { $format = $rs->fields['COMPANY_DATE_FORMAT']; } // Stripping out the percentage signs so php can render it correctly $literals = "%"; $Dformat = str_replace($literals, "", $format); //Now lets display the right date format if ($Dformat == 'd/m/Y' || $Dformat == 'd/m/y') { $cur_date = $d . "/" . $m . "/" . $y; } elseif ($Dformat == 'm/d/Y' || $Dformat == 'm/d/y') { $cur_date = $m . "/" . $d . "/" . $y; } //Assign it to Smarty
<?php require 'include.php'; if (!xml2php("schedule")) { $smarty->assign('error_msg', "Error in language file"); } /* load the date formate from the js calendar */ $wo_id = $_GET['wo_id']; /* check if work order closed we don't want to reschedule a work order if it's closed */ if (isset($wo_id)) { $q = "SELECT WORK_ORDER_CURRENT_STATUS FROM " . PRFX . "TABLE_WORK_ORDER WHERE WORK_ORDER_ID=" . $db->qstr($wo_id); if (!($rs = $db->execute($q))) { force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database'); exit; } else { $status = $rs->fields['WORK_ORDER_CURRENT_STATUS']; } if ($status == '6') { force_page('workorder', 'view&wo_id=' . $wo_id . '&error_msg=Can not set a schedule for closed work order&page_title=Work Order ID ' . $wo_id . '&type=warning'); } elseif ($status == '7') { force_page('workorder', 'view&wo_id=' . $wo_id . '&error_msg=Can not set a schedule for closed work order&page_title=Work Order ID ' . $wo_id . '&type=warning'); } elseif ($status == '8') { force_page('workorder', 'view&wo_id=' . $wo_id . '&error_msg=Can not set a schedule for closed work order&page_title=Work Order ID ' . $wo_id . '&type=warning'); } elseif ($status == '9') { force_page('workorder', 'view&wo_id=' . $wo_id . '&error_msg=Can not set a schedule for closed work order&page_title=Work Order ID ' . $wo_id . '&type=warning'); } } $y = $VAR['y']; $m = $VAR['m']; $d = $VAR['d']; /* get Date Formatting value from database and assign it to $format*/
<?php require_once 'include.php'; if (!xml2php('stats')) { $smarty->assign('error_msg', "Error in language file"); } if (isset($VAR['submit'])) { // General Section /* Change dates to proper timestamps */ $start_date = date_to_timestamp($db, $VAR['start_date']); $smarty->assign('start_date', $start_date); $end_date = date_to_timestamp($db, $VAR['end_date']); $smarty->assign('end_date', $end_date); /* Count open work orders in selected period */ $q = "SELECT count(*) AS count FROM " . PRFX . "TABLE_WORK_ORDER WHERE WORK_ORDER_OPEN_DATE >= '{$start_date}' AND WORK_ORDER_OPEN_DATE <= '{$end_date}'"; if (!($rs = $db->Execute($q))) { echo 'Error: ' . $db->ErrorMsg(); die; } $wo_opened = $rs->fields['count']; $smarty->assign('wo_opened', $wo_opened); /* Count closed work orders in selected period */ $q = "SELECT count(*) AS count FROM " . PRFX . "TABLE_WORK_ORDER WHERE WORK_ORDER_CLOSE_DATE >= '{$start_date}' AND WORK_ORDER_CLOSE_DATE <= '{$end_date}'"; if (!($rs = $db->Execute($q))) { echo 'Error: ' . $db->ErrorMsg(); die; } $wo_closed = $rs->fields['count']; $smarty->assign('wo_closed', $wo_closed); /* Count New Customers in selected period */ $q = "SELECT count(*) AS count FROM " . PRFX . "TABLE_CUSTOMER WHERE CREATE_DATE >= '{$start_date}' AND CREATE_DATE <= '{$end_date}'";
<?php // Load the Expense Functions require_once 'include.php'; // Load the Translations for this Module if (!xml2php('expense')) { $smarty->assign('error_msg', "Error in language file"); } $expenseID = $VAR['expenseID']; // Load PHP Language Translations $langvals = gateway_xml2php('expense'); // Make sure we got an Expense ID number if (!isset($expenseID) || $expenseID == "") { $smarty->assign('results', 'Please go back and select an expense record'); die; } // Delete the expense function call if (!delete_expense($db, $expenseID)) { force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database'); exit; } else { force_page('expense', 'search&page_title=' . $langvals['expense_search_title']); exit; }
<?php /* customer Id */ require_once "include.php"; if (!xml2php("billing")) { $smarty->assign('error_msg', "Error in language file"); } $customer_id = $VAR['customer_id']; $customer_name = $VAR['customer_name']; $smarty->assign('customer_name', $customer_name); $smarty->assign('customer_id', $customer_id); /* if no customer id error */ if ($customer_id == '') { force_page('core', 'error&error_msg=No Customer ID&menu=1&type=database'); exit; } /* check if gift cert is ebabled */ $q = "SELECT ACTIVE FROM " . PRFX . "CONFIG_BILLING_OPTIONS WHERE BILLING_OPTION='gift_billing'"; if (!($rs = $db->execute($q))) { force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database'); exit; } /* if gift cert not enabled send them back */ if ($rs->fields['ACTIVE'] != 1) { force_page('core', 'error&error_msg=Gift Certificate Billing is not enabled. To enbale gift certificates go to the Help menu and select Control Center. Then under the menu Billing Options select Payment Methods and check Gift Certificate. &menu=1&type=error'); exit; } /* if submit */ if (isset($VAR['submit'])) { /* add */ if ($VAR['action'] == 'add') {
function xml2php($xml) { $fils = 0; $tab = false; $array = array(); foreach ($xml->children() as $key => $value) { $child = xml2php($value); foreach ($node->attributes() as $ak => $av) { // To deal with the attributes $child[$ak] = (string) $av; } if ($tab == false && in_array($key, array_keys($array))) { // Let's see if the new child is not in the array $tmp = $array[$key]; // If this element is already in the array $array[$key] = NULL; // we will create an indexed array $array[$key][] = $tmp; $array[$key][] = $child; $tab = true; } elseif ($tab == true) { $array[$key][] = $child; //Add an element in an existing array } else { //Add a simple element $array[$key] = $child; } $fils++; } if ($fils == 0) { return (string) $xml; } return $array; }
<?php //Load Language File if (!xml2php("asset")) { $smarty->assign('error_msg', "Error in language file"); } $smarty->display('asset' . SEP . 'view.tpl');
<?php // Load the Refund Functions require_once 'include.php'; // Load the Translation for this Module if (!xml2php('invoice')) { $smarty->assign('error_msg', "Error in language file"); } $langvals = gateway_xml2php(invoice); $wo_id = $VAR['wo_id']; $customer_id = $VAR['customer_id']; $invoice_id = $VAR['invoice_id']; $labourID = $VAR['labourID']; $partsID = $VAR['partsID']; // Labour Delete Record if (isset($VAR['deleteType']) && $VAR['deleteType'] == "labourRecord") { // Delete the labour record Function call if (!delete_labour_record($db, $labourID)) { force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database'); exit; } else { force_page('invoice', 'new&invoice_id=' . $invoice_id . '&wo_id=' . $wo_id . '&page_title=' . $langvals['invoice_invoice'] . '&customer_id=' . $customer_id); exit; } } // Parts Delete Record if (isset($VAR['deleteType']) && $VAR['deleteType'] == "partsRecord") { // Delete the labour record Function call if (!delete_parts_record($db, $partsID)) { force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database'); exit;
<?php ######################################################### # This program is distributed under the terms and # # conditions of the GPL # # new.php # # Version 0.0.1 Fri Sep 30 09:30:10 PDT 2005 # # # ######################################################### require_once "include.php"; //require_once("js/emp_new.js"); if (!xml2php("employees")) { $smarty->assign('error_msg', "Error in language file"); } $VAR['page_title'] = "Add New Employee"; if (isset($VAR['submit'])) { $smarty->assign('VAR', $VAR); if (!check_employee_ex($db, $VAR)) { $smarty->assign('error_msg', 'The employees Display Name, ' . $VAR["displayName"] . ', already exists! Please use a differnt name.'); $smarty->display('employees' . SEP . 'new.tpl'); } else { if (!($employee_id = insert_new_employee($db, $VAR))) { $smarty->assign('error_msg', 'Falied to insert Employee'); } else { force_page('employees', 'employee_details&employee_id=' . $employee_id . '&page_title=Employees'); } } } else { $smarty->display('employees' . SEP . 'new.tpl'); }