From: <tim...@us...> - 2009-11-20 15:35:22
|
Revision: 3056 http://web-erp.svn.sourceforge.net/web-erp/?rev=3056&view=rev Author: tim_schofield Date: 2009-11-20 15:35:14 +0000 (Fri, 20 Nov 2009) Log Message: ----------- Create a log file of all status messages. Default is no log. Modified Paths: -------------- trunk/SystemParameters.php trunk/doc/Change.log.html trunk/includes/MiscFunctions.php trunk/sql/mysql/upgrade3.11-3.12.sql Modified: trunk/SystemParameters.php =================================================================== --- trunk/SystemParameters.php 2009-11-20 14:59:01 UTC (rev 3055) +++ trunk/SystemParameters.php 2009-11-20 15:35:14 UTC (rev 3056) @@ -243,6 +243,12 @@ if ($_SESSION['MonthsAuditTrail'] != $_POST['X_MonthsAuditTrail']){ $sql[] = 'UPDATE config SET confvalue=' . $_POST['X_MonthsAuditTrail'] . " WHERE confname='MonthsAuditTrail'"; } + if ($_SESSION['LogSeverity'] != $_POST['X_LogSeverity']){ + $sql[] = 'UPDATE config SET confvalue=' . $_POST['X_LogSeverity'] . " WHERE confname='LogSeverity'"; + } + if ($_SESSION['LogPath'] != $_POST['X_LogPath']){ + $sql[] = "UPDATE config SET confvalue='" . $_POST['X_LogPath'] . "' WHERE confname='LogPath'"; + } if ($_SESSION['UpdateCurrencyRatesDaily'] != $_POST['X_UpdateCurrencyRatesDaily']){ if ($_POST['X_UpdateCurrencyRatesDaily']=='Auto'){ $sql[] = "UPDATE config SET confvalue='" . Date('Y-m-d',mktime(0,0,0,Date('m'),Date('d')-1,Date('Y'))) . "' WHERE confname='UpdateCurrencyRatesDaily'"; @@ -250,7 +256,7 @@ $sql[] = "UPDATE config SET confvalue='0' WHERE confname='UpdateCurrencyRatesDaily'"; } } - if ($_SESSION['FactoryManagerEmail'] != $_POST['X_FactoryMangerEmail']){ + if ($_SESSION['FactoryManagerEmail'] != $_POST['X_FactoryManagerEmail']){ $sql[] = "UPDATE config SET confvalue='" . $_POST['X_FactoryManagerEmail'] . "' WHERE confname='FactoryManagerEmail'"; } if ($_SESSION['AutoCreateWOs'] != $_POST['X_AutoCreateWOs']){ @@ -633,7 +639,7 @@ $ErrMsg = _('Could not load the Number Of Month Must be Shown'); $result = DB_query($sql,$db,$ErrMsg); $row = DB_fetch_array($result); -$_SESSION['NumberOfMonthMustBeShown'] == $row['confvalue']; +$_SESSION['NumberOfMonthMustBeShown'] = $row['confvalue']; echo '<tr><td>' . _('Number Of Month Must Be Shown') . ':</td> <td><input type="text" class="number" name="X_NumberOfMonthMustBeShown" size=4 maxlength=3 value="' . $_SESSION['NumberOfMonthMustBeShown'] . '"></td> @@ -861,6 +867,47 @@ <td><input type="text" class="number" name="X_MonthsAuditTrail" size=3 maxlength=2 value="' . $_SESSION['MonthsAuditTrail'] . '"></td><td>' . _('If this parameter is set to 0 (zero) then no audit trail is retained. An audit trail is a log of which users performed which additions updates and deletes of database records. The full SQL is retained') . '</td> </tr>'; +//Which messages to log +echo '<tr><td>' . _('Log Severity Level') . ':</td><td><select name="X_LogSeverity" >'; +if ($_SESSION['LogSeverity']==0) { + echo '<option selected value=0>' ._('None'). '</option>'; + echo '<option value=1>' ._('Errors Only'). '</option>'; + echo '<option value=2>' ._('Errors and Warnings'). '</option>'; + echo '<option value=3>' ._('Errors, Warnings and Info'). '</option>'; + echo '<option value=4>' ._('All'). '</option>'; +} else if ($_SESSION['LogSeverity']==1) { + echo '<option value=0>' ._('None'). '</option>'; + echo '<option selected value=1>' ._('Errors Only'). '</option>'; + echo '<option value=2>' ._('Errors and Warnings'). '</option>'; + echo '<option value=3>' ._('Errors, Warnings and Info'). '</option>'; + echo '<option value=4>' ._('All'). '</option>'; +} else if ($_SESSION['LogSeverity']==2) { + echo '<option value=0>' ._('None'). '</option>'; + echo '<option value=1>' ._('Errors Only'). '</option>'; + echo '<option selected value=2>' ._('Errors and Warnings'). '</option>'; + echo '<option value=3>' ._('Errors, Warnings and Info'). '</option>'; + echo '<option value=4>' ._('All'). '</option>'; +} else if ($_SESSION['LogSeverity']==3) { + echo '<option value=0>' ._('None'). '</option>'; + echo '<option value=1>' ._('Errors Only'). '</option>'; + echo '<option value=2>' ._('Errors and Warnings'). '</option>'; + echo '<option selected value=3>' ._('Errors, Warnings and Info'). '</option>'; + echo '<option value=4>' ._('All'). '</option>'; +} else if ($_SESSION['LogSeverity']==4) { + echo '<option value=0>' ._('None'). '</option>'; + echo '<option value=1>' ._('Errors Only'). '</option>'; + echo '<option value=2>' ._('Errors andWarnings'). '</option>'; + echo '<option value=3>' ._('Errors, Warnings and Info'). '</option>'; + echo '<option selected value=4>' ._('All'). '</option>'; +} +echo '</select></td>'; +echo '<td>' . _('Choose which Status messages to keep in your log file.') . '</td></tr>'; + +//Path to keep log files in +echo '<tr><td>' . _('Path to log files') . ':</td> + <td><input type="text" name="X_LogPath" size=40 maxlength=79 value="' . $_SESSION['LogPath'] . '"></td><td>' . _('The path to the directory where the log files will be stored. Note the apache user must have write permissions on this directory.') . '</td> +</tr>'; + //DefineControlledOnWOEntry echo '<tr><td>' . _('Controlled Items Defined At Work Order Entry') . ':</td> <td><select Name="X_DefineControlledOnWOEntry"> Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-20 14:59:01 UTC (rev 3055) +++ trunk/doc/Change.log.html 2009-11-20 15:35:14 UTC (rev 3056) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>20/11/09 Tim: Create a log file of all status messages. Default is no log. <p>19/11/09 Tim: Improvements to factor company implementaton. <p>18/11/09 Tim: default.css - Correction to jelly theme <p>18/11/09 Tim: PO_Header.php - Add direct link to raise a Purchase Order Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2009-11-20 14:59:01 UTC (rev 3055) +++ trunk/includes/MiscFunctions.php 2009-11-20 15:35:14 UTC (rev 3056) @@ -13,23 +13,36 @@ function getMsg($Msg,$Type='info',$Prefix=''){ $Colour=''; + $LogFile=fopen($_SESSION['LogPath'].'/webERP-test.log', 'a'); switch($Type){ case 'error': $Class = 'error'; $Prefix = $Prefix ? $Prefix : _('ERROR') . ' ' ._('Message Report'); + if ($_SESSION['LogSeverity']>0) { + fwrite($LogFile, date('Y-m-d h-m-s').','.$Type.','.$_SESSION['UserID'].','.trim($Msg,',')."\n"); + } break; case 'warn': $Class = 'warn'; $Prefix = $Prefix ? $Prefix : _('WARNING') . ' ' . _('Message Report'); + if ($_SESSION['LogSeverity']>1) { + fwrite($LogFile, date('Y-m-d h-m-s').','.$Type.','.$_SESSION['UserID'].','.trim($Msg,',')."\n"); + } break; case 'success': $Class = 'success'; $Prefix = $Prefix ? $Prefix : _('SUCCESS') . ' ' . _('Report'); + if ($_SESSION['LogSeverity']>3) { + fwrite($LogFile, date('Y-m-d h-m-s').','.$Type.','.$_SESSION['UserID'].','.trim($Msg,',')."\n"); + } break; case 'info': default: $Prefix = $Prefix ? $Prefix : _('INFORMATION') . ' ' ._('Message'); $Class = 'info'; + if ($_SESSION['LogSeverity']>2) { + fwrite($LogFile, date('Y-m-d h-m-s').','.$Type.','.$_SESSION['UserID'].','.trim($Msg,',')."\n"); + } } return '<DIV class="'.$Class.'"><B>' . $Prefix . '</B> : ' .$Msg . '</DIV>'; }//getMsg Modified: trunk/sql/mysql/upgrade3.11-3.12.sql =================================================================== --- trunk/sql/mysql/upgrade3.11-3.12.sql 2009-11-20 14:59:01 UTC (rev 3055) +++ trunk/sql/mysql/upgrade3.11-3.12.sql 2009-11-20 15:35:14 UTC (rev 3056) @@ -42,4 +42,7 @@ ALTER TABLE `suppliers` DROP FOREIGN KEY `suppliers_ibfk_4`; UPDATE `suppliers` SET `factorcompanyid`=0 WHERE `factorcompanyid`=1; -DELETE FROM `factorcompanies` WHERE `coyname`='None'; \ No newline at end of file +DELETE FROM `factorcompanies` WHERE `coyname`='None'; + +INSERT INTO `config` (`confname`, `confvalue`) VALUES ('LogPath', ''); +INSERT INTO `config` (`confname`, `confvalue`) VALUES ('LogSeverity', '0'); \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |