From: <dai...@us...> - 2011-04-01 21:44:29
|
Revision: 4533 http://web-erp.svn.sourceforge.net/web-erp/?rev=4533&view=rev Author: daintree Date: 2011-04-01 21:44:23 +0000 (Fri, 01 Apr 2011) Log Message: ----------- More SQL quoting and xhtml fixes Modified Paths: -------------- trunk/PDFCustTransListing.php trunk/PDFPickingList.php trunk/PDFSuppTransListing.php trunk/PO_AuthorisationLevels.php Modified: trunk/PDFCustTransListing.php =================================================================== --- trunk/PDFCustTransListing.php 2011-04-01 20:14:14 UTC (rev 4532) +++ trunk/PDFCustTransListing.php 2011-04-01 21:44:23 UTC (rev 4533) @@ -2,9 +2,6 @@ /* $Id$*/ -/* $Revision: 1.13 $ */ - -//$PageSecurity = 3; include('includes/SQL_CommonFunctions.inc'); include ('includes/session.inc'); @@ -27,7 +24,7 @@ prnMsg($msg,'error'); } - echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '>'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection> <tr> @@ -37,17 +34,18 @@ echo '<tr><td>' . _('Transaction type') . '</td><td>'; - echo "<select name='TransType'>"; + echo '<select name="TransType">'; - echo '<option value=10>' . _('Invoices').'</option>'; - echo '<option value=11>' . _('Credit Notes').'</option>'; - echo '<option value=12>' . _('Receipts').'</option>'; + echo '<option value=10>' . _('Invoices') . '</option>'; + echo '<option value=11>' . _('Credit Notes') . '</option>'; + echo '<option value=12>' . _('Receipts') . '</option>'; echo '</select></td></tr>'; - echo "</select></td></tr></table><br><div class='centre'><input type=submit name='Go' value='" . _('Create PDF') . "'></div>"; + echo '</select></td></tr> + </table> + <br /><div class="centre"><input type="submit" name="Go" value="' . _('Create PDF') . '"></div>'; - include('includes/footer.inc'); exit; } else { @@ -73,7 +71,7 @@ include('includes/header.inc'); prnMsg(_('An error occurred getting the transactions'),'error'); if ($Debug==1){ - prnMsg(_('The SQL used to get the transaction information that failed was') . ':<br>' . $SQL,'error'); + prnMsg(_('The SQL used to get the transaction information that failed was') . ':<br />' . $SQL,'error'); } include('includes/footer.inc'); exit; @@ -100,7 +98,7 @@ while ($myrow=DB_fetch_array($result)){ - $sql='SELECT name FROM debtorsmaster WHERE debtorno="'.$myrow['debtorno'].'"'; + $sql="SELECT name FROM debtorsmaster WHERE debtorno='" . $myrow['debtorno'] . "'"; $supplierresult=DB_query($sql, $db); $supplierrow=DB_fetch_array($supplierresult); @@ -126,20 +124,8 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,number_format(-$TotalCheques,2), 'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+265,$YPos,300,$FontSize,_('Total') . ' ' . _('Transactions'), 'left'); -/* UldisN -$pdfcode = $pdf->output(); -$len = strlen($pdfcode); -header('Content-type: application/pdf'); -header('Content-Length: ' . $len); -header('Content-Disposition: inline; filename=ChequeListing.pdf'); -header('Expires: 0'); -header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); -header('Pragma: public'); - -$pdf->stream(); -*/ $ReportFileName = $_SESSION['DatabaseName'] . '_CustTransListing_' . date('Y-m-d').'.pdf'; -$pdf->OutputD($ReportFileName);//UldisN -$pdf->__destruct(); //UldisN +$pdf->OutputD($ReportFileName); +$pdf->__destruct(); ?> \ No newline at end of file Modified: trunk/PDFPickingList.php =================================================================== --- trunk/PDFPickingList.php 2011-04-01 20:14:14 UTC (rev 4532) +++ trunk/PDFPickingList.php 2011-04-01 21:44:23 UTC (rev 4533) @@ -2,8 +2,6 @@ /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); include('includes/SQL_CommonFunctions.inc'); @@ -13,7 +11,7 @@ if ($_SESSION['RequirePickingNote']==0) { $title = _('Picking Lists Not Enabled'); include('includes/header.inc'); - echo '<br>'; + echo '<br />'; prnMsg( _('The system is not configured for picking lists. Please consult your system administrator.'), 'info'); include('includes/footer.inc'); exit; @@ -28,18 +26,19 @@ FROM locations'; $result=DB_query($sql, $db); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/sales.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; - echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID . ' method=post name="form">'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection"><tr>'; echo '<td>'._('Create picking lists for all deliveries to be made on').' : '.'</td>'; echo '<td><input type=text class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="TransDate" maxlength=10 size=11 value='.date($_SESSION['DefaultDateFormat'], mktime(date('m'),date('Y'),date('d')+1)).'></td></tr>'; - echo '<tr><td>'._('From Warehouse').' : '.'</td><td><select name="loccode">'; + echo '<tr><td>'._('From Warehouse').' : '.'</td> + <td><select name="loccode">'; while ($myrow=DB_fetch_array($result)) { echo '<option value='.$myrow['loccode'].'>'.$myrow['locationname'].'</option>'; } echo '</select></td></tr>'; echo '</table>'; - echo "<br><div class='centre'><input type=submit name=Process value='" . _('Print Picking Lists') . "'></div></form>"; + echo '<br /><div class="centre"><input type="submit" name="Process" value="' . _('Print Picking Lists') . '"></div></form>'; include('includes/footer.inc'); exit(); } @@ -82,7 +81,8 @@ AND salesorders.shipvia=shippers.shipper_id AND salesorders.fromstkloc=locations.loccode AND salesorders.orderno='" . $_GET['TransNo']."'"; -} else if (isset($_POST['TransDate']) or (isset($_GET['TransNo']) and $_GET['TransNo'] != 'Preview')) { +} 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, @@ -120,18 +120,19 @@ AND salesorders.deliverydate='" . FormatDateForSQL($_POST['TransDate'])."'"; } -if (isset($_POST['TransDate']) or (isset($_GET['TransNo']) and $_GET['TransNo'] != 'Preview')) { +if (isset($_POST['TransDate']) + OR (isset($_GET['TransNo']) AND $_GET['TransNo'] != 'Preview')) { $result=DB_query($sql,$db, $ErrMsg); /*if there are no rows, there's a problem. */ if (DB_num_rows($result)==0){ $title = _('Print Picking List Error'); include('includes/header.inc'); - echo '<br>'; + echo '<br />'; prnMsg( _('Unable to Locate any orders for this criteria '), 'info'); - echo '<br><table class="selection"><tr><td> - <a href="'. $rootpath . '/PDFPickingList.php?'. SID .'">' . _('Enter Another Date') . '</a> - </td></tr></table><br>'; + echo '<br /><table class="selection"><tr><td> + <a href="'. $rootpath . '/PDFPickingList.php">' . _('Enter Another Date') . '</a> + </td></tr></table><br />'; include('includes/footer.inc'); exit(); } @@ -184,7 +185,7 @@ $pdf->addInfo('Title', _('Picking List') ); $pdf->addInfo('Subject', _('Laser Picking List') ); $FontSize=12; -$ListCount = 0; // UldisN +$ListCount = 0; $Copy=''; $line_height=$FormDesign->LineHeight; @@ -204,9 +205,9 @@ $OrdersToPick[$i]['orderno'] . ' ' . _('from the database'); /* Are there any picking lists for this order already */ - $sql='SELECT COUNT(orderno) + $sql="SELECT COUNT(orderno) FROM pickinglists - WHERE orderno='.$OrdersToPick[$i]['orderno']; + WHERE orderno='" . $OrdersToPick[$i]['orderno'] . "'"; $countresult=DB_query($sql, $db); $count=DB_fetch_row($countresult); if ($count[0]==0) { @@ -325,7 +326,7 @@ include('includes/footer.inc'); exit; } else { - $pdf->OutputD($_SESSION['DatabaseName'] . '_PickingLists_' . date('Y-m-d') . '.pdf');//UldisN - $pdf->__destruct(); //UldisN + $pdf->OutputD($_SESSION['DatabaseName'] . '_PickingLists_' . date('Y-m-d') . '.pdf'); + $pdf->__destruct(); } ?> \ No newline at end of file Modified: trunk/PDFSuppTransListing.php =================================================================== --- trunk/PDFSuppTransListing.php 2011-04-01 20:14:14 UTC (rev 4532) +++ trunk/PDFSuppTransListing.php 2011-04-01 21:44:23 UTC (rev 4533) @@ -2,9 +2,6 @@ /* $Id$*/ -/* $Revision: 1.13 $ */ - -//$PageSecurity = 3; include('includes/SQL_CommonFunctions.inc'); include ('includes/session.inc'); @@ -27,7 +24,7 @@ prnMsg($msg,'error'); } - echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '>'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection> <tr> @@ -39,15 +36,16 @@ echo "<select name='TransType'>"; - echo '<option value=20>' . _('Invoices').'</option>'; - echo '<option value=21>' . _('Credit Notes').'</option>'; - echo '<option value=22>' . _('Payments').'</option>'; + echo '<option value=20>' . _('Invoices') . '</option>'; + echo '<option value=21>' . _('Credit Notes') . '</option>'; + echo '<option value=22>' . _('Payments') . '</option>'; echo '</select></td></tr>'; - echo "</select></td></tr></table><br><div class='centre'><input type=submit name='Go' value='" . _('Create PDF') . "'></div>"; + echo '</select></td></tr> + </table> + <br /><div class="centre"><input type="submit" name="Go" value="' . _('Create PDF') . '"></div>'; - include('includes/footer.inc'); exit; } else { @@ -73,7 +71,7 @@ include('includes/header.inc'); prnMsg(_('An error occurred getting the payments'),'error'); if ($Debug==1){ - prnMsg(_('The SQL used to get the receipt header information that failed was') . ':<br>' . $SQL,'error'); + prnMsg(_('The SQL used to get the receipt header information that failed was') . ':<br />' . $SQL,'error'); } include('includes/footer.inc'); exit; @@ -100,7 +98,7 @@ while ($myrow=DB_fetch_array($result)){ - $sql='SELECT suppname FROM suppliers WHERE supplierid="'.$myrow['supplierno'].'"'; + $sql="SELECT suppname FROM suppliers WHERE supplierid='" . $myrow['supplierno']."'"; $supplierresult=DB_query($sql, $db); $supplierrow=DB_fetch_array($supplierresult); @@ -115,9 +113,9 @@ $TotalCheques = $TotalCheques - $myrow['ovamount']; if ($YPos - (2 *$line_height) < $Bottom_Margin){ - /*Then set up a new page */ - $PageNumber++; - include ('includes/PDFChequeListingPageHeader.inc'); + /*Then set up a new page */ + $PageNumber++; + include ('includes/PDFChequeListingPageHeader.inc'); } /*end of new page header */ } /* end of while there are customer receipts in the batch to print */ @@ -126,20 +124,7 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,number_format(-$TotalCheques,2), 'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+265,$YPos,300,$FontSize,_('Total') . ' ' . _('Transactions'), 'left'); -/* UldisN -$pdfcode = $pdf->output(); -$len = strlen($pdfcode); -header('Content-type: application/pdf'); -header('Content-Length: ' . $len); -header('Content-Disposition: inline; filename=ChequeListing.pdf'); -header('Expires: 0'); -header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); -header('Pragma: public'); - -$pdf->stream(); -*/ $ReportFileName = $_SESSION['DatabaseName'] . '_SuppTransListing_' . date('Y-m-d').'.pdf'; -$pdf->OutputD($ReportFileName);//UldisN -$pdf->__destruct(); //UldisN - +$pdf->OutputD($ReportFileName); +$pdf->__destruct(); ?> \ No newline at end of file Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-04-01 20:14:14 UTC (rev 4532) +++ trunk/PO_AuthorisationLevels.php 2011-04-01 21:44:23 UTC (rev 4533) @@ -2,8 +2,6 @@ /* $Id$*/ -//$PageSecurity=15; - include('includes/session.inc'); $title = _('Purchase Order Authorisation Maintenance'); @@ -16,38 +14,37 @@ $OffHold=1; $AuthLevel=0; if (isset($_POST['Submit'])) { - if (isset($_POST['cancreate']) and $_POST['cancreate']=='on') { - $cancreate=0; + if (isset($_POST['CanCreate']) and $_POST['CanCreate']=='on') { + $CanCreate=0; } else { - $cancreate=1; + $CanCreate=1; } - if (isset($_POST['offhold']) and $_POST['offhold']=='on') { - $offhold=0; + if (isset($_POST['OffHold']) and $_POST['OffHold']=='on') { + $OffHold=0; } else { - $offhold=1; + $OffHold=1; } - if ($_POST['authlevel']=='') { - $_POST['authlevel']=0; + if ($_POST['AuthLevel']=='') { + $_POST['AuthLevel']=0; } $sql="SELECT COUNT(*) FROM purchorderauth - WHERE userid='".$_POST['userid']."' - AND currabrev='".$_POST['currabrev']."'"; + WHERE userid='" . $_POST['UserID'] . "' + AND currabrev='" . $_POST['CurrCode'] . "'"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); if ($myrow[0]==0) { - $sql="INSERT INTO purchorderauth ( - userid, - currabrev, - cancreate, - offhold, - authlevel) - VALUES( - '".$_POST['userid']."', - '".$_POST['currabrev']."', - '".$cancreate."', - '".$offhold."', - '".$_POST['authlevel']."')"; + $sql="INSERT INTO purchorderauth ( userid, + currabrev, + cancreate, + offhold, + authlevel) + VALUES( + '".$_POST['UserID']."', + '".$_POST['CurrCode']."', + '".$CanCreate."', + '".$OffHold."', + '".$_POST['AuthLevel']."')"; $ErrMsg = _('The authentication details cannot be inserted because'); $Result=DB_query($sql,$db,$ErrMsg); } else { @@ -57,22 +54,22 @@ } if (isset($_POST['Update'])) { - if (isset($_POST['cancreate']) and $_POST['cancreate']=='on') { - $cancreate=0; + if (isset($_POST['CanCreate']) and $_POST['CanCreate']=='on') { + $CanCreate=0; } else { - $cancreate=1; + $CanCreate=1; } - if (isset($_POST['offhold']) and $_POST['offhold']=='on') { - $offhold=0; + if (isset($_POST['OffHold']) and $_POST['OffHold']=='on') { + $OffHold=0; } else { - $offhold=1; + $OffHold=1; } $sql="UPDATE purchorderauth SET - cancreate='".$cancreate."', - offhold='".$offhold."', - authlevel='".$_POST['authlevel']."' - WHERE userid='".$_POST['userid']."' - AND currabrev='".$_POST['currabrev']."'"; + cancreate='".$CanCreate."', + offhold='".$OffHold."', + authlevel='".$_POST['AuthLevel']."' + WHERE userid='".$_POST['UserID']."' + AND currabrev='".$_POST['CurrCode']."'"; $ErrMsg = _('The authentication details cannot be updated because'); $Result=DB_query($sql,$db,$ErrMsg); @@ -99,68 +96,69 @@ $myrow=DB_fetch_array($result); $UserID=$_GET['UserID']; $Currency=$_GET['Currency']; - $CanCreate=$myrow['cancreate']; + $CanCreate=$myrow['CanCreate']; $OffHold=$myrow['offhold']; $AuthLevel=$myrow['authlevel']; } -$sql="SELECT - purchorderauth.userid, - www_users.realname, - currencies.currabrev, - currencies.currency, - purchorderauth.cancreate, - purchorderauth.offhold, - purchorderauth.authlevel - FROM (purchorderauth - LEFT JOIN www_users ON purchorderauth.userid=www_users.userid) - LEFT JOIN currencies ON purchorderauth.currabrev=currencies.currabrev"; +$sql='SELECT purchorderauth.userid, + www_users.realname, + currencies.currabrev, + currencies.currency, + purchorderauth.cancreate, + purchorderauth.offhold, + purchorderauth.authlevel + FROM purchorderauth INNER JOIN www_users + ON purchorderauth.userid=www_users.userid + INNER JOIN currencies + ON purchorderauth.currabrev=currencies.currabrev'; $ErrMsg = _('The authentication details cannot be retrieved because'); $Result=DB_query($sql,$db,$ErrMsg); -echo '<table class=selection><tr>'; -echo '<th>'._('User ID').'</th>'; -echo '<th>'._('User Name').'</th>'; -echo '<th>'._('Currency').'</th>'; -echo '<th>'._('Create Order').'</th>'; -echo '<th>'._('Can Release').'<br />'. _('Invoices').'</th>'; -echo '<th>'._('Authority Level').'</th></tr>'; +echo '<table class="selection"><tr> + <th>' . _('User ID') . '</th> + <th>' . _('User Name') . '</th> + <th>' . _('Currency') . '</th> + <th>' . _('Create Order') . '</th> + <th>' . _('Can Release') . '<br />'. _('Invoices').'</th> + <th>' . _('Authority Level') . '</th></tr>'; while ($myrow=DB_fetch_array($Result)) { if ($myrow['cancreate']==0) { - $cancreate=_('Yes'); + $CanCreate=_('Yes'); } else { - $cancreate=_('No'); + $CanCreate=_('No'); } if ($myrow['offhold']==0) { - $offhold=_('Yes'); + $OffHold=_('Yes'); } else { - $offhold=_('No'); + $OffHold=_('No'); } - echo '<tr><td>'.$myrow['userid'].'</td>'; - echo '<td>'.$myrow['realname'].'</td>'; - echo '<td>'.$myrow['currency'].'</td>'; - echo '<td>'.$cancreate.'</td>'; - echo '<td>'.$offhold.'</td>'; - echo '<td class="number">'.number_format($myrow['authlevel'],2).'</td>'; - echo '<td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?' . SID . 'Edit=Yes&UserID=' . $myrow['userid'] . - '&Currency='.$myrow['currabrev'].'">'._('Edit').'</td>'; - echo '<td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?' . SID . 'Delete=Yes&UserID=' . $myrow['userid'] . - '&Currency='.$myrow['currabrev'].'">'._('Delete').'</td></tr>'; + echo '<tr><td>' . $myrow['userid'] . '</td> + <td>' . $myrow['realname'] . '</td> + <td>' . $myrow['currency'] . '</td> + <td>' . $CanCreate . '</td> + <td>' . $OffHold . '</td> + <td class="number">'.number_format($myrow['authlevel'],2).'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . + '&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . + '&Currency='.$myrow['currabrev'].'">'._('Delete').'</td> + </tr>'; } echo '</table><br><br>'; -echo "<form action='" . $_SERVER['PHP_SELF'] . '?' . SID . "' method=post name='form1'>"; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form1">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; if (isset($_GET['Edit'])) { echo '<tr><td>'._('User ID').'</td><td>'.$UserID.'</td></tr>'; - echo '<input type=hidden name=userid value="'.$UserID.'"'; + echo '<input type=hidden name=UserID value="'.$UserID.'"'; } else { - echo '<tr><td>'._('User ID').'</td><td><select name=userid>'; + echo '<tr><td>'._('User ID').'</td><td><select name=UserID>'; $usersql='SELECT userid FROM www_users'; $userresult=DB_query($usersql,$db); while ($myrow=DB_fetch_array($userresult)) { @@ -174,13 +172,14 @@ } if (isset($_GET['Edit'])) { - $currencysql='SELECT currency FROM currencies WHERE currabrev="'.$Currency.'"'; - $currencyresult=DB_query($currencysql,$db); - $myrow=DB_fetch_array($currencyresult); - echo '<tr><td>'._('Currency').'</td><td>'.$myrow['currency'].'</td></tr>'; - echo '<input type=hidden name=currabrev value="'.$Currency.'"'; + $CurrencySQL="SELECT currency FROM currencies WHERE currabrev='".$Currency."'"; + $CurrencyResult=DB_query($CurrencySQL,$db); + $myrow=DB_fetch_array($CurrencyResult); + echo '<tr><td>'._('Currency').'</td> + <td>' . $myrow['currency'] . '</td></tr>'; + echo '<input type=hidden name="currabrev" value="'.$Currency.'"'; } else { - echo '<tr><td>'._('Currency').'</td><td><select name=currabrev>'; + echo '<tr><td>'._('Currency').'</td><td><select name="CurrCode">'; $currencysql='SELECT currabrev,currency FROM currencies'; $currencyresult=DB_query($currencysql,$db); while ($myrow=DB_fetch_array($currencyresult)) { @@ -195,20 +194,20 @@ echo '<tr><td>'._('User can create orders').'</td>'; if ($CanCreate==1) { - echo '<td><input type=checkbox name=cancreate></td></tr>'; + echo '<td><input type=checkbox name="CanCreate"></td></tr>'; } else { - echo '<td><input type=checkbox checked name=cancreate></td></tr>'; + echo '<td><input type=checkbox checked name="CanCreate"></td></tr>'; } echo '<tr><td>'._('User can release invoices').'</td>'; if ($OffHold==1) { - echo '<td><input type=checkbox name=offhold></td></tr>'; + echo '<td><input type=checkbox name="OffHold"></td></tr>'; } else { - echo '<td><input type=checkbox checked name=offhold></td></tr>'; + echo '<td><input type=checkbox checked name="OffHold"></td></tr>'; } echo '<tr><td>'._('User can authorise orders up to :').'</td>'; -echo '<td><input type=input name=authlevel size=11 class=number value='.$AuthLevel.'></td</tr>'; +echo '<td><input type=input name="AuthLevel" size=11 class="number" value="' . $AuthLevel . '"></td</tr>'; echo '</table>'; if (isset($_GET['Edit'])) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |