From: <dai...@us...> - 2012-12-12 09:03:59
|
Revision: 5757 http://sourceforge.net/p/web-erp/reponame/5757 Author: daintree Date: 2012-12-12 09:03:56 +0000 (Wed, 12 Dec 2012) Log Message: ----------- Changes to Customer and Supplier login. Rework GLTransInquiry.php Modified Paths: -------------- trunk/GLTransInquiry.php trunk/PO_PDFPurchOrder.php trunk/SelectOrderItems.php trunk/doc/Change.log trunk/doc/Manual/ManualAPIFunctions.php trunk/doc/Manual/ManualContents.php trunk/doc/Manual/ManualOutline.php trunk/includes/session.inc trunk/index.php Modified: trunk/GLTransInquiry.php =================================================================== --- trunk/GLTransInquiry.php 2012-12-12 01:55:53 UTC (rev 5756) +++ trunk/GLTransInquiry.php 2012-12-12 09:03:56 UTC (rev 5757) @@ -67,11 +67,15 @@ $TransResult = DB_query($SQL,$db); $Posted = _('Yes'); - $CreditTotal = $DebitTotal = 0; + $CreditTotal = 0; + $DebitTotal = 0; $j=1; while ( $TransRow = DB_fetch_array($TransResult) ) { $TranDate = ConvertSQLDate($TransRow['trandate']); $DetailResult = false; + + $AccountName = $TransRow['accountname']; + $URL = $rootpath . '/GLAccountInquiry.php?Account=' . $TransRow['account']; if ( $TransRow['amount'] > 0) { $DebitAmount = locale_number_format($TransRow['amount'],$_SESSION['CompanyRecord']['decimalplaces']); @@ -86,96 +90,54 @@ $Posted = _('No'); } if ( $TransRow['account'] == $_SESSION['CompanyRecord']['debtorsact'] ) { - $URL = $rootpath . '/CustomerInquiry.php?CustomerID='; - $date = '&TransAfterDate=' . $TranDate; - - $DetailSQL = "SELECT debtortrans.debtorno, - debtortrans.ovamount, - debtortrans.ovgst, - debtortrans.ovfreight, - debtortrans.rate, - debtorsmaster.name - FROM debtortrans INNER JOIN debtorsmaster - ON debtortrans.debtorno = debtorsmaster.debtorno - WHERE debtortrans.type = '" . $TransRow['type'] . "' - AND debtortrans.transno = '" . $_GET['TransNo']. "'"; - $DetailResult = DB_query($DetailSQL,$db); + $DetailSQL = "SELECT debtortrans.debtorno, + debtorsmaster.name + FROM debtortrans INNER JOIN debtorsmaster + ON debtortrans.debtorno = debtorsmaster.debtorno + WHERE debtortrans.type = '" . $TransRow['type'] . "' + AND debtortrans.transno = '" . $_GET['TransNo']. "'"; + $DetailResult = DB_query($DetailSQL,$db); } elseif ( $TransRow['account'] == $_SESSION['CompanyRecord']['creditorsact'] ) { - $URL = $rootpath . '/SupplierInquiry.php?SupplierID='; - $date = '&FromDate=' . $TranDate; - - $DetailSQL = "SELECT supptrans.supplierno, - supptrans.ovamount, - supptrans.ovgst, - supptrans.rate, - suppliers.suppname - FROM supptrans INNER JOIN suppliers - ON supptrans.supplierno = suppliers.supplierid - WHERE supptrans.type = '" . $TransRow['type'] . "' - AND supptrans.transno = '" . $_GET['TransNo'] . "'"; - $DetailResult = DB_query($DetailSQL,$db); - } else { - $URL = $rootpath . '/GLAccountInquiry.php?Account=' . $TransRow['account']; - - if( mb_strlen($TransRow['narrative'])==0 ) { - $TransRow['narrative'] = ' '; - } - - if ($j==1) { - echo '<tr class="OddTableRows">'; - $j=0; - } else { - echo '<tr class="EvenTableRows">'; - $j++; - } - echo '<td>' . $TranDate . '</td> - <td>' . MonthAndYearFromSQLDate($TransRow['lastdate_in_period']) . '</td> - <td><a href="' . $URL . '">' . $TransRow['accountname'] . '</a></td> - <td class="number">' . $DebitAmount . '</td> - <td class="number">' . $CreditAmount . '</td> - <td>' . $TransRow['narrative'] . '</td> - <td>' . $Posted . '</td> - </tr>'; + $DetailSQL = "SELECT supptrans.supplierno, + suppliers.suppname + FROM supptrans INNER JOIN suppliers + ON supptrans.supplierno = suppliers.supplierid + WHERE supptrans.type = '" . $TransRow['type'] . "' + AND supptrans.transno = '" . $_GET['TransNo'] . "'"; + $DetailResult = DB_query($DetailSQL,$db); } - if ($DetailResult) { - while ( $DetailRow = DB_fetch_row($DetailResult) ) { - if ( $TransRow['amount'] > 0){ - if ($TransRow['account'] == $_SESSION['CompanyRecord']['debtorsact']) { - $Debit = locale_number_format(($DetailRow[1] + $DetailRow[2]+ $DetailRow[3]) / $DetailRow[4],$_SESSION['CompanyRecord']['decimalplaces']); - $Credit = ' '; - } else { - $Debit = locale_number_format((-$DetailRow[1] - $DetailRow[2]) / $DetailRow[3],$_SESSION['CompanyRecord']['decimalplaces']); - $Credit = ' '; - } - } else { - if ($TransRow['account'] == $_SESSION['CompanyRecord']['debtorsact']) { - $Credit = locale_number_format(-($DetailRow[1] + $DetailRow[2] + $DetailRow[3]) / $DetailRow[4],$_SESSION['CompanyRecord']['decimalplaces']); - $Debit = ' '; - } else { - $Credit = locale_number_format(($DetailRow[1] + $DetailRow[2]) / $DetailRow[3],$_SESSION['CompanyRecord']['decimalplaces']); - $Debit = ' '; - } - } - - if ($j==1) { - echo '<tr class="OddTableRows">'; - $j=0; - } else { - echo '<tr class="EvenTableRows">'; - $j++; - } - echo '<td>' . $TranDate . '</td> - <td>' . MonthAndYearFromSQLDate($TransRow['lastdate_in_period']) . '</td> - <td><a href="' . $URL . $DetailRow[0] . $date . '">' . $TransRow['accountname'] . ' - ' . $DetailRow[5] . '</a></td> - <td class="number">' . $Debit . '</td> - <td class="number">' . $Credit . '</td> - <td>' . $TransRow['narrative'] . '</td> - <td>' . $Posted . '</td> - </tr>'; + $DetailRow = DB_fetch_array($DetailResult);// there can be only one + if ($TransRow['account'] == $_SESSION['CompanyRecord']['debtorsact']) { + $URL = $rootpath . '/CustomerInquiry.php?CustomerID=' . $DetailRow['debtorno'] . '&TransAfterDate=' . $TranDate; + $AccountName .= ' ' . $DetailRow['name']; + } else { //its a supplier trans + $URL = $rootpath . '/SupplierInquiry.php?SupplierID=' . $DetailRow['supplierno'] . '&FromDate=' . $TranDate; + $AccountName .= ' ' . $DetailRow['suppname']; } DB_free_result($DetailResult); } + + + if( mb_strlen($TransRow['narrative'])==0 ) { + $TransRow['narrative'] = ' '; + } + + if ($j==1) { + echo '<tr class="OddTableRows">'; + $j=0; + } else { + echo '<tr class="EvenTableRows">'; + $j++; + } + echo '<td>' . $TranDate . '</td> + <td>' . MonthAndYearFromSQLDate($TransRow['lastdate_in_period']) . '</td> + <td><a href="' . $URL . '">' . $AccountName . '</a></td> + <td class="number">' . $DebitAmount . '</td> + <td class="number">' . $CreditAmount . '</td> + <td>' . $TransRow['narrative'] . '</td> + <td>' . $Posted . '</td> + </tr>'; } DB_free_result($TransResult); Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2012-12-12 01:55:53 UTC (rev 5756) +++ trunk/PO_PDFPurchOrder.php 2012-12-12 09:03:56 UTC (rev 5757) @@ -298,7 +298,7 @@ include('includes/PO_PDFOrderPageHeader.inc'); } //end if need a new page headed up if ($_POST['ShowAmounts'] == 'Yes') { - $DisplayOrderTotal = locale_number_format($OrdendrTotal, $POHeader['currdecimalplaces']); + $DisplayOrderTotal = locale_number_format($OrderTotal, $POHeader['currdecimalplaces']); } else { $DisplayOrderTotal = '----'; } Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2012-12-12 01:55:53 UTC (rev 5756) +++ trunk/SelectOrderItems.php 2012-12-12 09:03:56 UTC (rev 5757) @@ -55,7 +55,7 @@ $_SESSION['ExistingOrder' .$identifier]=0; $_SESSION['Items'.$identifier] = new cart; - if (count($_SESSION['AllowedPageSecurityTokens'])==1){ //its a customer logon + if ($CustomerLogin==1){ //its a customer logon $_SESSION['Items'.$identifier]->DebtorNo=$_SESSION['CustomerID']; $_SESSION['RequireCustomerSelection']=0; } else { Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-12-12 01:55:53 UTC (rev 5756) +++ trunk/doc/Change.log 2012-12-12 09:03:56 UTC (rev 5757) @@ -1,5 +1,8 @@ webERP Change Log +12/12/12 Phil/RockStar: SelectOrderitems.php would not recognise Customer only logins correctly as there are two tokens in a Customer login role. and was testing to see if just one token! +11/12/12 Phil: Made CustomerLogin and SupplierLogin more intuitive - still rely on hard coded Security Tokens though. +11/12/12 Phil: Reworked GLTransInquiry.php produced incorrect journals 10/12/12 Phil: Remove hard coding of security tokens in favour of new OrderEntryDiscountPricing dummy script 8/12/12 Phil: Check user has authority to receive goods before allowing auto receiving 7/12/12 Phil: SupplierInvoice.php add link to pay invoice after invoice input Modified: trunk/doc/Manual/ManualAPIFunctions.php =================================================================== --- trunk/doc/Manual/ManualAPIFunctions.php 2012-12-12 01:55:53 UTC (rev 5756) +++ trunk/doc/Manual/ManualAPIFunctions.php 2012-12-12 09:03:56 UTC (rev 5757) @@ -14,7 +14,7 @@ echo '<link REL="shortcut icon" HREF="'. $rootpath.'/favicon.ico">'; echo '<link REL="icon" HREF="' . $rootpath.'/favicon.ico">'; echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'; -echo '<link href="'.$rootpath. '/../../css/'. $_SESSION['Theme'] .'/default.css" REL="stylesheet" TYPE="text/css">'; +//echo '<link href="'.$rootpath. '/../../css/'. $_SESSION['Theme'] .'/default.css" REL="stylesheet" type="text/css">'; echo '</head>'; echo '<body>'; Modified: trunk/doc/Manual/ManualContents.php =================================================================== --- trunk/doc/Manual/ManualContents.php 2012-12-12 01:55:53 UTC (rev 5756) +++ trunk/doc/Manual/ManualContents.php 2012-12-12 09:03:56 UTC (rev 5757) @@ -67,18 +67,21 @@ } echo '</form>'."\n"; -if (!isset($_GET['ViewTopic'])) -{ +if (!isset($_GET['ViewTopic'])){ $_GET['ViewTopic'] = ''; } foreach ($TOC_Array['TableOfContents'] as $Name=>$FullName){ $PostName = 'Select' . $Name; - if (($_GET['ViewTopic'] == $Name) OR (isset($_POST[$PostName]))) - { - $ManualPage = 'Manual'.$Name.'.html'; - if (file_exists($ManualPage)) - { + if (($_GET['ViewTopic'] == $Name) OR (isset($_POST[$PostName]))){ + + if ($Name=='APIFunctions') { + $ManualPage = 'Manual' . $Name . '.php'; + } else { + $ManualPage = 'Manual' . $Name . '.html'; + } + + if (file_exists($ManualPage)) { include($ManualPage); } } Modified: trunk/doc/Manual/ManualOutline.php =================================================================== --- trunk/doc/Manual/ManualOutline.php 2012-12-12 01:55:53 UTC (rev 5756) +++ trunk/doc/Manual/ManualOutline.php 2012-12-12 09:03:56 UTC (rev 5757) @@ -6,13 +6,11 @@ $TOC_Array = array ( 'TableOfContents' => array( 'Introduction' => array('Introduction', - 'Why another accounting program?' - ), + 'Why another accounting program?'), 'Requirements' => array('Requirements', 'Hardware requirements', 'Software requirements', - 'Using webERP with a Wiki' - ), + 'Using webERP with a Wiki'), 'GettingStarted' => array('Getting started', 'Prerequisites', 'Copying the PHP Scripts', @@ -20,10 +18,8 @@ 'Editing config.php', 'Logging in for the first time', 'Themes and GUI modification', - 'Setting up users' - ), - 'SecuritySchema' => array('Security schema' - ), + 'Setting up users'), + 'SecuritySchema' => array('Security schema'), 'CreatingNewSystem' => array('Creating a new system', 'Running the Demonstration database', 'Setting up a system', @@ -36,8 +32,7 @@ 'Finally'), 'SystemConventions' => array('System Conventions', 'Navigating the menu', - 'Reporting' - ), + 'Reporting'), 'Inventory' => array('Inventory (aka "Stock")', 'Overview', 'Inventory system features', @@ -87,8 +82,7 @@ 'Inventory usage inquiries', 'Inventory valuation report', 'Inventory planning report', - 'Inventory checks' - ), + 'Inventory checks'), 'AccountsReceivable'=> array('Accounts Receivable', 'Overview', 'Features', @@ -118,8 +112,7 @@ 'Default freight company', 'Postal address 1,2,3 and 4', 'Amending customer details', - 'Shippers', - ), + 'Shippers'), 'AccountsPayable' => array('Accounts Payable', 'Overview', 'Features', @@ -132,49 +125,41 @@ 'Bank particulars/reference', 'Bank account number', 'Currency', - 'Remittance advice', - ), + 'Remittance advice'), 'SalesPeople' => array('Sales People', 'Salesperson records', 'Salesperson code', 'Salesperson name, telephone and fax numbers', - 'Salesperson commission rates and breakpoint' - ), + 'Salesperson commission rates and breakpoint'), 'Currencies' => array('Currencies', 'Currency abbreviation', 'Currency name', 'Country of currency', 'Hunredths name', - 'Exchange rates', - ), + 'Exchange rates'), 'SalesTypes' => array('Sales types/price lists', 'Sales type code', - 'Sales type description' - ), + 'Sales type description'), 'PaymentTerms' => array('Payment terms', 'Payment terms code', 'Payment terms description', - 'days before due/day in following month when due' - ), + 'days before due/day in following month when due'), 'CreditStatus' => array('Credit status', 'Credit status ratings', 'Status code', 'Status description', - 'Disallow invoices' - ), + 'Disallow invoices'), 'Tax' => array('Tax', 'Tax calculations', 'Overview', 'Setting up taxes', 'Sales only within one Tax Authority example - 2 Tax levels:', 'Sales only within one Tax Authority example - 3 Tax Levels:', - 'Sales within two Tax Authorities example - 3 tax levels:', - ), + 'Sales within two Tax Authorities example - 3 tax levels:'), 'Prices' => array('Prices and Discounts', 'Pricing overview', 'Maintaining prices', - 'Discount matrix' - ), + 'Discount matrix'), 'ARTransactions' => array('Accounts Receivable Transactions', 'Invoicing an order', 'Selecting an order to invoice', @@ -191,25 +176,21 @@ 'Differences on exchange', 'Receipts processing', 'Deposits listing', - 'Allocate credits to a customer\'s account', - ), + 'Allocate credits to a customer\'s account',), 'ARInquiries' => array('Accounts receivable inquiries', 'Customer inquiries', 'Customer account inquiries', - 'Transaction detail inquiries' - ), + 'Transaction detail inquiries'), 'ARReports' => array('Accounts receivable reports', 'Customers - reporting', 'Aged customer balance listing', 'Customer statements', 'Customer transaction listing options', - 'Printing invoices or credit notes' - ), + 'Printing invoices or credit notes'), 'SalesAnalysis' => array('Sales analysis', 'Sales analysis report headers', 'Sales analysis report columns', - 'Automating sales reports' - ), + 'Automating sales reports'), 'SalesOrders' => array('Sales orders', 'Sales order functionality', 'Entry of sales orders', @@ -220,35 +201,30 @@ 'Quotations', 'Recurring orders', 'Counter sales - entering sales directly', - 'Managing discounts by product group and customer group (Matrix)', - ), + 'Managing discounts by product group and customer group (Matrix)'), 'PurchaseOrdering' => array('Purchase ordering', 'Overview', 'Purchase orders', 'Adding a new purchase order', 'Authorising purchase orders', - 'Receiving purchase orders' - ), + 'Receiving purchase orders'), 'Shipments' => array('Shipments', 'Shipment general ledger posting', 'Creating shipments', 'Shipment costings', - 'Closing a shipment' - ), + 'Closing a shipment'), 'Contracts' => array('Contract Costing', 'Contract costing overview', 'Creating a new contract', 'Selecting a contract', - 'Charging against contracts' - ), + 'Charging against contracts'), 'Manufacturing' => array('Manufacturing', 'Manufacturing overview', 'General ledger implications', 'Work order entry', 'Work order receipts', 'Work order issues', - 'Closing work orders' - ), + 'Closing work orders'), 'MRP' => array('Material requirements planning', 'MRP Overview', 'Base data required', @@ -256,8 +232,7 @@ 'Master (Production) Schedule', 'Running the MRP calculation', 'How it works', - 'MRP Reports' - ), + 'MRP Reports'), 'GeneralLedger' => array('General Ledger', 'General ledger overview', 'Account groups', @@ -268,15 +243,13 @@ 'Stock journals', 'EDI', 'EDI setup', - 'Sending EDI Invoices' - ), + 'Sending EDI Invoices'), 'FixedAssets' => array('Fixed assets', 'Fixed assets overview', 'Creating a fixed asset', 'Selecting fixed assets', 'Depreciation run', - 'Fixed asset schedule' - ), + 'Fixed asset schedule'), 'ReportBuilder' => array('SQL Report Writer', 'Report writer introduction', 'Reports administration', @@ -287,28 +260,22 @@ 'Creating a new report - Specifying database tables and links', 'Creating a new report - specifying fields to retrieve', 'Creating a new report - entering and arranging criteria', - 'Viewing reports' - - ), + 'Viewing reports'), 'PettyCash' => array('Petty cash management system', 'Overview', - 'Setup general parameters' - ), + 'Setup general parameters'), 'Multilanguage' => array('Multilanguage', 'Introduction to multilanguage', 'Rebuild the system default language file', 'Add a new language to the system', 'Edit a language file header', - 'Edit a language file module', - - ), + 'Edit a language file module'), 'SpecialUtilities' => array('Special utilities', 'Reapply standard costs to sales analysis', 'Change a customer code', 'Change an inventory code', 'Make stock locations', - 'Repost general ledger from period', - ), + 'Repost general ledger from period'), 'NewScripts' => array('Development - Foundations', 'Directory structure', 'session.inc', @@ -318,10 +285,9 @@ 'PDFStarter.php', 'Database abstraction - ConnectDB.inc', 'DateFunctions.inc', - 'SQL_CommonFunctions.inc' - ), - 'APITutorial' => array('API Tutorial' - ), + 'SQL_CommonFunctions.inc'), + 'APITutorial' => array('API Tutorial'), + 'APIFunctions' => array('API Function reference'), 'DevelopmentStructure' => array('Development Structure', 'Sales orders', 'Pricing', @@ -336,10 +302,8 @@ 'Inventory', 'Stock inquiries', 'Accounts payable', - 'Supplier payments' - ), - 'Contributors' => array('Contributors - Acknowledgements' - ), + 'Supplier payments'), + 'Contributors' => array('Contributors - Acknowledgements') ) ); Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2012-12-12 01:55:53 UTC (rev 5756) +++ trunk/includes/session.inc 2012-12-12 09:03:56 UTC (rev 5757) @@ -301,13 +301,15 @@ } } -if (in_array(9,$_SESSION['AllowedPageSecurityTokens']) and $PageSecurity==0 and count($_SESSION['AllowedPageSecurityTokens'])==2){ +//$PageSecurity = 9 hard coded for supplier access Supplier access must have just 9 and 0 tokens +if (in_array(9,$_SESSION['AllowedPageSecurityTokens']) AND $PageSecurity==0 AND count($_SESSION['AllowedPageSecurityTokens'])==2){ $SupplierLogin=1; -} else if (in_array(1,$_SESSION['AllowedPageSecurityTokens']) and $PageSecurity==0 and count($_SESSION['AllowedPageSecurityTokens'])==2){ - $SupplierLogin=0; } +if (in_array(1,$_SESSION['AllowedPageSecurityTokens']) AND $PageSecurity==0 AND count($_SESSION['AllowedPageSecurityTokens'])==2){ + $CustomerLogin = 1; +} -if (in_array(15, $_SESSION['AllowedPageSecurityTokens'])) { /*System administrator login */ +if (in_array($_SESSION['PageSecurityArray']['WWW_Users.php'], $_SESSION['AllowedPageSecurityTokens'])) { /*System administrator login */ $debug = 1; //allow debug messages } else { $debug = 0; //don't allow debug messages Modified: trunk/index.php =================================================================== --- trunk/index.php 2012-12-12 01:55:53 UTC (rev 5756) +++ trunk/index.php 2012-12-12 09:03:56 UTC (rev 5757) @@ -29,7 +29,7 @@ </table>'; include('includes/footer.inc'); exit; -} elseif (isset($SupplierLogin) AND $SupplierLogin==0){ +} elseif (isset($CustomerLogin) AND $CustomerLogin==1){ echo '<table class="table_index"> <tr> <td class="menu_group_item"> |