From: <dai...@us...> - 2014-11-08 05:14:31
|
Revision: 6971 http://sourceforge.net/p/web-erp/reponame/6971 Author: daintree Date: 2014-11-08 05:14:21 +0000 (Sat, 08 Nov 2014) Log Message: ----------- login logic fixed Modified Paths: -------------- trunk/includes/ConnectDB.inc trunk/javascripts/MiscFunctions.js Modified: trunk/includes/ConnectDB.inc =================================================================== --- trunk/includes/ConnectDB.inc 2014-11-08 00:43:17 UTC (rev 6970) +++ trunk/includes/ConnectDB.inc 2014-11-08 05:14:21 UTC (rev 6971) @@ -7,42 +7,42 @@ $Version='4.11.5'; //must update manually every time there is a DB change require_once ($PathPrefix .'includes/MiscFunctions.php'); -if (!isset($_SESSION['DatabaseName'])){ //need to get the database name from the file structure +if (!isset($_SESSION['DatabaseName'])){ if (isset($_POST['CompanyNameField'])){ - if (isset($CompanyList) AND is_array($CompanyList)) { - foreach ($CompanyList as $CompanyEntryKey => $CompanyEntry){ - if (is_dir('./companies/'. $CompanyEntry['database']) AND ($CompanyEntryKey == $_POST['CompanyNameField']) ) { - $_SESSION['DatabaseName'] = $CompanyEntry['database']; - $_SESSION['CompanyName'] = $CompanyEntry['company']; - include_once ($PathPrefix . 'includes/ConnectDB_' . $DBType . '.inc'); - break; - } - } - if (!isset($_SESSION['DatabaseName'])) { - prnMsg(_('You do not seem to have a database configured correctly to use with webERP. Check you database exists and there is a corresponding directory in the \'companies\' directory of the same name. Contact your system administrator for assistance.'),'error'); - exit; - } + if (isset($CompanyList) AND is_array($CompanyList)) { + foreach ($CompanyList as $CompanyEntryKey => $CompanyEntry){ + if (is_dir('./companies/'. $CompanyEntry['database']) AND ($CompanyEntryKey == $_POST['CompanyNameField']) ) { + $_SESSION['DatabaseName'] = $CompanyEntry['database']; + $_SESSION['CompanyName'] = $CompanyEntry['company']; + break; + } + } + if (!isset($_SESSION['DatabaseName'])) { + prnMsg(_('You do not seem to have a database configured correctly to use with webERP. Check you database exists and there is a corresponding directory in the \'companies\' directory of the same name. Contact your system administrator for assistance.'),'error'); + exit; + } if (ContainsIllegalCharacters( $_SESSION['DatabaseName'])){ - prnMsg(_('The company database being logged into cannot contain any of the illegal characters'),'error'); - echo '<br /><a href="index.php">' . _('Back to login page') . '</a>'; - exit; + prnMsg(_('The company database being logged into cannot contain any of the illegal characters'),'error'); + echo '<br /><a href="index.php">' . _('Back to login page') . '</a>'; + exit; } } //provision for old setup - delete when we have a reliable upgrade for config.php else { if (ContainsIllegalCharacters($_POST['CompanyNameField'])){ - prnMsg(_('The company database being logged into cannot contain any of the illegal characters'),'error'); - echo '<br /><a href="index.php">' . _('Back to login page') . '</a>'; - exit; + prnMsg(_('The company database being logged into cannot contain any of the illegal characters'),'error'); + echo '<br /><a href="index.php">' . _('Back to login page') . '</a>'; + exit; } if (is_dir('companies/' . $_POST['CompanyNameField']) AND $_POST['CompanyNameField'] != '..'){ - $_SESSION['DatabaseName'] = $_POST['CompanyNameField']; - $_SESSION['CompanyName'] = $_POST['CompanyNameField']; - include_once ($PathPrefix . 'includes/ConnectDB_' . $DBType . '.inc'); + $_SESSION['DatabaseName'] = $_POST['CompanyNameField']; + $_SESSION['CompanyName'] = $_POST['CompanyNameField']; } else { - prnMsg(_('The company name entered' . ' (' . $_POST['CompanyNameField'] . ') ' . 'is not configured for use with this installation of webERP. Check that a directory named ' . $_POST['CompanyNameField'] . ' is set up under the companies sub-directory.'),'error'); - prnMsg(_('Check the company name entered' . ' (' . $_POST['CompanyNameField'] . ') ' . 'is the same as the database name.'),'error'); - prnMsg(_('The company name abbreviation entered at login must also have a company directory defined. See your system administrator'),'error'); + prnMsg(_('The company name entered' . ' (' . $_POST['CompanyNameField'] . ') ' . 'is not configured for use with this installation of webERP. Check that a directory named ' . $_POST['CompanyNameField'] . ' is set up under the companies sub-directory.'),'error'); + prnMsg(_('Check the company name entered' . ' (' . $_POST['CompanyNameField'] . ') ' . 'is the same as the database name.'),'error'); + prnMsg(_('The company name abbreviation entered at login must also have a company directory defined. See your system administrator'),'error'); + echo '<br /><a href="index.php">' . _('Back to login page') . '</a>'; + exit; } } // end provision for old setup include_once ($PathPrefix . 'includes/ConnectDB_' . $DBType . '.inc'); @@ -51,5 +51,7 @@ $_SESSION['CompanyName']= $DatabaseName; include_once ($PathPrefix . 'includes/ConnectDB_' . $DBType . '.inc'); } +} else { + include_once ($PathPrefix . 'includes/ConnectDB_' . $DBType . '.inc'); } ?> \ No newline at end of file Modified: trunk/javascripts/MiscFunctions.js =================================================================== --- trunk/javascripts/MiscFunctions.js 2014-11-08 00:43:17 UTC (rev 6970) +++ trunk/javascripts/MiscFunctions.js 2014-11-08 05:14:21 UTC (rev 6971) @@ -44,13 +44,13 @@ break; default: alert('something is wrong with your language setting'); - + } if(patt.test(this.value)){ this.setCustomValidity(''); return true; - + }else{ this.setCustomValidity('The number format is wrong'); return false; @@ -98,7 +98,7 @@ m=mA[3]; y=mA[1]; } - + if (m<1 || m>12){ alert("Month must be between 1 and 12"); return false; @@ -289,7 +289,7 @@ function(a,b) { if (direction=="a") { if (columnClass=="number") { - return parseFloat(a[columnNumber])-parseFloat(b[columnNumber]); + return parseFloat(e[columnNumber].replace(/[,.]/g, '')) - parseFloat(t[columnNumber].replace(/[,.]/g, '') } else if (columnClass=="date") { da=new Date(a[columnNumber]); db=new Date(b[columnNumber]); @@ -299,7 +299,7 @@ } } else { if (columnClass=="number") { - return parseFloat(b[columnNumber])-parseFloat(a[columnNumber]); + return parseFloat(e[columnNumber].replace(/[,.]/g, '')) - parseFloat(t[columnNumber].replace(/[,.]/g, '') } else if (columnClass=="date") { da=new Date(a[columnNumber]); db=new Date(b[columnNumber]); @@ -341,7 +341,7 @@ if (ds[i].className=="number") ds[i].onkeypress=rTN; if (ds[i].className=="integer") ds[i].onkeypress=rTI; if (ds[i].className=="number"){ - + ds[i].origonchange=ds[i].onchange; ds[i].newonchange=rLocaleNumber; ds[i].onchange=function(){ @@ -349,7 +349,7 @@ this.origonchange(); this.newonchange(); }; - + } } var ds=document.getElementsByTagName("th"); |