This list is closed, nobody may subscribe to it.
2011 |
Jan
(14) |
Feb
(42) |
Mar
(56) |
Apr
(60) |
May
(54) |
Jun
(48) |
Jul
(74) |
Aug
(52) |
Sep
(68) |
Oct
(64) |
Nov
(42) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(142) |
Feb
(270) |
Mar
(374) |
Apr
(230) |
May
(214) |
Jun
(116) |
Jul
(234) |
Aug
(66) |
Sep
(120) |
Oct
(16) |
Nov
(17) |
Dec
(41) |
2013 |
Jan
(19) |
Feb
(18) |
Mar
(8) |
Apr
(40) |
May
(121) |
Jun
(42) |
Jul
(127) |
Aug
(145) |
Sep
(27) |
Oct
(38) |
Nov
(83) |
Dec
(61) |
2014 |
Jan
(33) |
Feb
(35) |
Mar
(59) |
Apr
(41) |
May
(38) |
Jun
(45) |
Jul
(17) |
Aug
(58) |
Sep
(46) |
Oct
(51) |
Nov
(55) |
Dec
(36) |
2015 |
Jan
(57) |
Feb
(67) |
Mar
(70) |
Apr
(34) |
May
(32) |
Jun
(11) |
Jul
(3) |
Aug
(17) |
Sep
(16) |
Oct
(13) |
Nov
(30) |
Dec
(30) |
2016 |
Jan
(17) |
Feb
(12) |
Mar
(17) |
Apr
(20) |
May
(47) |
Jun
(15) |
Jul
(13) |
Aug
(30) |
Sep
(32) |
Oct
(20) |
Nov
(32) |
Dec
(24) |
2017 |
Jan
(16) |
Feb
|
Mar
(11) |
Apr
(11) |
May
(5) |
Jun
(42) |
Jul
(9) |
Aug
(10) |
Sep
(14) |
Oct
(15) |
Nov
(2) |
Dec
(29) |
2018 |
Jan
(28) |
Feb
(49) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <tu...@us...> - 2018-01-27 22:59:21
|
Revision: 7926 http://sourceforge.net/p/web-erp/reponame/7926 Author: turbopt Date: 2018-01-27 22:59:18 +0000 (Sat, 27 Jan 2018) Log Message: ----------- Paul Becker (PaulT commit): Remove stray ; appearing after if, else, and foreach blocks. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8064) Modified Paths: -------------- trunk/CustItem.php trunk/Factors.php trunk/MRPPlannedPurchaseOrders.php trunk/MRPPlannedWorkOrders.php trunk/PcClaimExpensesFromTab.php trunk/PurchData.php trunk/SupplierPriceList.php trunk/SystemParameters.php trunk/doc/Change.log trunk/includes/MiscFunctions.php trunk/includes/class.pdf.php trunk/javascripts/MiscFunctions.js Modified: trunk/CustItem.php =================================================================== --- trunk/CustItem.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/CustItem.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -229,7 +229,7 @@ </form>'; include ('includes/footer.php'); exit; - }; + } } if ($Edit == true) { Modified: trunk/Factors.php =================================================================== --- trunk/Factors.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/Factors.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -20,7 +20,7 @@ if (isset($_POST['Create'])) { $FactorID = 0; $_POST['New'] = 'Yes'; -}; +} echo '<div class="centre"><p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/supplier.png" title="' . _('Factor Companies') . '" alt="" />' . ' ' .$Title . '</p></div>'; Modified: trunk/MRPPlannedPurchaseOrders.php =================================================================== --- trunk/MRPPlannedPurchaseOrders.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/MRPPlannedPurchaseOrders.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -333,7 +333,7 @@ $displayconsolidation = _('Weekly'); } else { $displayconsolidation = _('Monthly'); - }; + } $pdf->addTextWrap($Left_Margin,$YPos,65,$FontSize,_('Consolidation').':'); $pdf->addTextWrap(110,$YPos,40,$FontSize,$displayconsolidation); Modified: trunk/MRPPlannedWorkOrders.php =================================================================== --- trunk/MRPPlannedWorkOrders.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/MRPPlannedWorkOrders.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -376,7 +376,7 @@ $displayconsolidation = _('Weekly'); } else { $displayconsolidation = _('Monthly'); - }; + } $pdf->addTextWrap($Left_Margin,$YPos,65,$FontSize,_('Consolidation').':'); $pdf->addTextWrap(110,$YPos,40,$FontSize,$displayconsolidation); Modified: trunk/PcClaimExpensesFromTab.php =================================================================== --- trunk/PcClaimExpensesFromTab.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/PcClaimExpensesFromTab.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -127,7 +127,7 @@ $UploadTheFile ='No'; } if ($UploadTheFile == 'Yes') { //Passed all the above validation - if (!file_exists($ReceiptFileDir)) { //Create the receipts directory if it doesn't already exist + if (!file_exists($ReceiptFileDir)) { //Create the receipts directory if it doesn't already exist mkdir($ReceiptFileDir, 0775, true); } $ReceiptFileExt = pathinfo($UploadOriginalName, PATHINFO_EXTENSION); //Grab the file extension of the uploaded file @@ -134,12 +134,12 @@ $ReceiptFileName = $SelectedIndex . '.' . $ReceiptFileExt; //Rename the uploaded file with the expenses index number $ReceiptFilePath = $ReceiptFileDir . '/' . $ReceiptFileName; $ReceiptExistingFiles = glob($ReceiptFileDir . '/' . $SelectedIndex . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE); //Find all existing receipt files for the expense, in case more than 1 file type is currently in the receipts directory - foreach($ReceiptExistingFiles as $ReceiptExistingFile) { // Overwrite existing files, and delete all other file types. + foreach($ReceiptExistingFiles as $ReceiptExistingFile) { // Overwrite existing files, and delete all other file types. unlink($ReceiptExistingFile); - }; + } move_uploaded_file($UploadTempName, $ReceiptFilePath); //Move the uploaded file from the temp directory to the receipts directory. } - } + } prnMsg($Msg, 'success'); } elseif ($InputError != 1) { // First check the type is not being duplicated @@ -232,7 +232,7 @@ $UploadTheFile ='No'; } if ($UploadTheFile == 'Yes') { //Passed all the above validation - if (!file_exists($ReceiptFileDir)) { //Create the receipts directory if it doesn't already exist + if (!file_exists($ReceiptFileDir)) { //Create the receipts directory if it doesn't already exist mkdir($ReceiptFileDir, 0775, true); } $ReceiptFileExt = pathinfo($UploadOriginalName, PATHINFO_EXTENSION); //Grab the file extension of the uploaded file @@ -239,12 +239,12 @@ $ReceiptFileName = $SelectedIndex . '.' . $ReceiptFileExt; //Rename the uploaded file with the expenses index number $ReceiptFilePath = $ReceiptFileDir . '/' . $ReceiptFileName; $ReceiptExistingFiles = glob($ReceiptFileDir . '/' . $SelectedIndex . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE); //Find all existing receipt files for the expense, in case more than 1 file type is currently in the receipts directory - foreach($ReceiptExistingFiles as $ReceiptExistingFile) { // Overwrite existing files, and delete all other file types. + foreach($ReceiptExistingFiles as $ReceiptExistingFile) { // Overwrite existing files, and delete all other file types. unlink($ReceiptExistingFile); - }; + } move_uploaded_file($UploadTempName, $ReceiptFilePath); //Move the uploaded file from the temp directory to the receipts directory. } - } + } prnMsg($Msg, 'success'); } if ($InputError != 1) { @@ -268,7 +268,7 @@ $ReceiptExistingFiles = glob($ReceiptFileDir . '/' . $SelectedIndex . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE); //Find all existing receipt files for the expense, in case more than 1 file type is currently in the receipts directory foreach($ReceiptExistingFiles as $ReceiptExistingFile) { unlink($ReceiptExistingFile); - }; + } unset($_GET['delete']); } //end of get delete if (!isset($SelectedTabs)) { @@ -333,7 +333,7 @@ <td>' . $SelectedTabs . '</td> </tr>'; echo '</table>'; - + //Limit expenses history to X days echo '<table class="selection"> <tr> @@ -392,19 +392,19 @@ WHERE codeexpense='" . $MyRow['codeexpense'] . "'"; $ResultDes = DB_query($SQLDes); $Description = DB_fetch_array($ResultDes); - + if (!isset($Description[0])) { $ExpenseCodeDes = 'ASSIGNCASH'; } else { $ExpenseCodeDes = $MyRow['codeexpense'] . ' - ' . $Description[0]; } - + if ($MyRow['authorized'] == '0000-00-00') { $AuthorisedDate = _('Unauthorised'); } else { $AuthorisedDate = ConvertSQLDate($MyRow['authorized']); } - + //Generate download link for expense receipt, or show text if no receipt file is found. $ReceiptFilePathMatched = reset(glob($ReceiptFileDir . '/' . $MyRow['counterindex'] . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE)); //Find the relevant receipt file for the expense. There should only be one (file type), but limit to one result just in case. if (!empty($ReceiptFilePathMatched)) { //If no receipt file for the expenses is found @@ -414,7 +414,7 @@ } else { $ReceiptText = _('No attachment'); } - + $TagSQL = "SELECT tagdescription FROM tags WHERE tagref='" . $MyRow['tag'] . "'"; $TagResult = DB_query($TagSQL); $TagRow = DB_fetch_array($TagResult); @@ -427,7 +427,7 @@ } else { $TagDescription = $TagTo . ' - ' . $TagRow['tagdescription']; } - + $TaxesDescription = ''; $TaxesTaxAmount = ''; $TaxSQL = "SELECT counterindex, @@ -630,7 +630,7 @@ ++$i; } } - + //Select the tag echo '<tr> <td>', _('Tag'), ':</td> @@ -655,7 +655,7 @@ </td> </tr>'; // End select tag - + //For the accept attribute of the file element, prefix dots to the front of each supported file extension. $ReceiptSupportedExtDotPrefix = array_map(function($ReceiptSupportedExt) { return '.' . $ReceiptSupportedExt; @@ -667,7 +667,7 @@ <input type="file" name="Receipt" id="Receipt" accept="' . implode(',', $ReceiptSupportedExtDotPrefix) . '" title="', _('Accepted file types'), ': ', implode(', ', $ReceiptSupportedExt), '" /> </td> </tr>'; - + if (!isset($_POST['Notes'])) { $_POST['Notes'] = ''; } @@ -677,7 +677,7 @@ <input type="text" name="Notes" size="50" maxlength="49" value="', $_POST['Notes'], '" /> </td> </tr>'; - + echo '</table>'; // close main table echo '<input type="hidden" name="SelectedTabs" value="', $SelectedTabs, '" />'; echo '<input type="hidden" name="Days" value="', $Days, '" />'; Modified: trunk/PurchData.php =================================================================== --- trunk/PurchData.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/PurchData.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -392,7 +392,7 @@ </form>'; include ('includes/footer.php'); exit; - }; + } } if ($Edit == true) { Modified: trunk/SupplierPriceList.php =================================================================== --- trunk/SupplierPriceList.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/SupplierPriceList.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -419,7 +419,7 @@ echo '</form>'; include ('includes/footer.php'); exit; - }; + } } if(isset($_POST['SearchSupplier'])) { Modified: trunk/SystemParameters.php =================================================================== --- trunk/SystemParameters.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/SystemParameters.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -1243,7 +1243,7 @@ } elseif ($_SESSION['QualityLogSamples'] == 1){ echo '<option select="selected" value="1">' . _('Yes') . '</option>'; echo '<option value="0">' . _('No') . '</option>'; - }; + } echo '</select> </td> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/doc/Change.log 2018-01-27 22:59:18 UTC (rev 7926) @@ -1,6 +1,7 @@ webERP Change Log -27/1/17 PaulT: MiscFunctions.php, Z_ChangeStockCode.php, Z_ChangeGLAccountCode.php: Remove unused $db parameter from function ChangeFieldInTable(). +27/1/18 Paul Becker (PaulT commit): Remove stray ; appearing after if, else, and foreach blocks. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8064) +27/1/18 PaulT: MiscFunctions.php, Z_ChangeStockCode.php, Z_ChangeGLAccountCode.php: Remove unused $db parameter from function ChangeFieldInTable(). 26/1/18 Andrew Galuski/Tim (PaulT merge/commit): New picking list feature for regular and controlled/serialized stock. This feature improves (and replaces) the current pick list handling. (Reported in forums by HDeriauFF: http://www.weberp.org/forum/showthread.php?tid=7988) 26/1/18 Exson: Add single quotation escape and charset in htmlspecialchars() in session.inc 26/1/18 Exson: Use htmlspecialchars() to encode html special characters to html entity and set the cookie available only httponly in session.inc Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/includes/MiscFunctions.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -139,7 +139,7 @@ var $attributes; var $content; var $children; -}; +} function GetECBCurrencyRates () { /* See http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html Modified: trunk/includes/class.pdf.php =================================================================== --- trunk/includes/class.pdf.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/includes/class.pdf.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -144,7 +144,7 @@ $ns=0; $cw = $this->GetStringWidth($s, '', '', 0, true); while($i<$nb) { - /*$c=$s{$i};*/ + $c=mb_substr($s, $i, 1, 'UTF-8'); if($c===' ' AND $i>0) { $sep=$i; Modified: trunk/javascripts/MiscFunctions.js =================================================================== --- trunk/javascripts/MiscFunctions.js 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/javascripts/MiscFunctions.js 2018-01-27 22:59:18 UTC (rev 7926) @@ -59,7 +59,7 @@ } else { this.setCustomValidity('The number format is wrong'); return false; - }; + } } function assignComboToInput(c, i) { |
From: <tu...@us...> - 2018-01-27 19:11:16
|
Revision: 7925 http://sourceforge.net/p/web-erp/reponame/7925 Author: turbopt Date: 2018-01-27 19:11:13 +0000 (Sat, 27 Jan 2018) Log Message: ----------- MiscFunctions.php, Z_ChangeStockCode.php, Z_ChangeGLAccountCode.php: Remove unused $db parameter from function ChangeFieldInTable() and all call points. Modified Paths: -------------- trunk/Z_ChangeGLAccountCode.php trunk/Z_ChangeStockCode.php trunk/doc/Change.log trunk/includes/MiscFunctions.php Modified: trunk/Z_ChangeGLAccountCode.php =================================================================== --- trunk/Z_ChangeGLAccountCode.php 2018-01-26 23:55:55 UTC (rev 7924) +++ trunk/Z_ChangeGLAccountCode.php 2018-01-27 19:11:13 UTC (rev 7925) @@ -66,62 +66,62 @@ DB_IgnoreForeignKeys(); - ChangeFieldInTable("bankaccounts", "accountcode", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("bankaccounts", "accountcode", $_POST['OldAccountCode'], $_POST['NewAccountCode']); - ChangeFieldInTable("bankaccountusers", "accountcode", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("bankaccountusers", "accountcode", $_POST['OldAccountCode'], $_POST['NewAccountCode']); - ChangeFieldInTable("banktrans", "bankact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("banktrans", "bankact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); - ChangeFieldInTable("chartdetails", "accountcode", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("chartdetails", "accountcode", $_POST['OldAccountCode'], $_POST['NewAccountCode']); - ChangeFieldInTable("cogsglpostings", "glcode", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("cogsglpostings", "glcode", $_POST['OldAccountCode'], $_POST['NewAccountCode']); - ChangeFieldInTable("companies", "debtorsact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("companies", "pytdiscountact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("companies", "creditorsact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("companies", "payrollact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("companies", "grnact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("companies", "exchangediffact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("companies", "purchasesexchangediffact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("companies", "retainedearnings", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("companies", "freightact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("companies", "debtorsact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("companies", "pytdiscountact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("companies", "creditorsact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("companies", "payrollact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("companies", "grnact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("companies", "exchangediffact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("companies", "purchasesexchangediffact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("companies", "retainedearnings", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("companies", "freightact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); - ChangeFieldInTable("fixedassetcategories", "costact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("fixedassetcategories", "depnact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("fixedassetcategories", "disposalact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("fixedassetcategories", "accumdepnact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("fixedassetcategories", "costact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("fixedassetcategories", "depnact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("fixedassetcategories", "disposalact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("fixedassetcategories", "accumdepnact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); - ChangeFieldInTable("glaccountusers", "accountcode", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("glaccountusers", "accountcode", $_POST['OldAccountCode'], $_POST['NewAccountCode']); - ChangeFieldInTable("gltrans", "account", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("gltrans", "account", $_POST['OldAccountCode'], $_POST['NewAccountCode']); - ChangeFieldInTable("lastcostrollup", "stockact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("lastcostrollup", "adjglact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("lastcostrollup", "stockact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("lastcostrollup", "adjglact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); - ChangeFieldInTable("locations", "glaccountcode", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db);// Location's ledger account. + ChangeFieldInTable("locations", "glaccountcode", $_POST['OldAccountCode'], $_POST['NewAccountCode']);// Location's ledger account. - ChangeFieldInTable("pcexpenses", "glaccount", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("pcexpenses", "glaccount", $_POST['OldAccountCode'], $_POST['NewAccountCode']); - ChangeFieldInTable("pctabs", "glaccountassignment", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("pctabs", "glaccountpcash", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("pctabs", "glaccountassignment", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("pctabs", "glaccountpcash", $_POST['OldAccountCode'], $_POST['NewAccountCode']); - ChangeFieldInTable("purchorderdetails", "glcode", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("purchorderdetails", "glcode", $_POST['OldAccountCode'], $_POST['NewAccountCode']); - ChangeFieldInTable("salesglpostings", "discountglcode", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("salesglpostings", "salesglcode", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("salesglpostings", "discountglcode", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("salesglpostings", "salesglcode", $_POST['OldAccountCode'], $_POST['NewAccountCode']); - ChangeFieldInTable("stockcategory", "stockact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("stockcategory", "adjglact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("stockcategory", "issueglact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("stockcategory", "purchpricevaract", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("stockcategory", "materialuseagevarac", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("stockcategory", "wipact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("stockcategory", "stockact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("stockcategory", "adjglact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("stockcategory", "issueglact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("stockcategory", "purchpricevaract", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("stockcategory", "materialuseagevarac", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("stockcategory", "wipact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); - ChangeFieldInTable("taxauthorities", "taxglcode", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("taxauthorities", "purchtaxglaccount", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); - ChangeFieldInTable("taxauthorities", "bankacctype", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("taxauthorities", "taxglcode", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("taxauthorities", "purchtaxglaccount", $_POST['OldAccountCode'], $_POST['NewAccountCode']); + ChangeFieldInTable("taxauthorities", "bankacctype", $_POST['OldAccountCode'], $_POST['NewAccountCode']); - ChangeFieldInTable("workcentres", "overheadrecoveryact", $_POST['OldAccountCode'], $_POST['NewAccountCode'], $db); + ChangeFieldInTable("workcentres", "overheadrecoveryact", $_POST['OldAccountCode'], $_POST['NewAccountCode']); DB_ReinstateForeignKeys(); Modified: trunk/Z_ChangeStockCode.php =================================================================== --- trunk/Z_ChangeStockCode.php 2018-01-26 23:55:55 UTC (rev 7924) +++ trunk/Z_ChangeStockCode.php 2018-01-27 19:11:13 UTC (rev 7925) @@ -2,7 +2,7 @@ /* $Id$*/ /* This script is an utility to change an inventory item code. */ /* It uses function ChangeFieldInTable($TableName, $FieldName, $OldValue, - $NewValue, $db) from .../includes/MiscFunctions.php.*/ + $NewValue) from .../includes/MiscFunctions.php.*/ include ('includes/session.php'); $Title = _('UTILITY PAGE Change A Stock Code');// Screen identificator. @@ -118,10 +118,10 @@ $result = DB_query($sql,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); - ChangeFieldInTable("locstock", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("stockmoves", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("loctransfers", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("mrpdemands", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); + ChangeFieldInTable("locstock", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("stockmoves", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("loctransfers", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("mrpdemands", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); //check if MRP tables exist before assuming $sql = "SELECT * FROM mrpparameters"; @@ -129,41 +129,38 @@ if (DB_error_no() == 0) { $result = DB_query("SELECT COUNT(*) FROM mrpplannedorders",'','',false,false); if (DB_error_no()==0) { - ChangeFieldInTable("mrpplannedorders", "part", $_POST['OldStockID'], $_POST['NewStockID'], $db); + ChangeFieldInTable("mrpplannedorders", "part", $_POST['OldStockID'], $_POST['NewStockID']); } $result = DB_query("SELECT * FROM mrprequirements" ,'','',false,false); if (DB_error_no()==0){ - ChangeFieldInTable("mrprequirements", "part", $_POST['OldStockID'], $_POST['NewStockID'], $db); + ChangeFieldInTable("mrprequirements", "part", $_POST['OldStockID'], $_POST['NewStockID']); } $result = DB_query("SELECT * FROM mrpsupplies" ,'','',false,false); if (DB_error_no()==0){ - ChangeFieldInTable("mrpsupplies", "part", $_POST['OldStockID'], $_POST['NewStockID'], $db); + ChangeFieldInTable("mrpsupplies", "part", $_POST['OldStockID'], $_POST['NewStockID']); } } - ChangeFieldInTable("salesanalysis", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("orderdeliverydifferenceslog", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("prices", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("salesorderdetails", "stkcode", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("purchorderdetails", "itemcode", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("purchdata", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("shipmentcharges", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("stockcheckfreeze", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("stockcounts", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("grns", "itemcode", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("contractbom", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("bom", "component", $_POST['OldStockID'], $_POST['NewStockID'], $db); + ChangeFieldInTable("salesanalysis", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("orderdeliverydifferenceslog", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("prices", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("salesorderdetails", "stkcode", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("purchorderdetails", "itemcode", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("purchdata", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("shipmentcharges", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("stockcheckfreeze", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("stockcounts", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("grns", "itemcode", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("contractbom", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("bom", "component", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("bom", "parent", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("stockrequestitems", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("stockdescriptiontranslations", "stockid", $_POST['OldStockID'], $_POST['NewStockID']);// Updates the translated item titles (StockTitles) + ChangeFieldInTable("custitem", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("pricematrix", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("pickreqdetails", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); - DB_IgnoreForeignKeys($db); - - ChangeFieldInTable("bom", "parent", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("stockrequestitems", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("stockdescriptiontranslations", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db);// Updates the translated item titles (StockTitles) - ChangeFieldInTable("custitem", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("pricematrix", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("pickreqdetails", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - echo '<br />' . _('Changing any image files'); $SupportedImgExt = array('png','jpg','jpeg'); foreach ($SupportedImgExt as $ext) { @@ -180,17 +177,17 @@ } } - ChangeFieldInTable("stockitemproperties", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("worequirements", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("worequirements", "parentstockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("woitems", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("salescatprod", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("stockserialitems", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("stockserialmoves", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("offers", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("tenderitems", "stockid", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("prodspecs", "keyval", $_POST['OldStockID'], $_POST['NewStockID'], $db); - ChangeFieldInTable("qasamples", "prodspeckey", $_POST['OldStockID'], $_POST['NewStockID'], $db); + ChangeFieldInTable("stockitemproperties", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("worequirements", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("worequirements", "parentstockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("woitems", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("salescatprod", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("stockserialitems", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("stockserialmoves", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("offers", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("tenderitems", "stockid", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("prodspecs", "keyval", $_POST['OldStockID'], $_POST['NewStockID']); + ChangeFieldInTable("qasamples", "prodspeckey", $_POST['OldStockID'], $_POST['NewStockID']); DB_ReinstateForeignKeys(); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-26 23:55:55 UTC (rev 7924) +++ trunk/doc/Change.log 2018-01-27 19:11:13 UTC (rev 7925) @@ -1,5 +1,6 @@ webERP Change Log +27/1/17 PaulT: MiscFunctions.php, Z_ChangeStockCode.php, Z_ChangeGLAccountCode.php: Remove unused $db parameter from function ChangeFieldInTable(). 26/1/18 Andrew Galuski/Tim (PaulT merge/commit): New picking list feature for regular and controlled/serialized stock. This feature improves (and replaces) the current pick list handling. (Reported in forums by HDeriauFF: http://www.weberp.org/forum/showthread.php?tid=7988) 26/1/18 Exson: Add single quotation escape and charset in htmlspecialchars() in session.inc 26/1/18 Exson: Use htmlspecialchars() to encode html special characters to html entity and set the cookie available only httponly in session.inc Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2018-01-26 23:55:55 UTC (rev 7924) +++ trunk/includes/MiscFunctions.php 2018-01-27 19:11:13 UTC (rev 7925) @@ -395,7 +395,7 @@ if ($i==0) { $FirstPart .= intval($ExplodedUnits[$i]).','; // creates each of the 2's group and adds a comma to the end } else { - $FirstPart .= $ExplodedUnits[$i].','; + $FirstPart .= $ExplodedUnits[$i].','; } } @@ -445,7 +445,7 @@ return $ToList; } -function ChangeFieldInTable($TableName, $FieldName, $OldValue, $NewValue, $db){ +function ChangeFieldInTable($TableName, $FieldName, $OldValue, $NewValue){ /* Used in Z_ scripts to change one field across the table. */ echo '<br />' . _('Changing') . ' ' . $TableName . ' ' . _('records'); @@ -456,4 +456,4 @@ echo ' ... ' . _('completed'); } -?> +?> \ No newline at end of file |
From: <tu...@us...> - 2018-01-26 23:55:59
|
Revision: 7924 http://sourceforge.net/p/web-erp/reponame/7924 Author: turbopt Date: 2018-01-26 23:55:55 +0000 (Fri, 26 Jan 2018) Log Message: ----------- Andrew Galuski/Tim (PaulT merge/commit): New picking list feature for regular and controlled/serialized stock. This feature improves (and replaces) the current pick list handling. (Reported in forums by HDeriauFF: http://www.weberp.org/forum/showthread.php?tid=7988) Modified Paths: -------------- trunk/AgedControlledInventory.php trunk/ConfirmDispatchControlled_Invoice.php trunk/ConfirmDispatch_Invoice.php trunk/PDFWOPrint.php trunk/PrintCustOrder_generic.php trunk/SelectSalesOrder.php trunk/SystemParameters.php trunk/Z_ChangeStockCode.php trunk/companies/weberpdemo/FormDesigns/PickingList.xml trunk/doc/Change.log trunk/includes/Add_SerialItems.php trunk/includes/InputSerialItems.php trunk/includes/InputSerialItemsExisting.php trunk/includes/MainMenuLinksArray.php trunk/sql/mysql/country_sql/default.sql trunk/sql/mysql/country_sql/demo.sql trunk/sql/mysql/upgrade4.14.1-4.14.2.sql Added Paths: ----------- trunk/GeneratePickingList.php trunk/PDFAck.php trunk/PDFShipLabel.php trunk/PickingLists.php trunk/PickingListsControlled.php trunk/SelectPickingLists.php trunk/companies/weberpdemo/FormDesigns/ShippingLabel.xml trunk/includes/GenPickingListHeader.inc trunk/includes/PDFAckPageHeader.php Modified: trunk/AgedControlledInventory.php =================================================================== --- trunk/AgedControlledInventory.php 2018-01-26 14:22:29 UTC (rev 7923) +++ trunk/AgedControlledInventory.php 2018-01-26 23:55:55 UTC (rev 7924) @@ -4,8 +4,10 @@ include('includes/session.php'); $PricesSecurity = 12;//don't show pricing info unless security token 12 available to user + $Today = time(); -$Title = _('Aged Controlled Inventory') . ' ' ._('as-of') .' ' . Date(($_SESSION['DefaultDateFormat']), strtotime($UpcomingDate . ' + 0 days')); +$Title = _('Aged Controlled Inventory') . ' ' . _('as-of') . ' ' . Date(($_SESSION['DefaultDateFormat']), $Today); + include('includes/header.php'); echo '<p class="page_title_text"> @@ -19,24 +21,30 @@ stockserialitems.quantity, stockmoves.trandate, stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS cost, + createdate, decimalplaces FROM stockserialitems - LEFT JOIN stockserialmoves ON stockserialitems.serialno=stockserialmoves.serialno - LEFT JOIN stockmoves ON stockserialmoves.stockmoveno=stockmoves.stkmoveno - INNER JOIN stockmaster ON stockmaster.stockid = stockserialitems.stockid - INNER JOIN locationusers ON locationusers.loccode=stockserialitems.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1 + LEFT JOIN stockserialmoves + ON stockserialitems.serialno=stockserialmoves.serialno + LEFT JOIN stockmoves + ON stockserialmoves.stockmoveno=stockmoves.stkmoveno + INNER JOIN stockmaster + ON stockmaster.stockid = stockserialitems.stockid + INNER JOIN locationusers + ON locationusers.loccode=stockserialitems.loccode + AND locationusers.userid='" . $_SESSION['UserID'] . "' + AND locationusers.canview=1 WHERE quantity > 0 - GROUP BY stockid, serialno - ORDER BY trandate"; + ORDER BY createdate, quantity"; $ErrMsg = _('The stock held could not be retrieved because'); $LocStockResult = DB_query($sql, $ErrMsg); -$NumRows = DB_num_rows($LocStockResult, $db); +$NumRows = DB_num_rows($LocStockResult); -$j = 1; $TotalQty=0; $TotalVal=0; $k=0; //row colour counter + echo '<table> <tr> <th class="ascending">' . _('Stock') . '</th> @@ -47,6 +55,7 @@ <th class="ascending">' . _('Date') . '</th> <th class="ascending">' . _('Days Old') . '</th> </tr>'; + while ($LocQtyRow=DB_fetch_array($LocStockResult)) { if ($k==1){ @@ -56,14 +65,16 @@ echo '<tr class="EvenTableRows">'; $k=1; } - $DaysOld=floor(($Today - strtotime($LocQtyRow['trandate']))/(60*60*24)); + + $DaysOld=floor(($Today - strtotime($LocQtyRow['createdate']))/(60*60*24)); $TotalQty +=$LocQtyRow['quantity']; - //$TotalVal +=($LocQtyRow['quantity'] *$LocQtyRow['cost']); $DispVal = '-----------'; + if (in_array($PricesSecurity, $_SESSION['AllowedPageSecurityTokens']) OR !isset($PricesSecurity)) { $DispVal =locale_number_format(($LocQtyRow['quantity']*$LocQtyRow['cost']),$LocQtyRow['decimalplaces']); $TotalVal +=($LocQtyRow['quantity'] *$LocQtyRow['cost']); } + printf('<td>%s</td> <td>%s</td> <td>%s</td> @@ -70,17 +81,18 @@ <td class="number">%s</td> <td class="number">%s</td> <td>%s</td> - <td class="number">%s</td></tr>', + <td class="number">%s</td> + </tr>', mb_strtoupper($LocQtyRow['stockid']), $LocQtyRow['description'], $LocQtyRow['serialno'], locale_number_format($LocQtyRow['quantity'],$LocQtyRow['decimalplaces']), $DispVal, - ConvertSQLDate($LocQtyRow['trandate']), - $DaysOld); + ConvertSQLDate($LocQtyRow['createdate']), + $DaysOld + ); +} //while - -} //while if ($k==1){ echo '<tfoot><tr class="OddTableRows">'; $k=0; @@ -88,7 +100,12 @@ echo '<tfoot><tr class="EvenTableRows">'; $k=1; } -echo '<td colspan="3"><b>' . _('Total') . '</b></td><td class="number"><b>' . locale_number_format($TotalQty,2) . '</td><td class="number"><b>' . locale_number_format($TotalVal,2) . '</td><td colspan="2"></td>'; + +echo '<td colspan="3"><b>' . _('Total') . '</b></td> + <td class="number"><b>' . locale_number_format($TotalQty,2) . '</b></td> + <td class="number"><b>' . locale_number_format($TotalVal,2) . '</b></td> + <td colspan="2"></td> + </tr></tfoot>'; echo '</table>'; include('includes/footer.php'); Modified: trunk/ConfirmDispatchControlled_Invoice.php =================================================================== --- trunk/ConfirmDispatchControlled_Invoice.php 2018-01-26 14:22:29 UTC (rev 7923) +++ trunk/ConfirmDispatchControlled_Invoice.php 2018-01-26 23:55:55 UTC (rev 7924) @@ -72,6 +72,13 @@ $RecvQty = $LineItem->Quantity-$LineItem->QtyInv; $ItemMustExist = true; /*Can only invoice valid batches/serial numbered items that exist */ $LocationOut = $_SESSION['Items'.$identifier]->Location; + +if ($_SESSION['RequirePickingNote'] == 1) { + $OrderstoPick = $_SESSION['Items'.$identifier]->OrderNo; +} else { + unset($OrderstoPick); +} + $InOutModifier=1; $ShowExisting=true; Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2018-01-26 14:22:29 UTC (rev 7923) +++ trunk/ConfirmDispatch_Invoice.php 2018-01-26 23:55:55 UTC (rev 7924) @@ -8,6 +8,8 @@ include('includes/session.php'); $Title = _('Confirm Dispatches and Invoice An Order'); + +/* Manual links before header.php */ $ViewTopic= 'ARTransactions'; $BookMark = 'ConfirmInvoice'; include('includes/header.php'); @@ -51,6 +53,7 @@ salesorders.branchcode, salesorders.customerref, salesorders.comments, + salesorders.internalcomment, salesorders.orddate, salesorders.ordertype, salesorders.shipvia, @@ -73,17 +76,26 @@ currencies.rate as currency_rate, currencies.decimalplaces, custbranch.defaultshipvia, - custbranch.specialinstructions - FROM salesorders INNER JOIN debtorsmaster - ON salesorders.debtorno = debtorsmaster.debtorno + custbranch.specialinstructions, + pickreq.consignment, + pickreq.packages + FROM salesorders + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno INNER JOIN custbranch - ON salesorders.branchcode = custbranch.branchcode - AND salesorders.debtorno = custbranch.debtorno + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno INNER JOIN currencies - ON debtorsmaster.currcode = currencies.currabrev + ON debtorsmaster.currcode = currencies.currabrev INNER JOIN locations - ON locations.loccode=salesorders.fromstkloc - INNER JOIN locationusers ON locationusers.loccode=salesorders.fromstkloc AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 + ON locations.loccode=salesorders.fromstkloc + INNER JOIN locationusers + ON locationusers.loccode=salesorders.fromstkloc + AND locationusers.userid='" . $_SESSION['UserID'] . "' + AND locationusers.canupd=1 + LEFT OUTER JOIN pickreq + ON pickreq.orderno=salesorders.orderno + AND pickreq.closed=0 WHERE salesorders.orderno = '" . $_GET['OrderNumber']."'"; if($_SESSION['SalesmanLogin'] != '') { @@ -109,6 +121,9 @@ $_SESSION['Items'.$identifier]->CurrDecimalPlaces = $myrow['decimalplaces']; $BestShipper = $myrow['shipvia']; $_SESSION['Items'.$identifier]->ShipVia = $myrow['shipvia']; + $_SESSION['Items'.$identifier]->InternalComments = reverse_escape($myrow['internalcomment']); + $_SESSION['Items'.$identifier]->Consignment = $myrow['consignment']; + $_SESSION['Items'.$identifier]->Packages = $myrow['packages']; if(is_null($BestShipper)) { $BestShipper=0; @@ -175,6 +190,9 @@ if(DB_num_rows($LineItemsResult)>0) { while ($myrow=DB_fetch_array($LineItemsResult)) { + $QOHSQL = "SELECT quantity FROM locstock WHERE stockid='" . $myrow['stkcode'] . "' and loccode='" . $_SESSION['Items'.$identifier]->Location . "'"; + $QOHResult = DB_query($QOHSQL); + $QOHRow = DB_fetch_array($QOHResult); $_SESSION['Items'.$identifier]->add_to_cart($myrow['stkcode'], $myrow['quantity'], @@ -185,7 +203,7 @@ $myrow['units'], $myrow['volume'], $myrow['grossweight'], - 0, + $QOHRow['quantity'], $myrow['mbflag'], $myrow['actualdispatchdate'], $myrow['qtyinvoiced'], @@ -205,7 +223,35 @@ /*Calculate the taxes applicable to this line item from the customer branch Tax Group and Item Tax Category */ $_SESSION['Items'.$identifier]->GetTaxes($myrow['orderlineno']); + $SerialItemsSQL = "SELECT pickreqdetails.qtypicked, + pickserialdetails.stockid, + serialno, + moveqty + FROM pickreq + INNER JOIN pickreqdetails + ON pickreqdetails.prid=pickreq.prid + LEFT OUTER JOIN pickserialdetails + ON pickserialdetails.detailno=pickreqdetails.detailno + WHERE pickreq.orderno ='" . $_GET['OrderNumber'] . "' + AND pickreq.closed=0 + AND pickreqdetails.orderlineno='" . $myrow['orderlineno'] . "'"; + $ErrMsg = _('The serial items of the pick list cannot be retrieved because'); + $DbgMsg = _('The SQL that failed was'); + $SerialItemsResult = DB_query($SerialItemsSQL, $ErrMsg, $DbgMsg); + + if (DB_num_rows($SerialItemsResult) > 0) { + $InOutModifier = 1; + while ($MySerial = DB_fetch_array($SerialItemsResult)) { + if (isset($MySerial['serialno'])) { + $_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->SerialItems[$MySerial['serialno']] = new SerialItem($MySerial['serialno'], ($InOutModifier > 0 ? 1 : 1) * filter_number_format($MySerial['moveqty'])); + } else { + if ($_SESSION['RequirePickingNote'] == 1) { + $_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->QtyDispatched = $MySerial['qtypicked']; + } + } + } + } } /* line items from sales order details */ } else { /* there are no line items that have a quantity to deliver */ echo '<br />'; @@ -233,6 +279,9 @@ if(isset($_POST['ChargeFreightCost'])) { $_SESSION['Items'.$identifier]->FreightCost = filter_number_format($_POST['ChargeFreightCost']); } + if (isset($_POST['InternalComments'])) { + $_SESSION['Items'.$identifier]->InternalComments = $_POST['InternalComments']; + } $i=1; foreach ($_SESSION['Items'.$identifier]->FreightTaxes as $FreightTaxLine) { if(isset($_POST['FreightTaxRate' . $i])) { @@ -249,7 +298,7 @@ } //Preventing from dispatched more than ordered. Since it's controlled items, users must select the batch/lot again. if($_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyDispatched > ($_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->Quantity - $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyInv)) { - prnMsg(_('Dispathed Quantity should not be more than order balanced quantity').'. '._('To dispatch quantity is').' '.$_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyDispatched.' '._('And the order balance is ').' '.($_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->Quantity - $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyInv),'error'); + prnMsg(_('Dispatched Quantity should not be more than order balanced quantity').'. '._('To dispatch quantity is').' '.$_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyDispatched.' '._('And the order balance is ').' '.($_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->Quantity - $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyInv),'error'); include('includes/footer.php'); exit; } @@ -325,34 +374,52 @@ /*show the line items on the order with the quantity being dispatched available for modification */ $k=0; //row colour counter -$j=0; +$j=0; //used for tabindex + foreach ($_SESSION['Items'.$identifier]->LineItems as $LnItm) { $j++; - $LineTotal = $LnItm->QtyDispatched * $LnItm->Price * (1 - $LnItm->DiscountPercent); - $_SESSION['Items'.$identifier]->total += $LineTotal; - $_SESSION['Items'.$identifier]->totalVolume += ($LnItm->QtyDispatched * $LnItm->Volume); - $_SESSION['Items'.$identifier]->totalWeight += ($LnItm->QtyDispatched * $LnItm->Weight); - if($k==1) { - $RowStarter = '<tr class="EvenTableRows">'; + if ($LnItm->QOHatLoc < $LnItm->Quantity and ($LnItm->MBflag == 'B' or $LnItm->MBflag == 'M')) { + /*There is a stock deficiency in the stock location selected */ + $RowStarter = '<tr style="background:#FF0000;color:#FFC0CB">'; //rows show red where stock deficiency + } elseif ($k == 1) { + $RowStarter = '<tr class="OddTableRows">'; $k = 0; } else { - $RowStarter = '<tr class="OddTableRows">'; + $RowStarter = '<tr class="EvenTableRows">'; $k = 1; } - echo $RowStarter, ' - <td>', $LnItm->StockID, '</td> - <td class="text" title="', $LnItm->LongDescription, '">', $LnItm->ItemDescription, '</td> - <td class="number">', locale_number_format($LnItm->Quantity, $LnItm->DecimalPlaces), '</td> - <td class="text">', $LnItm->Units, '</td> - <td class="number">', locale_number_format($LnItm->QtyInv, $LnItm->DecimalPlaces), '</td>'; + if (sizeOf($LnItm->SerialItems) > 0) { + $_SESSION['Items'.$identifier]->LineItems[$LnItm->LineNumber]->QtyDispatched = 0; //initialise QtyDispatched + foreach ($LnItm->SerialItems as $SerialItem) { //calculate QtyDispatched from bundle quantities + $_SESSION['Items'.$identifier]->LineItems[$LnItm->LineNumber]->QtyDispatched += $SerialItem->BundleQty; + } + } else if (isset($_POST[$LnItm->LineNumber . '_QtyDispatched'])) { + if (is_numeric(filter_number_format($_POST[$LnItm->LineNumber . '_QtyDispatched'])) and filter_number_format($_POST[$LnItm->LineNumber . '_QtyDispatched']) <= ($_SESSION['Items'.$identifier]->LineItems[$LnItm->LineNumber]->Quantity - $_SESSION['Items'.$identifier]->LineItems[$LnItm->LineNumber]->QtyInv)) { + + $_SESSION['Items'.$identifier]->LineItems[$LnItm->LineNumber]->QtyDispatched = round(filter_number_format($_POST[$LnItm->LineNumber . '_QtyDispatched']), $LnItm->DecimalPlaces); + } + } + + $LineTotal = $LnItm->QtyDispatched * $LnItm->Price * (1 - $LnItm->DiscountPercent); + $_SESSION['Items'.$identifier]->total += $LineTotal; + $_SESSION['Items'.$identifier]->totalVolume += ($LnItm->QtyDispatched * $LnItm->Volume); + $_SESSION['Items'.$identifier]->totalWeight += ($LnItm->QtyDispatched * $LnItm->Weight); + + echo $RowStarter; + echo '<td>' . $LnItm->StockID . '</td> + <td class="text" title="' . $LnItm->LongDescription . '">' . $LnItm->ItemDescription . '</td> + <td class="number">' . locale_number_format($LnItm->Quantity, $LnItm->DecimalPlaces) . '</td> + <td class="text">' . $LnItm->Units . '</td> + <td class="number">' . locale_number_format($LnItm->QtyInv, $LnItm->DecimalPlaces) . '</td>'; + if($LnItm->Controlled==1) { if(isset($_POST['ProcessInvoice'])) { echo '<td class="number">' . locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '</td>'; } else { - echo '<td class="number"><input type="hidden" name="' . $LnItm->LineNumber . '_QtyDispatched" value="' . $LnItm->QtyDispatched . '" /><a href="' . $RootPath .'/ConfirmDispatchControlled_Invoice.php?identifier=' . $identifier . '&LineNo='. $LnItm->LineNumber.'">' .locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '</a></td>'; + echo '<td class="number"><input type="hidden" name="' . $LnItm->LineNumber . '_QtyDispatched" required="required" maxlength="11" value="' . $LnItm->QtyDispatched . '" /><a href="' . $RootPath .'/ConfirmDispatchControlled_Invoice.php?identifier=' . urlencode($identifier) . '&LineNo=' . urlencode($LnItm->LineNumber) . '">' .locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '</a></td>'; } } else { if(isset($_POST['ProcessInvoice'])) { @@ -420,7 +487,7 @@ if($LnItm->Controlled==1) { if(!isset($_POST['ProcessInvoice'])) { - echo '<td><a href="' . $RootPath . '/ConfirmDispatchControlled_Invoice.php?identifier=' . $identifier . '&LineNo='. $LnItm->LineNumber.'">'; + echo '<td><a href="' . $RootPath . '/ConfirmDispatchControlled_Invoice.php?identifier=' . urlencode($identifier) . '&LineNo=' . urlencode($LnItm->LineNumber) . '">'; if($LnItm->Serialised==1) { echo _('Enter Serial Numbers'); } else { /*Just batch/roll/lot control */ @@ -441,7 +508,7 @@ It seems unfair to charge the customer twice for freight if the order was not fully delivered the first time ?? */ -if(!isset($_SESSION['Items'.$identifier]->FreightCost)) { +if (!isset($_SESSION['Items'.$identifier]->FreightCost) or $_SESSION['Items'.$identifier]->FreightCost == 0) { if($_SESSION['DoFreightCalc']==True) { list ($FreightCost, $BestShipper) = CalcFreightCost($_SESSION['Items'.$identifier]->total, $_SESSION['Items'.$identifier]->BrAdd2, @@ -456,7 +523,7 @@ $db); $_SESSION['Items'.$identifier]->ShipVia = $BestShipper; } - if(is_numeric($FreightCost)) { + if (isset($FreightCost) and is_numeric($FreightCost)) { $FreightCost = $FreightCost / $_SESSION['CurrencyRate']; } else { $FreightCost =0; @@ -634,8 +701,8 @@ ON stockmaster.stockid=bom.component WHERE bom.parent='" . $OrderLine->StockID . "' AND locstock.loccode='" . $_SESSION['Items'.$identifier]->Location . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "' - AND bom.effectiveto > '" . date('Y-m-d') . "'"; + AND effectiveafter <= CURRENT_DATE + AND effectiveto > CURRENT_DATE"; $ErrMsg = _('Could not retrieve the component quantity left at the location once the assembly item on this order is invoiced (for the purposes of checking that stock will not go negative because)'); $Result = DB_query($SQL,$ErrMsg); @@ -768,7 +835,9 @@ /*Update order header for invoice charged on */ $SQL = "UPDATE salesorders - SET comments = CONCAT(comments,' Inv ','" . $InvoiceNo . "') + SET comments = CONCAT(comments,' Inv ','" . $InvoiceNo . "'), + internalcomment = '" . $_POST['InternalComments'] . "', + printedpackingslip=0 WHERE orderno= '" . $_SESSION['ProcessingOrder']."'"; $ErrMsg = _('CRITICAL ERROR') . ' ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales order header could not be updated with the invoice number'); @@ -804,7 +873,7 @@ '" . $DefaultDispatchDate . "', '" . date('Y-m-d H-i-s') . "', '" . $PeriodNo . "', - '', + '" . $_SESSION['Items'.$identifier]->CustRef . "', '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', '" . $_SESSION['ProcessingOrder'] . "', '" . $_SESSION['Items'.$identifier]->total . "', @@ -946,8 +1015,32 @@ $DbgMsg = _('The following SQL to update the sales order detail record was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - /* Update location stock records if not a dummy stock item - need the MBFlag later too so save it to $MBFlag */ + /*update any open pickreqdetails*/ + $LineItemsSQL = "SELECT pickreqdetails.detailno + FROM pickreqdetails INNER JOIN pickreq ON pickreq.prid=pickreqdetails.prid + INNER JOIN salesorderdetails + ON salesorderdetails.orderno = pickreq.orderno + AND salesorderdetails.orderlineno=pickreqdetails.orderlineno + WHERE pickreq.orderno ='" . $_SESSION['ProcessingOrder'] . "' + AND pickreq.closed=0 + AND salesorderdetails.orderlineno='" . $OrderLine->LineNumber . "'"; + + $ErrMsg = _('The line items of the pick list cannot be retrieved because'); + $DbgMsg = _('The SQL that failed was'); + $LineItemsResult = DB_query($LineItemsSQL, $ErrMsg, $DbgMsg); + + $MyLine = DB_fetch_array($LineItemsResult); + $DetailNo = $MyLine['detailno']; + $SQL = "UPDATE pickreqdetails + SET invoicedqty='" . $OrderLine->QtyDispatched . "' + WHERE detailno='" . $DetailNo . "'"; + + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The pickreqdetail record could not be inserted because'); + $DbgMsg = _('The following SQL to insert the pickreqdetail records was used'); + $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); + + /* Update location stock records if not a dummy stock item + need the MBFlag later too so save it to $MBFlag */ $Result = DB_query("SELECT mbflag FROM stockmaster WHERE stockid = '" . $OrderLine->StockID . "'", @@ -996,8 +1089,8 @@ FROM bom INNER JOIN stockmaster ON bom.component=stockmaster.stockid WHERE bom.parent='" . $OrderLine->StockID . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "' - AND bom.effectiveto > '" . date('Y-m-d') . "'"; + AND bom.effectiveto > CURRENT_DATE + AND bom.effectiveafter <= CURRENT_DATE"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not retrieve assembly components from the database for'). ' '. $OrderLine->StockID . _('because').' '; $DbgMsg = _('The SQL that failed was'); @@ -1145,7 +1238,7 @@ '" . $_SESSION['Items'.$identifier]->Branch . "', '" . $LocalCurrencyPrice . "', '" . $PeriodNo . "', - '" . $_SESSION['ProcessingOrder'] . "', + '" . DB_escape_string($_SESSION['ProcessingOrder']) . "', '" . -$OrderLine->QtyDispatched . "', '" . $OrderLine->DiscountPercent . "', '" . $OrderLine->StandardCost . "', @@ -1228,7 +1321,8 @@ salesanalysis.periodno, salesanalysis.typeabbrev, salesanalysis.salesperson - FROM salesanalysis INNER JOIN custbranch + FROM salesanalysis + INNER JOIN custbranch ON salesanalysis.cust=custbranch.debtorno AND salesanalysis.custbranch=custbranch.branchcode AND salesanalysis.area=custbranch.area @@ -1235,12 +1329,12 @@ INNER JOIN stockmaster ON salesanalysis.stkcategory=stockmaster.categoryid WHERE salesanalysis.salesperson='" . $_SESSION['Items'.$identifier]->SalesPerson . "' - AND salesanalysis.typeabbrev ='" . $_SESSION['Items'.$identifier]->DefaultSalesType . "' - AND salesanalysis.periodno='" . $PeriodNo . "' - AND salesanalysis.cust='" . $_SESSION['Items'.$identifier]->DebtorNo . "' - AND salesanalysis.custbranch='" . $_SESSION['Items'.$identifier]->Branch . "' - AND salesanalysis.stockid='" . $OrderLine->StockID . "' - AND salesanalysis.budgetoractual=1 + AND salesanalysis.typeabbrev ='" . $_SESSION['Items'.$identifier]->DefaultSalesType . "' + AND salesanalysis.periodno='" . $PeriodNo . "' + AND salesanalysis.cust='" . $_SESSION['Items'.$identifier]->DebtorNo . "' + AND salesanalysis.custbranch='" . $_SESSION['Items'.$identifier]->Branch . "' + AND salesanalysis.stockid='" . $OrderLine->StockID . "' + AND salesanalysis.budgetoractual=1 GROUP BY salesanalysis.stockid, salesanalysis.stkcategory, salesanalysis.cust, @@ -1540,7 +1634,7 @@ 10, '" . $InvoiceNo . "', '" . $PeriodNo . "', - '" . Date('Y-m-d') . "', + CURRENT_DATE, 'disposal', '" . round(($OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']),$_SESSION['CompanyRecord']['decimalplaces']) . "', '" . $DefaultDispatchDate . "')"; @@ -1562,6 +1656,16 @@ } /*end of OrderLine loop */ + /*update any open pick list*/ + $SQL = "UPDATE pickreq + SET status = 'Invoiced', + closed='1' + WHERE orderno= '" . $_SESSION['ProcessingOrder'] . "' + AND closed=0"; + $ErrMsg = _('CRITICAL ERROR') . ' ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The pick list header could not be updated'); + $DbgMsg = _('The following SQL to update the pick list was used'); + $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); + if($_SESSION['CompanyRecord']['gllink_debtors']==1) { /*Post debtors transaction to GL debit debtors, credit freight re-charged and credit sales */ @@ -1635,10 +1739,10 @@ } } } /*end of if Sales and GL integrated */ - EnsureGLEntriesBalance(10,$InvoiceNo,$db); DB_Txn_Commit(); + EnsureGLEntriesBalance(10, $InvoiceNo,$db); // ************************************************************************* // E N D O F I N V O I C E S Q L P R O C E S S I N G // ************************************************************************* @@ -1664,10 +1768,18 @@ } else { /*Process Invoice not set so allow input of invoice data */ if(!isset($_POST['Consignment'])) { - $_POST['Consignment']=''; + if ($_SESSION['Items'.$identifier]->Consignment != '') { + $_POST['Consignment'] = $_SESSION['Items'.$identifier]->Consignment; + } else { + $_POST['Consignment']=''; + } } if(!isset($_POST['Packages'])) { - $_POST['Packages']='1'; + if ($_SESSION['Items'.$identifier]->Packages) { + $_POST['Packages'] = $_SESSION['Items'.$identifier]->Packages; + } else { + $_POST['Packages']='1'; + } } if(!isset($_POST['InvoiceText'])) { $_POST['InvoiceText']=''; @@ -1676,7 +1788,7 @@ echo '<table class="selection"> <tr> <td>' ._('Date On Invoice'). ':</td> - <td><input tabindex="'.$j.'" type="text" maxlength="10" size="15" required="required" name="DispatchDate" value="' . $DefaultDispatchDate . '" id="datepicker" alt="' . $_SESSION['DefaultDateFormat'] . '" class="date" /></td> + <td><input tabindex="'.$j.'" type="text" required="required" maxlength="10" size="15" required="required" name="DispatchDate" value="' . $DefaultDispatchDate . '" id="datepicker" alt="' . $_SESSION['DefaultDateFormat'] . '" class="date" /></td> </tr>'; $j++; echo '<tr> @@ -1692,7 +1804,12 @@ $j++; echo '<tr> <td>' . _('Action For Balance'). ':</td> - <td><select tabindex="'.$j.'" name="BOPolicy"><option selected="selected" value="BO">' . _('Automatically put balance on back order') . '</option><option value="CAN">' . _('Cancel any quantities not delivered') . '</option></select></td> + <td> + <select required="required" tabindex="' . $j . '" name="BOPolicy"> + <option selected="selected" value="BO">' . _('Automatically put balance on back order') . '</option> + <option value="CAN">' . _('Cancel any quantities not delivered') . '</option> + </select> + </td> </tr>'; $j++; echo '<tr> @@ -1700,6 +1817,12 @@ <td><textarea tabindex="'.$j.'" name="InvoiceText" pattern=".{0,20}" cols="31" rows="5">' . reverse_escape($_POST['InvoiceText']) . '</textarea></td> </tr>'; + ++$j; + echo '<tr> + <td>' . _('Internal Comments') . ':</td> + <td><textarea tabindex="' . $j . '" name="InternalComments" pattern=".{0,20}" cols="31" rows="5">' . reverse_escape($_SESSION['Items'.$identifier]->InternalComments) . '</textarea></td> + </tr>'; + $j++; echo '</table> <br /> @@ -1709,7 +1832,7 @@ $j++; echo '<br /> - <input type="submit" tabindex="'.$j.'" name="ProcessInvoice" value="'._('Process Invoice').'" /> + <input type="submit" tabindex="'.$j.'" name="ProcessInvoice" value="'._('Process Invoice').'" /> </div> <input type="hidden" name="ShipVia" value="' . $_SESSION['Items'.$identifier]->ShipVia . '" />'; } @@ -1717,4 +1840,4 @@ echo '</form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Added: trunk/GeneratePickingList.php =================================================================== --- trunk/GeneratePickingList.php (rev 0) +++ trunk/GeneratePickingList.php 2018-01-26 23:55:55 UTC (rev 7924) @@ -0,0 +1,513 @@ +<?php + +/* $Id: GeneratePickingList.php 1 2014-08-26 11:54:03Z agaluski $*/ + +include('includes/session.php'); +include('includes/SQL_CommonFunctions.inc'); + +/* Check that the config variable is set for + * picking notes and get out if not. + */ +if ($_SESSION['RequirePickingNote'] == 0) { + $Title = _('Picking Lists Not Enabled'); + include('includes/header.php'); + echo '<br />'; + prnMsg(_('The system is not configured for picking lists. A configuration parameter is required where picking slips are required. Please consult your system administrator.'), 'info'); + include('includes/footer.php'); + exit; +} + +/* Show selection screen if we have no orders to work with */ +if ((!isset($_GET['TransNo']) or $_GET['TransNo'] == '') and !isset($_POST['TransDate'])) { + $Title = _('Select Picking Lists'); + include('includes/header.php'); + $SQL = "SELECT locations.loccode, + locationname + FROM locations + INNER JOIN locationusers ON locationusers.loccode=locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1"; + $Result = DB_query($SQL); + echo '<p class="page_title_text"><img src="' . $RootPath . '/css/' . $_SESSION['Theme'] . '/images/sales.png" title="' . _('Search') . '" alt="" />' . ' ' . $Title . '</p><br />'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post" name="form"> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <table class="selection"> + <tr> + <td>' . _('Create picking lists for all deliveries to be made on') . ' : ' . '</td> + <td><input type="text" required="required" autofocus="autofocus" class="date" name="TransDate" maxlength="10" size="11" value="' . date($_SESSION['DefaultDateFormat'], mktime(date('m'), date('Y'), date('d') + 1)) . '" /></td> + </tr> + <tr> + <td>' . _('From Warehouse') . ' : ' . '</td> + <td><select required="required" name="loccode">'; + while ($MyRow = DB_fetch_array($Result)) { + echo '<option value="' . $MyRow['loccode'] . '">' . $MyRow['locationname'] . '</option>'; + } + echo '</select></td> + </tr> + </table>'; + echo '<div class="centre"> + <input type="submit" name="Process" value="' . _('Print Picking Lists') . '" /> + </div> + </form>'; + include('includes/footer.php'); + exit(); +} + +/*retrieve the order details from the database to print */ +$ErrMsg = _('There was a problem retrieving the order header details from the database'); + +if (!isset($_POST['TransDate']) and $_GET['TransNo'] != 'Preview') { + /* If there is no transaction date set, then it must be for a single order */ + $SQL = "SELECT salesorders.debtorno, + salesorders.orderno, + salesorders.customerref, + salesorders.comments, + salesorders.orddate, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.deliverblind, + salesorders.deliverydate, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + shippers.shippername, + salesorders.printedpackingslip, + salesorders.datepackingslipprinted, + locations.loccode, + locations.locationname + FROM salesorders INNER JOIN salesorderdetails on salesorderdetails.orderno=salesorders.orderno, + debtorsmaster, + shippers, + locations INNER JOIN locationusers ON locationusers.loccode=locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 + WHERE salesorders.debtorno=debtorsmaster.debtorno + AND salesorders.shipvia=shippers.shipper_id + AND salesorders.fromstkloc=locations.loccode + AND salesorders.orderno='" . $_GET['TransNo'] . "' + AND salesorderdetails.completed=0 + GROUP BY salesorders.orderno"; +} else if (isset($_POST['TransDate']) or (isset($_GET['TransNo']) and $_GET['TransNo'] != 'Preview')) { + /* We are printing picking lists for all orders on a day */ + $SQL = "SELECT salesorders.debtorno, + salesorders.orderno, + salesorders.customerref, + salesorders.comments, + salesorders.orddate, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.deliverblind, + salesorders.deliverydate, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + shippers.shippername, + salesorders.printedpackingslip, + salesorders.datepackingslipprinted, + locations.loccode, + locations.locationname + FROM salesorders INNER JOIN salesorderdetails on salesorderdetails.orderno=salesorders.orderno, + debtorsmaster, + shippers, + locations INNER JOIN locationusers ON locationusers.loccode=locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 + WHERE salesorders.debtorno=debtorsmaster.debtorno + AND salesorders.shipvia=shippers.shipper_id + AND salesorders.fromstkloc=locations.loccode + AND salesorders.fromstkloc='" . $_POST['loccode'] . "' + AND salesorders.deliverydate<='" . FormatDateForSQL($_POST['TransDate']) . "' + AND salesorderdetails.completed=0 + GROUP BY salesorders.orderno + ORDER BY salesorders.deliverydate, salesorders.orderno"; +} + +if ($_SESSION['SalesmanLogin'] != '') { + $SQL .= " AND salesorders.salesperson='" . $_SESSION['SalesmanLogin'] . "'"; +} + +if (isset($_POST['TransDate']) or (isset($_GET['TransNo']) and $_GET['TransNo'] != 'Preview')) { + $Result = DB_query($SQL, $ErrMsg); + + /*if there are no rows, there's a problem. */ + if (DB_num_rows($Result) == 0) { + $Title = _('Print Picking List Error'); + include('includes/header.php'); + echo '<br />'; + prnMsg(_('Unable to Locate any orders for this criteria '), 'info'); + echo '<br /> + <table class="selection"> + <tr> + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">' . _('Enter Another Date') . '</a></td> + </tr> + </table> + <br />'; + include('includes/footer.php'); + exit(); + } + + /*retrieve the order details from the database and place them in an array */ + while ($MyRow = DB_fetch_array($Result)) { + $OrdersToPick[] = $MyRow; + } +} +else { + $OrdersToPick[0]['debtorno'] = str_pad('', 10, 'x'); + $OrdersToPick[0]['orderno'] = 'Preview'; + $OrdersToPick[0]['customerref'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['comments'] = str_pad('', 100, 'x'); + $OrdersToPick[0]['orddate'] = '1900-00-01'; + $OrdersToPick[0]['deliverto'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['deladd1'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['deladd2'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['deladd3'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['deladd4'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['deladd5'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['deladd6'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['deliverblind'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['deliverydate'] = '1900-00-01'; + $OrdersToPick[0]['name'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['address1'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['address2'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['address3'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['address4'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['address5'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['address6'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['shippername'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['printedpackingslip'] = str_pad('', 20, 'x'); + $OrdersToPick[0]['datepackingslipprinted'] = '1900-00-01'; + $OrdersToPick[0]['locationname'] = str_pad('', 15, 'x'); +} +/* Then there's an order to print and its not been printed already (or its been flagged for reprinting/ge_Width=807;) +LETS GO */ + +if ($OrdersToPick[0]['orderno'] == 'Preview') { + $FormDesign = simplexml_load_file(sys_get_temp_dir() . '/PickingList.xml'); +} else { + $FormDesign = simplexml_load_file($PathPrefix . 'companies/' . $_SESSION['DatabaseName'] . '/FormDesigns/PickingList.xml'); +} + +$PaperSize = $FormDesign->PaperSize; +include('includes/PDFStarter.php'); +$pdf->addInfo('Title', _('Picking List')); +$pdf->addInfo('Subject', _('Laser Picking List')); +$FontSize = 12; +$ListCount = 0; +$Copy = ''; + +$line_height = $FormDesign->LineHeight; +$TotalOrderCount = sizeof($OrdersToPick); + +for ( $i = 0; $i < $TotalOrderCount; $i++ ){ + /*Cycle through each of the orders to pick */ + if ($i > 0) { + $pdf->newPage(); + } + + /* Now ... Has the order got any line items still outstanding to be picked */ + + $PageNumber = 1; + + if (isset($_POST['TransDate']) or (isset($_GET['TransNo']) and $_GET['TransNo'] != 'Preview')) { + $ErrMsg = _('There was a problem retrieving the order line details for Order Number') . ' ' . $OrdersToPick[$i]['orderno'] . ' ' . _('from the database'); + + /* Are there any picking lists for this order already */ + $SQL = "SELECT COUNT(orderno), + prid, + comments + FROM pickreq + WHERE orderno='" . $OrdersToPick[$i]['orderno'] . "' + AND closed='0'"; + + $CountResult = DB_query($SQL); + $Count = DB_fetch_row($CountResult); + + if (!isset($Count[2]) or $Count[2] == '') { /* No comment was found in the query */ + $Count[2]='Please pick order. Generate packing slip. Apply shipment labels and ship in system.'; + } + + if ($Count[0] == 0) { + $SQL = "SELECT salesorderdetails.stkcode, + stockmaster.description, + stockmaster.controlled, + stockmaster.serialised, + salesorderdetails.orderlineno, + (salesorderdetails.quantity - salesorderdetails.qtyinvoiced) as qtyexpected, + salesorderdetails.quantity, + salesorderdetails.qtyinvoiced, + salesorderdetails.narrative, + stockmaster.decimalplaces, + custitem.cust_part, + custitem.cust_description, + locstock.quantity qtyavail, + bin + FROM salesorderdetails + INNER JOIN locstock + ON locstock.loccode='" . $OrdersToPick[$i]['loccode'] . "' + AND locstock.stockid=salesorderdetails.stkcode + INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + LEFT OUTER JOIN custitem + ON custitem.debtorno='" . $OrdersToPick[$i]['debtorno'] . "' + AND custitem.stockid=stockmaster.stockid + WHERE salesorderdetails.orderno='" . $OrdersToPick[$i]['orderno'] . "' + AND salesorderdetails.completed=0"; + } else { + $SQL = "SELECT salesorderdetails.stkcode, + stockmaster.description, + stockmaster.controlled, + stockmaster.serialised, + salesorderdetails.orderlineno, + (salesorderdetails.quantity - salesorderdetails.qtyinvoiced) as qtyexpected, + salesorderdetails.quantity, + salesorderdetails.qtyinvoiced, + pickreqdetails.qtypicked, + pickreqdetails.shipqty, + salesorderdetails.narrative, + stockmaster.decimalplaces, + custitem.cust_part, + custitem.cust_description, + locstock.quantity qtyavail, + bin + FROM salesorderdetails + INNER JOIN locstock + ON locstock.loccode='" . $OrdersToPick[$i]['loccode'] . "' + AND locstock.stockid=salesorderdetails.stkcode + INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + LEFT OUTER JOIN pickreq + ON pickreq.orderno=salesorderdetails.orderno + AND pickreq.closed=0 + LEFT OUTER JOIN pickreqdetails + ON pickreqdetails.stockid=salesorderdetails.stkcode + AND pickreqdetails.orderlineno=salesorderdetails.orderlineno + AND pickreqdetails.prid=pickreq.prid + LEFT OUTER JOIN custitem + ON custitem.debtorno='" . $OrdersToPick[$i]['debtorno'] . "' + AND custitem.stockid=stockmaster.stockid + WHERE salesorderdetails.orderno='" . $OrdersToPick[$i]['orderno'] . "' + AND salesorderdetails.completed=0"; + } + $LineResult = DB_query($SQL, $ErrMsg); + } + if ((isset($_GET['TransNo']) and $_GET['TransNo'] == 'Preview') or (isset($LineResult) and DB_num_rows($LineResult) > 0)) { + /*Yes there are line items to start the ball rolling with a page header */ + DB_Txn_Begin(); + + if (isset($_POST['TransDate']) or (isset($_GET['TransNo']) and $_GET['TransNo'] != 'Preview')) { + $LinesToShow = DB_num_rows($LineResult); + if ($Count[0] == 0) { + /*create picklist we have open lines and no pickreq yet*/ + + $SQL = "INSERT INTO pickreq + (prid, + initiator, + initdate, + requestdate, + status, + comments, + loccode, + orderno) + VALUES ( + 'NULL', + '" . $_SESSION['UserID'] . "', + '" . date('Y-m-d') . "', + '" . $OrdersToPick[$i]['deliverydate'] . "', + 'New', + 'Please pick order. Generate packing slip. Apply shipment labels and ship in system. Return all Paperwork to Mem...@re...', + '" . $OrdersToPick[$i]['loccode'] . "', + '" . $OrdersToPick[$i]['orderno'] . "');"; + $HeaderResult = DB_query($SQL); + $PickReqID = DB_Last_Insert_ID('pickreq', 'prid'); + $Count[1]=$PickReqID; + } //create pickreq + } + else { + $LinesToShow = 1; + } + + include('includes/GenPickingListHeader.inc'); + $YPos = $FormDesign->Data->y; + $Lines = 0; + + while ($Lines < $LinesToShow) { + if (isset($_GET['TransNo']) and $_GET['TransNo'] == 'Preview') { + $MyRow2['stkcode'] = str_pad('', 10, 'x'); + $MyRow2['decimalplaces'] = 2; + $DisplayQty = 'XXXX.XX'; + $DisplayPrevDel = 'XXXX.XX'; + $DisplayQtySupplied = 'XXXX.XX'; + $MyRow2['description'] = str_pad('', 18, 'x'); + $MyRow2['narrative'] = str_pad('', 18, 'x'); + } + else { + $MyRow2 = DB_fetch_array($LineResult); + + if ($Count[0] == 0) { + $SQL = "INSERT INTO pickreqdetails + (detailno, + prid, + orderlineno, + stockid, + qtyexpected) + VALUES ( + 'NULL', + '" . $PickReqID . "', + '" . $MyRow2['orderlineno'] . "', + '" . $MyRow2['stkcode'] . "', + '" . $MyRow2['qtyexpected'] . "');"; + + $InsLineResult = DB_query($SQL); + $MyRow2['qtyexpected'] = 0; + $MyRow2['qtypicked'] = 0; + } //create pickreqdetail + + $DisplayQty = locale_number_format($MyRow2['quantity'], $MyRow2['decimalplaces']); + $DisplayQtySupplied = locale_number_format($MyRow2['quantity'] - $MyRow2['qtyinvoiced'], $MyRow2['decimalplaces']); + $DisplayPrevDel = locale_number_format($MyRow2['qtyinvoiced'], $MyRow2['decimalplaces']); + $DisplayQtyAvail = locale_number_format($MyRow2['qtyavail'], $MyRow2['decimalplaces']); + + if ($MyRow2['qtypicked'] > 0) { + $DisplayPicked = locale_number_format($MyRow2['qtypicked'], $MyRow2['decimalplaces']); + } else { + $DisplayPicked = '____________'; + } + } + ++$ListCount; + + $LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column1->x, $Page_Height - $YPos, $FormDesign->Headings->Column1->Length, $FormDesign->Headings->Column1->FontSize, $MyRow2['stkcode'], 'left'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column2->x, $Page_Height - $YPos, $FormDesign->Headings->Column2->Length, $FormDesign->Headings->Column2->FontSize, $MyRow2['description']); + $LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column3->x, $Page_Height - $YPos, $FormDesign->Headings->Column3->Length, $FormDesign->Headings->Column3->FontSize, $MyRow2['bin'], 'right'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column4->x, $Page_Height - $YPos, $FormDesign->Headings->Column4->Length, $FormDesign->Headings->Column4->FontSize, $DisplayQtySupplied, 'right'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column5->x, $Page_Height - $YPos, $FormDesign->Headings->Column5->Length, $FormDesign->Headings->Column5->FontSize, $DisplayQtyAvail, 'right'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column6->x, $Page_Height - $YPos, $FormDesign->Headings->Column6->Length, $FormDesign->Headings->Column6->FontSize, $DisplayPicked, 'right'); + + if ($Page_Height - $YPos - $line_height <= 60) { + /* We reached the end of the page so finish off the page and start a new */ + $PageNumber++; + include ('includes/GenPickingListHeader.inc'); + } //end if need a new page headed up + else { + /*increment a line down for the next line item */ + $YPos += ($line_height); + } + + if ($MyRow2['cust_part'] > '') { + $LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column2->x, $Page_Height - $YPos, $FormDesign->Headings->Column2->Length, $FormDesign->Headings->Column2->FontSize, $MyRow2['cust_part'] . ' ' . $MyRow2['cust_description']); + + if ($Page_Height - $YPos - $line_height <= 60) { + /* We reached the end of the page so finish off the page and start a new */ + $PageNumber++; + include ('includes/GenPickingListHeader.inc'); + } //end if need a new page headed up + else { + /*increment a line down for the next line item */ + $YPos += ($line_height); + } + } + + if ($MyRow2['narrative'] > '') { + $LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column2->x, $Page_Height - $YPos, $FormDesign->Headings->Column2->Length, $FormDesign->Headings->Column2->FontSize, $MyRow2['narrative']); + if ($Page_Height - $YPos - $line_height <= 60) { + /* We reached the end of the page so finish off the page and start a new */ + $PageNumber++; + include ('includes/GenPickingListHeader.inc'); + } //end if need a new page headed up + else { + /*increment a line down for the next line item */ + $YPos += ($line_height); + } + } + + if ($MyRow2['controlled'] == 1) { + if ($MyRow2['serialised'] == 1) { + $BundleLabel = _('Serial#:'); + } + else { + $BundleLabel = _('Lot#:'); + } + $SQL = "SELECT serialno, + quantity, + (SELECT SUM(moveqty) + FROM pickserialdetails + INNER JOIN pickreqdetails on pickreqdetails.detailno=pickserialdetails.detailno + INNER JOIN pickreq on pickreq.prid=pickreqdetails.prid + AND pickreq.closed=0 + WHERE pickserialdetails.serialno=stockserialitems.serialno + AND pickserialdetails.stockid=stockserialitems.stockid) as qtypickedtotal, + (SELECT SUM(moveqty) + FROM pickserialdetails + INNER JOIN pickreqdetails on pickreqdetails.detailno=pickserialdetails.detailno + INNER JOIN pickreq on pickreq.prid=pickreqdetails.prid + AND pickreq.orderno='" . $OrdersToPick[$i]['orderno'] . "' + AND pickreq.closed=0 + WHERE pickserialdetails.serialno=stockserialitems.serialno + AND pickserialdetails.stockid=stockserialitems.stockid) as qtypickedthisorder + FROM stockserialitems + WHERE stockid='" . $MyRow2['stkcode'] . "' + AND stockserialitems.loccode ='" . $OrdersToPick[$i]['loccode'] . "' + AND quantity > 0 + ORDER BY createdate, quantity"; + + $ErrMsg = '<br />' . _('Could not retrieve the items for') . ' ' . $MyRow2['stkcode']; + $Bundles = DB_query($SQL, $ErrMsg); + $YPos += ($line_height); + + while ($mybundles = DB_fetch_array($Bundles)) { + if ($mybundles['qtypickedthisorder'] == 0 or is_null($mybundles['qtypickedthisorder'])) { + $mybundles['qtypickedthisorder'] = '____________'; + } + + $LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column3->x, $Page_Height - $YPos, $FormDesign->Headings->Column3->Length, $FormDesign->Headings->Column3->FontSize, $BundleLabel, 'right'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column4->x, $Page_Height - $YPos, $FormDesign->Headings->Column4->Length, $FormDesign->Headings->Column4->FontSize, $mybundles['serialno'], 'left'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column5->x, $Page_Height - $YPos, $FormDesign->Headings->Column5->Length, $FormDesign->Headings->Column5->FontSize, $mybundles['quantity'] - $mybundles['qtypickedtotal'], 'right'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column6->x, $Page_Height - $YPos, $FormDesign->Headings->Column6->Length, $FormDesign->Headings->Column6->FontSize, $mybundles['qtypickedthisorder'], 'right'); + + if ($Page_Height - $YPos - $line_height <= 60) { + /* We reached the end of the page so finish off the page and start a new */ + $PageNumber++; + include ('includes/GenPickingListHeader.inc'); + } //end if need a new page headed up + else { + /*increment a line down for the next line item */ + $YPos += ($line_height); + } + } //while + } //controlled + + ++$Lines; + $YPos += ($line_height); + } //end while there are line items to print out + + $YPos = $Page_Height - 45; + $pdf->setFont('', 'B'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column2->x, $Page_Height - $YPos, $FormDesign->Headings->Column2->Length, $FormDesign->Headings->Column2->FontSize, _('Signed for: ') . '______________________________'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column3->x, $Page_Height - $YPos, $FormDesign->Headings->Column3->Length, $FormDesign->Headings->Column3->FontSize, _('Date : ') . '__________'); + $pdf->setFont('', ''); + } /*end if there are order details to show on the order*/ +} /*end for loop to print the whole lot twice */ + +if ($ListCount == 0) { + $Title = _('Print Picking List Error'); + include('includes/header.php'); + prnMsg( _('There are no picking lists to print'), 'error'); + include('includes/footer.php'); + exit; +} else { + $pdf->OutputD($_SESSION['DatabaseName'] . '_PickingLists_' . date('Y-m-d') . '.pdf'); + $pdf->__destruct(); + DB_Txn_Commit(); +} +?> \ No newline at end of file Added: trunk/PDFAck.php =================================================================== --- trunk/PDFAck.php (rev 0) +++ trunk/PDFAck.php 2018-01-26 23:55:55 UTC (rev 7924) @@ -0,0 +1,283 @@ +<?php + +/* $Id: PDFAcknowledgementPortrait.php 4491 2011-02-15 06:31:08Z daintree $ */ + +include('includes/session.php'); +include('includes/SQL_CommonFunctions.inc'); + +//Get Out if we have no order number to work with +If (!isset($_GET['AcknowledgementNo']) || $_GET['AcknowledgementNo'] == "") { + $Title = _('Select Acknowledgement To Print'); + include('includes/header.php'); + prnMsg(_('Select a Acknowledgement to Print before calling this page'), 'error'); + echo '<table class="table_index"> + <tr> + <td class="menu_group_item"> + <ul><li><a href="' . $RootPath . '/SelectSalesOrder.php?Acknowledgements=Quotes_Only">' . _('Acknowledgements') . '</a></li> + </ul> + </td> + </tr> + </table>'; + include('includes/footer.php'); + exit(); +} + +/*retrieve the order details from the database to print */ +$ErrMsg = _('There was a problem retrieving the Acknowledgement header details for Order Number') . ' ' . $_GET['AcknowledgementNo'] . ' ' . _('from the database'); + +$SQL = "SELECT salesorders.customerref, + salesorders.comments, + salesorders.orddate, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.freightcost, + debtorsmaster.debtorno, + debtorsmaster.name, + debtorsmaster.currcode, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + shippers.shippername, + salesorders.printedpackingslip, + salesorders.datepackingslipprinted, + salesorders.branchcode, + locations.taxprovinceid, + locations.locationname, + currencies.decimalplaces AS currdecimalplaces + FROM salesorders + INNER JOIN debtorsmaster + ON salesorders.debtorno=debtorsmaster.debtorno + INNER JOIN shippers + ON salesorders.shipvia=shippers.shipper_id + INNER JOIN locations + ON salesorders.fromstkloc=locations.loccode + INNER JOIN currencies + ON debtorsmaster.currcode=currencies.currabrev + AND salesorders.orderno='" . $_GET['AcknowledgementNo'] . "'"; + +$Result = DB_query($SQL, $ErrMsg); + +//If there are no rows, there's a problem. +if (DB_num_rows($Result) == 0) { + $Title = _('Print Acknowledgement Error'); + include('includes/header.php'); + prnMsg(_('Unable to Locate Acknowledgement Number') . ' : ' . $_GET['AcknowledgementNo'] . ' ', 'error'); + echo '<table class="table_index"> + <tr> + <td class="menu_group_item"> + <ul><li><a href="' . $RootPath . '/SelectSalesOrder.php?Acknowledgements=Quotes_Only">' . _('Outstanding Acknowledgements') . '</a></li></ul> + </td> + </tr> + </table>'; + include('includes/footer.php'); + exit; +} elseif (DB_num_rows($Result) == 1) { + /*There is only one order header returned - thats good! */ + $MyRow = DB_fetch_array($Result); +} + +/*retrieve the order details from the database to print */ + +/* Then there's an order to print and its not been printed already (or its been flagged for reprinting/ge_Width=807; +) +LETS GO */ +$Terms = $_SESSION['TermsAndConditions']; + +$PaperSize = 'Letter'; + +include('includes/PDFStarter.php'); +$pdf->addInfo('Title', _('Customer Acknowledgement')); +$pdf->addInfo('Subject', _('Acknowledgement') . ' ' . $_GET['AcknowledgementNo']); +$FontSize = 12; +$PageNumber = 1; +$line_height = $FontSize * 1.25; + +/* Now ... Has the order got any line items still outstanding to be invoiced */ + +$ErrMsg = _('There was a problem retrieving the Acknowledgement line details for Acknowledgement Number') . ' ' . $_GET['AcknowledgementNo'] . ' ' . _('from the database'); + +$SQL = "SELECT salesorderdetails.stkcode, + stockmaster.description, + salesorderdetails.quantity, + salesorderdetails.qtyinvoiced, + salesorderdetails.unitprice, + salesorderdetails.itemdue, + salesorderdetails.narrative, + stockmaster.taxcatid, + salesorderdetails.narrative, + stockmaster.decimalplaces, + custitem.cust_part, + custitem.cust_description + FROM salesorderdetails + INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + LEFT OUTER JOIN custitem + ON custitem.debtorno='" . $MyRow['debtorno'] . "' + AND custitem.stockid=stockmaster.stockid + WHERE salesorderdetails.orderno='" . $_GET['AcknowledgementNo'] . "'"; + +$Result = DB_query($SQL, $ErrMsg); + +$ListCount = 0; + +if (DB_num_rows($Result) > 0) { + /*Yes there are line items to start the ball rolling with a page header */ + include('includes/PDFAckPageHeader.php'); + + $AcknowledgementTotal = $MyRow['freightcost']; + $AcknowledgementTotalEx = 0; + $TaxTotal = 0; + + while ($MyRow2 = DB_fetch_array($Result)) { + + $ListCount++; + + if ((mb_strlen($MyRow2['narrative']) > 200 AND $YPos - $line_height <= 75) OR (mb_strlen($MyRow2['narrative']) > 1 AND $YPos - $line_height <= 62) OR $YPos - $line_height <= 50) { + /* We reached the end of the page so finsih off the page and start a newy */ + $PageNumber++; + include('includes/PDFAckPageHeader.php'); + + } //end if need a new page headed up + + $DisplayQty = locale_number_format($MyRow2['quantity'], $MyRow2['decimalplaces']); + $DisplayPrevDel = locale_number_format($MyRow2['qtyinvoiced'], $MyRow2['decimalplaces']); + //$DisplayPrice = locale_number_format($MyRow2['unitprice'],$MyRow['currdecimalplaces']); + $DisplayPrice = locale_number_format($MyRow2['unitprice'], 4); + $SubTot = $MyRow2['unitprice'] * $MyRow2['quantity'] * (1 - $MyRow2['discountpercent']); + $TaxProv = $MyRow['taxprovinceid']; + $TaxCat = $MyRow2['taxcatid']; + $Branch = $MyRow['branchcode']; + $SQL3 = " SELECT taxgrouptaxes.taxauthid + FROM taxgrouptaxes + INNER JOIN custbranch + ON taxgrouptaxes.taxgroupid=custbranch.taxgroupid + WHERE custbranch.branchcode='" . $Branch . "'"; + $Result3 = DB_query($SQL3, $ErrMsg); + while ($MyRow3 = DB_fetch_array($Result3)) { + $TaxAuth = $MyRow3['taxauthid']; + } + + $SQL4 = "SELECT taxrate + FROM taxauthrates + WHERE dispatchtaxprovince='" . $TaxProv . "' + AND taxcatid='" . $TaxCat . "' + AND taxauthority='" . $TaxAuth . "'"; + $Result4 = DB_query($SQL4, $ErrMsg); + while ($MyRow4 = DB_fetch_array($Result4)) { + $TaxClass = 100 * $MyRow4['taxrate']; + } + + $DisplayTaxClass = $TaxClass . "%"; + $TaxAmount = (($SubTot / 100) * (100 + $TaxClass)) - $SubTot; + $DisplayTaxAmount = locale_number_format($TaxAmount, $MyRow['currdecimalplaces']); + + $LineTotal = $SubTot + $TaxAmount; + $DisplayTotal = locale_number_format($LineTotal, $MyRow['currdecimalplaces']); + + $FontSize = 10; + + $LeftOvers = $pdf->addTextWrap($XPos + 1, $YPos, 100, $FontSize, $MyRow2['stkcode']); + $LeftOvers = $pdf->addTextWrap(120, $YPos, 295, $FontSize, $MyRow2['description']); + $LeftOvers = $pdf->addTextWrap(270, $YPos, 85, $FontSize, ConvertSQLDate($MyRow2['itemdue']), right); + $LeftOvers = $pdf->addTextWrap(350, $YPos, 85, $FontSize, $DisplayQty, 'right'); + $LeftOvers = $pdf->addTextWrap(400, $YPos, 85, $FontSize, $DisplayPrice, 'right'); + $LeftOvers = $pdf->addTextWrap($Page_Width - $Right_Margin - 90, $YPos, 90, $FontSize, $DisplayTotal, 'right'); + + if ($MyRow2['cust_part'] > '') { + $YPos -= $line_height; + $LeftOvers = $pdf->addTextWrap($XPos + 10, $YPos, 300, $FontSize, _('Customer Part') . ': ' . $MyRow2['cust_part'] . ' ' . $MyRow2['cust_description']); + //$LeftOvers = $pdf->addTextWrap(190,$YPos,186,$FontSize,$MyRow2['cust_description']); + } + + // Prints salesorderdetails.narrative + $Split = explode("\r\n", wordwrap($MyRow2['narrative'], 130, "\r\n")); + foreach ($Split as $TextLine) { + $YPos -= $line_height; // rchacon's suggestion: $YPos -= $FontSize; + if ($YPos < ($Bottom_Margin + $line_height)) { // Begins new page + $PageNumber++; + include('includes/PDFAckPageHeader.php'); + } + $LeftOvers = $pdf->addTextWrap($XPos + 1, $YPos, 750, 10, $TextLine); + } + $YPos -= $line_height; + + $AcknowledgementTotal += $LineTotal; + $AcknowledgementTotalEx += $SubTot; + $TaxTotal += $TaxAmount; + + /*increment a line down for the next line item */ + $YPos -= ($line_height); + + } //end while there are line items to print out + if ((mb_strlen($MyRow['comments']) > 200 AND $YPos - $line_height <= 75) OR (mb_strlen($MyRow['comments']) > 1 AND $YPos - $line_height <= 62) OR $YPos - $line_height <= 50) { + /* We reached the end of the page so finsih off the page and start a newy */ + $PageNumber++; + include('includes/PDFAckPageHeader.php'); + } //end if need a new page headed up + + $LeftOvers = $pdf->addTextWrap($XPos, $YPos - 80, 30, 10, _('Notes:')); + $LeftOvers = $pdf->addText($XPos, $YPos - 95, 10, $MyRow['comments']); + + if (mb_strlen($LeftOvers) > 1) { + $YPos -= 10; + $LeftOvers = $pdf->addTextWrap($XPos, $YPos, 700, 10, $LeftOvers); + if (mb_strlen($LeftOve... [truncated message content] |
From: <tu...@us...> - 2018-01-25 17:27:45
|
Revision: 7921 http://sourceforge.net/p/web-erp/reponame/7921 Author: turbopt Date: 2018-01-25 17:27:43 +0000 (Thu, 25 Jan 2018) Log Message: ----------- ReorderLevel.php: Exclude completed orders from on order counts. (Reported in forums by briantmg: http://www.weberp.org/forum/showthread.php?tid=8060) Modified Paths: -------------- trunk/ReorderLevel.php trunk/doc/Change.log Modified: trunk/ReorderLevel.php =================================================================== --- trunk/ReorderLevel.php 2018-01-24 23:28:23 UTC (rev 7920) +++ trunk/ReorderLevel.php 2018-01-25 17:27:43 UTC (rev 7921) @@ -83,12 +83,13 @@ $OnOrderSQL = "SELECT SUM(quantityord-quantityrecd) AS quantityonorder FROM purchorders LEFT JOIN purchorderdetails - ON purchorders.orderno=purchorderdetails.orderno - WHERE purchorders.status !='Cancelled' - AND purchorders.status !='Rejected' - AND purchorders.status !='Pending' - AND purchorderdetails.itemcode='".$myrow['stockid']."' - AND purchorders.intostocklocation='".$myrow['loccode']."'"; + ON purchorders.orderno=purchorderdetails.orderno + WHERE purchorders.status != 'Cancelled' + AND purchorders.status != 'Rejected' + AND purchorders.status != 'Pending' + AND purchorders.status != 'Completed' + AND purchorderdetails.itemcode='".$myrow['stockid']."' + AND purchorders.intostocklocation='".$myrow['loccode']."'"; $OnOrderResult = DB_query($OnOrderSQL); $OnOrderRow = DB_fetch_array($OnOrderResult); // Parameters for addTextWrap are defined in /includes/class.pdf.php Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-24 23:28:23 UTC (rev 7920) +++ trunk/doc/Change.log 2018-01-25 17:27:43 UTC (rev 7921) @@ -1,5 +1,6 @@ webERP Change Log +24/1/18 Briantmg (PaulT commit): ReorderLevel.php: Exclude completed orders from on order counts. (Reported in forums by briantmg: http://www.weberp.org/forum/showthread.php?tid=8060) 24/1/18 Paul Becker/PaulT (PaulT commit): SelectOrderItems.php: Paul B. Fix stock table columns NOT sorting on this page / PaulT. Use existing CSS to replace two style attributes. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8057&pid=13987#pid13987) 24/1/18 Andy Couling (PaulT commit): SupplierInvoice.php, CounterSales.php: Replace two other hard-coded styles with existing CSS class. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8057) 24/1/18 Paul Becker/PaulT (PaulT commit): SelectOrderItems.php: Paul B. Remove stray value output / PaulT. Replace hard-coded style with existing CSS class. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8057) |
From: <tu...@us...> - 2018-01-24 23:28:26
|
Revision: 7920 http://sourceforge.net/p/web-erp/reponame/7920 Author: turbopt Date: 2018-01-24 23:28:23 +0000 (Wed, 24 Jan 2018) Log Message: ----------- SelectOrderItems.php: Paul B. Fix stock table columns NOT sorting on this page / PaulT. Use existing CSS to replace two style attributes. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8057&pid=13987#pid13987) Modified Paths: -------------- trunk/SelectOrderItems.php trunk/doc/Change.log Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2018-01-24 17:46:27 UTC (rev 7919) +++ trunk/SelectOrderItems.php 2018-01-24 23:28:23 UTC (rev 7920) @@ -1694,9 +1694,12 @@ echo '<div>'; echo '<input name="FormID" type="hidden" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="table1">'; - echo '<tr><td colspan="1"><input name="PreviousList" type="hidden" value="'.strval($Offset-1).'" /><input tabindex="'.strval($j+8).'" type="submit" name="Previous" value="'._('Previous').'" /></td>'; - echo '<td style="text-align:center" colspan="6"><input name="SelectingOrderItems" type="hidden" value="1" /><input tabindex="'.strval($j+9).'" type="submit" value="'._('Add to Sales Order').'" /></td>'; - echo '<td colspan="1"><input name="NextList" type="hidden" value="'.strval($Offset+1).'" /><input tabindex="'.strval($j+10).'" name="Next" type="submit" value="'._('Next').'" /></td></tr>'; + echo '<thead><tr> + <td colspan="1"><input name="PreviousList" type="hidden" value="'.strval($Offset-1).'" /><input tabindex="'.strval($j+8).'" type="submit" name="Previous" value="'._('Previous').'" /></td> + <td class="centre" colspan="6"><input name="SelectingOrderItems" type="hidden" value="1" /><input tabindex="'.strval($j+9).'" type="submit" value="'._('Add to Sales Order').'" /></td> + <td colspan="1"><input name="NextList" type="hidden" value="'.strval($Offset+1).'" /><input tabindex="'.strval($j+10).'" name="Next" type="submit" value="'._('Next').'" /></td> + </tr></thead>'; + echo '<tbody>'; echo '<tr> <th class="ascending" >' . _('Code') . '</th> <th class="ascending" >' . _('Description') . '</th> @@ -1789,11 +1792,12 @@ #end of page full new headings if } #end of while loop - echo '<tr> + echo '</tbody>'; + echo '<tfoot><tr> <td><input name="PreviousList" type="hidden" value="'. strval($Offset-1).'" /><input tabindex="'. strval($j+7).'" type="submit" name="Previous" value="'._('Previous').'" /></td> - <td style="text-align:center" colspan="6"><input name="SelectingOrderItems" type="hidden" value="1" /><input tabindex="'. strval($j+8).'" type="submit" value="'._('Add to Sales Order').'" /></td> + <td class="centre" colspan="6"><input name="SelectingOrderItems" type="hidden" value="1" /><input tabindex="'. strval($j+8).'" type="submit" value="'._('Add to Sales Order').'" /></td> <td><input name="NextList" type="hidden" value="'.strval($Offset+1).'" /><input tabindex="'.strval($j+9).'" name="Next" type="submit" value="'._('Next').'" /></td> - </tr> + </tr></tfoot> </table> </div>'; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-24 17:46:27 UTC (rev 7919) +++ trunk/doc/Change.log 2018-01-24 23:28:23 UTC (rev 7920) @@ -1,5 +1,6 @@ webERP Change Log +24/1/18 Paul Becker/PaulT (PaulT commit): SelectOrderItems.php: Paul B. Fix stock table columns NOT sorting on this page / PaulT. Use existing CSS to replace two style attributes. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8057&pid=13987#pid13987) 24/1/18 Andy Couling (PaulT commit): SupplierInvoice.php, CounterSales.php: Replace two other hard-coded styles with existing CSS class. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8057) 24/1/18 Paul Becker/PaulT (PaulT commit): SelectOrderItems.php: Paul B. Remove stray value output / PaulT. Replace hard-coded style with existing CSS class. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8057) 15/1/18 Paul Becker (PaulT commit): CustomerPurchases.php: Adds Units and Discount columns and other minor changes so that it more closely matches output from OrderDetails.php. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8040) |
From: <tu...@us...> - 2018-01-24 17:46:29
|
Revision: 7919 http://sourceforge.net/p/web-erp/reponame/7919 Author: turbopt Date: 2018-01-24 17:46:27 +0000 (Wed, 24 Jan 2018) Log Message: ----------- SupplierInvoice.php, CounterSales.php: Replace two other hard-coded styles with existing CSS class. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8057) Modified Paths: -------------- trunk/CounterSales.php trunk/SupplierInvoice.php trunk/doc/Change.log Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2018-01-24 17:16:45 UTC (rev 7918) +++ trunk/CounterSales.php 2018-01-24 17:46:27 UTC (rev 7919) @@ -743,7 +743,7 @@ echo '<br /> <table width="90%" cellpadding="2"> - <tr style="background-color:#800000">'; + <tr style="tableheader">'; echo '<th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> <th>' . _('Quantity') . '</th> Modified: trunk/SupplierInvoice.php =================================================================== --- trunk/SupplierInvoice.php 2018-01-24 17:16:45 UTC (rev 7918) +++ trunk/SupplierInvoice.php 2018-01-24 17:46:27 UTC (rev 7919) @@ -667,7 +667,7 @@ <tr> <th colspan="6">' . _('Purchase Order Charges') . '</th> </tr>'; - $tableheader = '<tr style="background-color:#800000"> + $tableheader = '<tr style="tableheader"> <th>' . _('Seq') . ' #</th> <th>' . _('GRN Batch') . '</th> <th>' . _('Supplier Ref') . '</th> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-24 17:16:45 UTC (rev 7918) +++ trunk/doc/Change.log 2018-01-24 17:46:27 UTC (rev 7919) @@ -1,5 +1,6 @@ webERP Change Log +24/1/18 Andy Couling (PaulT commit): SupplierInvoice.php, CounterSales.php: Replace two other hard-coded styles with existing CSS class. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8057) 24/1/18 Paul Becker/PaulT (PaulT commit): SelectOrderItems.php: Paul B. Remove stray value output / PaulT. Replace hard-coded style with existing CSS class. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8057) 15/1/18 Paul Becker (PaulT commit): CustomerPurchases.php: Adds Units and Discount columns and other minor changes so that it more closely matches output from OrderDetails.php. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8040) 12/1/18 Paul Becker (PaulT commit): CustomerPurchases.php: Fix script to show actual Price and actual Amount of Sale based upon discount. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8040) |
From: <tu...@us...> - 2018-01-24 17:16:47
|
Revision: 7918 http://sourceforge.net/p/web-erp/reponame/7918 Author: turbopt Date: 2018-01-24 17:16:45 +0000 (Wed, 24 Jan 2018) Log Message: ----------- SelectOrderItems.php: Paul B. Remove stray value output / PaulT. Replace hard-coded style with existing CSS class. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8057) Modified Paths: -------------- trunk/SelectOrderItems.php trunk/doc/Change.log Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2018-01-15 22:41:51 UTC (rev 7917) +++ trunk/SelectOrderItems.php 2018-01-24 17:16:45 UTC (rev 7918) @@ -1351,7 +1351,7 @@ echo '<div class="page_help_text">' . _('Quantity (required) - Enter the number of units ordered. Price (required) - Enter the unit price. Discount (optional) - Enter a percentage discount. GP% (optional) - Enter a percentage Gross Profit (GP) to add to the unit cost. Due Date (optional) - Enter a date for delivery.') . '</div><br />'; echo '<br /> <table width="90%" cellpadding="2"> - <tr style="background-color:#800000">'; + <tr class="tableheader">'; /* if($_SESSION['Items'.$identifier]->DefaultPOLine == 1){*/ if($ShowPOLine) { echo '<th>' . _('PO Line') . '</th>'; @@ -1471,7 +1471,6 @@ echo '<tr class="EvenTableRows"> <td class="number" colspan="6"><b>' . _('TOTAL Excl Tax/Freight') . '</b></td> <td colspan="' . $varColSpan . '" class="number"><b>' . $DisplayTotal . '</b></td> - <td colspan="2">' . $ShowDiscountGP . ' </td> </tr> </table>'; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-15 22:41:51 UTC (rev 7917) +++ trunk/doc/Change.log 2018-01-24 17:16:45 UTC (rev 7918) @@ -1,5 +1,6 @@ webERP Change Log +24/1/18 Paul Becker/PaulT (PaulT commit): SelectOrderItems.php: Paul B. Remove stray value output / PaulT. Replace hard-coded style with existing CSS class. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8057) 15/1/18 Paul Becker (PaulT commit): CustomerPurchases.php: Adds Units and Discount columns and other minor changes so that it more closely matches output from OrderDetails.php. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8040) 12/1/18 Paul Becker (PaulT commit): CustomerPurchases.php: Fix script to show actual Price and actual Amount of Sale based upon discount. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8040) 9/1/18 PaulT: Payments.php: Remove my debug/test echo line from the previous commit. |
From: <tu...@us...> - 2018-01-15 22:41:54
|
Revision: 7917 http://sourceforge.net/p/web-erp/reponame/7917 Author: turbopt Date: 2018-01-15 22:41:51 +0000 (Mon, 15 Jan 2018) Log Message: ----------- CustomerPurchases.php: Adds Units and Discount columns and other minor changes so that it more closely matches output from OrderDetails.php. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8040) Modified Paths: -------------- trunk/CustomerPurchases.php trunk/doc/Change.log Modified: trunk/CustomerPurchases.php =================================================================== --- trunk/CustomerPurchases.php 2018-01-12 22:59:06 UTC (rev 7916) +++ trunk/CustomerPurchases.php 2018-01-15 22:41:51 UTC (rev 7917) @@ -37,6 +37,7 @@ $SQL = "SELECT stockmoves.stockid, stockmaster.description, + stockmaster.units, systypes.typename, transno, locations.locationname, @@ -84,9 +85,11 @@ <th>' . _('Transaction No.') . '</th> <th>' . _('From Location') . '</th> <th>' . _('Branch Code') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit') . '</th> <th>' . _('Price') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Amount of Sale') . '</th> + <th>' . _('Discount') . '</th> + <th>' . _('Total') . '</th> <th>' . _('Reference') . '</th> <th>' . _('Narrative') . '</th> </tr>'; @@ -100,8 +103,10 @@ <td class="number">' . $StockMovesRow['transno'] . '</td> <td>' . $StockMovesRow['locationname'] . '</td> <td>' . $StockMovesRow['branchcode'] . '</td> + <td class="number">' . -$StockMovesRow['qty'] . '</td> + <td>' . $StockMovesRow['units'] . '</td> <td class="number">' . locale_number_format($StockMovesRow['price'] * (1 - $StockMovesRow['discountpercent']), $_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . locale_number_format(-$StockMovesRow['qty'], $_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format(($StockMovesRow['discountpercent'] * 100),2) . '%' . '</td> <td class="number">' . locale_number_format((-$StockMovesRow['qty'] * $StockMovesRow['price'] * (1 - $StockMovesRow['discountpercent'])), $_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . $StockMovesRow['reference'] . '</td> <td>' . $StockMovesRow['narrative'] . '</td> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-12 22:59:06 UTC (rev 7916) +++ trunk/doc/Change.log 2018-01-15 22:41:51 UTC (rev 7917) @@ -1,5 +1,6 @@ webERP Change Log +15/1/18 Paul Becker (PaulT commit): CustomerPurchases.php: Adds Units and Discount columns and other minor changes so that it more closely matches output from OrderDetails.php. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8040) 12/1/18 Paul Becker (PaulT commit): CustomerPurchases.php: Fix script to show actual Price and actual Amount of Sale based upon discount. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8040) 9/1/18 PaulT: Payments.php: Remove my debug/test echo line from the previous commit. 9/1/18 Paul Becker (PaulT commit): Payments.php: Show bank balance at payments. Know that balance display/output is protected by a similar security check manner as protected information at the dashboard. (Reported in forums: http://weberp.org/forum/showthread.php?tid=8017) |
From: <tu...@us...> - 2018-01-12 22:59:09
|
Revision: 7916 http://sourceforge.net/p/web-erp/reponame/7916 Author: turbopt Date: 2018-01-12 22:59:06 +0000 (Fri, 12 Jan 2018) Log Message: ----------- CustomerPurchases.php: Fix script to show actual Price and actual Amount of Sale based upon discount. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8040) Modified Paths: -------------- trunk/CustomerPurchases.php trunk/doc/Change.log Modified: trunk/CustomerPurchases.php =================================================================== --- trunk/CustomerPurchases.php 2018-01-11 08:08:07 UTC (rev 7915) +++ trunk/CustomerPurchases.php 2018-01-12 22:59:06 UTC (rev 7916) @@ -45,6 +45,7 @@ price, reference, qty, + discountpercent, narrative FROM stockmoves INNER JOIN stockmaster @@ -99,9 +100,9 @@ <td class="number">' . $StockMovesRow['transno'] . '</td> <td>' . $StockMovesRow['locationname'] . '</td> <td>' . $StockMovesRow['branchcode'] . '</td> - <td class="number">' . locale_number_format($StockMovesRow['price'], $_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($StockMovesRow['price'] * (1 - $StockMovesRow['discountpercent']), $_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format(-$StockMovesRow['qty'], $_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . locale_number_format((-$StockMovesRow['qty'] * $StockMovesRow['price']), $_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format((-$StockMovesRow['qty'] * $StockMovesRow['price'] * (1 - $StockMovesRow['discountpercent'])), $_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . $StockMovesRow['reference'] . '</td> <td>' . $StockMovesRow['narrative'] . '</td> </tr>'; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-11 08:08:07 UTC (rev 7915) +++ trunk/doc/Change.log 2018-01-12 22:59:06 UTC (rev 7916) @@ -1,5 +1,6 @@ webERP Change Log +12/1/18 Paul Becker (PaulT commit): CustomerPurchases.php: Fix script to show actual Price and actual Amount of Sale based upon discount. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8040) 9/1/18 PaulT: Payments.php: Remove my debug/test echo line from the previous commit. 9/1/18 Paul Becker (PaulT commit): Payments.php: Show bank balance at payments. Know that balance display/output is protected by a similar security check manner as protected information at the dashboard. (Reported in forums: http://weberp.org/forum/showthread.php?tid=8017) 9/1/18 Paul Becker (PaulT commit): Z_MakeNewCompany.php, default.sql, demo.sql: Remove doubled underscore in EDI_Sent reference. (Reported in forums: http://weberp.org/forum/showthread.php?tid=7920) |
From: <dai...@us...> - 2018-01-11 08:08:10
|
Revision: 7915 http://sourceforge.net/p/web-erp/reponame/7915 Author: daintree Date: 2018-01-11 08:08:07 +0000 (Thu, 11 Jan 2018) Log Message: ----------- Modified Paths: -------------- trunk/BankAccountBalances.php Modified: trunk/BankAccountBalances.php =================================================================== --- trunk/BankAccountBalances.php 2018-01-11 07:49:09 UTC (rev 7914) +++ trunk/BankAccountBalances.php 2018-01-11 08:08:07 UTC (rev 7915) @@ -10,8 +10,8 @@ echo '<p class="page_title_text"><img src="', $RootPath, '/css/', $_SESSION['Theme'], '/images/bank.png" title="', _('Bank Account Balances'), '" alt="" /> ', _('Bank Account Balances'), ' - </p< - table> + </p> + <table> <tr> <th>', _('Bank Account'), '</th> <th>', _('Account Name'), '</th> @@ -19,19 +19,18 @@ <th>', _('Balance in functional currency'), '</th> </tr>'; -$SQL = "SELECT bankaccounts.accountcode, - currcode, - bankaccountname +$SQL = "SELECT DISTINCT bankaccounts.accountcode, + currcode, + bankaccountname FROM bankaccounts INNER JOIN bankaccountusers - ON bankaccounts.accountcode=bankaccountusers.accountcode - AND userid='" . $_SESSION['UserID'] . "'"; + ON bankaccounts.accountcode=bankaccountusers.accountcode + AND userid='" . $_SESSION['UserID'] . "'"; $Result = DB_query($SQL); if (DB_num_rows($Result) == 0) { echo _('There are no bank accounts defined that you have authority to see'); } else { - while ($MyBankRow = DB_fetch_array($Result)) { $CurrBalanceSQL = "SELECT SUM(amount) AS balance FROM banktrans WHERE bankact='" . $MyBankRow['accountcode'] . "'"; $CurrBalanceResult = DB_query($CurrBalanceSQL); |
From: <dai...@us...> - 2018-01-11 07:49:12
|
Revision: 7914 http://sourceforge.net/p/web-erp/reponame/7914 Author: daintree Date: 2018-01-11 07:49:09 +0000 (Thu, 11 Jan 2018) Log Message: ----------- Files I had meant to commmit but missed Added Paths: ----------- trunk/BOMs_SingleLevel.php trunk/BankAccountBalances.php Added: trunk/BOMs_SingleLevel.php =================================================================== --- trunk/BOMs_SingleLevel.php (rev 0) +++ trunk/BOMs_SingleLevel.php 2018-01-11 07:49:09 UTC (rev 7914) @@ -0,0 +1,979 @@ +<?php + +/* $Id: BOMs.php 6942 2014-10-27 02:48:29Z daintree $*/ + +include('includes/session.inc'); + +$Title = _('Bill Of Materials Maintenance'); + +include('includes/header.inc'); +include('includes/SQL_CommonFunctions.inc'); + +function display_children($Parent, $Level, &$BOMTree) { + + global $db; + global $i; + + // retrive all children of parent + $c_result = DB_query("SELECT parent, + component + FROM bom + WHERE parent='" . $Parent. "' + ORDER BY sequence ASC"); + if (DB_num_rows($c_result) > 0) { + + while ($row = DB_fetch_array($c_result)) { + //echo '<br />Parent: ' . $Parent . ' Level: ' . $Level . ' row[component]: ' . $row['component'] . '<br />'; + if ($Parent != $row['component']) { + // indent and display the title of this child + $BOMTree[$i]['Level'] = $Level; // Level + if ($Level > 15) { + prnMsg(_('A maximum of 15 levels of bill of materials only can be displayed'),'error'); + exit; + } + $BOMTree[$i]['Parent'] = $Parent; // Assemble + $BOMTree[$i]['Component'] = $row['component']; // Component + $i++; + } + } + } +} + + +function CheckForRecursiveBOM ($UltimateParent, $ComponentToCheck, $db) { + +/* returns true ie 1 if the BOM contains the parent part as a component +ie the BOM is recursive otherwise false ie 0 */ + + $sql = "SELECT component FROM bom WHERE parent='".$ComponentToCheck."'"; + $ErrMsg = _('An error occurred in retrieving the components of the BOM during the check for recursion'); + $DbgMsg = _('The SQL that was used to retrieve the components of the BOM and that failed in the process was'); + $result = DB_query($sql,$ErrMsg,$DbgMsg); + + if (DB_num_rows($result)!=0) { + while ($myrow=DB_fetch_array($result)){ + if ($myrow['component']==$UltimateParent){ + return 1; + } + if (CheckForRecursiveBOM($UltimateParent, $myrow['component'],$db)){ + return 1; + } + } //(while loop) + } //end if $result is true + + return 0; + +} //end of function CheckForRecursiveBOM + +function DisplayBOMItems($UltimateParent, $Parent, $Component,$Level, $db) { + + global $ParentMBflag; + $sql = "SELECT bom.sequence, + bom.component, + stockmaster.description as itemdescription, + stockmaster.units, + locations.locationname, + locations.loccode, + workcentres.description as workcentrename, + workcentres.code as workcentrecode, + bom.quantity, + bom.effectiveafter, + bom.effectiveto, + stockmaster.mbflag, + bom.autoissue, + stockmaster.controlled, + locstock.quantity AS qoh, + stockmaster.decimalplaces + FROM bom INNER JOIN stockmaster + ON bom.component=stockmaster.stockid + INNER JOIN locations ON + bom.loccode = locations.loccode + INNER JOIN workcentres + ON bom.workcentreadded=workcentres.code + INNER JOIN locstock + ON bom.loccode=locstock.loccode + AND bom.component = locstock.stockid + INNER JOIN locationusers ON locationusers.loccode=locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 + WHERE bom.component='".$Component."' + AND bom.parent = '".$Parent."'"; + + $ErrMsg = _('Could not retrieve the BOM components because'); + $DbgMsg = _('The SQL used to retrieve the components was'); + $result = DB_query($sql,$ErrMsg,$DbgMsg); + + //echo $TableHeader; + $RowCounter =0; + + while ($myrow=DB_fetch_array($result)) { + + $Level1 = str_repeat('- ',$Level-1).$Level; + if( $myrow['mbflag']=='B' + OR $myrow['mbflag']=='K' + OR $myrow['mbflag']=='D') { + + $DrillText = '%s%s'; + $DrillLink = '<div class="centre">' . _('No lower levels') . '</div>'; + $DrillID=''; + } else { + $DrillText = '<a href="%s&Select=%s">' . _('Drill Down') . '</a>'; + $DrillLink = htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?'; + $DrillID=$myrow['component']; + } + if ($ParentMBflag!='M' AND $ParentMBflag!='G'){ + $AutoIssue = _('N/A'); + } elseif ($myrow['controlled']==0 AND $myrow['autoissue']==1){//autoissue and not controlled + $AutoIssue = _('Yes'); + } elseif ($myrow['controlled']==1) { + $AutoIssue = _('No'); + } else { + $AutoIssue = _('N/A'); + } + + if ($myrow['mbflag']=='D' //dummy orservice + OR $myrow['mbflag']=='K' //kit-set + OR $myrow['mbflag']=='A' // assembly + OR $myrow['mbflag']=='G') /* ghost */ { + + $QuantityOnHand = _('N/A'); + } else { + $QuantityOnHand = locale_number_format($myrow['qoh'],$myrow['decimalplaces']); + } + + printf('<td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td><a href="%s&Select=%s&SelectedComponent=%s">' . _('Edit') . '</a></td> + <td><a href="%s&Select=%s&SelectedComponent=%s&delete=1&ReSelect=%s&Location=%s&WorkCentre=%s" onclick="return confirm(\'' . _('Are you sure you wish to delete this component from the bill of material?') . '\');">' . _('Delete') . '</a></td> + </tr>', + $myrow['sequence'], + $myrow['component'], + $myrow['itemdescription'], + $myrow['locationname'], + $myrow['workcentrename'], + locale_number_format($myrow['quantity'],'Variable'), + $myrow['units'], + ConvertSQLDate($myrow['effectiveafter']), + ConvertSQLDate($myrow['effectiveto']), + $AutoIssue, + $QuantityOnHand, + htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?', + $Parent, + $myrow['component'], + htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?', + $Parent, + $myrow['component'], + $UltimateParent, + $myrow['loccode'], + $myrow['workcentrecode']); + + } //END WHILE LIST LOOP +} //end of function DisplayBOMItems + +//--------------------------------------------------------------------------------- + +/* SelectedParent could come from a post or a get */ +if (isset($_GET['SelectedParent'])){ + $SelectedParent = $_GET['SelectedParent']; +}else if (isset($_POST['SelectedParent'])){ + $SelectedParent = $_POST['SelectedParent']; +} + + + +/* SelectedComponent could also come from a post or a get */ +if (isset($_GET['SelectedComponent'])){ + $SelectedComponent = $_GET['SelectedComponent']; +} elseif (isset($_POST['SelectedComponent'])){ + $SelectedComponent = $_POST['SelectedComponent']; +} + +/* delete function requires Location to be set */ +if (isset($_GET['Location'])){ + $Location = $_GET['Location']; +} elseif (isset($_POST['Location'])){ + $Location = $_POST['Location']; +} + +/* delete function requires WorkCentre to be set */ +if (isset($_GET['WorkCentre'])){ + $WorkCentre = $_GET['WorkCentre']; +} elseif (isset($_POST['WorkCentre'])){ + $WorkCentre = $_POST['WorkCentre']; +} + +if (isset($_GET['Select'])){ + $Select = $_GET['Select']; +} elseif (isset($_POST['Select'])){ + $Select = $_POST['Select']; +} + + +$msg=''; + +if (isset($Errors)) { + unset($Errors); +} + +$Errors = array(); +$InputError = 0; + +if (isset($Select)) { //Parent Stock Item selected so display BOM or edit Component + $SelectedParent = $Select; + unset($Select);// = NULL; + echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/maintenance.png" title="' . _('Search') . + '" alt="" />' . ' ' . $Title . '</p><br />'; + + if (isset($SelectedParent) AND isset($_POST['Submit'])) { + + //editing a component need to do some validation of inputs + + $i = 1; + + if (!Is_Date($_POST['EffectiveAfter'])) { + $InputError = 1; + prnMsg(_('The effective after date field must be a date in the format') . ' ' .$_SESSION['DefaultDateFormat'],'error'); + $Errors[$i] = 'EffectiveAfter'; + $i++; + } + if (!Is_Date($_POST['EffectiveTo'])) { + $InputError = 1; + prnMsg(_('The effective to date field must be a date in the format') . ' ' .$_SESSION['DefaultDateFormat'],'error'); + $Errors[$i] = 'EffectiveTo'; + $i++; + } + if (!is_numeric(filter_number_format($_POST['Quantity']))) { + $InputError = 1; + prnMsg(_('The quantity entered must be numeric'),'error'); + $Errors[$i] = 'Quantity'; + $i++; + } + if (filter_number_format($_POST['Quantity'])==0) { + $InputError = 1; + prnMsg(_('The quantity entered cannot be zero'),'error'); + $Errors[$i] = 'Quantity'; + $i++; + } + if(!Date1GreaterThanDate2($_POST['EffectiveTo'], $_POST['EffectiveAfter'])){ + $InputError = 1; + prnMsg(_('The effective to date must be a date after the effective after date') . '<br />' . _('The effective to date is') . ' ' . DateDiff($_POST['EffectiveTo'], $_POST['EffectiveAfter'], 'd') . ' ' . _('days before the effective after date') . '! ' . _('No updates have been performed') . '.<br />' . _('Effective after was') . ': ' . $_POST['EffectiveAfter'] . ' ' . _('and effective to was') . ': ' . $_POST['EffectiveTo'],'error'); + $Errors[$i] = 'EffectiveAfter'; + $i++; + $Errors[$i] = 'EffectiveTo'; + $i++; + } + if($_POST['AutoIssue']==1 AND isset($_POST['Component'])){ + $sql = "SELECT controlled FROM stockmaster WHERE stockid='" . $_POST['Component'] . "'"; + $CheckControlledResult = DB_query($sql); + $CheckControlledRow = DB_fetch_row($CheckControlledResult); + if ($CheckControlledRow[0]==1){ + prnMsg(_('Only non-serialised or non-lot controlled items can be set to auto issue. These items require the lot/serial numbers of items issued to the works orders to be specified so autoissue is not an option. Auto issue has been automatically set to off for this component'),'warn'); + $_POST['AutoIssue']=0; + } + } + + if (!in_array('EffectiveAfter', $Errors)) { + $EffectiveAfterSQL = FormatDateForSQL($_POST['EffectiveAfter']); + } + if (!in_array('EffectiveTo', $Errors)) { + $EffectiveToSQL = FormatDateForSQL($_POST['EffectiveTo']); + } + + if (isset($SelectedParent) AND isset($SelectedComponent) AND $InputError != 1) { + + + $sql = "UPDATE bom SET sequence='" . $_POST['Sequence'] . "', + workcentreadded='" . $_POST['WorkCentreAdded'] . "', + loccode='" . $_POST['LocCode'] . "', + effectiveafter='" . $EffectiveAfterSQL . "', + effectiveto='" . $EffectiveToSQL . "', + quantity= '" . filter_number_format($_POST['Quantity']) . "', + autoissue='" . $_POST['AutoIssue'] . "' + WHERE bom.parent='" . $SelectedParent . "' + AND bom.component='" . $SelectedComponent . "'"; + + $ErrMsg = _('Could not update this BOM component because'); + $DbgMsg = _('The SQL used to update the component was'); + + $result = DB_query($sql,$ErrMsg,$DbgMsg); + $msg = _('Details for') . ' - ' . $SelectedComponent . ' ' . _('have been updated') . '.'; + UpdateCost($db, $SelectedComponent); + + } elseif ($InputError !=1 AND ! isset($SelectedComponent) AND isset($SelectedParent)) { + + /*Selected component is null cos no item selected on first time round so must be adding a record must be Submitting new entries in the new component form */ + + //need to check not recursive BOM component of itself! + + if (!CheckForRecursiveBOM ($SelectedParent, $_POST['Component'], $db)) { + + /*Now check to see that the component is not already on the BOM */ + $sql = "SELECT component + FROM bom + WHERE parent='".$SelectedParent."' + AND component='" . $_POST['Component'] . "' + AND workcentreadded='" . $_POST['WorkCentreAdded'] . "' + AND loccode='" . $_POST['LocCode'] . "'" ; + + $ErrMsg = _('An error occurred in checking the component is not already on the BOM'); + $DbgMsg = _('The SQL that was used to check the component was not already on the BOM and that failed in the process was'); + + $result = DB_query($sql,$ErrMsg,$DbgMsg); + + if (DB_num_rows($result)==0) { + + $sql = "INSERT INTO bom (sequence, + parent, + component, + workcentreadded, + loccode, + quantity, + effectiveafter, + effectiveto, + autoissue) + VALUES ('" . $_POST['Sequence'] . "', + '".$SelectedParent."', + '" . $_POST['Component'] . "', + '" . $_POST['WorkCentreAdded'] . "', + '" . $_POST['LocCode'] . "', + " . filter_number_format($_POST['Quantity']) . ", + '" . $EffectiveAfterSQL . "', + '" . $EffectiveToSQL . "', + " . $_POST['AutoIssue'] . ")"; + + $ErrMsg = _('Could not insert the BOM component because'); + $DbgMsg = _('The SQL used to insert the component was'); + + $result = DB_query($sql,$ErrMsg,$DbgMsg); + + UpdateCost($db, $_POST['Component']); + $msg = _('A new component part') . ' ' . $_POST['Component'] . ' ' . _('has been added to the bill of material for part') . ' - ' . $SelectedParent . '.'; + + } else { + + /*The component must already be on the BOM */ + + prnMsg( _('The component') . ' ' . $_POST['Component'] . ' ' . _('is already recorded as a component of') . ' ' . $SelectedParent . '.' . '<br />' . _('Whilst the quantity of the component required can be modified it is inappropriate for a component to appear more than once in a bill of material'),'error'); + $Errors[$i]='ComponentCode'; + } + + + } //end of if its not a recursive BOM + + } //end of if no input errors + + if ($msg != '') {prnMsg($msg,'success');} + + } elseif (isset($_GET['delete']) AND isset($SelectedComponent) AND isset($SelectedParent)) { + + //the link to delete a selected record was clicked instead of the Submit button + + $sql="DELETE FROM bom + WHERE parent='".$SelectedParent."' + AND component='".$SelectedComponent."' + AND loccode='".$Location."' + AND workcentreadded='".$WorkCentre."'"; + + $ErrMsg = _('Could not delete this BOM components because'); + $DbgMsg = _('The SQL used to delete the BOM was'); + $result = DB_query($sql,$ErrMsg,$DbgMsg); + + $ComponentSQL = "SELECT component + FROM bom + WHERE parent='" . $SelectedParent ."'"; + $ComponentResult = DB_query($ComponentSQL); + $ComponentArray = DB_fetch_row($ComponentResult); + UpdateCost($db, $ComponentArray[0]); + + prnMsg(_('The component part') . ' - ' . $SelectedComponent . ' - ' . _('has been deleted from this BOM'),'success'); + // Now reset to enable New Component Details to display after delete + unset($_GET['SelectedComponent']); + } elseif (isset($SelectedParent) + AND !isset($SelectedComponent) + AND ! isset($_POST['submit'])) { + + /* It could still be the second time the page has been run and a record has been selected for modification - SelectedParent will exist because it was sent with the new call. if its the first time the page has been displayed with no parameters then none of the above are true and the list of components 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*/ + //DisplayBOMItems($SelectedParent, $db); + + } //BOM editing/insertion ifs + + + if(isset($_GET['ReSelect'])) { + $SelectedParent = $_GET['ReSelect']; + } + + //DisplayBOMItems($SelectedParent, $db); + $sql = "SELECT stockmaster.description, + stockmaster.mbflag + FROM stockmaster + WHERE stockmaster.stockid='" . $SelectedParent . "'"; + + $ErrMsg = _('Could not retrieve the description of the parent part because'); + $DbgMsg = _('The SQL used to retrieve description of the parent part was'); + $result=DB_query($sql,$ErrMsg,$DbgMsg); + + $myrow=DB_fetch_row($result); + + $ParentMBflag = $myrow[1]; + + switch ($ParentMBflag){ + case 'A': + $MBdesc = _('Assembly'); + break; + case 'B': + $MBdesc = _('Purchased'); + break; + case 'M': + $MBdesc = _('Manufactured'); + break; + case 'K': + $MBdesc = _('Kit Set'); + break; + case 'G': + $MBdesc = _('Phantom'); + break; + } + + echo '<br /><div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">' . _('Select a Different BOM') . '</a></div><br />'; + // Display Manufatured Parent Items + $sql = "SELECT bom.parent, + stockmaster.description, + stockmaster.mbflag + FROM bom INNER JOIN locationusers ON locationusers.loccode=bom.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1, stockmaster + WHERE bom.component='".$SelectedParent."' + AND stockmaster.stockid=bom.parent + AND stockmaster.mbflag='M'"; + + $ErrMsg = _('Could not retrieve the description of the parent part because'); + $DbgMsg = _('The SQL used to retrieve description of the parent part was'); + $result=DB_query($sql,$ErrMsg,$DbgMsg); + $ix = 0; + if( DB_num_rows($result) > 0 ) { + echo '<table class="selection">'; + echo '<tr><td><div class="centre">' . _('Manufactured parent items').' : '; + while ($myrow = DB_fetch_array($result)){ + echo (($ix)?', ':'') . '<a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Select='.$myrow['parent'].'">' . + $myrow['description'].' ('.$myrow['parent'].')</a>'; + $ix++; + } //end while loop + echo '</div></td></tr>'; + echo '</table>'; + } + // Display Assembly Parent Items + $sql = "SELECT bom.parent, + stockmaster.description, + stockmaster.mbflag + FROM bom INNER JOIN stockmaster + ON bom.parent=stockmaster.stockid + WHERE bom.component='".$SelectedParent."' + AND stockmaster.mbflag='A'"; + + $ErrMsg = _('Could not retrieve the description of the parent part because'); + $DbgMsg = _('The SQL used to retrieve description of the parent part was'); + $result=DB_query($sql,$ErrMsg,$DbgMsg); + if( DB_num_rows($result) > 0 ) { + echo '<table class="selection">'; + echo '<tr><td><div class="centre">' . _('Assembly parent items').' : '; + $ix = 0; + while ($myrow = DB_fetch_array($result)){ + echo (($ix)?', ':'') . '<a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Select='.$myrow['parent'].'">' . + $myrow['description'].' ('.$myrow['parent'].')</a>'; + $ix++; + } //end while loop + echo '</div></td></tr>'; + echo '</table>'; + } + // Display Kit Sets + $sql = "SELECT bom.parent, + stockmaster.description, + stockmaster.mbflag + FROM bom INNER JOIN stockmaster + ON bom.parent=stockmaster.stockid + INNER JOIN locationusers ON locationusers.loccode=bom.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 + WHERE bom.component='".$SelectedParent."' + AND stockmaster.mbflag='K'"; + + $ErrMsg = _('Could not retrieve the description of the parent part because'); + $DbgMsg = _('The SQL used to retrieve description of the parent part was'); + $result=DB_query($sql,$ErrMsg,$DbgMsg); + if( DB_num_rows($result) > 0 ) { + echo '<table class="selection">'; + echo '<tr><td><div class="centre">' . _('Kit sets').' : '; + $ix = 0; + while ($myrow = DB_fetch_array($result)){ + echo (($ix)?', ':'') . '<a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Select='.$myrow['parent'].'">' . + $myrow['description'].' ('.$myrow['parent'].')</a>'; + $ix++; + } //end while loop + echo '</div></td></tr>'; + echo '</table>'; + } + // Display Phantom/Ghosts + $sql = "SELECT bom.parent, + stockmaster.description, + stockmaster.mbflag + FROM bom INNER JOIN stockmaster + ON bom.parent=stockmaster.stockid + WHERE bom.component='".$SelectedParent."' + AND stockmaster.mbflag='G'"; + + $ErrMsg = _('Could not retrieve the description of the parent part because'); + $DbgMsg = _('The SQL used to retrieve description of the parent part was'); + $result=DB_query($sql,$ErrMsg,$DbgMsg); + if( DB_num_rows($result) > 0 ) { + echo '<table class="selection"> + <tr> + <td><div class="centre">' . _('Phantom').' : '; + $ix = 0; + while ($myrow = DB_fetch_array($result)){ + echo (($ix)?', ':'') . '<a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Select='.$myrow['parent'].'">' . $myrow['description'].' ('.$myrow['parent'].')</a>'; + $ix++; + } //end while loop + echo '</div></td> + </tr> + </table>'; + } + echo '<br /> + <table class="selection">'; + echo '<tr> + <th colspan="13"><div class="centre"><b>' . $SelectedParent .' - ' . $myrow[0] . ' ('. $MBdesc. ') </b></div></th> + </tr>'; + + $BOMTree = array(); + //BOMTree is a 2 dimensional array with three elements for each item in the array - Level, Parent, Component + //display children populates the BOM_Tree from the selected parent + $i =0; + display_children($SelectedParent, 1, $BOMTree); + + $TableHeader = '<tr> + <th>' . _('Sequence') . '</th> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Location') . '</th> + <th>' . _('Work Centre') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('UOM') . '</th> + <th>' . _('Effective After') . '</th> + <th>' . _('Effective To') . '</th> + <th>' . _('Auto Issue') . '</th> + <th>' . _('Qty On Hand') . '</th> + </tr>'; + echo $TableHeader; + if(count($BOMTree) == 0) { + echo '<tr class="OddTableRows"> + <td colspan="8">' . _('No materials found.') . '</td> + </tr>'; + } else { + $UltimateParent = $SelectedParent; + $k = 0; + $RowCounter = 1; + $BOMTree = arrayUnique($BOMTree); + foreach($BOMTree as $BOMItem){ + $Level = $BOMItem['Level']; + $Parent = $BOMItem['Parent']; + $Component = $BOMItem['Component']; + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + }else { + echo '<tr class="OddTableRows">'; + $k++; + } + DisplayBOMItems($UltimateParent, $Parent, $Component, $Level, $db); + } + } + echo '</table> + <br />'; + /* We do want to show the new component entry form in any case - it is a lot of work to get back to it otherwise if we need to add */ + + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Select=' . $SelectedParent .'">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + + if (isset($_GET['SelectedComponent']) AND $InputError !=1) { + //editing a selected component from the link to the line item + + $sql = "SELECT sequence, + bom.loccode, + effectiveafter, + effectiveto, + workcentreadded, + quantity, + autoissue + FROM bom + INNER JOIN locationusers ON locationusers.loccode=bom.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 + WHERE parent='".$SelectedParent."' + AND component='".$SelectedComponent."'"; + + $result = DB_query($sql); + $myrow = DB_fetch_array($result); + + $_POST['Sequence'] = $myrow['sequence']; + $_POST['LocCode'] = $myrow['loccode']; + $_POST['EffectiveAfter'] = ConvertSQLDate($myrow['effectiveafter']); + $_POST['EffectiveTo'] = ConvertSQLDate($myrow['effectiveto']); + $_POST['WorkCentreAdded'] = $myrow['workcentreadded']; + $_POST['Quantity'] = locale_number_format($myrow['quantity'],'Variable'); + $_POST['AutoIssue'] = $myrow['autoissue']; + + prnMsg(_('Edit the details of the selected component in the fields below') . '. <br />' . _('Click on the Enter Information button to update the component details'),'info'); + echo '<br /> + <input type="hidden" name="SelectedParent" value="' . $SelectedParent . '" />'; + echo '<input type="hidden" name="SelectedComponent" value="' . $SelectedComponent . '" />'; + echo '<table class="selection">'; + echo '<tr> + <th colspan="13"><div class="centre"><b>' . ('Edit Component Details') . '</b></div></th> + </tr>'; + echo '<tr> + <td>' . _('Component') . ':</td> + <td><b>' . $SelectedComponent . '</b></td> + <input type="hidden" name="Component" value="' . $SelectedComponent . '" /> + </tr>'; + + } else { //end of if $SelectedComponent + $_POST['Sequence'] = 0; + echo '<input type="hidden" name="SelectedParent" value="' . $SelectedParent . '" />'; + /* echo "Enter the details of a new component in the fields below. <br />Click on 'Enter Information' to add the new component, once all fields are completed."; + */ + echo '<table class="selection">'; + echo '<tr> + <th colspan="13"><div class="centre"><b>' . _('New Component Details') . '</b></div></th> + </tr>'; + echo '<tr> + <td>' . _('Component code') . ':</td> + <td>'; + echo '<select ' . (in_array('ComponentCode',$Errors) ? 'class="selecterror"' : '' ) .' tabindex="1" name="Component">'; + + if ($ParentMBflag=='A'){ /*Its an assembly */ + $sql = "SELECT stockmaster.stockid, + stockmaster.description + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid = stockcategory.categoryid + WHERE ((stockcategory.stocktype='L' AND stockmaster.mbflag ='D') + OR stockmaster.mbflag !='D') + AND stockmaster.mbflag !='K' + AND stockmaster.mbflag !='A' + AND stockmaster.controlled = 0 + AND stockmaster.stockid != '".$SelectedParent."' + ORDER BY stockmaster.stockid"; + + } else { /*Its either a normal manufac item, phantom, kitset - controlled items ok */ + $sql = "SELECT stockmaster.stockid, + stockmaster.description + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid = stockcategory.categoryid + WHERE ((stockcategory.stocktype='L' AND stockmaster.mbflag ='D') + OR stockmaster.mbflag !='D') + AND stockmaster.mbflag !='K' + AND stockmaster.mbflag !='A' + AND stockmaster.stockid != '".$SelectedParent."' + ORDER BY stockmaster.stockid"; + } + + $ErrMsg = _('Could not retrieve the list of potential components because'); + $DbgMsg = _('The SQL used to retrieve the list of potential components part was'); + $result = DB_query($sql,$ErrMsg, $DbgMsg); + + + while ($myrow = DB_fetch_array($result)) { + echo '<option value="' .$myrow['stockid'].'">' . str_pad($myrow['stockid'],21, '_', STR_PAD_RIGHT) . $myrow['description'] . '</option>'; + } //end while loop + + echo '</select></td> + </tr>'; + } + echo '<tr> + <td>' . _('Sequence in BOM') . ':</td> + <td><input type="text" class="integer" required="required" size="5" name="Sequence" value="' . $_POST['Sequence'] . '" /></td> + </tr>'; + + echo '<tr> + <td>' . _('Location') . ': </td> + <td><select tabindex="2" name="LocCode">'; + + DB_free_result($result); + $sql = "SELECT locationname, + locations.loccode + FROM locations + INNER JOIN locationusers + ON locationusers.loccode=locations.loccode + AND locationusers.userid='" . $_SESSION['UserID'] . "' + AND locationusers.canupd=1 + WHERE locations.usedforwo = 1"; + $result = DB_query($sql); + + while ($myrow = DB_fetch_array($result)) { + if (isset($_POST['LocCode']) AND $myrow['loccode']==$_POST['LocCode']) { + echo '<option selected="selected" value="'; + } else { + echo '<option value="'; + } + echo $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + + } //end while loop + + DB_free_result($result); + + echo '</select></td> + </tr> + <tr> + <td>' . _('Work Centre Added') . ': </td><td>'; + + $sql = "SELECT code, description FROM workcentres INNER JOIN locationusers ON locationusers.loccode=workcentres.location AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1"; + $result = DB_query($sql); + + if (DB_num_rows($result)==0){ + prnMsg( _('There are no work centres set up yet') . '. ' . _('Please use the link below to set up work centres') . '.','warn'); + echo '<a href="' . $RootPath . '/WorkCentres.php">' . _('Work Centre Maintenance') . '</a></td></tr></table><br />'; + include('includes/footer.inc'); + exit; + } + + echo '<select tabindex="3" name="WorkCentreAdded">'; + + while ($myrow = DB_fetch_array($result)) { + if (isset($_POST['WorkCentreAdded']) AND $myrow['code']==$_POST['WorkCentreAdded']) { + echo '<option selected="selected" value="'; + } else { + echo '<option value="'; + } + echo $myrow['code'] . '">' . $myrow['description'] . '</option>'; + } //end while loop + + DB_free_result($result); + + echo '</select></td> + </tr> + <tr> + <td>' . _('Quantity') . ': </td> + <td><input ' . (in_array('Quantity',$Errors) ? 'class="inputerror"' : '' ) .' tabindex="4" type="text" class="number" required="required" name="Quantity" size="10" maxlength="8" title="' . _('Enter the quantity of this item required for the parent item') . '" value="'; + if (isset($_POST['Quantity'])){ + echo $_POST['Quantity']; + } else { + echo 1; + } + + echo '" /></td> + </tr>'; + + if (!isset($_POST['EffectiveTo']) OR $_POST['EffectiveTo']=='') { + $_POST['EffectiveTo'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),Date('d'),(Date('y')+20))); + } + if (!isset($_POST['EffectiveAfter']) OR $_POST['EffectiveAfter']=='') { + $_POST['EffectiveAfter'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))); + } + + echo '<tr> + <td>' . _('Effective After') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> + <td><input ' . (in_array('EffectiveAfter',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="5" type="text" required="required" name="EffectiveAfter" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" size="11" maxlength="10" value="' . $_POST['EffectiveAfter'] .'" /></td> + </tr> + <tr> + <td>' . _('Effective To') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> + <td><input ' . (in_array('EffectiveTo',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex="6" type="text" name="EffectiveTo" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" size="11" maxlength="10" value="' . $_POST['EffectiveTo'] .'" /></td> + </tr>'; + + if ($ParentMBflag=='M' OR $ParentMBflag=='G'){ + echo '<tr> + <td>' . _('Auto Issue this Component to Work Orders') . ':</td> + <td> + <select tabindex="7" name="AutoIssue">'; + + if (!isset($_POST['AutoIssue'])){ + $_POST['AutoIssue'] = $_SESSION['AutoIssue']; + } + if ($_POST['AutoIssue']==0) { + echo '<option selected="selected" value="0">' . _('No') . '</option>'; + echo '<option value="1">' . _('Yes') . '</option>'; + } else { + echo '<option selected="selected" value="1">' . _('Yes') . '</option>'; + echo '<option value="0">' . _('No') . '</option>'; + } + + + echo '</select></td> + </tr>'; + } else { + echo '<input type="hidden" name="AutoIssue" value="0" />'; + } + + echo '</table> + <br /> + <div class="centre"> + <input tabindex="8" type="submit" name="Submit" value="' . _('Enter Information') . '" /> + </div> + </div> + </form>'; + + + // end of BOM maintenance code - look at the parent selection form if not relevant +// ---------------------------------------------------------------------------------- + +} elseif (isset($_POST['Search'])){ + // Work around to auto select + if ($_POST['Keywords']=='' AND $_POST['StockCode']=='') { + $_POST['StockCode']='%'; + } + if ($_POST['Keywords'] AND $_POST['StockCode']) { + prnMsg( _('Stock description keywords have been used in preference to the Stock code extract entered'), 'info' ); + } + if ($_POST['Keywords']=='' AND $_POST['StockCode']=='') { + prnMsg( _('At least one stock description keyword or an extract of a stock code must be entered for the search'), 'info' ); + } else { + if (mb_strlen($_POST['Keywords'])>0) { + //insert wildcard characters in spaces + $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; + + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.decimalplaces, + stockmaster.mbflag, + SUM(locstock.quantity) as totalonhand + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid = locstock.stockid + WHERE stockmaster.description " . LIKE . " '".$SearchString."' + AND (stockmaster.mbflag='M' OR stockmaster.mbflag='K' OR stockmaster.mbflag='A' OR stockmaster.mbflag='G') + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.decimalplaces, + stockmaster.mbflag + ORDER BY stockmaster.stockid"; + + } elseif (mb_strlen($_POST['StockCode'])>0){ + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.mbflag, + stockmaster.decimalplaces, + sum(locstock.quantity) as totalonhand + FROM stockmaster INNER JOIN locstock + ON stockmaster.stockid = locstock.stockid + WHERE stockmaster.stockid " . LIKE . "'%" . $_POST['StockCode'] . "%' + AND (stockmaster.mbflag='M' + OR stockmaster.mbflag='K' + OR stockmaster.mbflag='G' + OR stockmaster.mbflag='A') + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.mbflag, + stockmaster.decimalplaces + ORDER BY stockmaster.stockid"; + + } + + $ErrMsg = _('The SQL to find the parts selected failed with the message'); + $result = DB_query($sql,$ErrMsg); + + } //one of keywords or StockCode was more than a zero length string +} //end of if search + +if (!isset($SelectedParent)) { + + echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $Title . '</p>'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">' . + '<div class="page_help_text">' . _('Select a manufactured part') . ' (' . _('or Assembly or Kit part') . ') ' . _('to maintain the bill of material for using the options below') . '<br />' . _('Parts must be defined in the stock item entry') . '/' . _('modification screen as manufactured') . ', ' . _('kits or assemblies to be available for construction of a bill of material') . '</div>' . ' + <div> + <br /> + <table class="selection" cellpadding="3"> + <tr><td>' . _('Enter text extracts in the') . ' <b>' . _('description') . '</b>:</td> + <td><input tabindex="1" type="text" name="Keywords" size="20" maxlength="25" /></td> + <td><b>' . _('OR') . '</b></td> + <td>' . _('Enter extract of the') . ' <b>' . _('Stock Code') . '</b>:</td> + <td><input tabindex="2" type="text" name="StockCode" autofocus="autofocus" size="15" maxlength="18" /></td> + </tr> + </table> + <br /><div class="centre"><input tabindex="3" type="submit" name="Search" value="' . _('Search Now') . '" /></div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + + if (isset($_POST['Search']) + AND isset($result) + AND !isset($SelectedParent)) { + + echo '<br /> + <table cellpadding="2" class="selection">'; + $TableHeader = '<tr> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('On Hand') . '</th> + <th>' . _('Units') . '</th> + </tr>'; + + echo $TableHeader; + + $j = 1; + $k=0; //row colour counter + while ($myrow=DB_fetch_array($result)) { + if ($k==1){ + echo '<tr class="EvenTableRows">';; + $k=0; + } else { + echo '<tr class="OddTableRows">';; + $k++; + } + if ($myrow['mbflag']=='A' OR $myrow['mbflag']=='K' OR $myrow['mbflag']=='G'){ + $StockOnHand = _('N/A'); + } else { + $StockOnHand = locale_number_format($myrow['totalonhand'],$myrow['decimalplaces']); + } + $tab = $j+3; + printf('<td><input tabindex="' . $tab . '" type="submit" name="Select" value="%s" /></td> + <td>%s</td> + <td class="number">%s</td> + <td>%s</td> + </tr>', + $myrow['stockid'], + $myrow['description'], + $StockOnHand, + $myrow['units']); + + $j++; + //end of page full new headings if + } + //end of while loop + + echo '</table>'; + + } + //end if results to show + + echo '</div>'; + echo '</form>'; + + } //end StockID already selected +// This function created by Dominik Jungowski on PHP developer blog +function arrayUnique($array, $preserveKeys = false) +{ + //Unique Array for return + $arrayRewrite = array(); + //Array with the md5 hashes + $arrayHashes = array(); + foreach($array as $key => $item) { + // Serialize the current element and create a md5 hash + $hash = md5(serialize($item)); + // If the md5 didn't come up yet, add the element to + // arrayRewrite, otherwise drop it + if (!isset($arrayHashes[$hash])) { + // Save the current element hash + $arrayHashes[$hash] = $hash; + //Add element to the unique Array + if ($preserveKeys) { + $arrayRewrite[$key] = $item; + } else { + $arrayRewrite[] = $item; + } + } + } + return $arrayRewrite; +} + +include('includes/footer.inc'); +?> \ No newline at end of file Added: trunk/BankAccountBalances.php =================================================================== --- trunk/BankAccountBalances.php (rev 0) +++ trunk/BankAccountBalances.php 2018-01-11 07:49:09 UTC (rev 7914) @@ -0,0 +1,59 @@ +<?php + +include('includes/session.php'); + +$Title = _('List of bank account balances'); +/* Manual links before header.php */ +$ViewTopic = 'GeneralLedger'; +$BookMark = ''; +include('includes/header.php'); + +echo '<p class="page_title_text"><img src="', $RootPath, '/css/', $_SESSION['Theme'], '/images/bank.png" title="', _('Bank Account Balances'), '" alt="" /> ', + _('Bank Account Balances'), ' + </p< + table> + <tr> + <th>', _('Bank Account'), '</th> + <th>', _('Account Name'), '</th> + <th>', _('Balance in account currency'), '</th> + <th>', _('Balance in functional currency'), '</th> + </tr>'; + +$SQL = "SELECT bankaccounts.accountcode, + currcode, + bankaccountname + FROM bankaccounts + INNER JOIN bankaccountusers + ON bankaccounts.accountcode=bankaccountusers.accountcode + AND userid='" . $_SESSION['UserID'] . "'"; +$Result = DB_query($SQL); + +if (DB_num_rows($Result) == 0) { + echo _('There are no bank accounts defined that you have authority to see'); +} else { + + while ($MyBankRow = DB_fetch_array($Result)) { + $CurrBalanceSQL = "SELECT SUM(amount) AS balance FROM banktrans WHERE bankact='" . $MyBankRow['accountcode'] . "'"; + $CurrBalanceResult = DB_query($CurrBalanceSQL); + $CurrBalanceRow = DB_fetch_array($CurrBalanceResult); + + $FuncBalanceSQL = "SELECT SUM(amount) AS balance FROM gltrans WHERE account='" . $MyBankRow['accountcode'] . "'"; + $FuncBalanceResult = DB_query($FuncBalanceSQL); + $FuncBalanceRow = DB_fetch_array($FuncBalanceResult); + + $DecimalPlacesSQL = "SELECT decimalplaces FROM currencies WHERE currabrev='" . $MyBankRow['currcode'] . "'"; + $DecimalPlacesResult = DB_query($DecimalPlacesSQL); + $DecimalPlacesRow = DB_fetch_array($DecimalPlacesResult); + + echo '<tr class="selection"> + <td>', $MyBankRow['accountcode'], '</td> + <td>', $MyBankRow['bankaccountname'], '</td> + <td class="number">', locale_number_format($CurrBalanceRow['balance'], $DecimalPlacesRow['decimalplaces']), ' ', $MyBankRow['currcode'], '</td> + <td class="number">', locale_number_format($FuncBalanceRow['balance'], $_SESSION['CompanyRecord']['decimalplaces']), ' ', $_SESSION['CompanyRecord']['currencydefault'], '</td> + </tr>'; + } + + echo '</table>'; +} +include('includes/footer.php'); +?> \ No newline at end of file |
From: <tu...@us...> - 2018-01-09 20:15:51
|
Revision: 7913 http://sourceforge.net/p/web-erp/reponame/7913 Author: turbopt Date: 2018-01-09 20:15:49 +0000 (Tue, 09 Jan 2018) Log Message: ----------- Remove my debug/test echo line from the previous commit. [committed with SVN version 7912] Modified Paths: -------------- trunk/Payments.php trunk/doc/Change.log Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2018-01-09 20:10:44 UTC (rev 7912) +++ trunk/Payments.php 2018-01-09 20:15:49 UTC (rev 7913) @@ -66,7 +66,7 @@ $Security2Result = DB_query($SQL, $ErrMsg, $DbgMsg); $MyUserRow = DB_fetch_array($Security2Result); $CashSecurity = $MyUserRow['pagesecurity']; -echo 'CS: ' . $CashSecurity . '<br>'; + if(isset($_GET['SupplierID'])) { /*The page was called with a supplierID check it is valid and default the inputs for Supplier Name and currency of payment */ Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-09 20:10:44 UTC (rev 7912) +++ trunk/doc/Change.log 2018-01-09 20:15:49 UTC (rev 7913) @@ -1,5 +1,6 @@ webERP Change Log +9/1/18 PaulT: Payments.php: Remove my debug/test echo line from the previous commit. 9/1/18 Paul Becker (PaulT commit): Payments.php: Show bank balance at payments. Know that balance display/output is protected by a similar security check manner as protected information at the dashboard. (Reported in forums: http://weberp.org/forum/showthread.php?tid=8017) 9/1/18 Paul Becker (PaulT commit): Z_MakeNewCompany.php, default.sql, demo.sql: Remove doubled underscore in EDI_Sent reference. (Reported in forums: http://weberp.org/forum/showthread.php?tid=7920) 8/1/18 Paul Becker (PaulT commit): PDFTransPageHeader.inc, PDFTransPageHeaderPortrait.inc: Add additional address fields and/or adds an extra space between some address fields. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7942) |
From: <tu...@us...> - 2018-01-09 20:10:46
|
Revision: 7912 http://sourceforge.net/p/web-erp/reponame/7912 Author: turbopt Date: 2018-01-09 20:10:44 +0000 (Tue, 09 Jan 2018) Log Message: ----------- Payments.php: Show bank balance at payments. Know that balance display/output is protected by a similar security check manner as protected information at the dashboard. (Reported in forums: http://weberp.org/forum/showthread.php?tid=8017) Modified Paths: -------------- trunk/Payments.php trunk/doc/Change.log Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2018-01-09 16:30:48 UTC (rev 7911) +++ trunk/Payments.php 2018-01-09 20:10:44 UTC (rev 7912) @@ -58,6 +58,15 @@ echo '<div class="page_help_text">', _('Use this screen to enter payments FROM your bank account.<br />Note: To enter a payment FROM a supplier, first select the Supplier, click Enter a Payment to, or Receipt from the Supplier, and use a negative Payment amount on this form.'), '</div> <br />'; +$SQL = "SELECT pagesecurity + FROM scripts + WHERE scripts.script = 'BankAccountBalances.php'"; +$ErrMsg = _('The security for G/L Accounts cannot be retrieved because'); +$DbgMsg = _('The SQL that was used and failed was'); +$Security2Result = DB_query($SQL, $ErrMsg, $DbgMsg); +$MyUserRow = DB_fetch_array($Security2Result); +$CashSecurity = $MyUserRow['pagesecurity']; +echo 'CS: ' . $CashSecurity . '<br>'; if(isset($_GET['SupplierID'])) { /*The page was called with a supplierID check it is valid and default the inputs for Supplier Name and currency of payment */ @@ -167,10 +176,10 @@ if(isset($_POST['Paymenttype']) AND $_POST['Paymenttype']!='') { $_SESSION['PaymentDetail'.$identifier]->Paymenttype = $_POST['Paymenttype']; //lets validate the paymenttype here - $sql = "SELECT usepreprintedstationery + $SQL = "SELECT usepreprintedstationery FROM paymentmethods WHERE paymentname='" . $_SESSION['PaymentDetail'.$identifier]->Paymenttype . "'"; - $result = DB_query($sql); + $result = DB_query($SQL); $myrow = DB_fetch_row($result); if($myrow[0] == 1) { if(empty($_POST['ChequeNum'])) { @@ -332,10 +341,10 @@ $PeriodNo = GetPeriod($_SESSION['PaymentDetail'.$identifier]->DatePaid,$db); - $sql = "SELECT usepreprintedstationery + $SQL = "SELECT usepreprintedstationery FROM paymentmethods WHERE paymentname='" . $_SESSION['PaymentDetail'.$identifier]->Paymenttype ."'"; - $result=DB_query($sql); + $result=DB_query($SQL); $myrow=DB_fetch_row($result); // first time through commit if supplier cheque then print it first @@ -925,6 +934,16 @@ if($_SESSION['PaymentDetail'.$identifier]->BankAccountName!='') { echo ' ' . _('from the') . ' ' . $_SESSION['PaymentDetail'.$identifier]->BankAccountName; + + if (in_array($CashSecurity, $_SESSION['AllowedPageSecurityTokens']) OR !isset($CashSecurity)) { + $CurrBalanceSQL = "SELECT SUM(amount) AS balance FROM banktrans WHERE bankact='" . $_SESSION['PaymentDetail'.$identifier]->Account . "'"; + $CurrBalanceResult = DB_query($CurrBalanceSQL); + $CurrBalanceRow = DB_fetch_array($CurrBalanceResult); + + $DecimalPlacesSQL = "SELECT decimalplaces FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail'.$identifier]->Account . "'"; + $DecimalPlacesResult = DB_query($DecimalPlacesSQL); + $DecimalPlacesRow = DB_fetch_array($DecimalPlacesResult); + } } echo ' ' . _('on') . ' ' . $_SESSION['PaymentDetail'.$identifier]->DatePaid . '</h3></th></tr>'; @@ -966,8 +985,13 @@ } echo 'value="', $myrow['accountcode'], '">', $myrow['bankaccountname'], ' - ', $myrow['currcode'], '</option>'; } - echo '</select></td> - </tr>'; + echo '</select>'; + + if (in_array($CashSecurity, $_SESSION['AllowedPageSecurityTokens']) OR !isset($CashSecurity)) { + echo ' (' . locale_number_format($CurrBalanceRow['balance'], $_SESSION['CompanyRecord']['decimalplaces']) . ' ' . _('Balance in account currency') . ')'; + } + + echo '</td></tr>'; } echo '<tr> @@ -979,7 +1003,6 @@ echo '<tr> <td>', _('Currency'), ':</td> <td>'; -/*$result = DB_query("SELECT currency, currabrev, rate FROM currencies");*/ $result = DB_query("SELECT currabrev FROM currencies"); if(DB_num_rows($result) == 0) { prnMsg( _('No currencies are defined yet. Payments cannot be entered until a currency is defined'),'error'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-09 16:30:48 UTC (rev 7911) +++ trunk/doc/Change.log 2018-01-09 20:10:44 UTC (rev 7912) @@ -1,5 +1,6 @@ webERP Change Log +9/1/18 Paul Becker (PaulT commit): Payments.php: Show bank balance at payments. Know that balance display/output is protected by a similar security check manner as protected information at the dashboard. (Reported in forums: http://weberp.org/forum/showthread.php?tid=8017) 9/1/18 Paul Becker (PaulT commit): Z_MakeNewCompany.php, default.sql, demo.sql: Remove doubled underscore in EDI_Sent reference. (Reported in forums: http://weberp.org/forum/showthread.php?tid=7920) 8/1/18 Paul Becker (PaulT commit): PDFTransPageHeader.inc, PDFTransPageHeaderPortrait.inc: Add additional address fields and/or adds an extra space between some address fields. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7942) 8/1/18 Tim (PaulT commit): PO_Items.php: Fix/improve Supplier checkbox handling, and fix a PHP7 compatibility issue. (Reported in forums by Confucius: http://www.weberp.org/forum/showthread.php?tid=7958) |
From: <tu...@us...> - 2018-01-09 16:30:50
|
Revision: 7911 http://sourceforge.net/p/web-erp/reponame/7911 Author: turbopt Date: 2018-01-09 16:30:48 +0000 (Tue, 09 Jan 2018) Log Message: ----------- Z_MakeNewCompany.php, default.sql, demo.sql: Remove doubled underscore in EDI_Sent reference. (Reported in forums: http://weberp.org/forum/showthread.php?tid=7920) Modified Paths: -------------- trunk/Z_MakeNewCompany.php trunk/doc/Change.log trunk/sql/mysql/country_sql/default.sql trunk/sql/mysql/country_sql/demo.sql Modified: trunk/Z_MakeNewCompany.php =================================================================== --- trunk/Z_MakeNewCompany.php 2018-01-09 01:14:56 UTC (rev 7910) +++ trunk/Z_MakeNewCompany.php 2018-01-09 16:30:48 UTC (rev 7911) @@ -191,7 +191,7 @@ unset ($_SESSION['Items']); unset ($_SESSION['CreditItems']); - $SQL ="UPDATE config SET confvalue='companies/" . $_POST['NewDatabase'] . "/EDI__Sent' WHERE confname='EDI_MsgSent'"; + $SQL ="UPDATE config SET confvalue='companies/" . $_POST['NewDatabase'] . "/EDI_Sent' WHERE confname='EDI_MsgSent'"; $result = DB_query($SQL); $SQL ="UPDATE config SET confvalue='companies/" . $_POST['NewDatabase'] . "/EDI_Incoming_Orders' WHERE confname='EDI_Incoming_Orders'"; $result = DB_query($SQL); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-09 01:14:56 UTC (rev 7910) +++ trunk/doc/Change.log 2018-01-09 16:30:48 UTC (rev 7911) @@ -1,5 +1,6 @@ webERP Change Log +9/1/18 Paul Becker (PaulT commit): Z_MakeNewCompany.php, default.sql, demo.sql: Remove doubled underscore in EDI_Sent reference. (Reported in forums: http://weberp.org/forum/showthread.php?tid=7920) 8/1/18 Paul Becker (PaulT commit): PDFTransPageHeader.inc, PDFTransPageHeaderPortrait.inc: Add additional address fields and/or adds an extra space between some address fields. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7942) 8/1/18 Tim (PaulT commit): PO_Items.php: Fix/improve Supplier checkbox handling, and fix a PHP7 compatibility issue. (Reported in forums by Confucius: http://www.weberp.org/forum/showthread.php?tid=7958) 8/1/18 Paul Becker/Tim (PaulT commit): SalesGraph.php: Replace period numbers in graph title with month and year. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7946) Modified: trunk/sql/mysql/country_sql/default.sql =================================================================== --- trunk/sql/mysql/country_sql/default.sql 2018-01-09 01:14:56 UTC (rev 7910) +++ trunk/sql/mysql/country_sql/default.sql 2018-01-09 16:30:48 UTC (rev 7911) @@ -6661,7 +6661,7 @@ INSERT INTO `config` VALUES ('EDIReference','WEBERP'); INSERT INTO `config` VALUES ('EDI_Incoming_Orders','companies/test/EDI_Incoming_Orders'); INSERT INTO `config` VALUES ('EDI_MsgPending','companies/test/EDI_Pending'); -INSERT INTO `config` VALUES ('EDI_MsgSent','companies/test/EDI__Sent'); +INSERT INTO `config` VALUES ('EDI_MsgSent','companies/test/EDI_Sent'); INSERT INTO `config` VALUES ('ExchangeRateFeed','Google'); INSERT INTO `config` VALUES ('Extended_CustomerInfo','1'); INSERT INTO `config` VALUES ('Extended_SupplierInfo','1'); Modified: trunk/sql/mysql/country_sql/demo.sql =================================================================== --- trunk/sql/mysql/country_sql/demo.sql 2018-01-09 01:14:56 UTC (rev 7910) +++ trunk/sql/mysql/country_sql/demo.sql 2018-01-09 16:30:48 UTC (rev 7911) @@ -8581,7 +8581,7 @@ INSERT INTO `config` VALUES ('EDIReference','WEBERP'); INSERT INTO `config` VALUES ('EDI_Incoming_Orders','companies/test/EDI_Incoming_Orders'); INSERT INTO `config` VALUES ('EDI_MsgPending','companies/test/EDI_Pending'); -INSERT INTO `config` VALUES ('EDI_MsgSent','companies/test/EDI__Sent'); +INSERT INTO `config` VALUES ('EDI_MsgSent','companies/test/EDI_Sent'); INSERT INTO `config` VALUES ('ExchangeRateFeed','Google'); INSERT INTO `config` VALUES ('Extended_CustomerInfo','1'); INSERT INTO `config` VALUES ('Extended_SupplierInfo','1'); |
From: <tu...@us...> - 2018-01-09 01:14:58
|
Revision: 7910 http://sourceforge.net/p/web-erp/reponame/7910 Author: turbopt Date: 2018-01-09 01:14:56 +0000 (Tue, 09 Jan 2018) Log Message: ----------- PDFTransPageHeader.inc, PDFTransPageHeaderPortrait.inc: Add additional address fields and/or adds an extra space between some address fields. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7942) Modified Paths: -------------- trunk/doc/Change.log trunk/includes/PDFTransPageHeader.inc trunk/includes/PDFTransPageHeaderPortrait.inc Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-09 00:19:00 UTC (rev 7909) +++ trunk/doc/Change.log 2018-01-09 01:14:56 UTC (rev 7910) @@ -1,6 +1,7 @@ webERP Change Log -8/1/18 Tim (PaulT commit): PO_Items.php: Fix/improve Supplier checkbox hanlding, and fix a PHP7 compatibility issue. (Reported in forums by Confucius: http://www.weberp.org/forum/showthread.php?tid=7958) +8/1/18 Paul Becker (PaulT commit): PDFTransPageHeader.inc, PDFTransPageHeaderPortrait.inc: Add additional address fields and/or adds an extra space between some address fields. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7942) +8/1/18 Tim (PaulT commit): PO_Items.php: Fix/improve Supplier checkbox handling, and fix a PHP7 compatibility issue. (Reported in forums by Confucius: http://www.weberp.org/forum/showthread.php?tid=7958) 8/1/18 Paul Becker/Tim (PaulT commit): SalesGraph.php: Replace period numbers in graph title with month and year. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7946) 7/1/18 Paul Becker (PaulT commit): WriteReport.inc: Fix broken page number handling. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7955) 7/1/18 PaulT: Change.log: Update remaining past commit entries (during the past few weeks) to give credit to the right person(s) involved with the change, and when applicable, add the related forum URL for historical reference. Modified: trunk/includes/PDFTransPageHeader.inc =================================================================== --- trunk/includes/PDFTransPageHeader.inc 2018-01-09 00:19:00 UTC (rev 7909) +++ trunk/includes/PDFTransPageHeader.inc 2018-01-09 01:14:56 UTC (rev 7910) @@ -79,7 +79,7 @@ $pdf->addText($XPos, $YPos-10, $FontSize, $_SESSION['TaxAuthorityReferenceName'] . ': ' . $_SESSION['CompanyRecord']['gstno']); $pdf->addText($XPos, $YPos-19,$FontSize, $_SESSION['CompanyRecord']['regoffice1']); $pdf->addText($XPos, $YPos-28,$FontSize, $_SESSION['CompanyRecord']['regoffice2']); -$pdf->addText($XPos, $YPos-37,$FontSize, $_SESSION['CompanyRecord']['regoffice3'] . ' ' . $_SESSION['CompanyRecord']['regoffice4'] . ' ' . $_SESSION['CompanyRecord']['regoffice5']); +$pdf->addText($XPos, $YPos-37,$FontSize, $_SESSION['CompanyRecord']['regoffice3'] . ' ' . $_SESSION['CompanyRecord']['regoffice4'] . ' ' . $_SESSION['CompanyRecord']['regoffice5']); $pdf->addText($XPos, $YPos-46, $FontSize, $_SESSION['CompanyRecord']['regoffice6']); $pdf->addText($XPos, $YPos-54, $FontSize, _('Phone') . ':' . $_SESSION['CompanyRecord']['telephone'] . ' ' . _('Fax') . ': ' . $_SESSION['CompanyRecord']['fax']); $pdf->addText($XPos, $YPos-63, $FontSize, _('Email') . ': ' . $_SESSION['CompanyRecord']['email']); @@ -98,12 +98,12 @@ $pdf->addText($XPos, $YPos, $FontSize, html_entity_decode($myrow['name'])); $pdf->addText($XPos, $YPos-14, $FontSize, html_entity_decode($myrow['address1'])); $pdf->addText($XPos, $YPos-28, $FontSize, html_entity_decode($myrow['address2'])); - $pdf->addText($XPos, $YPos-42, $FontSize, html_entity_decode($myrow['address3']) . ' ' . html_entity_decode($myrow['address4'])); + $pdf->addText($XPos, $YPos-42, $FontSize, html_entity_decode($myrow['address3']) . ' ' . html_entity_decode($myrow['address4']) . ' ' . html_entity_decode($myrow['address5']) . ' ' . html_entity_decode($myrow['address6'])); } else { $pdf->addText($XPos, $YPos, $FontSize, html_entity_decode($myrow['name'])); $pdf->addText($XPos, $YPos-14, $FontSize, html_entity_decode($myrow['brpostaddr1'])); $pdf->addText($XPos, $YPos-28, $FontSize, html_entity_decode($myrow['brpostaddr2'])); - $pdf->addText($XPos, $YPos-42, $FontSize, html_entity_decode($myrow['brpostaddr3']) . ' ' . html_entity_decode($myrow['brpostaddr4']) . ' ' . html_entity_decode($myrow['brpostaddr5']) . ' ' . html_entity_decode($myrow['brpostaddr6'])); + $pdf->addText($XPos, $YPos-42, $FontSize, html_entity_decode($myrow['brpostaddr3']) . ' ' . html_entity_decode($myrow['brpostaddr4']) . ' ' . html_entity_decode($myrow['brpostaddr5']) . ' ' . html_entity_decode($myrow['brpostaddr6'])); } @@ -132,7 +132,7 @@ $pdf->addText($XPos, $YPos, $FontSize, html_entity_decode($myrow['deliverto'])); $pdf->addText($XPos, $YPos-14, $FontSize, html_entity_decode($myrow['deladd1'])); $pdf->addText($XPos, $YPos-28, $FontSize, html_entity_decode($myrow['deladd2'])); - $pdf->addText($XPos, $YPos-42, $FontSize, html_entity_decode($myrow['deladd3']) . ' ' . html_entity_decode($myrow['deladd4']) . ' ' . html_entity_decode($myrow['deladd5'])); + $pdf->addText($XPos, $YPos-42, $FontSize, html_entity_decode($myrow['deladd3']) . ' ' . html_entity_decode($myrow['deladd4']) . ' ' . html_entity_decode($myrow['deladd5']) . ' ' . html_entity_decode($myrow['deladd6'])); $XPos -=80; } if ($InvOrCredit=='Credit'){ @@ -143,7 +143,7 @@ $pdf->addText($XPos, $YPos, $FontSize, html_entity_decode($myrow['brname'])); $pdf->addText($XPos, $YPos-14, $FontSize, html_entity_decode($myrow['braddress1'])); $pdf->addText($XPos, $YPos-28, $FontSize, html_entity_decode($myrow['braddress2'])); - $pdf->addText($XPos, $YPos-42, $FontSize, html_entity_decode($myrow['braddress3']) . ' ' . html_entity_decode($myrow['braddress4']) . ' ' . html_entity_decode($myrow['braddress5']) . ' ' . html_entity_decode($myrow['braddress6'])); + $pdf->addText($XPos, $YPos-42, $FontSize, html_entity_decode($myrow['braddress3']) . ' ' . html_entity_decode($myrow['braddress4']) . ' ' . html_entity_decode($myrow['braddress5']) . ' ' . html_entity_decode($myrow['braddress6'])); $XPos -=80; } Modified: trunk/includes/PDFTransPageHeaderPortrait.inc =================================================================== --- trunk/includes/PDFTransPageHeaderPortrait.inc 2018-01-09 00:19:00 UTC (rev 7909) +++ trunk/includes/PDFTransPageHeaderPortrait.inc 2018-01-09 01:14:56 UTC (rev 7910) @@ -103,7 +103,7 @@ } if(($_SESSION['CompanyRecord']['regoffice3'] <> '') OR ($_SESSION['CompanyRecord']['regoffice4'] <> '') OR ($_SESSION['CompanyRecord']['regoffice5'] <> '')) { $LineCount += 1; - $pdf->addText($XPos, $YPos-$LineCount*$LineHeight,$FontSize, $_SESSION['CompanyRecord']['regoffice3'] . ' ' . $_SESSION['CompanyRecord']['regoffice4'] . ' ' . $_SESSION['CompanyRecord']['regoffice5']); // country in 6 not printed + $pdf->addText($XPos, $YPos-$LineCount*$LineHeight,$FontSize, $_SESSION['CompanyRecord']['regoffice3'] . ' ' . $_SESSION['CompanyRecord']['regoffice4'] . ' ' . $_SESSION['CompanyRecord']['regoffice5']); // country in 6 not printed } $LineCount += 1; $pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, _('Phone') . ':' . $_SESSION['CompanyRecord']['telephone']); @@ -137,7 +137,7 @@ $LineCount += 1; $pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, html_entity_decode($myrow['address2'])); $LineCount += 1; - $pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, html_entity_decode($myrow['address3']) . ' ' . html_entity_decode($myrow['address4']) . ' ' . html_entity_decode($myrow['address5']) . ' ' . html_entity_decode($myrow['address6'])); + $pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, html_entity_decode($myrow['address3']) . ' ' . html_entity_decode($myrow['address4']) . ' ' . html_entity_decode($myrow['address5']) . ' ' . html_entity_decode($myrow['address6'])); } else { $LineCount += 1; $pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, html_entity_decode($myrow['name'])); @@ -146,7 +146,7 @@ $LineCount += 1; $pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, html_entity_decode($myrow['brpostaddr2'])); $LineCount += 1; - $pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, html_entity_decode($myrow['brpostaddr3']) . ' ' . html_entity_decode($myrow['brpostaddr4']) . ' ' . html_entity_decode($myrow['brpostaddr5']) . ' ' . html_entity_decode($myrow['brpostaddr6'])); + $pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, html_entity_decode($myrow['brpostaddr3']) . ' ' . html_entity_decode($myrow['brpostaddr4']) . ' ' . html_entity_decode($myrow['brpostaddr5']) . ' ' . html_entity_decode($myrow['brpostaddr6'])); } $XPos = $Page_Width - 265; @@ -183,7 +183,7 @@ $LineCount += 1; $pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, html_entity_decode($myrow['deladd2'])); $LineCount += 1; - $pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, html_entity_decode($myrow['deladd3']) . ' ' . html_entity_decode($myrow['deladd4']) . ' ' . html_entity_decode($myrow['deladd5']) . ' ' . html_entity_decode($myrow['deladd6'])); + $pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, html_entity_decode($myrow['deladd3']) . ' ' . html_entity_decode($myrow['deladd4']) . ' ' . html_entity_decode($myrow['deladd5']) . ' ' . html_entity_decode($myrow['deladd6'])); //$XPos -=80; } if($InvOrCredit=='Credit') { @@ -199,7 +199,7 @@ $LineCount += 1; $pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, html_entity_decode($myrow['braddress2'])); $LineCount += 1; - $pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, html_entity_decode($myrow['braddress3']) . ' ' . html_entity_decode($myrow['braddress4']) . ' ' . html_entity_decode($myrow['braddress5']) . ' ' . html_entity_decode($myrow['braddress6'])); + $pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, html_entity_decode($myrow['braddress3']) . ' ' . html_entity_decode($myrow['braddress4']) . ' ' . html_entity_decode($myrow['braddress5']) . ' ' . html_entity_decode($myrow['braddress6'])); //$XPos -=80; } |
From: <tu...@us...> - 2018-01-09 00:19:02
|
Revision: 7909 http://sourceforge.net/p/web-erp/reponame/7909 Author: turbopt Date: 2018-01-09 00:19:00 +0000 (Tue, 09 Jan 2018) Log Message: ----------- PO_Items.php: Fix/improve Supplier checkbox hanlding, and fix a PHP7 compatibility issue. (Reported in forums by Confucius: http://www.weberp.org/forum/showthread.php?tid=7958) Modified Paths: -------------- trunk/PO_Items.php trunk/doc/Change.log Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2018-01-08 05:57:24 UTC (rev 7908) +++ trunk/PO_Items.php 2018-01-09 00:19:00 UTC (rev 7909) @@ -1149,14 +1149,16 @@ $_POST['StockCode']=''; } + if (isset($_POST['SupplierItemsOnly'])) { + $Checked = 'checked'; + } else { + $Checked = ''; + } + echo '</select></td> <td>' . _('Enter text extracts in the description') . ':</td> <td><input type="text" name="Keywords" size="20" maxlength="25" value="' . $_POST['Keywords'] . '" /></td></tr> - <tr><td>' . _('Only items defined as from this Supplier') . ' <input type="checkbox" checked name="SupplierItemsOnly" '; - if (isset($_POST['SupplierItemsOnly']) AND $_POST['SupplierItemsOnly']=='on'){ - echo 'checked'; - } - echo ' /></td> + <tr><td>' . _('Only items defined as from this Supplier') . ' <input type="checkbox" ' . $Checked . ' name="SupplierItemsOnly" /></td> <td><b>' . _('OR') . ' </b>' . _('Enter extract of the Stock Code') . ':</td> <td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td> </tr> @@ -1213,7 +1215,10 @@ } $SupportedImgExt = array('png','jpg','jpeg'); - $imagefile = reset((glob($_SESSION['part_pics_dir'] . '/' . $myrow['stockid'] . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE))); + + $imagefilearray = (glob($_SESSION['part_pics_dir'] . '/' . $myrow['stockid'] . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE)); + $imagefile = reset($imagefilearray); + if (extension_loaded('gd') && function_exists('gd_info') && file_exists ($imagefile) ) { $ImageSource = '<img src="GetStockImage.php?automake=1&textcolor=FFFFFF&bgcolor=CCCCCC'. '&StockID='.urlencode($myrow['stockid']). Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-08 05:57:24 UTC (rev 7908) +++ trunk/doc/Change.log 2018-01-09 00:19:00 UTC (rev 7909) @@ -1,5 +1,6 @@ webERP Change Log +8/1/18 Tim (PaulT commit): PO_Items.php: Fix/improve Supplier checkbox hanlding, and fix a PHP7 compatibility issue. (Reported in forums by Confucius: http://www.weberp.org/forum/showthread.php?tid=7958) 8/1/18 Paul Becker/Tim (PaulT commit): SalesGraph.php: Replace period numbers in graph title with month and year. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7946) 7/1/18 Paul Becker (PaulT commit): WriteReport.inc: Fix broken page number handling. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7955) 7/1/18 PaulT: Change.log: Update remaining past commit entries (during the past few weeks) to give credit to the right person(s) involved with the change, and when applicable, add the related forum URL for historical reference. |
From: <tu...@us...> - 2018-01-08 05:57:26
|
Revision: 7908 http://sourceforge.net/p/web-erp/reponame/7908 Author: turbopt Date: 2018-01-08 05:57:24 +0000 (Mon, 08 Jan 2018) Log Message: ----------- SalesGraph.php: Replace period numbers in graph title with month and year. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7946) Modified Paths: -------------- trunk/SalesGraph.php trunk/doc/Change.log Modified: trunk/SalesGraph.php =================================================================== --- trunk/SalesGraph.php 2018-01-08 00:56:50 UTC (rev 7907) +++ trunk/SalesGraph.php 2018-01-08 05:57:24 UTC (rev 7908) @@ -218,6 +218,18 @@ $SelectClause = 'qty'; } + $SQL = "SELECT YEAR(`lastdate_in_period`) AS year, MONTHNAME(`lastdate_in_period`) AS month + FROM `periods` + WHERE `periodno`='" . $_POST['FromPeriod'] . "' OR periodno='" . $_POST['ToPeriod'] . "'"; + + $result = DB_query($SQL); + + $fromPeriod = DB_fetch_array($result); + $_POST['FromPeriod'] = $fromPeriod['month'] . ' ' . $fromPeriod['year']; + + $toPeriod = DB_fetch_array($result); + $_POST['ToPeriod'] = $toPeriod['month'] . ' ' . $toPeriod['year']; + $GraphTitle .= ' ' . _('From Period') . ' ' . $_POST['FromPeriod'] . ' ' . _('to') . ' ' . $_POST['ToPeriod'] . "\n\r"; if ($_POST['SalesArea']=='All'){ Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-08 00:56:50 UTC (rev 7907) +++ trunk/doc/Change.log 2018-01-08 05:57:24 UTC (rev 7908) @@ -1,7 +1,8 @@ webERP Change Log -8/1/18 Paul Becker (PaulT commit): WriteReport.inc: Fix broken page number handling. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7955) -8/1/18 PaulT: Change.log: Update remaining past commit entries (during the past few weeks) to give credit to the right person(s) involved with the change, and when applicable, add the related forum URL for historical reference. +8/1/18 Paul Becker/Tim (PaulT commit): SalesGraph.php: Replace period numbers in graph title with month and year. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7946) +7/1/18 Paul Becker (PaulT commit): WriteReport.inc: Fix broken page number handling. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7955) +7/1/18 PaulT: Change.log: Update remaining past commit entries (during the past few weeks) to give credit to the right person(s) involved with the change, and when applicable, add the related forum URL for historical reference. 7/1/18 Phil: Update phpxmlrpc to latest from https://github.com/gggeek/phpxmlrpc 6/1/18 PaulT: Change.log: Update some past commit entries to give credit to the right person(s) involved with the change, and when applicable, add the related forum URL for historical reference. 6/1/18 Paul Becker and Tim (PaulT commit): SelectSalesOrder.php: Fix handling to correct table heading value. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8000) |
From: <tu...@us...> - 2018-01-08 00:56:53
|
Revision: 7907 http://sourceforge.net/p/web-erp/reponame/7907 Author: turbopt Date: 2018-01-08 00:56:50 +0000 (Mon, 08 Jan 2018) Log Message: ----------- WriteReport.inc: Fix broken page number handling. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7955) Modified Paths: -------------- trunk/doc/Change.log trunk/reportwriter/WriteReport.inc Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-08 00:48:17 UTC (rev 7906) +++ trunk/doc/Change.log 2018-01-08 00:56:50 UTC (rev 7907) @@ -1,7 +1,9 @@ webERP Change Log +8/1/18 Paul Becker (PaulT commit): WriteReport.inc: Fix broken page number handling. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7955) +8/1/18 PaulT: Change.log: Update remaining past commit entries (during the past few weeks) to give credit to the right person(s) involved with the change, and when applicable, add the related forum URL for historical reference. 7/1/18 Phil: Update phpxmlrpc to latest from https://github.com/gggeek/phpxmlrpc -6/1/18 PaulT: Update some past commit entries to give credit to the right person(s) involved with the change, and when applicable, add the related forum URL for historical reference. +6/1/18 PaulT: Change.log: Update some past commit entries to give credit to the right person(s) involved with the change, and when applicable, add the related forum URL for historical reference. 6/1/18 Paul Becker and Tim (PaulT commit): SelectSalesOrder.php: Fix handling to correct table heading value. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8000) 6/1/18 Phil: Attempt to avoid XSS attacks by logged in users by parsing out "script>" from all $_POST and $_GET variables - subsequentely changed to strip_tags from all $_POST and $_GETs per Tim's recommendation 3/1/18: Paul Becker (PaulT commit): SelectSalesOrder.php: Fix search to retain quote option and set StockLocation to the UserStockLocation to auto-load current Sales Orders. (Reported in formus: http://www.weberp.org/forum/showthread.php?tid=8000) Modified: trunk/reportwriter/WriteReport.inc =================================================================== --- trunk/reportwriter/WriteReport.inc 2018-01-08 00:48:17 UTC (rev 7906) +++ trunk/reportwriter/WriteReport.inc 2018-01-08 00:56:50 UTC (rev 7907) @@ -120,7 +120,7 @@ //Arial italic 8 $this->SetTextColor(0); //Page number - $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); + $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/' . $this->getNumPages(), 0, 0, 'C'); } function ReportTable($Data) { |
From: <tu...@us...> - 2018-01-08 00:48:19
|
Revision: 7906 http://sourceforge.net/p/web-erp/reponame/7906 Author: turbopt Date: 2018-01-08 00:48:17 +0000 (Mon, 08 Jan 2018) Log Message: ----------- Update remaining past commit entries (during the past few weeks) to give credit to the right person(s) involved with the change, and when applicable, add the related forum URL for historical reference. Modified Paths: -------------- trunk/doc/Change.log Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-07 04:20:24 UTC (rev 7905) +++ trunk/doc/Change.log 2018-01-08 00:48:17 UTC (rev 7906) @@ -16,17 +16,17 @@ 18/12/17 rjonesbsink (PaulT commit): ReportCreator.php: PHP 7.1 array compatibility change. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7969) 18/12/17 Paul Becker (PaulT commit): BOMIndented.php, BOMIndentedReverse.php: Adjust PDF position values, and add UoM, remove stray 0-9 string output. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7994) 18/12/17 Paul Becker (PaulT commit): PDFBOMListingPageHeader.inc, BOMListing.php: Adjust PDF position values, and add UoM. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7993) -15/12/17 PaulT: MRPPlannedPurchaseOrders.php, MRPPlannedWorkOrders.php: Fix PDF highlighting, PDF position value adjustments, and other minor tweaks. (Reported in forums by Paul Becker) -14/12/17 PaulT: CustomerReceipt.php: Wrap delete link parameter values with urlencode(). (Suggested by Tim in forums) -13/12/17 PaulT: PDFCOA.php: Add column prodspeckey to queries which is used as a description alternative. (Reported in forums by Paul Becker) -13/12/17 PaulT: PDFCOA.php, PDFProdSpec: Minor value adjust to correct inconsistent footer wrap. (Reported in forums by Paul Becker) -13/12/17 PaulT: HistoricalTestResults.php, SelectQASamples.php, TestPlanResults.php: Fix date inputs to work with the date picker. (Reported in forums by briantmg) +15/12/17 Paul Becker (PaulT commit): MRPPlannedPurchaseOrders.php, MRPPlannedWorkOrders.php: Fix PDF highlighting, PDF position value adjustments, and other minor tweaks. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7991) +14/12/17 Tim (PaulT commit): CustomerReceipt.php: Wrap delete link parameter values with urlencode(). (Tim forum suggestion: http://www.weberp.org/forum/showthread.php?tid=7980) +13/12/17 Paul Becker (PaulT commit): PDFCOA.php: Add column prodspeckey to queries which is used as a description alternative. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7989) +13/12/17 Paul Becker (PaulT commit): PDFCOA.php, PDFProdSpec: Minor value adjust to correct inconsistent footer wrap. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7987) +13/12/17 PaulT: HistoricalTestResults.php, SelectQASamples.php, TestPlanResults.php: Fix date inputs to work with the date picker. (Reported in forums by briantmg: http://www.weberp.org/forum/showthread.php?tid=7984) 13/12/17 Paul Becker (PaulT commit): PDFQALabel.php: Overlapping in the PDF when printing non-controlled items. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7976) -13/12/17 PaulT: CustomerReceipt.php: Add identifier to URL for delete link. (Reported in forums by Paul Becker) +13/12/17 Paul Becker (PaulT commit): CustomerReceipt.php: Add identifier to URL for delete link. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7980) 13/12/17 Paul Becker (PaulT commit): QATests.php: Correct wrong attribute name in two option tags. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7983) -11/12/17 PaulT: PHP 7 constructor compatibility change to phplot.php. (Reported in forums by rjonesbsink) +11/12/17 rjonesbsink (PaulT commit): PHP 7 constructor compatibility change to phplot.php. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7977) 11/12/17 Paul Becker (PaulT commit): SelectSalesOrder.php: Consistent delivery address and correct a unit conversion issue. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7967) -11/12/17 PaulT: PHP 7 constructor compatibility change to htmlMimeMail.php and mimePart.php +11/12/17 rjonesbsink (PaulT commit): PHP 7 constructor compatibility change to htmlMimeMail.php and mimePart.php. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7971) 6/12/17 RChacon: Order by transaction date and add link to debtors in Dashboard.php script. 3/12/17 Phil commited Tim's BankAccountBalances.php script 2/12/17 Exson: Fixed the outstanding quantity is not right in PO_SelectOSPurchOrder.php. |
From: <tu...@us...> - 2018-01-07 04:20:26
|
Revision: 7905 http://sourceforge.net/p/web-erp/reponame/7905 Author: turbopt Date: 2018-01-07 04:20:24 +0000 (Sun, 07 Jan 2018) Log Message: ----------- Update some past commit entries to give credit to the right person(s) involved with the change, and when applicable, add the related forum URL for historical reference. (updates to other commits during the past few weeks will be provided later) Modified Paths: -------------- trunk/doc/Change.log Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-06 23:15:16 UTC (rev 7904) +++ trunk/doc/Change.log 2018-01-07 04:20:24 UTC (rev 7905) @@ -1,11 +1,11 @@ webERP Change Log -6/1/18 PaulT: SelectSalesOrder.php: Fix handling to correct table heading value. (Reported in forums by Paul Becker) -7/1/18 Phil: Update phpxmlrpc to latest from https://github.com/gggeek/phpxmlrpc -6/1/18 Phil: Attempt to avoid XSS attacks by logged in users by parsing out "script>" from all $_POST and $_GET variables - subsequentely changed to strip_tags from all $_POST and $_GETs per Tim's recommendation - -3/1/18: PaulT: SelectSalesOrder.php: Fix search to retain quote option and set StockLocation to the UserStockLocation to auto-load current Sales Orders. -2/1/18: PaulT: SelectSalesOrder.php: Move handling for URL Quotations parameter to top of file to avoid potential page error(s). (Reported in forums by Paul Becker) Handling move reduces code within some conditional checks. This change also includes minor whitespace improvements and removes an unused global reference. +7/1/18 Phil: Update phpxmlrpc to latest from https://github.com/gggeek/phpxmlrpc +6/1/18 PaulT: Update some past commit entries to give credit to the right person(s) involved with the change, and when applicable, add the related forum URL for historical reference. +6/1/18 Paul Becker and Tim (PaulT commit): SelectSalesOrder.php: Fix handling to correct table heading value. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8000) +6/1/18 Phil: Attempt to avoid XSS attacks by logged in users by parsing out "script>" from all $_POST and $_GET variables - subsequentely changed to strip_tags from all $_POST and $_GETs per Tim's recommendation +3/1/18: Paul Becker (PaulT commit): SelectSalesOrder.php: Fix search to retain quote option and set StockLocation to the UserStockLocation to auto-load current Sales Orders. (Reported in formus: http://www.weberp.org/forum/showthread.php?tid=8000) +2/1/18: Paul Becker and Tim (PaulT commit): SelectSalesOrder.php: Move handling for URL Quotations parameter to top of file to avoid potential page error(s). (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8000) Handling move reduces code within some conditional checks. This change also includes minor whitespace improvements and removes an unused global reference. 2/1/18: PaulT: css/default/default.css: Add text alignment in a couple of styles to match the same use in other CSS to avoid formatting issues when the default theme is used. Also, set several property names to lowercase. 20/12/17 PaulT: FormMaker.php, ReportMaker.php, WriteForm.inc: A few more PHP 7.1 array compatibility changes. 20/12/17 PaulT: RCFunctions.inc, FormMaker.php: PHP 7.1 array compatibility change. @@ -12,20 +12,20 @@ 19/12/17 PaulT: PDFOrderStatus.php: Remove redundant ConnectDB.inc include reference. (already included by session.php at the top of the file) 19/12/17 PaulT: Change.log: Correct my Day/Month entry references over the last few days. 19/12/17 PaulT: Contracts.php: Move work center handling causing a partial form to appear after the footer when no work centers exist. -19/12/17 PaulT: Contract_Readin.php: Add customerref field to query to appear in the form when a contract is modified. -18/12/17 PaulT: ReportCreator.php: PHP 7.1 array compatibility change. (Reported in forums by rjonesbsink) -18/12/17 PaulT: BOMIndented.php, BOMIndentedReverse.php: Adjust PDF position values, and add UoM, remove stray 0-9 string output. (Reported in forums by Paul Becker) -18/12/17 PaulT: PDFBOMListingPageHeader.inc, BOMListing.php: Adjust PDF position values, and add UoM. (Reported in forums by Paul Becker) +19/12/17 Paul Becker (PaulT commit): Contract_Readin.php: Add customerref field to query to appear in the form when a contract is modified. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7998) +18/12/17 rjonesbsink (PaulT commit): ReportCreator.php: PHP 7.1 array compatibility change. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7969) +18/12/17 Paul Becker (PaulT commit): BOMIndented.php, BOMIndentedReverse.php: Adjust PDF position values, and add UoM, remove stray 0-9 string output. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7994) +18/12/17 Paul Becker (PaulT commit): PDFBOMListingPageHeader.inc, BOMListing.php: Adjust PDF position values, and add UoM. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7993) 15/12/17 PaulT: MRPPlannedPurchaseOrders.php, MRPPlannedWorkOrders.php: Fix PDF highlighting, PDF position value adjustments, and other minor tweaks. (Reported in forums by Paul Becker) 14/12/17 PaulT: CustomerReceipt.php: Wrap delete link parameter values with urlencode(). (Suggested by Tim in forums) 13/12/17 PaulT: PDFCOA.php: Add column prodspeckey to queries which is used as a description alternative. (Reported in forums by Paul Becker) 13/12/17 PaulT: PDFCOA.php, PDFProdSpec: Minor value adjust to correct inconsistent footer wrap. (Reported in forums by Paul Becker) 13/12/17 PaulT: HistoricalTestResults.php, SelectQASamples.php, TestPlanResults.php: Fix date inputs to work with the date picker. (Reported in forums by briantmg) -13/12/17 PaulT: PDFQALabel.php: Overlapping in the PDF when printing non-controlled items. (Reported in forums by Paul Becker) +13/12/17 Paul Becker (PaulT commit): PDFQALabel.php: Overlapping in the PDF when printing non-controlled items. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7976) 13/12/17 PaulT: CustomerReceipt.php: Add identifier to URL for delete link. (Reported in forums by Paul Becker) -13/12/17 PaulT: QATests.php: Correct wrong attribute name in two option tags. (Reported in forums by Paul Becker) +13/12/17 Paul Becker (PaulT commit): QATests.php: Correct wrong attribute name in two option tags. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7983) 11/12/17 PaulT: PHP 7 constructor compatibility change to phplot.php. (Reported in forums by rjonesbsink) -11/12/17 Paul Becker: (forums) SelectSalesOrder.php: Consistent delivery address and correct a unit conversion issue. +11/12/17 Paul Becker (PaulT commit): SelectSalesOrder.php: Consistent delivery address and correct a unit conversion issue. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=7967) 11/12/17 PaulT: PHP 7 constructor compatibility change to htmlMimeMail.php and mimePart.php 6/12/17 RChacon: Order by transaction date and add link to debtors in Dashboard.php script. 3/12/17 Phil commited Tim's BankAccountBalances.php script |
From: <dai...@us...> - 2018-01-06 23:15:20
|
Revision: 7904 http://sourceforge.net/p/web-erp/reponame/7904 Author: daintree Date: 2018-01-06 23:15:16 +0000 (Sat, 06 Jan 2018) Log Message: ----------- Update phpxmlrpc from fithub latest Modified Paths: -------------- trunk/AutomaticTranslationDescriptions.php trunk/doc/Change.log trunk/includes/GoogleTranslator.php trunk/xmlrpc/lib/xmlrpc.inc trunk/xmlrpc/lib/xmlrpc_wrappers.inc trunk/xmlrpc/lib/xmlrpcs.inc Modified: trunk/AutomaticTranslationDescriptions.php =================================================================== --- trunk/AutomaticTranslationDescriptions.php 2018-01-06 14:30:16 UTC (rev 7903) +++ trunk/AutomaticTranslationDescriptions.php 2018-01-06 23:15:16 UTC (rev 7904) @@ -7,6 +7,12 @@ $BookMark = 'Z_TranslateItemDescriptions'; // Anchor's id in the manual's html document. include ('includes/header.php'); +if (!function_exists("curl_init")){ + prnMsg("This script requires that the PHP curl module be available to use the Google API. Unfortunately this installation does not have the curl module available","error"); + include('includes/footer.php'); + exit; +} + include ('includes/GoogleTranslator.php'); $SourceLanguage=mb_substr($_SESSION['Language'],0,2); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-06 14:30:16 UTC (rev 7903) +++ trunk/doc/Change.log 2018-01-06 23:15:16 UTC (rev 7904) @@ -1,7 +1,9 @@ webERP Change Log 6/1/18 PaulT: SelectSalesOrder.php: Fix handling to correct table heading value. (Reported in forums by Paul Becker) -6/1/18 Phil: Attempt to avoid XSS attacks by logged in users by parsing out "script>" from all $_POST and $_GET variables - subsequentely changed to strip_tags from all $_POST and $_GETs per Tim's recommendation +7/1/18 Phil: Update phpxmlrpc to latest from https://github.com/gggeek/phpxmlrpc +6/1/18 Phil: Attempt to avoid XSS attacks by logged in users by parsing out "script>" from all $_POST and $_GET variables - subsequentely changed to strip_tags from all $_POST and $_GETs per Tim's recommendation + 3/1/18: PaulT: SelectSalesOrder.php: Fix search to retain quote option and set StockLocation to the UserStockLocation to auto-load current Sales Orders. 2/1/18: PaulT: SelectSalesOrder.php: Move handling for URL Quotations parameter to top of file to avoid potential page error(s). (Reported in forums by Paul Becker) Handling move reduces code within some conditional checks. This change also includes minor whitespace improvements and removes an unused global reference. 2/1/18: PaulT: css/default/default.css: Add text alignment in a couple of styles to match the same use in other CSS to avoid formatting issues when the default theme is used. Also, set several property names to lowercase. Modified: trunk/includes/GoogleTranslator.php =================================================================== --- trunk/includes/GoogleTranslator.php 2018-01-06 14:30:16 UTC (rev 7903) +++ trunk/includes/GoogleTranslator.php 2018-01-06 23:15:16 UTC (rev 7904) @@ -4,14 +4,13 @@ // This webERP-style code is based on http://hayageek.com/google-translate-api-tutorial/ function translate_via_google_translator($text,$target,$source=false){ - $url = 'https://www.googleapis.com/language/translate/v2?key=' . $_SESSION['GoogleTranslatorAPIKey'] . '&q=' . rawurlencode($text); - $url .= '&target='.$target; + $url = 'https://www.googleapis.com/language/translate/v2?key=' . $_SESSION['GoogleTranslatorAPIKey'] . '&q=' . rawurlencode($text) . '&target=' . $target; if($source){ - $url .= '&source='.$source; + $url .= '&source=' . $source; } $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - $response = curl_exec($ch); + $response = curl_exec($ch); curl_close($ch); $obj =json_decode($response,true); //true converts stdClass to associative array. if($obj != null){ @@ -21,13 +20,13 @@ else{ $TranslatedText = $obj['data']['translations'][0]['translatedText']; // if(isset($obj['data']['translations'][0]['detectedSourceLanguage'])) //this is set if only source is not available. - // echo "Detecte Source Languge : ".$obj['data']['translations'][0]['detectedSourceLanguage']."n"; + // echo "Detecte Source Languge : ".$obj['data']['translations'][0]['detectedSourceLanguage']."n"; } } else{ - $TranslatedText = "UNKNOW ERROR"; + $TranslatedText = "UNKNOW ERROR"; } return $TranslatedText; -} +} ?> \ No newline at end of file Modified: trunk/xmlrpc/lib/xmlrpc.inc =================================================================== --- trunk/xmlrpc/lib/xmlrpc.inc 2018-01-06 14:30:16 UTC (rev 7903) +++ trunk/xmlrpc/lib/xmlrpc.inc 2018-01-06 23:15:16 UTC (rev 7904) @@ -1,7 +1,6 @@ <?php // by Edd Dumbill (C) 1999-2002 // <ed...@us...> -// $Id: xmlrpc.inc,v 1.174 2009/03/16 19:36:38 ggiunta Exp $ // Copyright (c) 1999,2000,2002 Edd Dumbill. // All rights reserved. @@ -35,3742 +34,181 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED // OF THE POSSIBILITY OF SUCH DAMAGE. - if(!function_exists('xml_parser_create')) - { - // For PHP 4 onward, XML functionality is always compiled-in on windows: - // no more need to dl-open it. It might have been compiled out on *nix... - if(strtoupper(substr(PHP_OS, 0, 3) != 'WIN')) - { - dl('xml.so'); - } - } +/****************************************************************************** + * + * *** DEPRECATED *** + * + * This file is only used to insure backwards compatibility + * with the API of the library <= rev. 3 + * + * If it is included, the library will work without any further autoloading + *****************************************************************************/ - // G. Giunta 2005/01/29: declare global these variables, - // so that xmlrpc.inc will work even if included from within a function - // Milosch: 2005/08/07 - explicitly request these via $GLOBALS where used. - $GLOBALS['xmlrpcI4']='i4'; - $GLOBALS['xmlrpcInt']='int'; - $GLOBALS['xmlrpcBoolean']='boolean'; - $GLOBALS['xmlrpcDouble']='double'; - $GLOBALS['xmlrpcString']='string'; - $GLOBALS['xmlrpcDateTime']='dateTime.iso8601'; - $GLOBALS['xmlrpcBase64']='base64'; - $GLOBALS['xmlrpcArray']='array'; - $GLOBALS['xmlrpcStruct']='struct'; - $GLOBALS['xmlrpcValue']='undefined'; +include_once(__DIR__.'/../src/PhpXmlRpc.php'); +include_once(__DIR__.'/../src/Value.php'); +include_once(__DIR__.'/../src/Request.php'); +include_once(__DIR__.'/../src/Response.php'); +include_once(__DIR__.'/../src/Client.php'); +include_once(__DIR__.'/../src/Encoder.php'); +include_once(__DIR__.'/../src/Helper/Charset.php'); +include_once(__DIR__.'/../src/Helper/Date.php'); +include_once(__DIR__.'/../src/Helper/Http.php'); +include_once(__DIR__.'/../src/Helper/Logger.php'); +include_once(__DIR__.'/../src/Helper/XMLParser.php'); - $GLOBALS['xmlrpcTypes']=array( - $GLOBALS['xmlrpcI4'] => 1, - $GLOBALS['xmlrpcInt'] => 1, - $GLOBALS['xmlrpcBoolean'] => 1, - $GLOBALS['xmlrpcString'] => 1, - $GLOBALS['xmlrpcDouble'] => 1, - $GLOBALS['xmlrpcDateTime'] => 1, - $GLOBALS['xmlrpcBase64'] => 1, - $GLOBALS['xmlrpcArray'] => 2, - $GLOBALS['xmlrpcStruct'] => 3 - ); - $GLOBALS['xmlrpc_valid_parents'] = array( - 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT'), - 'BOOLEAN' => array('VALUE'), - 'I4' => array('VALUE'), - 'INT' => array('VALUE'), - 'STRING' => array('VALUE'), - 'DOUBLE' => array('VALUE'), - 'DATETIME.ISO8601' => array('VALUE'), - 'BASE64' => array('VALUE'), - 'MEMBER' => array('STRUCT'), - 'NAME' => array('MEMBER'), - 'DATA' => array('ARRAY'), - 'ARRAY' => array('VALUE'), - 'STRUCT' => array('VALUE'), - 'PARAM' => array('PARAMS'), - 'METHODNAME' => array('METHODCALL'), - 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'), - 'FAULT' => array('METHODRESPONSE'), - 'NIL' => array('VALUE'), // only used when extension activated - 'EX:NIL' => array('VALUE') // only used when extension activated - ); +/* Expose the global variables which used to be defined */ +PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'ISO-8859-1'; // old default +PhpXmlRpc\PhpXmlRpc::exportGlobals(); - // define extra types for supporting NULL (useful for json or <NIL/>) - $GLOBALS['xmlrpcNull']='null'; - $GLOBALS['xmlrpcTypes']['null']=1; +/* some stuff deprecated enough that we do not want to put it in the new lib version */ - // Not in use anymore since 2.0. Shall we remove it? - /// @deprecated - $GLOBALS['xmlEntities']=array( - 'amp' => '&', - 'quot' => '"', - 'lt' => '<', - 'gt' => '>', - 'apos' => "'" - ); +/// @deprecated +$GLOBALS['xmlEntities'] = array( + 'amp' => '&', + 'quot' => '"', + 'lt' => '<', + 'gt' => '>', + 'apos' => "'" +); - // tables used for transcoding different charsets into us-ascii xml +// formulate backslashes for escaping regexp +// Not in use anymore since 2.0. Shall we remove it? +/// @deprecated +$GLOBALS['xmlrpc_backslash'] = chr(92).chr(92); - $GLOBALS['xml_iso88591_Entities']=array(); - $GLOBALS['xml_iso88591_Entities']['in'] = array(); - $GLOBALS['xml_iso88591_Entities']['out'] = array(); - for ($i = 0; $i < 32; $i++) - { - $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i); - $GLOBALS['xml_iso88591_Entities']['out'][] = '&#'.$i.';'; - } - for ($i = 160; $i < 256; $i++) - { - $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i); - $GLOBALS['xml_iso88591_Entities']['out'][] = '&#'.$i.';'; - } +/* Expose with the old names the classes which have been namespaced */ - /// @todo add to iso table the characters from cp_1252 range, i.e. 128 to 159? - /// These will NOT be present in true ISO-8859-1, but will save the unwary - /// windows user from sending junk (though no luck when reciving them...) - /* - $GLOBALS['xml_cp1252_Entities']=array(); - for ($i = 128; $i < 160; $i++) - { - $GLOBALS['xml_cp1252_Entities']['in'][] = chr($i); - } - $GLOBALS['xml_cp1252_Entities']['out'] = array( - '€', '?', '‚', 'ƒ', - '„', '…', '†', '‡', - 'ˆ', '‰', 'Š', '‹', - 'Œ', '?', 'Ž', '?', - '?', '‘', '’', '“', - '”', '•', '–', '—', - '˜', '™', 'š', '›', - 'œ', '?', 'ž', 'Ÿ' - ); - */ +class xmlrpcval extends PhpXmlRpc\Value +{ + /** + * @deprecated + * @param xmlrpcval $o + * @return string + */ + public function serializeval($o) + { + // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals... + //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval'))) + //{ + $ar = $o->me; + $val = reset($ar); + $typ = key($ar); - $GLOBALS['xmlrpcerr'] = array( - 'unknown_method'=>1, - 'invalid_return'=>2, - 'incorrect_params'=>3, - 'introspect_unknown'=>4, - 'http_error'=>5, - 'no_data'=>6, - 'no_ssl'=>7, - 'curl_fail'=>8, - 'invalid_request'=>15, - 'no_curl'=>16, - 'server_error'=>17, - 'multicall_error'=>18, - 'multicall_notstruct'=>9, - 'multicall_nomethod'=>10, - 'multicall_notstring'=>11, - 'multicall_recursion'=>12, - 'multicall_noparams'=>13, - 'multicall_notarray'=>14, + return '<value>' . $this->serializedata($typ, $val) . "</value>\n"; + //} + } - 'cannot_decompress'=>103, - 'decompress_fail'=>104, - 'dechunk_fail'=>105, - 'server_cannot_decompress'=>106, - 'server_decompress_fail'=>107 - ); + /** + * @deprecated this code looks like it is very fragile and has not been fixed + * for a long long time. Shall we remove it for 2.0? + */ + public function getval() + { + // UNSTABLE + $b = reset($this->me); + $a = key($this->me); + // contributed by I Sofer, 2001-03-24 + // add support for nested arrays to scalarval + // i've created a new method here, so as to + // preserve back compatibility - $GLOBALS['xmlrpcstr'] = array( - 'unknown_method'=>'Unknown method', - 'invalid_return'=>'Invalid return payload: enable debugging to examine incoming payload', - 'incorrect_params'=>'Incorrect parameters passed to method', - 'introspect_unknown'=>"Can't introspect: method unknown", - 'http_error'=>"Didn't receive 200 OK from remote server.", - 'no_data'=>'No data received from server.', - 'no_ssl'=>'No SSL support compiled in.', - 'curl_fail'=>'CURL error', - 'invalid_request'=>'Invalid request payload', - 'no_curl'=>'No CURL support compiled in.', - 'server_error'=>'Internal server error', - 'multicall_error'=>'Received from server invalid multicall response', - 'multicall_notstruct'=>'system.multicall expected struct', - 'multicall_nomethod'=>'missing methodName', - 'multicall_notstring'=>'methodName is not a string', - 'multicall_recursion'=>'recursive system.multicall forbidden', - 'multicall_noparams'=>'missing params', - 'multicall_notarray'=>'params is not an array', + if (is_array($b)) { + foreach($b as $id => $cont) { + $b[$id] = $cont->scalarval(); + } + } - 'cannot_decompress'=>'Received from server compressed HTTP and cannot decompress', - 'decompress_fail'=>'Received from server invalid compressed HTTP', - 'dechunk_fail'=>'Received from server invalid chunked HTTP', - 'server_cannot_decompress'=>'Received from client compressed HTTP request and cannot decompress', - 'server_decompress_fail'=>'Received from client invalid compressed HTTP request' - ); + // add support for structures directly encoding php objects + if (is_object($b)) { + $t = get_object_vars($b); + foreach($t as $id => $cont) { + $t[$id] = $cont->scalarval(); + } + foreach($t as $id => $cont) { + @$b->$id = $cont; + } + } + // end contrib + return $b; + } - // The charset encoding used by the server for received messages and - // by the client for received responses when received charset cannot be determined - // or is not supported - $GLOBALS['xmlrpc_defencoding']='UTF-8'; + /// reset functionality added by parent class: same as it would happen if no interface was declared + public function count() + { + return 1; + } - // The encoding used internally by PHP. - // String values received as xml will be converted to this, and php strings will be converted to xml - // as if having been coded with this - $GLOBALS['xmlrpc_internalencoding']='ISO-8859-1'; + /// reset functionality added by parent class: same as it would happen if no interface was declared + public function getIterator() { + return new ArrayIterator($this); + } +} - $GLOBALS['xmlrpcName']='XML-RPC for PHP'; - $GLOBALS['xmlrpcVersion']='3.0.0.beta'; +class xmlrpcmsg extends PhpXmlRpc\Request +{ +} - // let user errors start at 800 - $GLOBALS['xmlrpcerruser']=800; - // let XML parse errors start at 100 - $GLOBALS['xmlrpcerrxml']=100; +class xmlrpcresp extends PhpXmlRpc\Response +{ +} - // formulate backslashes for escaping regexp - // Not in use anymore since 2.0. Shall we remove it? - /// @deprecated - $GLOBALS['xmlrpc_backslash']=chr(92).chr(92); +class xmlrpc_client extends PhpXmlRpc\Client +{ +} - // set to TRUE to enable correct decoding of <NIL/> and <EX:NIL/> values - $GLOBALS['xmlrpc_null_extension']=false; +/* Expose as global functions the ones which are now class methods */ - // set to TRUE to enable encoding of php NULL values to <EX:NIL/> instead of <NIL/> - $GLOBALS['xmlrpc_null_apache_encoding']=false; +/// Wrong speling, but we are adamant on backwards compatibility! +function xmlrpc_encode_entitites($data, $srcEncoding='', $destEncoding='') +{ + return PhpXmlRpc\Helper\Charset::instance()->encodeEntitites($data, $srcEncoding, $destEncoding); +} - // used to store state during parsing - // quick explanation of components: - // ac - used to accumulate values - // isf - used to indicate a parsing fault (2) or xmlrpcresp fault (1) - // isf_reason - used for storing xmlrpcresp fault string - // lv - used to indicate "looking for a value": implements - // the logic to allow values with no types to be strings - // params - used to store parameters in method calls - // method - used to store method name - // stack - array with genealogy of xml elements names: - // used to validate nesting of xmlrpc elements - $GLOBALS['_xh']=null; +function iso8601_encode($timeT, $utc=0) +{ + return PhpXmlRpc\Helper\Date::iso8601Encode($timeT, $utc); +} - /** - * Convert a string to the correct XML representation in a target charset - * To help correct communication of non-ascii chars inside strings, regardless - * of the charset used when sending requests, parsing them, sending responses - * and parsing responses, an option is to convert all non-ascii chars present in the message - * into their equivalent 'charset entity'. Charset entities enumerated this way - * are independent of the charset encoding used to transmit them, and all XML - * parsers are bound to understand them. - * Note that in the std case we are not sending a charset encoding mime type - * along with http headers, so we are bound by RFC 3023 to emit strict us-ascii. - * - * @todo do a bit of basic benchmarking (strtr vs. str_replace) - * @todo make usage of iconv() or recode_string() or mb_string() where available - */ - function xmlrpc_encode_entitites($data, $src_encoding='', $dest_encoding='') - { - if ($src_encoding == '') - { - // lame, but we know no better... - $src_encoding = $GLOBALS['xmlrpc_internalencoding']; - } +function iso8601_decode($iDate, $utc=0) +{ + return PhpXmlRpc\Helper\Date::iso8601Decode($iDate, $utc); +} - switch(strtoupper($src_encoding.'_'.$dest_encoding)) - { - case 'ISO-8859-1_': - case 'ISO-8859-1_US-ASCII': - $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data); - $escaped_data = str_replace($GLOBALS['xml_iso88591_Entities']['in'], $GLOBALS['xml_iso88591_Entities']['out'], $escaped_data); - break; - case 'ISO-8859-1_UTF-8': - $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data); - $escaped_data = utf8_encode($escaped_data); - break; - case 'ISO-8859-1_ISO-8859-1': - case 'US-ASCII_US-ASCII': - case 'US-ASCII_UTF-8': - case 'US-ASCII_': - case 'US-ASCII_ISO-8859-1': - case 'UTF-8_UTF-8': - //case 'CP1252_CP1252': - $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data); - break; - case 'UTF-8_': - case 'UTF-8_US-ASCII': - case 'UTF-8_ISO-8859-1': - // NB: this will choke on invalid UTF-8, going most likely beyond EOF - $escaped_data = ''; - // be kind to users creating string xmlrpcvals out of different php types - $data = (string) $data; - $ns = strlen ($data); - for ($nn = 0; $nn < $ns; $nn++) - { - $ch = $data[$nn]; - $ii = ord($ch); - //1 7 0bbbbbbb (127) - if ($ii < 128) - { - /// @todo shall we replace this with a (supposedly) faster str_replace? - switch($ii){ - case 34: - $escaped_data .= '"'; - break; - case 38: - $escaped_data .= '&'; - break; - case 39: - $escaped_data .= '''; - break; - case 60: - $escaped_data .= '<'; - break; - case 62: - $escaped_data .= '>'; - break; - default: - $escaped_data .= $ch; - } // switch - } - //2 11 110bbbbb 10bbbbbb (2047) - else if ($ii>>5 == 6) - { - $b1 = ($ii & 31); - $ii = ord($data[$nn+1]); - $b2 = ($ii & 63); - $ii = ($b1 * 64) + $b2; - $ent = sprintf ('&#%d;', $ii); - $escaped_data .= $ent; - $nn += 1; - } - //3 16 1110bbbb 10bbbbbb 10bbbbbb - else if ($ii>>4 == 14) - { - $b1 = ($ii & 15); - $ii = ord($data[$nn+1]); - $b2 = ($ii & 63); - $ii = ord($data[$nn+2]); - $b3 = ($ii & 63); - $ii = ((($b1 * 64) + $b2) * 64) + $b3; - $ent = sprintf ('&#%d;', $ii); - $escaped_data .= $ent; - $nn += 2; - } - //4 21 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb - else if ($ii>>3 == 30) - { - $b1 = ($ii & 7); - $ii = ord($data[$nn+1]); - $b2 = ($ii & 63); - $ii = ord($data[$nn+2]); - $b3 = ($ii & 63); - $ii = ord($data[$nn+3]); - $b4 = ($ii & 63); - $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4; - $ent = sprintf ('&#%d;', $ii); - $escaped_data .= $ent; - $nn += 3; - } - } - break; -/* - case 'CP1252_': - case 'CP1252_US-ASCII': - $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data); - $escaped_data = str_replace($GLOBALS['xml_iso88591_Entities']['in'], $GLOBALS['xml_iso88591_Entities']['out'], $escaped_data); - $escaped_data = str_replace($GLOBALS['xml_cp1252_Entities']['in'], $GLOBALS['xml_cp1252_Entities']['out'], $escaped_data); - break; - case 'CP1252_UTF-8': - $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data); - /// @todo we could use real UTF8 chars here instead of xml entities... (note that utf_8 encode all allone will NOT convert them) - $escaped_data = str_replace($GLOBALS['xml_cp1252_Entities']['in'], $GLOBALS['xml_cp1252_Entities']['out'], $escaped_data); - $escaped_data = utf8_encode($escaped_data); - break; - case 'CP1252_ISO-8859-1': - $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data); - // we might as well replave all funky chars with a '?' here, but we are kind and leave it to the receiving application layer to decide what to do with these weird entities... - $escaped_data = str_replace($GLOBALS['xml_cp1252_Entities']['in'], $GLOBALS['xml_cp1252_Entities']['out'], $escaped_data); - break; -*/ - default: - $escaped_data = ''; - error_log("Converting from $src_encoding to $dest_encoding: not supported..."); - } - return $escaped_data; - } +function decode_chunked($buffer) +{ + return PhpXmlRpc\Helper\Http::decodeChunked($buffer); +} - /// xml parser handler function for opening element tags - function xmlrpc_se($parser, $name, $attrs, $accept_single_vals=false) - { - // if invalid xmlrpc already detected, skip all processing - if ($GLOBALS['_xh']['isf'] < 2) - { - // check for correct element nesting - // top level element can only be of 2 types - /// @todo optimization creep: save this check into a bool variable, instead of using count() every time: - /// there is only a single top level element in xml anyway - if (count($GLOBALS['_xh']['stack']) == 0) - { - if ($name != 'METHODRESPONSE' && $name != 'METHODCALL' && ( - $name != 'VALUE' && !$accept_single_vals)) - { - $GLOBALS['_xh']['isf'] = 2; - $GLOBALS['_xh']['isf_reason'] = 'missing top level xmlrpc element'; - return; - } - else - { - $GLOBALS['_xh']['rt'] = strtolower($name); - $GLOBALS['_xh']['rt'] = strtolower($name); - } - } - else - { - // not top level element: see if parent is OK - $parent = end($GLOBALS['_xh']['stack']); - if (!array_key_exists($name, $GLOBALS['xmlrpc_valid_parents']) || !in_array($parent, $GLOBALS['xmlrpc_valid_parents'][$name])) - { - $GLOBALS['_xh']['isf'] = 2; - $GLOBALS['_xh']['isf_reason'] = "xmlrpc element $name cannot be child of $parent"; - return; - } - } +function php_xmlrpc_decode($xmlrpcVal, $options=array()) +{ + $encoder = new PhpXmlRpc\Encoder(); + return $encoder->decode($xmlrpcVal, $options); +} - switch($name) - { - // optimize for speed switch cases: most common cases first - case 'VALUE': - /// @todo we could check for 2 VALUE elements inside a MEMBER or PARAM element - $GLOBALS['_xh']['vt']='value'; // indicator: no value found yet - $GLOBALS['_xh']['ac']=''; - $GLOBALS['_xh']['lv']=1; - $GLOBALS['_xh']['php_class']=null; - break; - case 'I4': - case 'INT': - case 'STRING': - case 'BOOLEAN': - case 'DOUBLE': - case 'DATETIME.ISO8601': - case 'BASE64': - if ($GLOBALS['_xh']['vt']!='value') - { - //two data elements inside a value: an error occurred! - $GLOBALS['_xh']['isf'] = 2; - $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value"; - return; - } - $GLOBALS['_xh']['ac']=''; // reset the accumulator - break; - case 'STRUCT': - case 'ARRAY': - if ($GLOBALS['_xh']['vt']!='value') - { - //two data elements inside a value: an error occurred! - $GLOBALS['_xh']['isf'] = 2; - $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value"; - return; - } - // create an empty array to hold child values, and push it onto appropriate stack - $cur_val = array(); - $cur_val['values'] = array(); - $cur_val['type'] = $name; - // check for out-of-band information to rebuild php objs - // and in case it is found, save it - if (@isset($attrs['PHP_CLASS'])) - { - $cur_val['php_class'] = $attrs['PHP_CLASS']; - } - $GLOBALS['_xh']['valuestack'][] = $cur_val; - $GLOBALS['_xh']['vt']='data'; // be prepared for a data element next - break; - case 'DATA': - if ($GLOBALS['_xh']['vt']!='data') - { - //two data elements inside a value: an error occurred! - $GLOBALS['_xh']['isf'] = 2; - $GLOBALS['_xh']['isf_reason'] = "found two data elements inside an array element"; - return; - } - case 'METHODCALL': - case 'METHODRESPONSE': - case 'PARAMS': - // valid elements that add little to processing - break; - case 'METHODNAME': - case 'NAME': - /// @todo we could check for 2 NAME elements inside a MEMBER element - $GLOBALS['_xh']['ac']=''; - break; - case 'FAULT': - $GLOBALS['_xh']['isf']=1; - break; - case 'MEMBER': - $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name']=''; // set member name to null, in case we do not find in the xml later on - //$GLOBALS['_xh']['ac']=''; - // Drop trough intentionally - case 'PARAM': - // clear value type, so we can check later if no value has been passed for this param/member - $GLOBALS['_xh']['vt']=null; - break; - case 'NIL': - case 'EX:NIL': - if ($GLOBALS['xmlrpc_null_extension']) - { - if ($GLOBALS['_xh']['vt']!='value') - { - //two data elements inside a value: an error occurred! - $GLOBALS['_xh']['isf'] = 2; - $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value"; - return; - } - $GLOBALS['_xh']['ac']=''; // reset the accumulator - break; - } - // we do not support the <NIL/> extension, so - // drop through intentionally - default: - /// INVALID ELEMENT: RAISE ISF so that it is later recognized!!! - $GLOBALS['_xh']['isf'] = 2; - $GLOBALS['_xh']['isf_reason'] = "found not-xmlrpc xml element $name"; - break; - } +function php_xmlrpc_encode($phpVal, $options=array()) +{ + $encoder = new PhpXmlRpc\Encoder(); + return $encoder->encode($phpVal, $options); +} - // Save current element name to stack, to validate nesting - $GLOBALS['_xh']['stack'][] = $name; +function php_xmlrpc_decode_xml($xmlVal, $options=array()) +{ + $encoder = new PhpXmlRpc\Encoder(); + return $encoder->decodeXml($xmlVal, $options); +} - /// @todo optimization creep: move this inside the big switch() above - if($name!='VALUE') - { - $GLOBALS['_xh']['lv']=0; - } - } - } +function guess_encoding($httpHeader='', $xmlChunk='', $encodingPrefs=null) +{ + return PhpXmlRpc\Helper\XMLParser::guessEncoding($httpHeader, $xmlChunk, $encodingPrefs); +} - /// Used in decoding xml chunks that might represent single xmlrpc values - function xmlrpc_se_any($parser, $name, $attrs) - { - xmlrpc_se($parser, $name, $attrs, true); - } +function has_encoding($xmlChunk) +{ + return PhpXmlRpc\Helper\XMLParser::hasEncoding($xmlChunk); +} - /// xml parser handler function for close element tags - function xmlrpc_ee($parser, $name, $rebuild_xmlrpcvals = true) - { - if ($GLOBALS['_xh']['isf'] < 2) - { - // push this element name from stack - // NB: if XML validates, correct opening/closing is guaranteed and - // we do not have to check for $name == $curr_elem. - // we also checked for proper nesting at start of elements... - $curr_elem = array_pop($GLOBALS['_xh']['stack']); - - switch($name) - { - case 'VALUE': - // This if() detects if no scalar was inside <VALUE></VALUE> - if ($GLOBALS['_xh']['vt']=='value') - { - $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac']; - $GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcString']; - } - - if ($rebuild_xmlrpcvals) - { - // build the xmlrpc val out of the data received, and substitute it - $temp = new xmlrpcval($GLOBALS['_xh']['value'], $GLOBALS['_xh']['vt']); - // in case we got info about underlying php class, save it - // in the object we're rebuilding - if (isset($GLOBALS['_xh']['php_class'])) - $temp->_php_class = $GLOBALS['_xh']['php_class']; - // check if we are inside an array or struct: - // if value just built is inside an array, let's move it into array on the stack - $vscount = count($GLOBALS['_xh']['valuestack']); - if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY') - { - $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $temp; - } - else - { - $GLOBALS['_xh']['value'] = $temp; - } - } - else - { - /// @todo this needs to treat correctly php-serialized objects, - /// since std deserializing is done by php_xmlrpc_decode, - /// which we will not be calling... - if (isset($GLOBALS['_xh']['php_class'])) - { - } - - // check if we are inside an array or struct: - // if value just built is inside an array, let's move it into array on the stack - $vscount = count($GLOBALS['_xh']['valuestack']); - if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY') - { - $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $GLOBALS['_xh']['value']; - } - } - break; - case 'BOOLEAN': - case 'I4': - case 'INT': - case 'STRING': - case 'DOUBLE': - case 'DATETIME.ISO8601': - case 'BASE64': - $GLOBALS['_xh']['vt']=strtolower($name); - /// @todo: optimization creep - remove the if/elseif cycle below - /// since the case() in which we are already did that - if ($name=='STRING') - { - $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac']; - } - elseif ($name=='DATETIME.ISO8601') - { - if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $GLOBALS['_xh']['ac'])) - { - error_log('XML-RPC: invalid value received in DATETIME: '.$GLOBALS['_xh']['ac']); - } - $GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcDateTime']; - $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac']; - } - elseif ($name=='BASE64') - { - /// @todo check for failure of base64 decoding / catch warnings - $GLOBALS['_xh']['value']=base64_decode($GLOBALS['_xh']['ac']); - } - elseif ($name=='BOOLEAN') - { - // special case here: we translate boolean 1 or 0 into PHP - // constants true or false. - // Strings 'true' and 'false' are accepted, even though the - // spec never mentions them (see eg. Blogger api docs) - // NB: this simple checks helps a lot sanitizing input, ie no - // security problems around here - if ($GLOBALS['_xh']['ac']=='1' || strcasecmp($GLOBALS['_xh']['ac'], 'true') == 0) - { - $GLOBALS['_xh']['value']=true; - } - else - { - // log if receiveing something strange, even though we set the value to false anyway - if ($GLOBALS['_xh']['ac']!='0' && strcasecmp($GLOBALS['_xh']['ac'], 'false') != 0) - error_log('XML-RPC: invalid value received in BOOLEAN: '.$GLOBALS['_xh']['ac']); - $GLOBALS['_xh']['value']=false; - } - } - elseif ($name=='DOUBLE') - { - // we have a DOUBLE - // we must check that only 0123456789-.<space> are characters here - // NOTE: regexp could be much stricter than this... - if (!preg_match('/^[+-eE0123456789 \t.]+$/', $GLOBALS['_xh']['ac'])) - { - /// @todo: find a better way of throwing an error than this! - error_log('XML-RPC: non numeric value received in DOUBLE: '.$GLOBALS['_xh']['ac']); - $GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND'; - } - else - { - // it's ok, add it on - $GLOBALS['_xh']['value']=(double)$GLOBALS['_xh']['ac']; - } - } - else - { - // we have an I4/INT - // we must check that only 0123456789-<space> are characters here - if (!preg_match('/^[+-]?[0123456789 \t]+$/', $GLOBALS['_xh']['ac'])) - { - /// @todo find a better way of throwing an error than this! - error_log('XML-RPC: non numeric value received in INT: '.$GLOBALS['_xh']['ac']); - $GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND'; - } - else - { - // it's ok, add it on - $GLOBALS['_xh']['value']=(int)$GLOBALS['_xh']['ac']; - } - } - //$GLOBALS['_xh']['ac']=''; // is this necessary? - $GLOBALS['_xh']['lv']=3; // indicate we've found a value - break; - case 'NAME': - $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name'] = $GLOBALS['_xh']['ac']; - break; - case 'MEMBER': - //$GLOBALS['_xh']['ac']=''; // is this necessary? - // add to array in the stack the last element built, - // unless no VALUE was found - if ($GLOBALS['_xh']['vt']) - { - $vscount = count($GLOBALS['_xh']['valuestack']); - $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][$GLOBALS['_xh']['valuestack'][$vscount-1]['name']] = $GLOBALS['_xh']['value']; - } else - error_log('XML-RPC: missing VALUE inside STRUCT in received xml'); - break; - case 'DATA': - //$GLOBALS['_xh']['ac']=''; // is this necessary? - $GLOBALS['_xh']['vt']=null; // reset this to check for 2 data elements in a row - even if they're empty - break; - case 'STRUCT': - case 'ARRAY': - // fetch out of stack array of values, and promote it to current value - $curr_val = array_pop($GLOBALS['_xh']['valuestack']); - $GLOBALS['_xh']['value'] = $curr_val['values']; - $GLOBALS['_xh']['vt']=strtolower($name); - if (isset($curr_val['php_class'])) - { - $GLOBALS['_xh']['php_class'] = $curr_val['php_class']; - } - break; - case 'PARAM': - // add to array of params the current value, - // unless no VALUE was found - if ($GLOBALS['_xh']['vt']) - { - $GLOBALS['_xh']['params'][]=$GLOBALS['_xh']['value']; - $GLOBALS['_xh']['pt'][]=$GLOBALS['_xh']['vt']; - } - else - error_log('XML-RPC: missing VALUE inside PARAM in received xml'); - break; - case 'METHODNAME': - $GLOBALS['_xh']['method']=preg_replace('/^[\n\r\t ]+/', '', $GLOBALS['_xh']['ac']); - break; - case 'NIL': - case 'EX:NIL': - if ($GLOBALS['xmlrpc_null_extension']) - { - $GLOBALS['_xh']['vt']='null'; - $GLOBALS['_xh']['value']=null; - $GLOBALS['_xh']['lv']=3; - break; - } - // drop through intentionally if nil extension not enabled - case 'PARAMS': - case 'FAULT': - case 'METHODCALL': - case 'METHORESPONSE': - break; - default: - // End of INVALID ELEMENT! - // shall we add an assert here for unreachable code??? - break; - } - } - } - - /// Used in decoding xmlrpc requests/responses without rebuilding xmlrpc values - function xmlrpc_ee_fast($parser, $name) - { - xmlrpc_ee($parser, $name, false); - } - - /// xml parser handler function for character data - function xmlrpc_cd($parser, $data) - { - // skip processing if xml fault already detected - if ($GLOBALS['_xh']['isf'] < 2) - { - // "lookforvalue==3" means that we've found an entire value - // and should discard any further character data - if($GLOBALS['_xh']['lv']!=3) - { - // G. Giunta 2006-08-23: useless change of 'lv' from 1 to 2 - //if($GLOBALS['_xh']['lv']==1) - //{ - // if we've found text and we're just in a <value> then - // say we've found a value - //$GLOBALS['_xh']['lv']=2; - //} - // we always initialize the accumulator before starting parsing, anyway... - //if(!@isset($GLOBALS['_xh']['ac'])) - //{ - // $GLOBALS['_xh']['ac'] = ''; - //} - $GLOBALS['_xh']['ac'].=$data; - } - } - } - - /// xml parser handler function for 'other stuff', ie. not char data or - /// element start/end tag. In fact it only gets called on unknown entities... - function xmlrpc_dh($parser, $data) - { - // skip processing if xml fault already detected - if ($GLOBALS['_xh']['isf'] < 2) - { - if(substr($data, 0, 1) == '&' && substr($data, -1, 1) == ';') - { - // G. Giunta 2006-08-25: useless change of 'lv' from 1 to 2 - //if($GLOBALS['_xh']['lv']==1) - //{ - // $GLOBALS['_xh']['lv']=2; - //} - $GLOBALS['_xh']['ac'].=$data; - } - } - return true; - } - - class xmlrpc_client - { - var $path; - var $server; - var $port=0; - var $method='http'; - var $errno; - var $errstr; - var $debug=0; - var $username=''; - var $password=''; - var $authtype=1; - var $cert=''; - var $certpass=''; - var $cacert=''; - var $cacertdir=''; - var $key=''; - var $keypass=''; - var $verifypeer=true; - var $verifyhost=1; - var $no_multicall=false; - var $proxy=''; - var $proxyport=0; - var $proxy_user=''; - var $proxy_pass=''; - var $proxy_authtype=1; - var $cookies=array(); - var $extracurlopts=array(); - - /** - * List of http compression methods accepted by the client for responses. - * NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib - * - * NNB: you can set it to any non-empty array for HTTP11 and HTTPS, since - * in those cases it will be up to CURL to decide the compression methods - * it supports. You might check for the presence of 'zlib' in the output of - * curl_version() to determine wheter compression is supported or not - */ - var $accepted_compression = array(); - /** - * Name of compression scheme to be used for sending requests. - * Either null, gzip or deflate - */ - var $request_compression = ''; - /** - * CURL handle: used for keep-alive connections (PHP 4.3.8 up, see: - * http://curl.haxx.se/docs/faq.html#7.3) - */ - var $xmlrpc_curl_handle = null; - /// Wheter to use persistent connections for http 1.1 and https - var $keepalive = false; - /// Charset encodings that can be decoded without problems by the client - var $accepted_charset_encodings = array(); - /// Charset encoding to be used in serializing request. NULL = use ASCII - var $request_charset_encoding = ''; - /** - * Decides the content of xmlrpcresp objects returned by calls to send() - * valid strings are 'xmlrpcvals', 'phpvals' or 'xml' - */ - var $return_type = 'xmlrpcvals'; - /** - * Sent to servers in http headers - */ - var $user_agent; - - /** - * @param string $path either the complete server URL or the PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php - * @param string $server the server name / ip address - * @param integer $port the port the server is listening on, defaults to 80 or 443 depending on protocol used - * @param string $method the http protocol variant: defaults to 'http', 'https' and 'http11' can be used if CURL is installed - */ - function xmlrpc_client($path, $server='', $port='', $method='') - { - // allow user to specify all params in $path - if($server == '' and $port == '' and $method == '') - { - $parts = parse_url($path); - $server = $parts['host']; - $path = isset($parts['path']) ? $parts['path'] : ''; - if(isset($parts['query'])) - { - $path .= '?'.$parts['query']; - } - if(isset($parts['fragment'])) - { - $path .= '#'.$parts['fragment']; - } - if(isset($parts['port'])) - { - $port = $parts['port']; - } - if(isset($parts['scheme'])) - { - $method = $parts['scheme']; - } - if(isset($parts['user'])) - { - $this->username = $parts['user']; - } - if(isset($parts['pass'])) - { - $this->password = $parts['pass']; - } - } - if($path == '' || $path[0] != '/') - { - $this->path='/'.$path; - } - else - { - $this->path=$path; - } - $this->server=$server; - if($port != '') - { - $this->port=$port; - } - if($method != '') - { - $this->method=$method; - } - - // if ZLIB is enabled, let the client by default accept compressed responses - if(function_exists('gzinflate') || ( - function_exists('curl_init') && (($info = curl_version()) && - ((is_string($info) && strpos($info, 'zlib') !== null) || isset($info['libz_version']))) - )) - { - $this->accepted_compression = array('gzip', 'deflate'); - } - - // keepalives: enabled by default - $this->keepalive = true; - - // by default the xml parser can support these 3 charset encodings - $this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII'); - - // initialize user_agent string - $this->user_agent = $GLOBALS['xmlrpcName'] . ' ' . $GLOBALS['xmlrpcVersion']; - } - - /** - * Enables/disables the echoing to screen of the xmlrpc responses received - * @param integer $debug values 0, 1 and 2 are supported (2 = echo sent msg too, before received response) - * @access public - */ - function setDebug($in) - { - $this->debug=$in; - } - - /** - * Add some http BASIC AUTH credentials, used by the client to authenticate - * @param string $u username - * @param string $p password - * @param integer $t auth type. See curl_setopt man page for supported auth types. Defaults to CURLAUTH_BASIC (basic auth) - * @access public - */ - function setCredentials($u, $p, $t=1) - { - $this->username=$u; - $this->password=$p; - $this->authtype=$t; - } - - /** - * Add a client-side https certificate - * @param string $cert - * @param string $certpass - * @access public - */ - function setCertificate($cert, $certpass) - { - $this->cert = $cert; - $this->certpass = $certpass; - } - - /** - * Add a CA certificate to verify server with (see man page about - * CURLOPT_CAINFO for more details - * @param string $cacert certificate file name (or dir holding certificates) - * @param bool $is_dir set to true to indicate cacert is a dir. defaults to false - * @access public - */ - function setCaCertificate($cacert, $is_dir=false) - { - if ($is_dir) - { - $this->cacertdir = $cacert; - } - else - { - $this->cacert = $cacert; - } - } - - /** - * Set attributes for SSL communication: private SSL key - * NB: does not work in older php/curl installs - * Thanks to Daniel Convissor - * @param string $key The name of a file containing a private SSL key - * @param string $keypass The secret password needed to use the private SSL key - * @access public - */ - function setKey($key, $keypass) - { - $this->key = $key; - $this->keypass = $keypass; - } - - /** - * Set attributes for SSL communication: verify server certificate - * @param bool $i enable/disable verification of peer certificate - * @access public - */ - function setSSLVerifyPeer($i) - { - $this->verifypeer = $i; - } - - /** - * Set attributes for SSL communication: verify match of server cert w. hostname - * @param int $i - * @access public - */ - function setSSLVerifyHost($i) - { - $this->verifyhost = $i; - } - - /** - * Set proxy info - * @param string $proxyhost - * @param string $proxyport Defaults to 8080 for HTTP and 443 for HTTPS - * @param string $proxyusername Leave blank if proxy has public access - * @param string $proxypassword Leave blank if proxy has public access - * @param int $proxyauthtype set to constant CURLAUTH_NTLM to use NTLM auth with proxy - * @access public - */ - function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 1) - { - $this->proxy = $proxyhost; - $this->proxyport = $proxyport; - $this->proxy_user = $proxyusername; - $this->proxy_pass = $proxypassword; - $this->proxy_authtype = $proxyauthtype; - } - - /** - * Enables/disables reception of compressed xmlrpc responses. - * Note that enabling reception of compressed responses merely adds some standard - * http headers to xmlrpc requests. It is up to the xmlrpc server to return - * compressed responses when receiving such requests. - * @param string $compmethod either 'gzip', 'deflate', 'any' or '' - * @access public - */ - function setAcceptedCompression($compmethod) - { - if ($compmethod == 'any') - $this->accepted_compression = array('gzip', 'deflate'); - else - $this->accepted_compression = array($compmethod); - } - - /** - * Enables/disables http compression of xmlrpc request. - * Take care when sending compressed requests: servers might not support them - * (and automatic fallback to uncompressed requests is not yet implemented) - * @param string $compmethod either 'gzip', 'deflate' or '' - * @access public - */ - function setRequestCompression($compmethod) - { - $this->request_compression = $compmethod; - } - - /** - * Adds a cookie to list of cookies that will be sent to server. - * NB: setting any param but name and value will turn the cookie into a 'version 1' cookie: - * do not do it unless you know what you are doing - * @param string $name - * @param string $value - * @param string $path - * @param string $domain - * @param int $port - * @access public - * - * @todo check correctness of urlencoding cookie value (copied from php way of doing it...) - */ - function setCookie($name, $value='', $path='', $domain='', $port=null) - { - $this->cookies[$name]['value'] = urlencode($value); - if ($path || $domain || $port) - { - $this->cookies[$name]['path'] = $path; - $this->cookies[$name]['domain'] = $domain; - $this->cookies[$name]['port'] = $port; - $this->cookies[$name]['version'] = 1; - } - else - { - $this->cookies[$name]['version'] = 0; - } - } - - /** - * Directly set cURL options, for extra flexibility - * It allows eg. to bind client to a specific IP interface / address - * @param $options array - */ - function SetCurlOptions( $options ) - { - $this->extracurlopts = $options; - } - - /** - * Set user-agent string that will be used by this client instance - * in http headers sent to the server - */ - function SetUserAgent( $agentstring ) - { - $this->user_agent = $agentstring; - } - - /** - * Send an xmlrpc request - * @param mixed $msg The message object, or an array of messages for using multicall, or the complete xml representation of a request - * @param integer $timeout Connection timeout, in seconds, If unspecified, a platform specific timeout will apply - * @param string $method if left unspecified, the http protocol chosen during creation of the object will be used - * @return xmlrpcresp - * @access public - */ - function& send($msg, $timeout=0, $method='') - { - // if user deos not specify http protocol, use native method of this client - // (i.e. method set during call to constructor) - if($method == '') - { - $method = $this->method; - } - - if(is_array($msg)) - { - // $msg is an array of xmlrpcmsg's - $r = $this->multicall($msg, $timeout, $method); - return $r; - } - elseif(is_string($msg)) - { - $n = new xmlrpcmsg(''); - $n->payload = $msg; - $msg = $n; - } - - // where msg is an xmlrpcmsg - $msg->debug=$this->debug; - - if($method == 'https') - { - $r =& $this->sendPayloadHTTPS( - $msg, - $this->server, - $this->port, - $timeout, - $this->username, - $this->password, - $this->authtype, - $this->cert, - $this->certpass, - $this->cacert, - $this->cacertdir, - $this->proxy, - $this->proxyport, - $this->proxy_user, - $this->proxy_pass, - $this->proxy_authtype, - $this->keepalive, - $this->key, - $this->keypass - ); - } - elseif($method == 'http11') - { - $r =& $this->sendPayloadCURL( - $msg, - $this->server, - $this->port, - $timeout, - $this->username, - $this->password, - $this->authtype, - null, - null, - null, - null, - $this->proxy, - $this->proxyport, - $this->proxy_user, - $this->proxy_pass, - $this->proxy_authtype, - 'http', - $this->keepalive - ); - } - else - { - $r =& $this->sendPayloadHTTP10( - $msg, - $this->server, - $this->port, - $timeout, - $this->username, - $this->password, - $this->authtype, - $this->proxy, - $this->proxyport, - $this->proxy_user, - $this->proxy_pass, - $this->proxy_authtype - ); - } - - return $r; - } - - /** - * @access private - */ - function &sendPayloadHTTP10($msg, $server, $port, $timeout=0, - $username='', $password='', $authtype=1, $proxyhost='', - $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1) - { - if($port==0) - { - $port=80; - } - - // Only create the payload if it was not created previously - if(empty($msg->payload)) - { - $msg->createPayload($this->request_charset_encoding); - } - - $payload = $msg->payload; - // Deflate request body and set appropriate request headers - if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate')) - { - if($this->request_compression == 'gzip') - { - $a = @gzencode($payload); - if($a) - { - $payload = $a; - $encoding_hdr = "Content-Encoding: gzip\r\n"; - } - } - else - { - $a = @gzcompress($payload); - if($a) - { - $payload = $a; - $encoding_hdr = "Content-Encoding: deflate\r\n"; - } - } - } - else - { - $encoding_hdr = ''; - } - - // thanks to Grant Rauscher <gr...@fi...> for this - $credentials=''; - if($username!='') - { - $credentials='Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; - if ($authtype != 1) - { - error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); - } - } - - $accepted_encoding = ''; - if(is_array($this->accepted_compression) && count($this->accepted_compression)) - { - $accepted_encoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; - } - - $proxy_credentials = ''; - if($proxyhost) - { - if($proxyport == 0) - { - $proxyport = 8080; - } - $connectserver = $proxyhost; - $connectport = $proxyport; - $uri = 'http://'.$server.':'.$port.$this->path; - if($proxyusername != '') - { - if ($proxyauthtype != 1) - { - error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); - } - $proxy_credentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyusername.':'.$proxypassword) . "\r\n"; - } - } - else - { - $connectserver = $server; - $connectport = $port; - $uri = $this->path; - } - - // Cookie generation, as per rfc2965 (version 1 cookies) or - // netscape's rules (version 0 cookies) - $cookieheader=''; - if (count($this->cookies)) - { - $version = ''; - foreach ($this->cookies as $name => $cookie) - { - if ($cookie['version']) - { - $version = ' $Version="' . $cookie['version'] . '";'; - $cookieheader .= ' ' . $name . '="' . $cookie['value'] . '";'; - if ($cookie['path']) - $cookieheader .= ' $Path="' . $cookie['path'] . '";'; - if ($cookie['domain']) - $cookieheader .= ' $Domain="' . $cookie['domain'] . '";'; - if ($cookie['port']) - $cookieheader .= ' $Port="' . $cookie['port'] . '";'; - } - else - { - $cookieheader .= ' ' . $name . '=' . $cookie['value'] . ";"; - } - } - $cookieheader = 'Cookie:' . $version . substr($cookieheader, 0, -1) . "\r\n"; - } - - $op= 'POST ' . $uri. " HTTP/1.0\r\n" . - 'User-Agent: ' . $this->user_agent . "\r\n" . - 'Host: '. $server . ':' . $port . "\r\n" . - $credentials . - $proxy_credentials . - $accepted_encoding . - $encoding_hdr . - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . - $cookieheader . - 'Content-Type: ' . $msg->content_type . "\r\nContent-Length: " . - strlen($payload) . "\r\n\r\n" . - $payload; - - if($this->debug > 1) - { - print "<PRE>\n---SENDING---\n" . htmlentities($op) . "\n---END---\n</PRE>"; - // let the client see this now in case http times out... - flush(); - } - - if($timeout>0) - { - $fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr, $timeout); - } - else - { - $fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr); - } - if($fp) - { - if($timeout>0 && function_exists('stream_set_timeout')) - { - stream_set_timeout($fp, $timeout); - } - } - else - { - $this->errstr='Connect error: '.$this->errstr; - $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr . ' (' . $this->errno . ')'); - return $r; - } - - if(!fputs($fp, $op, strlen($op))) - { - fclose($fp); - $this->errstr='Write error'; - $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr); - return $r; - } - else - { - // reset errno and errstr on succesful socket connection - $this->errstr = ''; - } - // G. Giunta 2005/10/24: close socket before parsing. - // should yeld slightly better execution times, and make easier recursive calls (e.g. to follow http redirects) - $ipd=''; - do - { - // shall we check for $data === FALSE? - // as per the manual, it signals an error - $ipd.=fread($fp, 32768); - } while(!feof($fp)); - fclose($fp); - $r =& $msg->parseResponse($ipd, false, $this->return_type); - return $r; - - } - - /** - * @access private - */ - function &sendPayloadHTTPS($msg, $server, $port, $timeout=0, $username='', - $password='', $authtype=1, $cert='',$certpass='', $cacert='', $cacertdir='', - $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1, - $keepalive=false, $key='', $keypass='') - { - $r =& $this->sendPayloadCURL($msg, $server, $port, $timeout, $username, - $password, $authtype, $cert, $certpass, $cacert, $cacertdir, $proxyhost, $proxyport, - $proxyusername, $proxypassword, $proxyauthtype, 'https', $keepalive, $key, $keypass); - return $r; - } - - /** - * Contributed by Justin Miller <ju...@vo...> - * Requires curl to be built into PHP - * NB: CURL versions before 7.11.10 cannot use proxy to talk to https servers! - * @access private - */ - function &sendPayloadCURL($msg, $server, $port, $timeout=0, $username='', - $password='', $authtype=1, $cert='', $certpass='', $cacert='', $cacertdir='', - $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1, $method='https', - $keepalive=false, $key='', $keypass='') - { - if(!function_exists('curl_init')) - { - $this->errstr='CURL unavailable on this install'; - $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_curl'], $GLOBALS['xmlrpcstr']['no_curl']); - return $r; - } - if($method == 'https') - { - if(($info = curl_version()) && - ((is_string($info) && strpos($info, 'OpenSSL') === null) || (is_array($info) && !isset($info['ssl_version'])))) - { - $this->errstr='SSL unavailable on this install'; - $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_ssl'], $GLOBALS['xmlrpcstr']['no_ssl']); - return $r; - } - } - - if($port == 0) - { - if($method == 'http') - { - $port = 80; - } - else - { - $port = 443; - } - } - - // Only create the payload if it was not created previously - if(empty($msg->payload)) - { - $msg->createPayload($this->request_charset_encoding); - } - - // Deflate request body and set appropriate request headers - $payload = $msg->payload; - if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate')) - { - if($this->request_compression == 'gzip') - { - $a = @gzencode($payload); - if($a) - { - $payload = $a; - $encoding_hdr = 'Content-Encoding: gzip'; - } - } - else - { - $a = @gzcompress($payload); - if($a) - { - $payload = $a; - $encoding_hdr = 'Content-Encoding: deflate'; - } - } - } - else - { - $encoding_hdr = ''; - } - - if($this->debug > 1) - { - print "<PRE>\n---SENDING---\n" . htmlentities($payload) . "\n---END---\n</PRE>"; - // let the client see this now in case http times out... - flush(); - } - - if(!$keepalive || !$this->xmlrpc_curl_handle) - { - $curl = curl_init($method . '://' . $server . ':' . $port . $this->path); - if($keepalive) - { - $this->xmlrpc_curl_handle = $curl; - } - } - else - { - $curl = $this->xmlrpc_curl_handle; - } - - // results into variable - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); - - if($this->debug) - { - curl_setopt($curl, CURLOPT_VERBOSE, 1); - } - curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent); - // required for XMLRPC: post the data - curl_setopt($curl, CURLOPT_POST, 1); - // the data - curl_setopt($curl, CURLOPT_POSTFIELDS, $payload); - - // return the header too - curl_setopt($curl, CURLOPT_HEADER, 1); - - // will only work with PHP >= 5.0 - // NB: if we set an empty string, CURL will add http header indicating - // ALL methods it is supporting. This is possibly a better option than - // letting the user tell what curl can / cannot do... - if(is_array($this->accepted_compression) && count($this->accepted_compression)) - { - //curl_setopt($curl, CURLOPT_ENCODING, implode(',', $this->accepted_compression)); - // empty string means 'any supported by CURL' (shall we catch errors in case CURLOPT_SSLKEY undefined ?) - if (count($this->accepted_compression) == 1) - { - curl_setopt($curl, CURLOPT_ENCODING, $this->accepted_compression[0]); - } - else - curl_setopt($curl, CURLOPT_ENCODING, ''); - } - // extra headers - $headers = array('Content-Type: ' . $msg->content_type , 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); - // if no keepalive is wanted, let the server know it in advance - if(!$keepalive) - { - $headers[] = 'Connection: close'; - } - // request compression header - if($encoding_hdr) - { - $headers[] = $encoding_hdr; - } - - curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); - // timeout is borked - if($timeout) - { - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); - } - - if($username && $password) - { - curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); - if (defined('CURLOPT_HTTPAUTH')) - { - curl_setopt($curl, CURLOPT_HTTPAUTH, $authtype); - } - else if ($authtype != 1) - { - error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); - } - } - - if($method == 'https') - { - // set cert file - if($cert) - { - curl_setopt($curl, CURLOPT_SSLCERT, $cert); - } - // set cert password - if($certpass) - { - curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $certpass); - } - // whether to verify remote host's cert - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verifypeer); - // set ca certificates file/dir - if($cacert) - { - curl_setopt($curl, CURLOPT_CAINFO, $cacert); - } - if($cacertdir) - { - curl_setopt($curl, CURLOPT_CAPATH, $cacertdir); - } - // set key file (shall we ... [truncated message content] |
From: <tu...@us...> - 2018-01-06 14:30:19
|
Revision: 7903 http://sourceforge.net/p/web-erp/reponame/7903 Author: turbopt Date: 2018-01-06 14:30:16 +0000 (Sat, 06 Jan 2018) Log Message: ----------- SelectSalesOrder.php: Fix handling to correct table heading value. (Reported in forums by Paul Becker) Modified Paths: -------------- trunk/SelectSalesOrder.php trunk/doc/Change.log Modified: trunk/SelectSalesOrder.php =================================================================== --- trunk/SelectSalesOrder.php 2018-01-06 10:18:42 UTC (rev 7902) +++ trunk/SelectSalesOrder.php 2018-01-06 14:30:16 UTC (rev 7903) @@ -647,11 +647,17 @@ } //figure out the SQL required from the inputs available - if( $_POST['Quotations'] == 'Quotes_Only' ) { + if( $_POST['Quotations'] == 'Orders_Only' ) { + $Quotations = 0; + } + elseif( $_POST['Quotations'] == 'Quotes_Only' ) { $Quotations = 1; - } elseif( $_POST['Quotations'] == 'Overdue_Only' ) { + } + elseif( $_POST['Quotations'] == 'Overdue_Only' ) { $Quotations = "0 AND itemdue<'" . Date('Y-m-d') . "'"; - } else { + } + else { + $_POST['Quotations'] = 'Orders_Only'; $Quotations = 0; } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-06 10:18:42 UTC (rev 7902) +++ trunk/doc/Change.log 2018-01-06 14:30:16 UTC (rev 7903) @@ -1,6 +1,7 @@ webERP Change Log -6/1/18 Phil: Attempt to avoid XSS attacks by logged in users by parsing out "script>" from all $_POST and $_GET variables - subsequentely changed to strip_tags from all $_POST and $_GETs per Tim's recommendation +6/1/18 PaulT: SelectSalesOrder.php: Fix handling to correct table heading value. (Reported in forums by Paul Becker) +6/1/18 Phil: Attempt to avoid XSS attacks by logged in users by parsing out "script>" from all $_POST and $_GET variables - subsequentely changed to strip_tags from all $_POST and $_GETs per Tim's recommendation 3/1/18: PaulT: SelectSalesOrder.php: Fix search to retain quote option and set StockLocation to the UserStockLocation to auto-load current Sales Orders. 2/1/18: PaulT: SelectSalesOrder.php: Move handling for URL Quotations parameter to top of file to avoid potential page error(s). (Reported in forums by Paul Becker) Handling move reduces code within some conditional checks. This change also includes minor whitespace improvements and removes an unused global reference. 2/1/18: PaulT: css/default/default.css: Add text alignment in a couple of styles to match the same use in other CSS to avoid formatting issues when the default theme is used. Also, set several property names to lowercase. |
From: <dai...@us...> - 2018-01-06 10:18:45
|
Revision: 7902 http://sourceforge.net/p/web-erp/reponame/7902 Author: daintree Date: 2018-01-06 10:18:42 +0000 (Sat, 06 Jan 2018) Log Message: ----------- Changed to strip_tags rather than replace script> in _POST and _GET variables per Tims idea Modified Paths: -------------- trunk/doc/Change.log trunk/includes/session.php Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-06 00:20:56 UTC (rev 7901) +++ trunk/doc/Change.log 2018-01-06 10:18:42 UTC (rev 7902) @@ -1,6 +1,6 @@ webERP Change Log -6/1/18 Phil: Attempt to avoid XSS attacks by logged in users by parsing out "script>" from all $_POST and $_GET variables. +6/1/18 Phil: Attempt to avoid XSS attacks by logged in users by parsing out "script>" from all $_POST and $_GET variables - subsequentely changed to strip_tags from all $_POST and $_GETs per Tim's recommendation 3/1/18: PaulT: SelectSalesOrder.php: Fix search to retain quote option and set StockLocation to the UserStockLocation to auto-load current Sales Orders. 2/1/18: PaulT: SelectSalesOrder.php: Move handling for URL Quotations parameter to top of file to avoid potential page error(s). (Reported in forums by Paul Becker) Handling move reduces code within some conditional checks. This change also includes minor whitespace improvements and removes an unused global reference. 2/1/18: PaulT: css/default/default.css: Add text alignment in a couple of styles to match the same use in other CSS to avoid formatting issues when the default theme is used. Also, set several property names to lowercase. Modified: trunk/includes/session.php =================================================================== --- trunk/includes/session.php 2018-01-06 00:20:56 UTC (rev 7901) +++ trunk/includes/session.php 2018-01-06 10:18:42 UTC (rev 7902) @@ -56,13 +56,13 @@ $_POST['name'] = stripslashes($_POST['name']); } - $_POST[$PostVariableName] = DB_escape_string(str_replace('script>','',$PostVariableValue)); + $_POST[$PostVariableName] = DB_escape_string(strip_tags($PostVariableValue)); } else { foreach ($PostVariableValue as $PostArrayKey => $PostArrayValue) { if(get_magic_quotes_gpc()) { $PostVariableValue[$PostArrayKey] = stripslashes($value[$PostArrayKey]); } - $PostVariableValue[$PostArrayKey] = DB_escape_string(str_replace('script>','',$PostArrayValue)); + $PostVariableValue[$PostArrayKey] = DB_escape_string(strip_tags($PostArrayValue)); } } } @@ -72,7 +72,7 @@ */ foreach ($_GET as $GetKey => $GetValue) { if (gettype($GetValue) != 'array') { - $_GET[$GetKey] = DB_escape_string(str_replace('script>','',$GetValue)); + $_GET[$GetKey] = DB_escape_string(strip_tags($GetValue)); } } } else { //set SESSION['FormID'] before the a user has even logged in |
From: <dai...@us...> - 2018-01-06 00:20:58
|
Revision: 7901 http://sourceforge.net/p/web-erp/reponame/7901 Author: daintree Date: 2018-01-06 00:20:56 +0000 (Sat, 06 Jan 2018) Log Message: ----------- Attempt to avoid XSS problems created by logged in users by parsing out script> Modified Paths: -------------- trunk/Factors.php trunk/doc/Change.log trunk/includes/session.php Modified: trunk/Factors.php =================================================================== --- trunk/Factors.php 2018-01-03 19:35:47 UTC (rev 7900) +++ trunk/Factors.php 2018-01-06 00:20:56 UTC (rev 7901) @@ -205,7 +205,7 @@ <table class="selection"> <tr> <td>' . _('Factor company Name') . ':</td> - <td><input tabindex="1" type="text" name="FactorName" required="required" size="42" maxlength="40" value="' .$_POST['FactorName'].'" /></td> + <td><input tabindex="1" type="text" name="FactorName" required="required" size="42" maxlength="40" value="' . $_POST['FactorName'] . '" /></td> </tr> <tr> <td>' . _('Address Line 1') . ':</td> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-03 19:35:47 UTC (rev 7900) +++ trunk/doc/Change.log 2018-01-06 00:20:56 UTC (rev 7901) @@ -1,5 +1,6 @@ webERP Change Log +6/1/18 Phil: Attempt to avoid XSS attacks by logged in users by parsing out "script>" from all $_POST and $_GET variables. 3/1/18: PaulT: SelectSalesOrder.php: Fix search to retain quote option and set StockLocation to the UserStockLocation to auto-load current Sales Orders. 2/1/18: PaulT: SelectSalesOrder.php: Move handling for URL Quotations parameter to top of file to avoid potential page error(s). (Reported in forums by Paul Becker) Handling move reduces code within some conditional checks. This change also includes minor whitespace improvements and removes an unused global reference. 2/1/18: PaulT: css/default/default.css: Add text alignment in a couple of styles to match the same use in other CSS to avoid formatting issues when the default theme is used. Also, set several property names to lowercase. @@ -27,7 +28,7 @@ 3/12/17 Phil commited Tim's BankAccountBalances.php script 2/12/17 Exson: Fixed the outstanding quantity is not right in PO_SelectOSPurchOrder.php. 2/12/17 Phil committed Tim Schofield's fix for javascript date picker for US date formats -2/12/17 Phil/Paul Becker: Purchases report - also deleted id non-exsitent in css committed changes suggested by VortecCPI http://www.weberp.org/forum/showthread.php?tid=7943 +2/12/17 Phil/Paul Becker: Purchases report - also deleted id non-exsitent in css committed changes suggested by VortecCPI http://www.weberp.org/forum/showthread.php?tid=7943 23/11/2017 Andy Couling: Added Petty Cash receipt file upload to directory functionality. 7/11/17 Exson: Remove cost updating for WAC method in BOMs.php. 25/10/17 Exson: Fixed the salesman authority problem in PrintCustTrans.php. Modified: trunk/includes/session.php =================================================================== --- trunk/includes/session.php 2018-01-03 19:35:47 UTC (rev 7900) +++ trunk/includes/session.php 2018-01-06 00:20:56 UTC (rev 7901) @@ -55,13 +55,14 @@ if(get_magic_quotes_gpc()) { $_POST['name'] = stripslashes($_POST['name']); } - $_POST[$PostVariableName] = DB_escape_string($PostVariableValue); + + $_POST[$PostVariableName] = DB_escape_string(str_replace('script>','',$PostVariableValue)); } else { foreach ($PostVariableValue as $PostArrayKey => $PostArrayValue) { if(get_magic_quotes_gpc()) { $PostVariableValue[$PostArrayKey] = stripslashes($value[$PostArrayKey]); } - $PostVariableValue[$PostArrayKey] = DB_escape_string($PostArrayValue); + $PostVariableValue[$PostArrayKey] = DB_escape_string(str_replace('script>','',$PostArrayValue)); } } } @@ -71,7 +72,7 @@ */ foreach ($_GET as $GetKey => $GetValue) { if (gettype($GetValue) != 'array') { - $_GET[$GetKey] = DB_escape_string($GetValue); + $_GET[$GetKey] = DB_escape_string(str_replace('script>','',$GetValue)); } } } else { //set SESSION['FormID'] before the a user has even logged in |
From: <tu...@us...> - 2018-01-03 19:35:49
|
Revision: 7900 http://sourceforge.net/p/web-erp/reponame/7900 Author: turbopt Date: 2018-01-03 19:35:47 +0000 (Wed, 03 Jan 2018) Log Message: ----------- SelectSalesOrder.php: Fix search to retain quote option and set StockLocation to the UserStockLocation to auto-load current Sales Orders. Modified Paths: -------------- trunk/SelectSalesOrder.php trunk/doc/Change.log Modified: trunk/SelectSalesOrder.php =================================================================== --- trunk/SelectSalesOrder.php 2018-01-02 19:18:56 UTC (rev 7899) +++ trunk/SelectSalesOrder.php 2018-01-03 19:35:47 UTC (rev 7900) @@ -32,7 +32,7 @@ if ( isset($_GET['Quotations']) ) { $_POST['Quotations'] = $_GET['Quotations']; } -else { +else if ( !isset($_POST['Quotations']) ) { $_POST['Quotations'] = ''; } @@ -677,7 +677,7 @@ } if(!isset($_POST['StockLocation'])) { - $_POST['StockLocation'] = ''; + $_POST['StockLocation'] = $_SESSION['UserStockLocation']; } //Harmonize the ordervalue with SUM function since webERP allowed same items appeared several times in one sales orders. If there is no sum value, this situation not inclued. //We should separate itemdue inquiry from normal inquiry. Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-02 19:18:56 UTC (rev 7899) +++ trunk/doc/Change.log 2018-01-03 19:35:47 UTC (rev 7900) @@ -1,5 +1,6 @@ webERP Change Log +3/1/18: PaulT: SelectSalesOrder.php: Fix search to retain quote option and set StockLocation to the UserStockLocation to auto-load current Sales Orders. 2/1/18: PaulT: SelectSalesOrder.php: Move handling for URL Quotations parameter to top of file to avoid potential page error(s). (Reported in forums by Paul Becker) Handling move reduces code within some conditional checks. This change also includes minor whitespace improvements and removes an unused global reference. 2/1/18: PaulT: css/default/default.css: Add text alignment in a couple of styles to match the same use in other CSS to avoid formatting issues when the default theme is used. Also, set several property names to lowercase. 20/12/17 PaulT: FormMaker.php, ReportMaker.php, WriteForm.inc: A few more PHP 7.1 array compatibility changes. |