From: <dai...@us...> - 2011-06-18 04:55:22
|
Revision: 4598 http://web-erp.svn.sourceforge.net/web-erp/?rev=4598&view=rev Author: daintree Date: 2011-06-18 04:55:08 +0000 (Sat, 18 Jun 2011) Log Message: ----------- languages names Modified Paths: -------------- trunk/CreditItemsControlled.php trunk/CreditStatus.php trunk/Credit_Invoice.php trunk/Currencies.php trunk/CustEDISetup.php trunk/CustLoginSetup.php trunk/CustomerTransInquiry.php trunk/DeliveryDetails.php trunk/UserSettings.php trunk/WWW_Users.php trunk/doc/Change.log trunk/includes/session.inc trunk/index.php Added Paths: ----------- trunk/includes/LanguagesArray.php Modified: trunk/CreditItemsControlled.php =================================================================== --- trunk/CreditItemsControlled.php 2011-06-17 09:16:37 UTC (rev 4597) +++ trunk/CreditItemsControlled.php 2011-06-18 04:55:08 UTC (rev 4598) @@ -1,9 +1,9 @@ <?php -/* $Revision: 1.11 $ */ + /* $Id$*/ + include('includes/DefineCartClass.php'); include('includes/DefineSerialItems.php'); -//$PageSecurity = 3; include('includes/session.inc'); $title = _('Specify Credited Controlled Items'); @@ -29,18 +29,18 @@ } elseif (isset($_POST['LineNo'])){ $LineNo = $_POST['LineNo']; } else { - echo '<div class="centre"><a href="' . $rootpath . '/' . $CreditLink . '?' . SID . '">'. _('Select Credit Items'). '</a><br><br>'; + echo '<div class="centre"><a href="' . $rootpath . '/' . $CreditLink . '">'. _('Select Credit Items'). '</a><br /><br />'; prnMsg( _('This page can only be opened if a Line Item on a credit note has been selected.') . ' ' . _('Please do that first'), 'error'); echo '</div>'; include('includes/footer.inc'); exit; } - - if (!isset($_SESSION['CreditItems'])) { /* This page can only be called with a credit note entry part entered */ - echo '<div class="centre"><a href="' . $rootpath . '/' . $CreditLink . '?' . SID . '">'. _('Select Credit Items'). '</a><br><br>'; + echo '<div class="centre"><a href="' . $rootpath . '/' . $CreditLink . '">'. _('Select Credit Items'). '</a> + <br /> + <br />'; prnMsg( _('This page can only be opened if a controlled credit note line item has been selected.') . ' ' . _('Please do that first'),'error'); echo '</div>'; include('includes/footer.inc'); @@ -53,8 +53,8 @@ //Make sure this item is really controlled if ( $LineItem->Controlled != 1 ){ - echo '<div class="centre"><a href="' . $rootpath . '/' . $CreditLink . '?' . SID . '">'. _('Back to Credit Note Entry').'</a></div>'; - echo '<br>'; + echo '<div class="centre"><a href="' . $rootpath . '/' . $CreditLink . '">'. _('Back to Credit Note Entry').'</a></div>'; + echo '<br />'; prnMsg( _('Notice') . ' - ' . _('The line item must be defined as controlled to require input of the batch numbers or serial numbers being credited'),'warn'); include('includes/footer.inc'); exit; @@ -70,17 +70,16 @@ echo '<div class="centre">'; if ($CreditLink == 'Credit_Invoice.php'){ - echo '<input type=hidden name="CreditInvoice" VALUE="Yes">'; + echo '<input type="hidden" name="CreditInvoice" value="Yes">'; } -echo '<br><a href="' . $rootpath . '/' . $CreditLink . '?' . SID . '">'. _('Back to Credit Note Entry'). '</a>'; +echo '<br /><a href="' . $rootpath . '/' . $CreditLink . '">'. _('Back to Credit Note Entry'). '</a>'; -echo '<br><font size=2><b>'. _('Credit of Controlled Item'). ' ' . $LineItem->StockID . ' - ' . $LineItem->ItemDescription . ' '. _('from') .' '. $_SESSION['CreditItems']->CustomerName . '</b></font></div>'; +echo '<br /><font size=2><b>'. _('Credit of Controlled Item'). ' ' . $LineItem->StockID . ' - ' . $LineItem->ItemDescription . ' '. _('from') .' '. $_SESSION['CreditItems']->CustomerName . '</b></font></div>'; /** vars needed by InputSerialItem : **/ $LocationOut = $_SESSION['CreditItems']->Location; -/* $_SESSION['CreditingControlledItems_MustExist'] is in config.php - Phil and Jesse disagree on the default treatment -compromise position make it user configurable */ +/* $_SESSION['CreditingControlledItems_MustExist'] is in config.php - Phil and Jesse disagree on the default treatment compromise position make it user configurable */ $ItemMustExist = $_SESSION['CreditingControlledItems_MustExist']; $StockID = $LineItem->StockID; $InOutModifier=1; @@ -88,7 +87,8 @@ $IsCredit = true; include ('includes/InputSerialItems.php'); - echo '</tr></table>'; +echo '</tr> + </table>'; /*TotalQuantity set inside this include file from the sum of the bundles of the item selected for dispatch */ @@ -100,4 +100,4 @@ include('includes/footer.inc'); exit; -?> +?> \ No newline at end of file Modified: trunk/CreditStatus.php =================================================================== --- trunk/CreditStatus.php 2011-06-17 09:16:37 UTC (rev 4597) +++ trunk/CreditStatus.php 2011-06-18 04:55:08 UTC (rev 4598) @@ -17,7 +17,8 @@ } $Errors = array(); $InputError = 0; -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p> + <br />'; if (isset($_POST['submit'])) { @@ -80,24 +81,21 @@ /*Selected Reason is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new status code form */ - if (isset($_POST['DisallowInvoices']) and $_POST['DisallowInvoices']=='on'){ + if (isset($_POST['DisallowInvoices']) AND $_POST['DisallowInvoices']=='on'){ - $sql = "INSERT INTO holdreasons ( - reasoncode, - reasondescription, - dissallowinvoices) - VALUES ( - '" .$_POST['ReasonCode'] . "', - '".$_POST['ReasonDescription'] . "' - , 1)"; + $sql = "INSERT INTO holdreasons (reasoncode, + reasondescription, + dissallowinvoices) + VALUES ('" .$_POST['ReasonCode'] . "', + '".$_POST['ReasonDescription'] . "', + 1)"; } else { - $sql = "INSERT INTO holdreasons ( - reasoncode, - reasondescription, - dissallowinvoices) - VALUES ( - '" . $_POST['ReasonCode'] . "', - '" . $_POST['ReasonDescription'] ."', 0)"; + $sql = "INSERT INTO holdreasons (reasoncode, + reasondescription, + dissallowinvoices) + VALUES ('" . $_POST['ReasonCode'] . "', + '" . $_POST['ReasonDescription'] ."', + 0)"; } $msg = _('A new credit status record has been inserted'); @@ -122,7 +120,7 @@ $myrow = DB_fetch_row($result); if ($myrow[0] > 0) { prnMsg( _('Cannot delete this credit status code because customer accounts have been created referring to it'),'warn'); - echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('customer accounts that refer to this credit status code'); + echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('customer accounts that refer to this credit status code'); } else { //only delete if used in neither customer or supplier accounts @@ -200,10 +198,10 @@ //editing an existing status code $sql = "SELECT reasoncode, - reasondescription, - dissallowinvoices - FROM holdreasons - WHERE reasoncode='".$SelectedReason."'"; + reasondescription, + dissallowinvoices + FROM holdreasons + WHERE reasoncode='".$SelectedReason."'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -215,14 +213,17 @@ echo '<input type="hidden" name="SelectedReason" value="' . $SelectedReason . '">'; echo '<input type="hidden" name="ReasonCode" value="' . $_POST['ReasonCode'] . '">'; echo '<table class="selection"> - <tr><td>'. _('Status Code') .':</td> - <td>' . $_POST['ReasonCode'] . '</td></tr>'; + <tr> + <td>'. _('Status Code') .':</td> + <td>' . $_POST['ReasonCode'] . '</td> + </tr>'; } else { //end of if $SelectedReason only do the else when a new record is being entered if (!isset($_POST['ReasonCode'])) { $_POST['ReasonCode'] = ''; } - echo '<br /><table class="selection"> + echo '<br /> + <table class="selection"> <tr> <td>'. _('Status Code') .':</td> <td><input ' . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex=1 type="text" name="ReasonCode" value="'. $_POST['ReasonCode'] .'" size=3 maxlength=2></td> @@ -233,17 +234,21 @@ $_POST['ReasonDescription'] = ''; } echo '<tr> - <td>'. _('Description') .':</td> - <td><input ' . (in_array('ReasonDescription',$Errors) ? 'class="inputerror"' : '' ) . - ' tabindex=2 type="text" name="ReasonDescription" VALUE="'. $_POST['ReasonDescription'] .'" size="28" maxlength="30"> - </td></tr> - <tr><td>'. _('Disallow Invoices') . '</td>'; + <td>'. _('Description') .':</td> + <td><input ' . (in_array('ReasonDescription',$Errors) ? 'class="inputerror"' : '' ) . + ' tabindex=2 type="text" name="ReasonDescription" VALUE="'. $_POST['ReasonDescription'] .'" size="28" maxlength="30"></td> + </tr> + <tr> + <td>'. _('Disallow Invoices') . '</td>'; if (isset($_POST['DisallowInvoices']) and $_POST['DisallowInvoices']==1) { echo '<td><input tabindex=3 type="checkbox" checked name="DisallowInvoices"></td></tr>'; } else { echo '<td><input tabindex=3 type="checkbox" name="DisallowInvoices"></td></tr>'; } - echo '</table><br><div class="centre"><input tabindex=4 type="submit" name="submit" value="' . _('Enter Information') . '"></div></form>'; + echo '</table> + <br /> + <div class="centre"><input tabindex=4 type="submit" name="submit" value="' . _('Enter Information') . '"></div> + </form>'; } //end if record deleted no point displaying form to add record include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2011-06-17 09:16:37 UTC (rev 4597) +++ trunk/Credit_Invoice.php 2011-06-18 04:55:08 UTC (rev 4598) @@ -357,7 +357,7 @@ echo '<br />'; } if (!isset($_POST['ProcessCredit'])) { - echo '<input type=text class="number" name="' . $LnItm->LineNumber . $Tax->TaxCalculationOrder . + echo '<input type="text" class="number" name="' . $LnItm->LineNumber . $Tax->TaxCalculationOrder . '_TaxRate" maxlength=4 size=4 value="' . $Tax->TaxRate*100 . '">'; } $i++; @@ -381,7 +381,7 @@ echo '<td class=number>' . $DisplayTaxAmount . '</td> <td class=number>' . $DisplayGrossLineTotal . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $LnItm->LineNumber . '">' . _('Delete') . '</a></td></tr>'; + <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $LnItm->LineNumber . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this item from the credit?') . '\');">' . _('Delete') . '</a></td></tr>'; echo '<tr' . $RowStarter . '><td colspan=12><textarea tabindex=' . $j .' name="Narrative_' . $LnItm->LineNumber . '" cols=100% rows=1>' . $LnItm->Narrative . '</textarea><br /><hr></td></tr>'; $j++; @@ -395,7 +395,7 @@ if (!isset($_POST['ProcessCredit'])) { echo '<tr> <td colspan=3 class=number>' . _('Freight cost charged on invoice') . '</td> - <td class=number>' . number_format($_SESSION['Old_FreightCost'],2) . '</td> + <td class=number>' . number_format($_SESSION['Old_FreightCost'],$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> <td></td> <td colspan=2 class=number>' . _('Credit Freight Cost') . '</td> <td><input tabindex='.$j.' type=text class="number" size=6 maxlength=6 name="ChargeFreightCost" value="' . $_SESSION['CreditItems']->FreightCost . '"></td>'; @@ -449,7 +449,7 @@ <td colspan=7 class=number>' . _('Credit Totals') . '</td> <td class=number><hr><b>' . $DisplayTotal . '</b><hr></td> <td colspan=2></td> - <td class=number><hr><b>' . number_format($TaxTotal,2) . '<hr></td> + <td class=number><hr><b>' . number_format($TaxTotal,$_SESSION['CreditItems']->CurrDecimalPlaces) . '<hr></td> <td class=number><hr><b>' . number_format($TaxTotal+($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost),$_SESSION['CreditItems']->CurrDecimalPlaces) . '</b><hr></td> </tr></table>'; } @@ -507,8 +507,8 @@ /*Do some rounding */ - $_SESSION['CreditItems']->total = round($_SESSION['CreditItems']->total,2); - $TaxTotal = round($TaxTotal,2); + $_SESSION['CreditItems']->total = round($_SESSION['CreditItems']->total,$_SESSION['CreditItems']->CurrDecimalPlaces); + $TaxTotal = round($TaxTotal,$_SESSION['CreditItems']->CurrDecimalPlaces); $Allocate_amount=0; $Settled =0; @@ -623,7 +623,7 @@ foreach ($_SESSION['CreditItems']->LineItems as $OrderLine) { if ($OrderLine->QtyDispatched >0){ - $LocalCurrencyPrice= round(($OrderLine->Price / $_SESSION['CurrencyRate']),2); + $LocalCurrencyPrice= round(($OrderLine->Price / $_SESSION['CurrencyRate']),$_SESSION['CompanyRecord']['decimalplaces']); /*Determine the type of stock item being credited */ $SQL = "SELECT mbflag FROM stockmaster WHERE stockid = '" . $OrderLine->StockID . "'"; @@ -1255,7 +1255,7 @@ '" . $PeriodNo . "', '" . $COGSAccount . "', '" . $_SESSION['CreditItems']->DebtorNo . " - " . $OrderLine->StockID . " x " . $OrderLine->QtyDispatched . " @ " . $OrderLine->StandardCost . "', - '" . -round($OrderLine->StandardCost * $OrderLine->QtyDispatched,2) . "' + '" . -round($OrderLine->StandardCost * $OrderLine->QtyDispatched,$_SESSION['CompanyRecord']['decimalplaces']) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The cost of sales GL posting could not be inserted because'); @@ -1279,7 +1279,7 @@ '" . $PeriodNo . "', '" . $_POST['WriteOffGLCode'] . "', '" . $_SESSION['CreditItems']->DebtorNo . " - " . $OrderLine->StockID . " x " . $OrderLine->QtyDispatched . " @ " . $OrderLine->StandardCost . "', - '" . round($OrderLine->StandardCost * $OrderLine->QtyDispatched,2) . "')"; + '" . round($OrderLine->StandardCost * $OrderLine->QtyDispatched,$_SESSION['CompanyRecord']['decimalplaces']) . "')"; } else { $StockGLCode = GetStockGLCode($OrderLine->StockID, $db); $SQL = "INSERT INTO gltrans (type, @@ -1295,7 +1295,7 @@ '" . $PeriodNo . "', '" . $StockGLCode['stockact'] . "', '" . $_SESSION['CreditItems']->DebtorNo . " - " . $OrderLine->StockID . " x " . $OrderLine->QtyDispatched . " @ " . $OrderLine->StandardCost . "', - '" . round($OrderLine->StandardCost * $OrderLine->QtyDispatched,2) . "')"; + '" . round($OrderLine->StandardCost * $OrderLine->QtyDispatched,$_SESSION['CompanyRecord']['decimalplaces']) . "')"; } $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock side or write off of the cost of sales GL posting could not be inserted because'); @@ -1322,7 +1322,7 @@ '" . $PeriodNo . "', '" . $SalesGLAccounts['salesglcode'] . "', '" . $_SESSION['CreditItems']->DebtorNo . " - " . $OrderLine->StockID . " x " . $OrderLine->QtyDispatched . " @ " . $OrderLine->Price . "', - '" . round(($OrderLine->Price * $OrderLine->QtyDispatched)/$_SESSION['CurrencyRate'],2) . "' + '" . round(($OrderLine->Price * $OrderLine->QtyDispatched)/$_SESSION['CurrencyRate'],$_SESSION['CompanyRecord']['decimalplaces']) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The credit note GL posting could not be inserted because'); @@ -1344,7 +1344,7 @@ '" . $PeriodNo . "', '" . $SalesGLAccounts['discountglcode'] . "', '" . $_SESSION['CreditItems']->DebtorNo . " - " . $OrderLine->StockID . " @ " . ($OrderLine->DiscountPercent * 100) . "%', - '" . -round(($OrderLine->Price * $OrderLine->QtyDispatched * $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate'],2) . "' + '" . -round(($OrderLine->Price * $OrderLine->QtyDispatched * $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate'],$_SESSION['CompanyRecord']['decimalplaces']) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The credit note discount GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1372,7 +1372,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['debtorsact'] . "', '" . $_SESSION['CreditItems']->DebtorNo . "', - '" . -round(($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost + $TaxTotal)/$_SESSION['CurrencyRate'],2) . "' + '" . -round(($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost + $TaxTotal)/$_SESSION['CurrencyRate'],$_SESSION['CompanyRecord']['decimalplaces']) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The total debtor GL posting for the credit note could not be inserted because'); @@ -1384,7 +1384,7 @@ /*Could do with setting up a more flexible freight posting schema that looks at the sales type and area of the customer branch to determine where to post the freight recovery */ - if (round($_SESSION['CreditItems']->FreightCost,2) !=0 ) { + if (round($_SESSION['CreditItems']->FreightCost,$_SESSION['CreditItems']->CurrDecimalPlaces) !=0 ) { $SQL = "INSERT INTO gltrans (type, typeno, trandate, @@ -1398,7 +1398,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['freightact'] . "', '" . $_SESSION['CreditItems']->DebtorNo . "', - '" . round($_SESSION['CreditItems']->FreightCost/$_SESSION['CurrencyRate'],2) . "' + '" . round($_SESSION['CreditItems']->FreightCost/$_SESSION['CurrencyRate'],$_SESSION['CompanyRecord']['decimalplaces']) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The freight GL posting for this credit note could not be inserted because'); Modified: trunk/Currencies.php =================================================================== --- trunk/Currencies.php 2011-06-17 09:16:37 UTC (rev 4597) +++ trunk/Currencies.php 2011-06-18 04:55:08 UTC (rev 4598) @@ -25,7 +25,8 @@ $Errors = array(); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p> + <br />'; if (isset($_POST['submit'])) { @@ -61,6 +62,22 @@ $Errors[$i] = 'ExchangeRate'; $i++; } + if (!is_numeric($_POST['DecimalPlaces'])){ + $InputError = 1; + prnMsg(_('The number of decimal places to display for amounts in this currency must be numeric'),'error'); + $Errors[$i] = 'DecimalPlaces'; + $i++; + }elseif ($_POST['DecimalPlaces']<=0){ + $InputError = 1; + prnMsg(_('The number of decimal places to display for amounts in this currency must be positive or zero'),'error'); + $Errors[$i] = 'DecimalPlaces'; + $i++; + } elseif ($_POST['DecimalPlaces']>2){ + $InputError = 1; + prnMsg(_('The number of decimal places to display for amounts in this currency is expected to be 2 or less'),'error'); + $Errors[$i] = 'DecimalPlaces'; + $i++; + } if (strlen($_POST['CurrencyName']) > 20) { $InputError = 1; prnMsg(_('The currency name must be 20 characters or less long'),'error'); @@ -79,7 +96,7 @@ $Errors[$i] = 'HundredsName'; $i++; } - if (($FunctionalCurrency != '') and (isset($SelectedCurrency) and $SelectedCurrency==$FunctionalCurrency)){ + if (($FunctionalCurrency != '') AND (isset($SelectedCurrency) AND $SelectedCurrency==$FunctionalCurrency)){ $InputError = 1; prnMsg(_('The functional currency cannot be modified or deleted'),'error'); } @@ -93,11 +110,11 @@ if (isset($SelectedCurrency) AND $InputError !=1) { /*SelectedCurrency could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/ - $sql = "UPDATE currencies SET - currency='" . $_POST['CurrencyName'] . "', - country='". $_POST['Country']. "', - hundredsname='" . $_POST['HundredsName'] . "', - rate='" .$_POST['ExchangeRate'] . "' + $sql = "UPDATE currencies SET currency='" . $_POST['CurrencyName'] . "', + country='". $_POST['Country']. "', + hundredsname='" . $_POST['HundredsName'] . "', + decimalplaces='" . $_POST['DecimalPlaces'] . "', + rate='" .$_POST['ExchangeRate'] . "' WHERE currabrev = '" . $SelectedCurrency . "'"; $msg = _('The currency definition record has been updated'); @@ -105,16 +122,18 @@ /*Selected currencies is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new payment terms form */ $sql = "INSERT INTO currencies (currency, - currabrev, - country, - hundredsname, - rate) - VALUES ('" . $_POST['CurrencyName'] . "', - '" . $_POST['Abbreviation'] . "', - '" . $_POST['Country'] . "', - '" . $_POST['HundredsName'] . "', - '" . $_POST['ExchangeRate'] . "')"; - + currabrev, + country, + hundredsname, + decimalplaces, + rate) + VALUES ('" . $_POST['CurrencyName'] . "', + '" . $_POST['Abbreviation'] . "', + '" . $_POST['Country'] . "', + '" . $_POST['HundredsName'] . "', + '" . $_POST['DecimalPlaces'] . "', + '" . $_POST['ExchangeRate'] . "')"; + $msg = _('The currency definition record has been added'); } //run the SQL from either of the above possibilites @@ -126,6 +145,7 @@ unset($_POST['CurrencyName']); unset($_POST['Country']); unset($_POST['HundredsName']); + unset($_POST['DecimalPlaces']); unset($_POST['ExchangeRate']); unset($_POST['Abbreviation']); @@ -134,7 +154,8 @@ // PREVENT DELETES IF DEPENDENT RECORDS IN DebtorsMaster - $sql= "SELECT COUNT(*) FROM debtorsmaster WHERE debtorsmaster.currcode = '" . $SelectedCurrency . "'"; + $sql= "SELECT COUNT(*) FROM debtorsmaster + WHERE currcode = '" . $SelectedCurrency . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0] > 0) @@ -142,15 +163,16 @@ prnMsg(_('Cannot delete this currency because customer accounts have been created referring to this currency') . '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('customer accounts that refer to this currency'),'warn'); } else { - $sql= "SELECT COUNT(*) FROM suppliers WHERE suppliers.currcode = '".$SelectedCurrency."'"; + $sql= "SELECT COUNT(*) FROM suppliers + WHERE suppliers.currcode = '".$SelectedCurrency."'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); - if ($myrow[0] > 0) - { + if ($myrow[0] > 0) { prnMsg(_('Cannot delete this currency because supplier accounts have been created referring to this currency') . '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('supplier accounts that refer to this currency'),'warn'); } else { - $sql= "SELECT COUNT(*) FROM banktrans WHERE banktrans.currcode = '" . $SelectedCurrency . "'"; + $sql= "SELECT COUNT(*) FROM banktrans + WHERE currcode = '" . $SelectedCurrency . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0] > 0){ @@ -176,15 +198,22 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT currency, currabrev, country, hundredsname, rate FROM currencies'; + $sql = "SELECT currency, + currabrev, + country, + hundredsname, + rate, + decimalplaces + FROM currencies"; $result = DB_query($sql, $db); - echo '<table class=selection>'; + echo '<table class="selection">'; echo '<tr><td></td> <th>' . _('ISO4217 Code') . '</th> <th>' . _('Currency Name') . '</th> <th>' . _('Country') . '</th> <th>' . _('Hundredths Name') . '</th> + <th>' . _('Decimal Places') . '</th> <th>' . _('Exchange Rate') . '</th> <th>' . _('Ex Rate - ECB') .'</th> </tr>'; @@ -197,7 +226,7 @@ $CurrencyRatesArray = array(); } - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { if ($myrow[1]==$FunctionalCurrency){ echo '<tr bgcolor=#FFbbbb>'; } elseif ($k==1){ @@ -222,39 +251,43 @@ <td>%s</td> <td class=number>%s</td> <td class=number>%s</td> + <td class=number>%s</td> <td><a href="%s&SelectedCurrency=%s">%s</a></td> - <td><a href="%s&SelectedCurrency=%s&delete=1">%s</a></td> + <td><a href="%s&SelectedCurrency=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this currency?') . '\');">%s</a></td> <td><a href="%s/ExchangeRateTrend.php?%s">' . _('Graph') . '</a></td> </tr>', $ImageFile, - $myrow[1], - $myrow[0], - $myrow[2], - $myrow[3], - number_format($myrow[4],5), - number_format(GetCurrencyRate($myrow[1],$CurrencyRatesArray),5), + $myrow['currabrev'], + $myrow['currency'], + $myrow['country'], + $myrow['hundredsname'], + $myrow['decimalplaces'], + number_format($myrow['rate'],5), + number_format(GetCurrencyRate($myrow['currabrev'],$CurrencyRatesArray),5), $_SERVER['PHP_SELF'] . '?', - $myrow[1], + $myrow['currabrev'], _('Edit'), $_SERVER['PHP_SELF'] . '?', - $myrow[1], + $myrow['currabrev'], _('Delete'), $rootpath, - '&CurrencyToShow=' . $myrow[1]); + '&CurrencyToShow=' . $myrow['currabrev']); } else { printf('<td><img src="%s"></td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> <td colspan=4>%s</td> </tr>', $ImageFile, - $myrow[1], - $myrow[0], - $myrow[2], - $myrow[3], + $myrow['currabrev'], + $myrow['currency'], + $myrow['country'], + $myrow['hundredsname'], + $myrow['decimalplaces'], 1, _('Functional Currency')); } @@ -282,6 +315,7 @@ currabrev, country, hundredsname, + decimalplaces, rate FROM currencies WHERE currabrev='" . $SelectedCurrency . "'"; @@ -296,18 +330,22 @@ $_POST['Country'] = $myrow['country']; $_POST['HundredsName'] = $myrow['hundredsname']; $_POST['ExchangeRate'] = $myrow['rate']; + $_POST['DecimalPlaces'] = $myrow['decimalplaces']; echo '<input type="hidden" name="SelectedCurrency" value="' . $SelectedCurrency . '">'; echo '<input type="hidden" name="Abbreviation" value="' . $_POST['Abbreviation'] . '">'; - echo '<table class=selection><tr> + echo '<table class="selection"> + <tr> <td>' . _('ISO 4217 Currency Code').':</td> - <td>' . $_POST['Abbreviation'] . '</td></tr>'; + <td>' . $_POST['Abbreviation'] . '</td> + </tr>'; } else { //end of if $SelectedCurrency only do the else when a new record is being entered if (!isset($_POST['Abbreviation'])) {$_POST['Abbreviation']='';} - echo '<table class=selection><tr> + echo '<table class="selection"> + <tr> <td>' ._('Currency Abbreviation') . ':</td> <td><input ' . (in_array('Abbreviation',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Abbreviation" value="' . $_POST['Abbreviation'] . '" size=4 maxlength=3></td></tr>'; } @@ -317,15 +355,16 @@ if (!isset($_POST['CurrencyName'])) { $_POST['CurrencyName']=''; } - echo '<input ' . (in_array('CurrencyName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="CurrencyName" size=20 maxlength=20 VALUE="' . $_POST['CurrencyName'] . '">'; + echo '<input ' . (in_array('CurrencyName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="CurrencyName" size=20 maxlength=20 value="' . $_POST['CurrencyName'] . '">'; echo '</td></tr>'; echo '<tr><td>'._('Country').':</td>'; echo '<td>'; if (!isset($_POST['Country'])) { $_POST['Country']=''; } - echo '<input ' . (in_array('Country',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Country" size=30 maxlength=50 VALUE="' . $_POST['Country'] . '">'; + echo '<input ' . (in_array('Country',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Country" size=30 maxlength=50 value="' . $_POST['Country'] . '">'; echo '</td></tr>'; + echo '<tr><td>'._('Hundredths Name').':</td>'; echo '<td>'; if (!isset($_POST['HundredsName'])) { @@ -333,6 +372,15 @@ } echo '<input ' . (in_array('HundredsName',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="HundredsName" size=10 maxlength=15 value="'. $_POST['HundredsName'].'">'; echo '</td></tr>'; + + echo '<tr><td>'._('Decimal Places to Display').':</td>'; + echo '<td>'; + if (!isset($_POST['DecimalPlaces'])) { + $_POST['DecimalPlaces']=''; + } + echo '<input ' . (in_array('DecimalPlaces',$Errors) ? 'class="inputerror"' : 'class="number"' ) .' type="text" name="DecimalPlaces" size="2" maxlength="2" value="'. $_POST['DecimalPlaces'].'">'; + echo '</td></tr>'; + echo '<tr><td>'._('Exchange Rate').':</td>'; echo '<td>'; if (!isset($_POST['ExchangeRate'])) { Modified: trunk/CustEDISetup.php =================================================================== --- trunk/CustEDISetup.php 2011-06-17 09:16:37 UTC (rev 4597) +++ trunk/CustEDISetup.php 2011-06-18 04:55:08 UTC (rev 4598) @@ -62,9 +62,8 @@ WHERE debtorno = '" . $_SESSION['CustomerID'] . "'"; $ErrMsg = _('The customer EDI setup data could not be updated because'); - $result = DB_query($sql,$db,$ErrMsg); + $result = DB_query($sql,$db,$ErrMsg); prnMsg(_('Customer EDI configuration updated'),'success'); - } else { prnMsg(_('Customer EDI configuration failed'),'error'); } @@ -72,7 +71,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<br /><table class=selection>'; +echo '<br /><table class="selection">'; $sql = "SELECT debtorno, name, @@ -92,11 +91,13 @@ $myrow = DB_fetch_array($result); echo '<tr><td>'._('Customer Code').':</td> - <td>' . $_SESSION['CustomerID'] . '</td></tr>'; + <td>' . $_SESSION['CustomerID'] . '</td> + </tr>'; echo '<tr><td>'._('Customer Name').':</td> - <td>' . $myrow['name'] . '</td></tr>'; + <td>' . $myrow['name'] . '</td> + </tr>'; echo '<tr><td>'._('Enable Sending of EDI Invoices').':</td> - <td><select tabindex=1 name="EDIInvoices">'; + <td><select tabindex=1 name="EDIInvoices">'; if ($myrow['ediinvoices']==0){ @@ -107,7 +108,8 @@ echo '<option selected value=1>'._('Enabled') . '</option>'; } -echo '</select><a href="' . $rootpath . '/EDIMessageFormat.php?MessageType=INVOIC&PartnerCode=' . $_SESSION['CustomerID'] . '">'._('Create') . '/' . _('Edit Invoice Message Format').'</a></td></tr>'; +echo '</select><a href="' . $rootpath . '/EDIMessageFormat.php?MessageType=INVOIC&PartnerCode=' . $_SESSION['CustomerID'] . '">'._('Create') . '/' . _('Edit Invoice Message Format').'</a></td> + </tr>'; echo '<tr><td>'._('Enable Receiving of EDI Orders') . ':</td> <td><select tabindex=2 name="EDIOrders">'; @@ -121,7 +123,8 @@ echo '<option selected value=1>'._('Enabled') . '</option>'; } -echo '</select></td></tr>'; +echo '</select></td> + </tr>'; echo '<tr><td>'._('Customer EDI Reference') . ':</td> <td><input ' . (in_array('EDIReference',$Errors) ? 'class="inputerror"' : '' ) . @@ -152,7 +155,9 @@ <td><input tabindex=7 type="text" name="EDIServerPwd" size=20 maxlength=20 value="' . $myrow['ediserverpwd'] . '"></td></tr>'; } -echo '</table><br /><div class="centre"><input tabindex=8 type="submit" name="submit" value="' ._('Update EDI Configuration'). '"></div></form>'; +echo '</table> + <br /><div class="centre"><input tabindex=8 type="submit" name="submit" value="' ._('Update EDI Configuration'). '"></div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/CustLoginSetup.php =================================================================== --- trunk/CustLoginSetup.php 2011-06-17 09:16:37 UTC (rev 4597) +++ trunk/CustLoginSetup.php 2011-06-18 04:55:08 UTC (rev 4598) @@ -6,21 +6,10 @@ $title = _('Customer Login Configuration'); include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); +include ('includes/LanguagesArray.php'); -$ModuleList = array(_('Orders'), - _('Receivables'), - _('Payables'), - _('Purchasing'), - _('Inventory'), - _('Manufacturing'), - _('Contracts'), - _('General Ledger'), - _('Asset Manager'), - _('Petty Cash'), - _('Setup')); +echo '<a href="' . $rootpath . '/SelectCustomer.php">' . _('Back to Customers') . '</a><br />'; -echo '<a href="' . $rootpath . '/SelectCustomer.php">' . _('Back to Customers') . '</a><br>'; - $sql="SELECT name FROM debtorsmaster WHERE debtorno='".$_SESSION['CustomerID']."'"; @@ -33,37 +22,6 @@ '" alt="" />' . ' ' . _('Customer') . ' : ' . $_SESSION['CustomerID'] . ' - ' . $CustomerName. _(' has been selected') . '</p><br />'; -//Make an array of the security roles where only one role is active and is ID 1 - -//For the security role selection box, we will only show roles that have: -//- Only one entry in securitygroups AND the tokenid of this entry == 1 - -//First get all available security role ID's' -$query_roles = "SELECT secroleid FROM securityroles"; -$result_roles = DB_query($query_roles, $db); - -//Check for every security role if they have only one entry in securitygroups, if so check if the tokenid == 1, then store in selection box -//Then they can be put in the $SecurityRoles array for the selection box; -$SecurityRoles = array(); -while ($myroles = DB_fetch_array($result_roles)){ - - $sqltoken = "SELECT tokenid FROM securitygroups WHERE secroleid = '" . $myroles['secroleid'] ."'"; - $result = DB_query($sqltoken,$db); - $Number_roles = DB_num_rows($result); - $myrow=DB_fetch_array($result); - - if ($Number_roles == 1 && $myrow['tokenid']==1 ) { - - $sql = "SELECT secroleid, secrolename FROM securityroles WHERE secroleid = '" . $myroles['secroleid'] ."'"; - $Sec_Result = DB_query($sql, $db); - // Now load it into an aray using Key/Value pairs - while( $Sec_row = DB_fetch_row($Sec_Result) ) { - $SecurityRoles[$Sec_row[0]] = $Sec_row[1]; - } - DB_free_result($Sec_Result); - } -} - if (isset($_GET['SelectedUser'])){ $SelectedUser = $_GET['SelectedUser']; } elseif (isset($_POST['SelectedUser'])){ @@ -97,20 +55,13 @@ $InputError = 1; prnMsg(_('If you enter a Customer Code you must also enter a Branch Code valid for this Customer'),'error'); } - //comment out except for demo! Do not want anyone modifying demo user. - /* - elseif ($_POST['UserID'] == 'demo') { - prnMsg(_('The demonstration user called demo cannot be modified.'),'error'); - $InputError = 1; - } - */ - + if ((strlen($_POST['BranchCode'])>0) AND ($InputError !=1)) { // check that the entered branch is valid for the customer code - $sql = "SELECT custbranch.debtorno + $sql = "SELECT defaultlocation FROM custbranch - WHERE custbranch.debtorno='" . $_POST['Cust'] . "' - AND custbranch.branchcode='" . $_POST['BranchCode'] . "'"; + WHERE debtorno='" . $_POST['Cust'] . "' + AND branchcode='" . $_POST['BranchCode'] . "'"; $ErrMsg = _('The check on validity of the customer code and branch failed because'); $DbgMsg = _('The SQL that was used to check the customer code and branch was'); @@ -119,82 +70,65 @@ if (DB_num_rows($result)==0){ prnMsg(_('The entered Branch Code is not valid for the entered Customer Code'),'error'); $InputError = 1; - } + } else { + $myrow = DB_fetch_row($result); + $InventoryLocation = $myrow[0]; } - - /* Make a comma separated list of modules allowed ready to update the database*/ - $i=0; - $ModulesAllowed = ''; - while ($i < count($ModuleList)){ - $FormVbl = "Module_" . $i; - $ModulesAllowed .= $_POST[($FormVbl)] . ','; - $i++; - } - $_POST['ModulesAllowed']= $ModulesAllowed; - - + if (isset($SelectedUser) AND $InputError !=1) { -/*SelectedUser could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/ - - if (!isset($_POST['Cust']) OR $_POST['Cust']==NULL OR $_POST['Cust']==''){ - $_POST['Cust']=''; - $_POST['BranchCode']=''; - } - $UpdatePassword = ""; + $UpdatePassword = ''; if ($_POST['Password'] != ""){ $UpdatePassword = "password='" . CryptPass($_POST['Password']) . "',"; } $sql = "UPDATE www_users SET realname='" . $_POST['RealName'] . "', - customerid='" . $_POST['Cust'] ."', phone='" . $_POST['Phone'] ."', email='" . $_POST['Email'] ."', ".$UpdatePassword." branchcode='" . $_POST['BranchCode'] . "', pagesize='" . $_POST['PageSize'] . "', - fullaccess='" . $_POST['Access'] . "', theme='" . $_POST['Theme'] . "', language ='" . $_POST['UserLanguage'] . "', - defaultlocation='" . $_POST['DefaultLocation'] ."', - modulesallowed='" . $ModulesAllowed . "', + defaultlocation='" . $InventoryLocation ."', blocked='" . $_POST['Blocked'] . "' WHERE userid = '".$SelectedUser."'"; prnMsg( _('The selected user record has been updated'), 'success' ); - } elseif ($InputError !=1) { - - $sql = "INSERT INTO www_users (userid, - realname, - customerid, - branchcode, - password, - phone, - email, - pagesize, - lastvisitdate, - fullaccess, - defaultlocation, - modulesallowed, - displayrecordsmax, - theme, - language) - VALUES ('" . $_POST['UserID'] . "', - '" . $_POST['RealName'] ."', - '" . $_POST['Cust'] ."', - '" . $_POST['BranchCode'] ."', - '" . CryptPass($_POST['Password']) ."', - '" . $_POST['Phone'] . "', - '" . $_POST['Email'] ."', - '" . $_POST['PageSize'] ."', - '" . date('Y-m-d') ."', - '" . $_POST['Access'] . "', - '" . $_POST['DefaultLocation'] ."', - '" . $ModulesAllowed . "', - '" . $_SESSION['DefaultDisplayRecordsMax'] . "', - '" . $_POST['Theme'] . "', - '". $_POST['UserLanguage'] ."')"; - prnMsg( _('A new user record has been inserted'), 'success' ); + + + } else { //no selected user so it's an insert of new user + + $sql = "INSERT INTO www_users (userid, + realname, + customerid, + branchcode, + password, + phone, + email, + pagesize, + fullaccess, + defaultlocation, + modulesallowed, + displayrecordsmax, + theme, + language) + VALUES ('" . $_POST['UserID'] . "', + '" . $_POST['RealName'] ."', + '" . $_POST['Cust'] ."', + '" . $_POST['BranchCode'] ."', + '" . CryptPass($_POST['Password']) ."', + '" . $_POST['Phone'] . "', + '" . $_POST['Email'] ."', + '" . $_POST['PageSize'] ."', + '7', + '" . $InventoryLocation ."', + '1,1,0,0,0,0,0,0', + '" . $_SESSION['DefaultDisplayRecordsMax'] . "', + '" . $_POST['Theme'] . "', + '". $_POST['UserLanguage'] ."')"; + prnMsg( _('A new user record has been inserted'), 'success' ); + } } if ($InputError!=1){ @@ -211,24 +145,15 @@ unset($_POST['Email']); unset($_POST['Password']); unset($_POST['PageSize']); - unset($_POST['Access']); - unset($_POST['DefaultLocation']); - unset($_POST['ModulesAllowed']); - unset($_POST['Blocked']); unset($_POST['Theme']); unset($_POST['UserLanguage']); + unset($_POST['Blocked']); unset($SelectedUser); } } elseif (isset($_GET['delete'])) { //the link to delete a selected record was clicked instead of the submit button - // comment out except for demo! Do not want anyopne deleting demo user. - /* - if ($SelectedUser == 'demo') { - prnMsg(_('The demonstration user called demo cannot be deleted'),'error'); - } else { - */ $sql="SELECT userid FROM audittrail where userid='". $SelectedUser ."'"; $result=DB_query($sql, $db); if (DB_num_rows($result)!=0) { @@ -241,8 +166,6 @@ prnMsg(_('User Deleted'),'info'); } unset($SelectedUser); - // } - } if (!isset($SelectedUser)) { @@ -250,29 +173,25 @@ /* If its the first time the page has been displayed with no parameters then none of the above are true and the list of Users will be displayed with links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ $sql = "SELECT userid, - realname, - phone, - email, - customerid, - branchcode, - lastvisitdate, - fullaccess, - pagesize, - theme, - language - FROM www_users WHERE customerid = '" . $_SESSION['CustomerID'] . "'"; + realname, + phone, + email, + customerid, + branchcode, + lastvisitdate, + pagesize, + theme, + language + FROM www_users WHERE customerid = '" . $_SESSION['CustomerID'] . "'"; $result = DB_query($sql,$db); - - echo '<table class=selection>'; + echo '<table class="selection>"'; + echo '<tr><th>' . _('User Login') . '</th> <th>' . _('Full Name') . '</th> <th>' . _('Telephone') . '</th> <th>' . _('Email') . '</th> - <th>' . _('Customer Code') . '</th> - <th>' . _('Branch Code') . '</th> <th>' . _('Last Visit') . '</th> - <th>' . _('Security Role') .'</th> <th>' . _('Report Size') .'</th> <th>' . _('Theme') .'</th> <th>' . _('Language') .'</th> @@ -280,7 +199,7 @@ $k=0; //row colour counter - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; $k=0; @@ -289,10 +208,6 @@ $k=1; } - $LastVisitDate = ConvertSQLDate($myrow[6]); - - /*The SecurityHeadings array is defined in config.php */ - printf('<td>%s</td> <td>%s</td> <td>%s</td> @@ -301,35 +216,29 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> <td><a href="%s&SelectedUser=%s">' . _('Edit') . '</a></td> - <td><a href="%s&SelectedUser=%s&delete=1">' . _('Delete') . '</a></td> + <td><a href="%s&SelectedUser=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this user login?') . '\');">' . _('Delete') . '</a></td> </tr>', - $myrow[0], - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], - $myrow[5], + $myrow['userid'], + $myrow['realname'], + $myrow['phone'], + $myrow['email'], $LastVisitDate, - $SecurityRoles[($myrow[7])], - $myrow[8], - $myrow[9], - $myrow[10], + $myrow['pagesize'], + $myrow['theme'], + $LanguagesArray[$myrow['language']], $_SERVER['PHP_SELF'] . '?', - $myrow[0], + $myrow['userid'], $_SERVER['PHP_SELF'] . '?', - $myrow[0]); + $myrow['userid']); } //END WHILE LIST LOOP - echo '</table><br>'; -} //end of ifs and buts! + echo '</table><br />'; +} //end of if there is no selected user if (isset($SelectedUser)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] .'">' . _('Review Existing Users') . '</a></div><br>'; + echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] .'">' . _('Review Existing Users') . '</a></div><br />'; } echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -338,21 +247,17 @@ //editing an existing User $sql = "SELECT userid, - realname, - phone, - email, - customerid, - password, - branchcode, - pagesize, - fullaccess, - defaultlocation, - modulesallowed, - blocked, - theme, - language - FROM www_users - WHERE userid='" . $SelectedUser . "'"; + realname, + phone, + email, + customerid, + password, + branchcode, + pagesize, + theme, + language + FROM www_users + WHERE userid='" . $SelectedUser . "'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -361,39 +266,25 @@ $_POST['RealName'] = $myrow['realname']; $_POST['Phone'] = $myrow['phone']; $_POST['Email'] = $myrow['email']; - $_POST['Cust'] = $myrow['customerid']; - $_POST['BranchCode'] = $myrow['branchcode']; $_POST['PageSize'] = $myrow['pagesize']; - $_POST['Access'] = $myrow['fullaccess']; - $_POST['DefaultLocation'] = $myrow['defaultlocation']; - $_POST['ModulesAllowed'] = $myrow['modulesallowed']; $_POST['Theme'] = $myrow['theme']; $_POST['UserLanguage'] = $myrow['language']; - $_POST['Blocked'] = $myrow['blocked']; - + echo '<input type="hidden" name="SelectedUser" value="' . $SelectedUser . '">'; echo '<input type="hidden" name="UserID" value="' . $_POST['UserID'] . '">'; - echo '<input type="hidden" name="ModulesAllowed" value="' . $_POST['ModulesAllowed'] . '">'; - echo '<table class="selection"> <tr><td>' . _('User code') . ':</td><td>'; - echo $_POST['UserID'] . '</td></tr>'; + echo '<table class="selection"> + <tr> + <td>' . _('User code') . ':</td> + <td>' . $_POST['UserID'] . '</td> + </tr>'; } else { //end of if $SelectedUser only do the else when a new record is being entered - echo '<table class=selection><tr><td>' . _('User Login') . ':</td><td><input type="text" name="UserID" size=22 maxlength=20 /></td></tr>'; - - /*set the default modules to show to all - this had trapped a few people previously*/ - $i=0; - if (!isset($_POST['ModulesAllowed'])) { - $_POST['ModulesAllowed']=''; - } - foreach($ModuleList as $ModuleName){ - if ($i>0){ - $_POST['ModulesAllowed'] .=','; - } - $_POST['ModulesAllowed'] .= '1'; - $i++; - } + echo '<table class="selection"> + <tr> + <td>' . _('User Login') . ':</td> + <td><input type="text" name="UserID" size="22" maxlength="20" /></td> + </tr>'; } if (!isset($_POST['Password'])) { @@ -417,31 +308,9 @@ <td><input type="text" name="Phone" value="' . $_POST['Phone'] . '" size=32 maxlength=30></td></tr>'; echo '<tr><td>' . _('Email Address') .':</td> <td><input type="text" name="Email" value="' . $_POST['Email'] .'" size=32 maxlength=55></td></tr>'; -echo '<tr><td>' . _('Security Role') . ':</td><td><select name="Access">'; -foreach ($SecurityRoles as $SecKey => $SecVal) { - if (isset($_POST['Access']) and $SecKey == $_POST['Access']){ - echo '<option selected value="' . $SecKey . '">' . $SecVal .'</option>'; - } else { - echo '<option value="' . $SecKey . '">' . $SecVal .'</option>'; - } -} -echo '</select></td></tr>'; -echo '<input type="hidden" name="ID" value="'.$_SESSION['UserID'].'">'; -echo '<tr><td>' . _('Default Location') . ':</td> - <td><select name="DefaultLocation">'; +echo '<input type="hidden" name="Access" value="1">'; -$sql = "SELECT loccode, locationname FROM locations"; -$result = DB_query($sql,$db); -while ($myrow=DB_fetch_array($result)){ - if (isset($_POST['DefaultLocation']) and $myrow['loccode'] == $_POST['DefaultLocation']){ - echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] .'</option>'; - } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] .'</option>'; - } -} - - //Customer is fixed by selection of customer $_POST['Cust']=$_SESSION['CustomerID']; echo '<input type="hidden" name="Cust" value="' . $_POST['Cust'] . '">'; @@ -542,60 +411,31 @@ <td>' . _('Language') . ':</td> <td><select name="UserLanguage">'; -$Languages = scandir('locale/', 0); - - -foreach ($Languages as $LanguageEntry){ - - if (is_dir('locale/' . $LanguageEntry) - AND $LanguageEntry != '..' - AND $LanguageEntry != '.svn' - AND $LanguageEntry!='.'){ - - if (isset($_POST['UserLanguage']) and $_POST['UserLanguage'] == $LanguageEntry){ - echo '<option selected value="' . $LanguageEntry . '">' . $LanguageEntry .'</option>'; - } elseif (!isset($_POST['UserLanguage']) and $LanguageEntry == $DefaultLanguage) { - echo '<option selected value="' . $LanguageEntry . '">' . $LanguageEntry .'</option>'; - } else { - echo '<option value="' . $LanguageEntry . '">' . $LanguageEntry .'</option>'; - } +foreach ($LanguagesArray as $LanguageEntry => $LanguageName){ + if (isset($_POST['UserLanguage']) and $_POST['UserLanguage'] == $LanguageEntry){ + echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; + } elseif (!isset($_POST['UserLanguage']) and $LanguageEntry == $DefaultLanguage) { + echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; + } else { + echo '<option value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; } } + echo '</select></td></tr>'; - -/*Make an array out of the comma separated list of modules allowed*/ -$ModulesAllowed = explode(',',$_POST['ModulesAllowed']); - -$i=0; -foreach($ModuleList as $ModuleName){ - - echo '<tr><td>' . _('Display') . ' ' . $ModuleName . ' ' . _('options') . ': </td> - <td><select name="Module_' . $i . '">'; - if ($ModulesAllowed[$i]==0){ - echo '<option selected value=0>' . _('No') . '</option>'; - echo '<option value=1>' . _('Yes') . '</option>'; - } else { - echo '<option selected value=1>' . _('Yes') . '</option>'; - echo '<option value=0>' . _('No') . '</option>'; - } - echo '</select></td></tr>'; - $i++; -} - echo '<tr><td>' . _('Account Status') . ':</td> <td><select name="Blocked">'; if ($_POST['Blocked']==0){ - echo '<option selected value=0>' . _('Open') . '</option>'; - echo '<option value=1>' . _('Blocked') . '</option>'; + echo '<option selected value="0">' . _('Open') . '</option> + <option value="1">' . _('Blocked') . '</option>'; } else { - echo '<option selected value=1>' . _('Blocked') . '</option>'; - echo '<option value=0>' . _('Open') . '</option>'; + echo '<option value="0">' . _('Open') . '</option> + <option selected value="1">' . _('Blocked') . '</option>'; } echo '</select></td></tr>'; -echo '</table><br> +echo '</table><br /> <div class="centre"><input type="submit" name="submit" value="' . _('Enter Information') . '"></div> </form>'; Modified: trunk/CustomerTransInquiry.php =================================================================== --- trunk/CustomerTransInquiry.php 2011-06-17 09:16:37 UTC (rev 4597) +++ trunk/CustomerTransInquiry.php 2011-06-18 04:55:08 UTC (rev 4598) @@ -1,35 +1,38 @@ <?php -/* $Revision: 1.17 $ */ /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('Customer Transactions Inquiry'); include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . - _('Transaction Inquiry') . '" alt="" />' . ' ' . _('Transaction Inquiry') . '</p>'; -echo '<div class="page_help_text">' . _('Choose which type of transaction to report on.') . '</div><br>'; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Transaction Inquiry') . '" alt="" />' . ' ' . _('Transaction Inquiry') . '</p>'; +echo '<div class="page_help_text">' . _('Choose which type of transaction to report on.') . '</div> + <br />'; -echo "<form action='" . $_SERVER['PHP_SELF'] . "' method=post>"; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table cellpadding=2 class=selection><tr>'; -echo '<td>' . _('Type') . ":</td><td><select tabindex=1 name='TransType'> "; +echo '<td>' . _('Type') . ':</td> + <td><select tabindex="1" name="TransType"> '; -$sql = 'SELECT typeid, typename FROM systypes WHERE typeid >= 10 AND typeid <= 14'; +$sql = "SELECT typeid, + typename + FROM systypes + WHERE typeid >= 10 + AND typeid <= 14"; + $resultTypes = DB_query($sql,$db); -echo "<option Value='All'> All"; +echo '<option value="All">' . _('All') . '</option>'; while ($myrow=DB_fetch_array($resultTypes)){ if (isset($_POST['TransType'])){ if ($myrow['typeid'] == $_POST['TransType']){ - echo "<option selected Value='" . $myrow['typeid'] . "'>" . $myrow['typename']; + echo '<option selected value="' . $myrow['typeid'] . '">' . $myrow['typename'] . '</option>'; } else { - echo "<option Value='" . $myrow['typeid'] . "'>" . $myrow['typename']; + echo '<option value="' . $myrow['typeid'] . '">' . $myrow['typename'] . '</option>'; } } else { echo "<option Value='" . $myrow['typeid'] . "'>" . $myrow['typename']; @@ -46,7 +49,7 @@ echo '<td>' . _('From') . ':</td><td><input tabindex="2" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="TEXT" name="FromDate" maxlength="10" size="11" VALUE="' . $_POST['FromDate'] . '"></td>'; echo '<td>' . _('To') . ':</td><td><input tabindex="3" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="TEXT" name="ToDate" maxlength="10" size="11" VALUE="' . $_POST['ToDate'] . '"></td>'; -echo "</tr></table><br><div class='centre'><input tabindex=4 type=submit name='ShowResults' VALUE='" . _('Show Transactions') . "'>"; +echo "</tr></table><br /><div class='centre'><input tabindex=4 type=submit name='ShowResults' VALUE='" . _('Show Transactions') . "'>"; echo '</form></div>'; @@ -79,7 +82,7 @@ $DbgMsg = _('The SQL that failed was'); $TransResult = DB_query($sql, $db,$ErrMsg,$DbgMsg); - echo '<br><table cellpadding=2 class=selection>'; + echo '<br /><table cellpadding=2 class=selection>'; $tableheader = "<tr> <th>" . _('Type') . "</th> Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2011-06-17 09:16:37 UTC (rev 4597) +++ trunk/DeliveryDetails.php 2011-06-18 04:55:08 UTC (rev 4598) @@ -797,34 +797,34 @@ prnMsg($_SESSION['Items'.$identifier]->SpecialInstructions,'info'); } echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Delivery') . '" alt="" />' . ' ' . _('Delivery Details'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="" />' . ' ' . _('Customer Code') . ' :<b> ' . $_SESSION['Items'.$identifier]->DebtorNo; -echo '</b> ' . _('Customer Name') . ' :<b> ' . $_SESSION['Items'.$identifier]->CustomerName . '</p>'; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="" />' . ' ' . _('Customer Code') . ' :<b> ' . $_SESSION['Items'.$identifier]->DebtorNo . '<br />'; +echo '</b> ' . _('Customer Name') . ' :<b> ' . $_SESSION['Items'.$identifier]->CustomerName . '</b></p>'; + + echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /*Display the order with or without discount depending on access level*/ if (in_array(2,$_SESSION['AllowedPageSecurityTokens'])){ - - echo '<div class="centre"><b>'; - + + echo '<table cellpading=2 colspan=7>'; + if ($_SESSION['Items'.$identifier]->Quotation==1){ - echo _('Quotation Summary'); + echo '<tr><th colspan=7>'._('Quotation Summary').'</th></tr>'; } else { - echo _('Order Summary'); + echo '<tr><th colspan=7>'._('Order Summary').'</th></tr>'; } - echo '</b></div> - <table cellpading=2 colspan=7> - <Tr> - <th>'. _('Item Code') .'</th> - <th>'. _('Item Description') .'</th> - <th>'. _('Quantity') .'</th> - <th>'. _('Unit') .'</th> - <th>'. _('Price') .'</th> - <th>'. _('Discount') .' %</th> - <th>'. _('Total') .'</th> - </tr>'; + echo '<tr> + <th>'. _('Item Code') .'</th> + <th>'. _('Item Description') .'</th> + <th>'. _('Quantity') .'</th> + <th>'. _('Unit') .'</th> + <th>'. _('Price') .'</th> + <th>'. _('Discount') .' %</th> + <th>'. _('Total') .'</th> + </tr>'; $_SESSION['Items'.$identifier]->total = 0; $_SESSION['Items'.$identifier]->totalVolume = 0; @@ -834,8 +834,8 @@ foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) { $LineTotal = $StockItem->Quantity * $StockItem->Price * (1 - $StockItem->DiscountPercent); - $DisplayLineTotal = number_format($LineTotal,2); - $DisplayPrice = number_format($StockItem->Price,2); + $DisplayLineTotal = number_format($LineTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $DisplayPrice = number_format($StockItem->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); $DisplayQuantity = number_format($StockItem->Quantity,$StockItem->DecimalPlaces); $DisplayDiscount = number_format(($StockItem->DiscountPercent * 100),2); @@ -872,9 +872,9 @@ $DisplayWeight = number_format($_SESSION['Items'.$identifier]->totalWeight,2); echo '<br /><table><tr class="EvenTableRows"> <td>'. _('Total Weight') .':</td> - <td>'.$DisplayWeight.'</td> + <td class="number">'.$DisplayWeight.'</td> <td>'. _('Total Volume') .':</td> - <td>'.$DisplayVolume.'</td> + <td class="number">'.$DisplayVolume.'</td> </tr></table>'; } else { @@ -897,8 +897,8 @@ foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) { $LineTotal = $StockItem->Quantity * $StockItem->Price * (1 - $StockItem->DiscountPercent); - $DisplayLineTotal = number_format($LineTotal,2); - $DisplayPrice = number_format($StockItem->Price,2); + $DisplayLineTotal = number_format($LineTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $DisplayPrice = number_format($StockItem->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); $DisplayQuantity = number_format($StockItem->Quantity,$StockItem->DecimalPlaces); if ($k==1){ @@ -921,7 +921,7 @@ } - $DisplayTotal = number_format($_SESSION['Items'.$identifier]->total,2); + $DisplayTotal = number_format($_SESSION['Items'.$identifier]->total,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); echo '<table class=selection><tr> <td>'. _('Total Weight') .':</td> <td>'.$DisplayWeight .'</td> @@ -958,11 +958,11 @@ $StkLocsResult = DB_query("SELECT locationname,loccode FROM locations",$db, $ErrMsg, $DbgMsg); -while ($myrow=DB_fetch_row($StkLocsResult)){ - if ($_SESSION['Items'.$identifier]->Location==$myrow[1]){ - echo '<option selected value="' . $myrow[1] . '">' . $myrow[0] . '</option>'; +while ($myrow=DB_fetch_array($StkLocsResult)){ + if ($_SESSION['Items'.$identifier]->Location==$myrow['loccode']){ + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option value="'.$myrow[1].'">'.$myrow[0] . '</option>'; + echo '<option value="'.$myrow['loccode'].'">'.$myrow['locationname'] . '</option>'; } } @@ -982,32 +982,32 @@ // The estimated Dispatch date or Delivery date for this order echo '<tr> <td>'. _('Estimated Delivery Date') .':</td> - <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="Text" size=15 maxlength=14 name="DeliveryDate" value="' . $_SESSION['Items'.$identifier]->DeliveryDate . '"></td> + <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" size=15 maxlength=14 name="DeliveryDate" value="' . $_SESSION['Items'.$identifier]->DeliveryDate . '"></td> </tr>'; // The date when a quote was issued to the customer echo '<tr> <td>'. _('Quote Date') .':</td> - <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="Text" size=15 maxlength=14 name="QuoteDate" value="' . $_SESSION['Items'.$identifier]->QuoteDate . '"></td> + <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" size=15 maxlength=14 name="QuoteDate" value="' . $_SESSION['Items'.$identifier]->QuoteDate . '"></td> </tr>'; // The date when the customer confirmed their order echo '<tr> <td>'. _('Confirmed Order Date') .':</td> - <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="Text" size=15 maxlength=14 name="ConfirmedDate" value="' . $_SESSION['Items'.$identifier]->ConfirmedDate . '"></td> + <td><input class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" size=15 maxlength=14 name="ConfirmedDate" value="' . $_SESSION['Items'.$identifier]->ConfirmedDate . '"></td> </tr>'; ... [truncated message content] |