|
From: <dai...@us...> - 2012-07-01 02:53:07
|
Revision: 5466
http://web-erp.svn.sourceforge.net/web-erp/?rev=5466&view=rev
Author: daintree
Date: 2012-07-01 02:53:00 +0000 (Sun, 01 Jul 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/Z_POS_Data.php
trunk/api/api_php.php
trunk/api/api_webERPsettings.php
trunk/api/api_xml-rpc.php
trunk/config.distrib.php
trunk/doc/Change.log
trunk/includes/GetPrice.inc
trunk/includes/Z_POSDataCreation.php
Modified: trunk/Z_POS_Data.php
===================================================================
--- trunk/Z_POS_Data.php 2012-06-29 23:40:08 UTC (rev 5465)
+++ trunk/Z_POS_Data.php 2012-07-01 02:53:00 UTC (rev 5466)
@@ -3,12 +3,21 @@
/* $Id: Z_POS_Data.php 3843 2010-09-30 14:49:45Z daintree $*/
$PageSecurity = 9;
+/* Note: For really large databases need to change config.php MaxExecutionTime = 1000; or similar */
+
include('includes/session.inc');
$title = _('Create POS Data Upload File');
include('includes/header.inc');
+if (isset($_GET['Delete'])){
+ unlink($_SESSION['reports_dir'] . '/POS.sql');
+ unlink($_SESSION['reports_dir'] . '/POS.sql.zip');
+ prnMsg(_('Old POS upload files deleted'),'info');
+}
+
+
if (!isset($_GET['POSDebtorNo']) AND !isset($_GET['POSBranchCode'])){
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Create POS Data File') . '" alt="">' . ' ' . $title.'<br />';
echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '><br>';
@@ -54,10 +63,10 @@
if ($InputError ==0) {
include('includes/Z_POSDataCreation.php');
- if (CreatePOSDataFull($_POST['POSDebtorNo'],$_POST['POSBranchCode'],$db) ==1){
- echo '<br />
- <br />
- <a href="' . $_SESSION['reports_dir'] . '/POS.sql.zip">' . _('Download POS Upload File') . '</a>';
+ if (Create_POS_Data_Full($_POST['POSDebtorNo'],$_POST['POSBranchCode'],$db) == 1 ){
+ echo '<br />
+ <br />
+ <a href="' . $_SESSION['reports_dir'] . '/POS.sql.zip">' . _('Download POS Upload File') . '</a>';
} else {
prnMsg(_('Unable to create POS Data file - perhaps the POS Customer Code or Branch Code do not exist'),'error');
}
@@ -65,5 +74,9 @@
} // end if no input errors
} //hit create POSDataFile
+if (file_exists($_SESSION['reports_dir'] . '/POS.sql.zip')){
+ prnMsg(_('It is important to delete the POS Data file after it has been retrieved - use the link below to delete it'),'warn');
+ echo '<p><a href="' . $_SERVER['PHP_SELF'] . '?Delete=Yes">' . _('Delete the POS Upload File') . '</a></p>';
+}
include('includes/footer.inc');
?>
\ No newline at end of file
Modified: trunk/api/api_php.php
===================================================================
--- trunk/api/api_php.php 2012-06-29 23:40:08 UTC (rev 5465)
+++ trunk/api/api_php.php 2012-07-01 02:53:00 UTC (rev 5466)
@@ -3,7 +3,7 @@
/* Include session.inc, to allow database connection, and access to
miscfunctions, and datefunctions.*/
// FOLLOWING ONLY REQUIRED TO SUPPORT PER FUNCTION AUTHENTICATION
- $api_DatabaseName='weberpdemo';
+ $api_DatabaseName='ipartx_erp';
// END OF OLD STYLE AUTHENTICATION
$AllowAnyone = true;
@@ -15,7 +15,7 @@
include($PathPrefix . 'includes/SQL_CommonFunctions.inc');
/* Required for creating invoices/credits */
include($PathPrefix . 'includes/GetSalesTransGLCodes.inc');
- include($PathPrefix . 'includes/POSDataCreation.php');
+ include($PathPrefix . 'includes/Z_POSDataCreation.php');
/* Get weberp authentication, and return a valid database
connection */
Modified: trunk/api/api_webERPsettings.php
===================================================================
--- trunk/api/api_webERPsettings.php 2012-06-29 23:40:08 UTC (rev 5465)
+++ trunk/api/api_webERPsettings.php 2012-07-01 02:53:00 UTC (rev 5466)
@@ -101,12 +101,24 @@
$Errors[0]=NoAuthorisation;
return $Errors;
}
- if (CreatePOSDataFull($_POST['POSDebtorNo'],$_POST['POSBranchCode'],$db) ==1){
- $ReturnValue=0;
+
+ if (Create_POS_Data_Full($_POST['POSDebtorNo'],$_POST['POSBranchCode'],$db) ==1){
+ $ReturnValue[0]=0;
} else {
- $ReturnValue=1;
+ $ReturnValue[0]=1;
}
return $ReturnValue;
}
+ function DeletePOSData($User, $Password) {
+ $Errors = array();
+ $db = db($User, $Password);
+ if (gettype($db)=='integer') {
+ $Errors[0]=NoAuthorisation;
+ return $Errors;
+ }
+ Delete_POS_Data();
+ $ReturnValue[0]=0;
+ return $ReturnValue;
+ }
-?>
+?>
\ No newline at end of file
Modified: trunk/api/api_xml-rpc.php
===================================================================
--- trunk/api/api_xml-rpc.php 2012-06-29 23:40:08 UTC (rev 5465)
+++ trunk/api/api_xml-rpc.php 2012-07-01 02:53:00 UTC (rev 5466)
@@ -1140,7 +1140,7 @@
ob_end_flush();
return $rtn;
}
-
+
unset($Description);
unset($Parameter);
unset($ReturnValue);
@@ -1475,7 +1475,7 @@
unset($Description);
unset($Parameter);
unset($ReturnValue);
-
+
$Description = _('This function returns a list of stock location ids.');
$Parameter[0]['name'] = _('User name');
$Parameter[0]['description'] = _('A valid weberp username. This user should have security access to this data.');
@@ -2971,28 +2971,57 @@
$Parameter[3]['description'] = _('The weberp password associated with this user name. ');
$ReturnValue[0] = _('If successful this function returns 0 for success and 1 for error. ');
- $GetCreatePOSDataFull_sig = array(array($xmlrpcStruct),
+ $CreatePOSDataFull_sig = array(array($xmlrpcStruct),
array($xmlrpcStruct,$xmlrpcString,$xmlrpcString,$xmlrpcString,$xmlrpcString));
- $GetCreatePOSDataFull_doc = apiBuildDocHTML( $Description,$Parameter,$ReturnValue );
+ $CreatePOSDataFull_doc = apiBuildDocHTML( $Description,$Parameter,$ReturnValue );
function xmlrpc_CreatePOSDataFull($xmlrpcmsg){
ob_start('ob_file_callback');
/*x*/ if ($xmlrpcmsg->getNumParams() == 4) {
/*x*/ $rtn = new xmlrpcresp( php_xmlrpc_encode(CreatePOSDataFull($xmlrpcmsg->getParam( 0 )->scalarval( ),
-/*x*/ $xmlrpcmsg->getParam( 1 )->scalarval( ),
+/*x*/ $xmlrpcmsg->getParam( 1 )->scalarval( ),
$xmlrpcmsg->getParam( 2 )->scalarval( ),
$xmlrpcmsg->getParam( 3 )->scalarval( ))) );
/*x*/ } else {
/*e*/ $rtn = new xmlrpcresp( php_xmlrpc_encode(CreatePOSDataFull( $xmlrpcmsg->getParam( 0 )->scalarval( ),
/*x*/ $xmlrpcmsg->getParam( 1 )->scalarval( ),
- '',
+ '',
'')));
/*x*/ }
ob_end_flush();
return $rtn;
}
+ unset($Description);
+ unset($Parameter);
+ unset($ReturnValue);
+ $Description = _('This function deletes a POS data file on the webERP server');
+ $Parameter[0]['name'] = _('User name');
+ $Parameter[0]['description'] = _('A valid weberp username. This user should have security access to this data.');
+ $Parameter[1]['name'] = _('User password');
+ $Parameter[1]['description'] = _('The weberp password associated with this user name. ');
+ $ReturnValue[0] = _('Returns 0 if the delete POS Data was successfull');
+
+/*E*/$DeletePOSData_sig = array(array($xmlrpcStruct),
+/*x*/ array($xmlrpcStruct,$xmlrpcString,$xmlrpcString));
+ $DeletePOSData_doc = apiBuildDocHTML( $Description,$Parameter,$ReturnValue );
+
+
+ function xmlrpc_DeletePOSData($xmlrpcmsg){
+ ob_start('ob_file_callback');
+/*x*/ if ($xmlrpcmsg->getNumParams() == 2) {
+/*x*/ $rtn = new xmlrpcresp( php_xmlrpc_encode(DeletePOSData($xmlrpcmsg->getParam( 0 )->scalarval( ),
+/*x*/ $xmlrpcmsg->getParam( 1 )->scalarval( ) )) );
+/*x*/ } else {
+/*e*/ $rtn = new xmlrpcresp( php_xmlrpc_encode(DeletePOSData( '',
+ '')));
+/*x*/ }
+ ob_end_flush();
+ return $rtn;
+ }
+
+
unset($Description);
unset($Parameter);
unset($ReturnValue);
@@ -3413,6 +3442,14 @@
"function" => "xmlrpc_GetDefaultLocation",
"signature" => $GetDefaultLocation_sig,
"docstring" => $GetDefaultLocation_doc),
+ "weberp.xmlrpc_CreatePOSDataFull" => array(
+ "function" => "xmlrpc_CreatePOSDataFull",
+ "signature" => $CreatePOSDataFull_sig,
+ "docstring" => $CreatePOSDataFull_doc),
+ "weberp.xmlrpc_DeletePOSData" => array(
+ "function" => "xmlrpc_DeletePOSData",
+ "signature" => $DeletePOSData_sig,
+ "docstring" => $DeletePOSData_doc),
"weberp.xmlrpc_GetStockCatProperty" => array(
"function" => "xmlrpc_GetStockCatProperty",
"signature" => $GetStockCatProperty_sig,
@@ -3424,7 +3461,7 @@
)
);
-
+
// Generate the HTMLised description string for each API.
function apiBuildDocHTML( $description, $parameter, $return )
Modified: trunk/config.distrib.php
===================================================================
--- trunk/config.distrib.php 2012-06-29 23:40:08 UTC (rev 5465)
+++ trunk/config.distrib.php 2012-07-01 02:53:00 UTC (rev 5466)
@@ -18,10 +18,12 @@
// The timezone of the business - this allows the possibility of having
// the web-server on a overseas machine but record local time
// this is not necessary if you have your own server locally
-putenv('TZ=Europe/London');
-// putenv('TZ=Australia/Melbourne');
-// putenv('TZ=Australia/Sydney');
-//putenv('TZ=Pacific/Auckland');
+//date_default_timezone_set('Europe/London');
+//date_default_timezone_set('America/Los_Angeles');
+date_default_timezone_set('Asia/Shanghai');
+//date_default_timezone_set('Australia/Melbourne');
+//date_default_timezone_set('Australia/Sydney');
+//date_default_timezone_set('Pacific/Auckland');
// Connection information for the database
// $host is the computer ip address or name where the database is located
Modified: trunk/doc/Change.log
===================================================================
--- trunk/doc/Change.log 2012-06-29 23:40:08 UTC (rev 5465)
+++ trunk/doc/Change.log 2012-07-01 02:53:00 UTC (rev 5466)
@@ -1,5 +1,7 @@
webERP Change Log
+30/6/12 Phil: Attempt at quicker price retrieval
+30/6/12 Phil: Allow creation of work orders for Raw materials - well intermediary components manufacture - per Bob Thomas email
26/06/12 Bob Thomas: StockAdjustments fix link to controlled stock adjustments entry
24/06/2012 Phil: Added tooltip/title showing long description on many scripts where short description is currently shown SelectOrderItems.php SelectCreditItems.php CreditInvoice.php DeliveryDetails.php CounterSales.php RecurringSalesOrders.php
24/06/2012 Icedlava: Add ViewTopic and BookMark vars to some functions to take advantage of new Manual contextual help. Must be added before header.inc include.
Modified: trunk/includes/GetPrice.inc
===================================================================
--- trunk/includes/GetPrice.inc 2012-06-29 23:40:08 UTC (rev 5465)
+++ trunk/includes/GetPrice.inc 2012-07-01 02:53:00 UTC (rev 5466)
@@ -170,7 +170,7 @@
$sql="SELECT prices.price, prices.debtorno, prices.branchcode, prices.enddate, prices.typeabbrev
FROM prices INNER JOIN debtorsmaster
- AND prices.currabrev = debtorsmaster.currcode
+ ON prices.currabrev = debtorsmaster.currcode
WHERE debtorsmaster.debtorno='" . $DebtorNo . "'
AND (prices.typeabbrev = debtorsmaster.salestype OR prices.typeabbrev='" . $_SESSION['DefaultPriceList'] . "')
AND prices.stockid = '" . $StockID . "'
@@ -187,7 +187,7 @@
$PricesArray = array();
$RankArray = array();
$i = 0;
- while ($myrow=DB_fetch_row($result)){
+ while ($myrow=DB_fetch_array($result)){
$Prices[$i]['Price'] = $myrow['price'];
$Prices[$i]['DebtorNo'] = $myrow['debtorno'];
$Prices[$i]['BranchCode'] = $myrow['branchcode'];
Modified: trunk/includes/Z_POSDataCreation.php
===================================================================
--- trunk/includes/Z_POSDataCreation.php 2012-06-29 23:40:08 UTC (rev 5465)
+++ trunk/includes/Z_POSDataCreation.php 2012-07-01 02:53:00 UTC (rev 5466)
@@ -1,6 +1,6 @@
<?php
-function CreatePOSDataFull ( $POSDebtorNo, $POSBranchCode, $db) {
+function Create_POS_Data_Full ( $POSDebtorNo, $POSBranchCode, $db) {
$result = DB_query("SELECT currcode, salestype FROM debtorsmaster WHERE debtorno='" . $POSDebtorNo . "'",$db);
$CustomerRow = DB_fetch_array($result);
if (DB_num_rows($result)==0){
@@ -11,11 +11,15 @@
$FileHandle = fopen($_SESSION['reports_dir'] . '/POS.sql','w');
+ if ($FileHandle == false){
+ return 0;
+ }
+
fwrite($FileHandle,"DELETE FROM currencies;\n");
$result = DB_query('SELECT currency, currabrev, country, hundredsname,decimalplaces, rate FROM currencies',$db);
while ($CurrRow = DB_fetch_array($result)) {
- fwrite($FileHandle,"INSERT INTO currencies VALUES ('" . $CurrRow['currency'] . "', '" . $CurrRow['currabrev'] . "', '" . sqlite_escape_string ($CurrRow['country']) . "', '" . sqlite_escape_string ($CurrRow['hundredsname']) . "', '" .$CurrRow['decimalplaces'] . "', '" .$CurrRow['rate'] . "');\n");
+ fwrite($FileHandle,"INSERT INTO currencies VALUES ('" . $CurrRow['currency'] . "', '" . $CurrRow['currabrev'] . "', '" . SQLite_Escape ($CurrRow['country']) . "', '" . SQLite_Escape ($CurrRow['hundredsname']) . "', '" .$CurrRow['decimalplaces'] . "', '" .$CurrRow['rate'] . "');\n");
}
@@ -24,7 +28,7 @@
$result = DB_query('SELECT typeabbrev, sales_type FROM salestypes',$db);
while ($myrow = DB_fetch_array($result)) {
- fwrite($FileHandle,"INSERT INTO salestypes VALUES ('" . $myrow['typeabbrev'] . "', '" . sqlite_escape_string ($myrow['sales_type']) . "');\n");
+ fwrite($FileHandle,"INSERT INTO salestypes VALUES ('" . $myrow['typeabbrev'] . "', '" . SQLite_Escape ($myrow['sales_type']) . "');\n");
}
fwrite($FileHandle,"DELETE FROM holdreasons;\n");
@@ -32,7 +36,7 @@
$result = DB_query('SELECT reasoncode, reasondescription, dissallowinvoices FROM holdreasons',$db);
while ($myrow = DB_fetch_array($result)) {
- fwrite($FileHandle,"INSERT INTO holdreasons VALUES ('" . $myrow['reasoncode'] . "', '" . sqlite_escape_string ($myrow['reasondescription']) . "', '" . $myrow['dissallowinvoices'] . "');\n");
+ fwrite($FileHandle,"INSERT INTO holdreasons VALUES ('" . $myrow['reasoncode'] . "', '" . SQLite_Escape ($myrow['reasondescription']) . "', '" . $myrow['dissallowinvoices'] . "');\n");
}
fwrite($FileHandle,"DELETE FROM paymentterms;\n");
@@ -40,7 +44,7 @@
$result = DB_query('SELECT termsindicator, terms FROM paymentterms',$db);
while ($myrow = DB_fetch_array($result)) {
- fwrite($FileHandle,"INSERT INTO paymentterms VALUES ('" . $myrow['termsindicator'] . "', '" . sqlite_escape_string ($myrow['terms']) . "');\n");
+ fwrite($FileHandle,"INSERT INTO paymentterms VALUES ('" . $myrow['termsindicator'] . "', '" . SQLite_Escape ($myrow['terms']) . "');\n");
}
@@ -48,7 +52,7 @@
$result = DB_query('SELECT paymentid, paymentname,opencashdrawer FROM paymentmethods',$db);
while ($myrow = DB_fetch_array($result)) {
- fwrite($FileHandle,"INSERT INTO paymentmethods VALUES ('" . $myrow['paymentid'] . "', '" . sqlite_escape_string ($myrow['paymentname']) . "', '" . $myrow['opencashdrawer'] . "');\n");
+ fwrite($FileHandle,"INSERT INTO paymentmethods VALUES ('" . $myrow['paymentid'] . "', '" . SQLite_Escape ($myrow['paymentname']) . "', '" . $myrow['opencashdrawer'] . "');\n");
}
@@ -56,7 +60,7 @@
$result = DB_query('SELECT loccode, locationname,taxprovinceid FROM locations',$db);
while ($myrow = DB_fetch_array($result)) {
- fwrite($FileHandle,"INSERT INTO locations VALUES ('" . $myrow['loccode'] . "', '" . sqlite_escape_string ($myrow['locationname']) . "', '" . $myrow['taxprovinceid'] . "');\n");
+ fwrite($FileHandle,"INSERT INTO locations VALUES ('" . $myrow['loccode'] . "', '" . SQLite_Escape ($myrow['locationname']) . "', '" . $myrow['taxprovinceid'] . "');\n");
}
@@ -64,14 +68,14 @@
$result = DB_query('SELECT categoryid, categorydescription FROM stockcategory',$db);
while ($myrow = DB_fetch_array($result)) {
- fwrite($FileHandle,"INSERT INTO stockcategory VALUES ('" . $myrow['categoryid'] . "', '" . sqlite_escape_string ($myrow['categorydescription']) . "');\n");
+ fwrite($FileHandle,"INSERT INTO stockcategory VALUES ('" . $myrow['categoryid'] . "', '" . SQLite_Escape ($myrow['categorydescription']) . "');\n");
}
fwrite($FileHandle,"DELETE FROM taxgroups;\n");
$result = DB_query('SELECT taxgroupid, taxgroupdescription FROM taxgroups',$db);
while ($myrow = DB_fetch_array($result)) {
- fwrite($FileHandle,"INSERT INTO taxgroups VALUES ('" . $myrow['taxgroupid'] . "', '" . sqlite_escape_string ($myrow['taxgroupdescription']) . "');\n");
+ fwrite($FileHandle,"INSERT INTO taxgroups VALUES ('" . $myrow['taxgroupid'] . "', '" . SQLite_Escape ($myrow['taxgroupdescription']) . "');\n");
}
@@ -86,7 +90,7 @@
$result = DB_query('SELECT taxid, description FROM taxauthorities',$db);
while ($myrow = DB_fetch_array($result)) {
- fwrite($FileHandle,"INSERT INTO taxauthorities VALUES ('" . $myrow['taxid'] . "', '" . sqlite_escape_string ($myrow['description']) . "');\n");
+ fwrite($FileHandle,"INSERT INTO taxauthorities VALUES ('" . $myrow['taxid'] . "', '" . SQLite_Escape ($myrow['description']) . "');\n");
}
fwrite($FileHandle,"DELETE FROM taxauthrates;\n");
@@ -100,8 +104,8 @@
$result = DB_query("SELECT stockid, categoryid, description, longdescription, units, barcode, taxcatid, decimalplaces FROM stockmaster WHERE (mbflag='B' OR mbflag='M') AND discontinued=0 AND controlled=0",$db);
while ($myrow = DB_fetch_array($result)) {
- fwrite($FileHandle,"INSERT INTO stockmaster VALUES ('" . sqlite_escape_string ($myrow['stockid']) . "', '" . sqlite_escape_string ($myrow['categoryid']) . "', '" . sqlite_escape_string ($myrow['description']) . "', '" . sqlite_escape_string (str_replace("\n", '', $myrow['longdescription'])) . "', '" . sqlite_escape_string ($myrow['units']) . "', '" . sqlite_escape_string ($myrow['barcode']) . "', '" . $myrow['taxcatid'] . "', '" . $myrow['decimalplaces'] . "');\n");
- $Price = GetPrice ($myrow['stockid'], $_POST['POSDebtorNo'], $_POST['POSBranchCode'], $db,0);
+ fwrite($FileHandle,"INSERT INTO stockmaster VALUES ('" . SQLite_Escape ($myrow['stockid']) . "', '" . SQLite_Escape ($myrow['categoryid']) . "', '" . SQLite_Escape ($myrow['description']) . "', '" . SQLite_Escape (str_replace("\n", '', $myrow['longdescription'])) . "', '" . SQLite_Escape ($myrow['units']) . "', '" . SQLite_Escape ($myrow['barcode']) . "', '" . $myrow['taxcatid'] . "', '" . $myrow['decimalplaces'] . "');\n");
+ $Price = GetPriceQuick ($myrow['stockid'], $_POST['POSDebtorNo'], $_POST['POSBranchCode'], $db);
if ($Price!=0) {
fwrite($FileHandle,"INSERT INTO prices (stockid, currabrev, typeabbrev, price) VALUES('" . $myrow['stockid'] . "', '" . $CurrCode . "', '" . $SalesType . "', '" . $Price . "');\n");
}
@@ -111,14 +115,14 @@
$result = DB_query("SELECT debtorno, name, currcode, salestype, holdreason, paymentterms, discount, creditlimit, discountcode FROM debtorsmaster WHERE currcode='". $CurrCode . "'",$db);
while ($myrow = DB_fetch_array($result)) {
- fwrite($FileHandle,"INSERT INTO debtorsmaster VALUES ('" . $myrow['debtorno'] . "', '" . sqlite_escape_string ($myrow['name']) . "', '" . $myrow['currcode'] . "', '" . $myrow['salestype'] . "', '" . $myrow['holdreason'] . "', '" . sqlite_escape_string ($myrow['paymentterms']) . "', '" . $myrow['discount'] . "', '" . $myrow['creditlimit'] . "', '" . $myrow['discountcode'] . "');\n");
+ fwrite($FileHandle,"INSERT INTO debtorsmaster VALUES ('" . $myrow['debtorno'] . "', '" . SQLite_Escape ($myrow['name']) . "', '" . $myrow['currcode'] . "', '" . $myrow['salestype'] . "', '" . $myrow['holdreason'] . "', '" . SQLite_Escape ($myrow['paymentterms']) . "', '" . $myrow['discount'] . "', '" . $myrow['creditlimit'] . "', '" . $myrow['discountcode'] . "');\n");
}
fwrite($FileHandle,"DELETE FROM custbranch;\n");
$result = DB_query("SELECT branchcode, debtorsmaster.debtorno, brname, contactname, specialinstructions,taxgroupid FROM custbranch INNER JOIN debtorsmaster ON custbranch.debtorno=debtorsmaster.debtorno WHERE debtorsmaster.currcode='". $CurrCode . "'",$db);
while ($myrow = DB_fetch_array($result)) {
- fwrite($FileHandle,"INSERT INTO custbranch VALUES ('" . $myrow['branchcode'] . "', '" . $myrow['debtorno'] . "', '" . sqlite_escape_string ($myrow['brname']) . "', '" . sqlite_escape_string ($myrow['contactname']) . "', '" . sqlite_escape_string ($myrow['specialinstructions']) . "', '" . $myrow['taxgroupid'] . "');\n");
+ fwrite($FileHandle,"INSERT INTO custbranch VALUES ('" . $myrow['branchcode'] . "', '" . $myrow['debtorno'] . "', '" . SQLite_Escape ($myrow['brname']) . "', '" . SQLite_Escape ($myrow['contactname']) . "', '" . SQLite_Escape ($myrow['specialinstructions']) . "', '" . $myrow['taxgroupid'] . "');\n");
}
@@ -134,6 +138,25 @@
}
$ZipFile->addFile($_SESSION['reports_dir'] . '/POS.sql','POS.sql');
$ZipFile->close();
+ //delete the original big sql file as we now have the zip for transferring
+ unlink($_SESSION['reports_dir'] . '/POS.sql');
+ return 1;
}
+function SQLite_Escape($String) {
+ $SearchCharacters = array('&', '"', "'",'<', '>',"\n","\r" );
+ $ReplaceWith = array('&', '""', "''", '<', '>', '', ' ');
+
+ $String = str_replace($SearchCharacters, $ReplaceWith, $String);
+ return $String;
+}
+function Delete_POS_Data(){
+ if (file_exists($_SESSION['reports_dir'] . '/POS.sql.zip')){
+ unlink($_SESSION['reports_dir'] . '/POS.sql');
+ }
+ if (file_exists($_SESSION['reports_dir'] . '/POS.sql')){
+ unlink($_SESSION['reports_dir'] . '/POS.sql');
+ }
+ return 1;
+}
?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|