From: <dai...@us...> - 2010-12-18 05:18:15
|
Revision: 4185 http://web-erp.svn.sourceforge.net/web-erp/?rev=4185&view=rev Author: daintree Date: 2010-12-18 05:18:08 +0000 (Sat, 18 Dec 2010) Log Message: ----------- sql script pricing end dates per Ricard Modified Paths: -------------- trunk/SelectOrderItems.php trunk/includes/MiscFunctions.php trunk/sql/mysql/upgrade3.11.1-4.00.sql Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2010-12-17 21:58:59 UTC (rev 4184) +++ trunk/SelectOrderItems.php 2010-12-18 05:18:08 UTC (rev 4185) @@ -307,16 +307,16 @@ $SearchString = '%' . str_replace(' ', '%', $_POST['CustKeywords']) . '%'; $SQL = "SELECT custbranch.brname, - custbranch.contactname, - custbranch.phoneno, - custbranch.faxno, - custbranch.branchcode, - custbranch.debtorno, - debtorsmaster.name - FROM custbranch - LEFT JOIN debtorsmaster - ON custbranch.debtorno=debtorsmaster.debtorno - WHERE custbranch.brname " . LIKE . " '$SearchString'"; + custbranch.contactname, + custbranch.phoneno, + custbranch.faxno, + custbranch.branchcode, + custbranch.debtorno, + debtorsmaster.name + FROM custbranch + LEFT JOIN debtorsmaster + ON custbranch.debtorno=debtorsmaster.debtorno + WHERE custbranch.brname " . LIKE . " '$SearchString'"; if ($_SESSION['SalesmanLogin']!=''){ $SQL .= " AND custbranch.salesman='" . $_SESSION['SalesmanLogin'] . "'"; @@ -329,17 +329,17 @@ $_POST['CustCode'] = strtoupper(trim($_POST['CustCode'])); $SQL = "SELECT custbranch.brname, - custbranch.contactname, - custbranch.phoneno, - custbranch.faxno, - custbranch.branchcode, - custbranch.debtorno, - debtorsmaster.name - FROM custbranch - LEFT JOIN debtorsmaster - ON custbranch.debtorno=debtorsmaster.debtorno - WHERE custbranch.debtorno " . LIKE . " '%" . $_POST['CustCode'] . "%' OR custbranch.branchcode " . LIKE . " '%" . $_POST['CustCode'] . "%'"; - + custbranch.contactname, + custbranch.phoneno, + custbranch.faxno, + custbranch.branchcode, + custbranch.debtorno, + debtorsmaster.name + FROM custbranch + LEFT JOIN debtorsmaster + ON custbranch.debtorno=debtorsmaster.debtorno + WHERE custbranch.debtorno " . LIKE . " '%" . $_POST['CustCode'] . "%' OR custbranch.branchcode " . LIKE . " '%" . $_POST['CustCode'] . "%'"; + if ($_SESSION['SalesmanLogin']!=''){ $SQL .= " AND custbranch.salesman='" . $_SESSION['SalesmanLogin'] . "'"; } @@ -347,23 +347,23 @@ ORDER BY custbranch.debtorno'; } elseif (strlen($_POST['CustPhone'])>0){ $SQL = "SELECT custbranch.brname, - custbranch.contactname, - custbranch.phoneno, - custbranch.faxno, - custbranch.branchcode, - custbranch.debtorno, - debtorsmaster.name - FROM custbranch - LEFT JOIN debtorsmaster - ON custbranch.debtorno=debtorsmaster.debtorno - WHERE custbranch.phoneno " . LIKE . " '%" . $_POST['CustPhone'] . "%'"; + custbranch.contactname, + custbranch.phoneno, + custbranch.faxno, + custbranch.branchcode, + custbranch.debtorno, + debtorsmaster.name + FROM custbranch + LEFT JOIN debtorsmaster + ON custbranch.debtorno=debtorsmaster.debtorno + WHERE custbranch.phoneno " . LIKE . " '%" . $_POST['CustPhone'] . "%'"; if ($_SESSION['SalesmanLogin']!=''){ $SQL .= " AND custbranch.salesman='" . $_SESSION['SalesmanLogin'] . "'"; } $SQL .= ' AND custbranch.disabletrans=0 - ORDER BY custbranch.debtorno'; + ORDER BY custbranch.debtorno'; } $ErrMsg = _('The searched customer records requested cannot be retrieved because'); @@ -389,20 +389,20 @@ // Now check to ensure this account is not on hold */ $sql = "SELECT debtorsmaster.name, - holdreasons.dissallowinvoices, - debtorsmaster.salestype, - salestypes.sales_type, - debtorsmaster.currcode, - debtorsmaster.customerpoline, - paymentterms.terms - FROM debtorsmaster, - holdreasons, - salestypes, - paymentterms - WHERE debtorsmaster.salestype=salestypes.typeabbrev - AND debtorsmaster.holdreason=holdreasons.reasoncode - AND debtorsmaster.paymentterms=paymentterms.termsindicator - AND debtorsmaster.debtorno = '" . $_POST['Select'] . "'"; + holdreasons.dissallowinvoices, + debtorsmaster.salestype, + salestypes.sales_type, + debtorsmaster.currcode, + debtorsmaster.customerpoline, + paymentterms.terms + FROM debtorsmaster, + holdreasons, + salestypes, + paymentterms + WHERE debtorsmaster.salestype=salestypes.typeabbrev + AND debtorsmaster.holdreason=holdreasons.reasoncode + AND debtorsmaster.paymentterms=paymentterms.termsindicator + AND debtorsmaster.debtorno = '" . $_POST['Select'] . "'"; $ErrMsg = _('The details of the customer selected') . ': ' . $_POST['Select'] . ' ' . _('cannot be retrieved because'); $DbgMsg = _('The SQL used to retrieve the customer details and failed was') . ':'; @@ -430,26 +430,26 @@ # the branch was also selected from the customer selection so default the delivery details from the customer branches table CustBranch. The order process will ask for branch details later anyway $sql = "SELECT custbranch.brname, - custbranch.braddress1, - custbranch.braddress2, - custbranch.braddress3, - custbranch.braddress4, - custbranch.braddress5, - custbranch.braddress6, - custbranch.phoneno, - custbranch.email, - custbranch.defaultlocation, - custbranch.defaultshipvia, - custbranch.deliverblind, - custbranch.specialinstructions, - custbranch.estdeliverydays, - locations.locationname, - custbranch.salesman - FROM custbranch - INNER JOIN locations - ON custbranch.defaultlocation=locations.loccode - WHERE custbranch.branchcode='" . $_SESSION['Items'.$identifier]->Branch . "' - AND custbranch.debtorno = '" . $_POST['Select'] . "'"; + custbranch.braddress1, + custbranch.braddress2, + custbranch.braddress3, + custbranch.braddress4, + custbranch.braddress5, + custbranch.braddress6, + custbranch.phoneno, + custbranch.email, + custbranch.defaultlocation, + custbranch.defaultshipvia, + custbranch.deliverblind, + custbranch.specialinstructions, + custbranch.estdeliverydays, + locations.locationname, + custbranch.salesman + FROM custbranch + INNER JOIN locations + ON custbranch.defaultlocation=locations.loccode + WHERE custbranch.branchcode='" . $_SESSION['Items'.$identifier]->Branch . "' + AND custbranch.debtorno = '" . $_POST['Select'] . "'"; $ErrMsg = _('The customer branch record of the customer selected') . ': ' . $_POST['Select'] . ' ' . _('cannot be retrieved because'); $DbgMsg = _('SQL used to retrieve the branch details was') . ':'; @@ -516,13 +516,13 @@ #DefaultSalesType will not have been set as above $sql = "SELECT debtorsmaster.name, - holdreasons.dissallowinvoices, - debtorsmaster.salestype, - debtorsmaster.currcode, - debtorsmaster.customerpoline - FROM debtorsmaster, holdreasons - WHERE debtorsmaster.holdreason=holdreasons.reasoncode - AND debtorsmaster.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; + holdreasons.dissallowinvoices, + debtorsmaster.salestype, + debtorsmaster.currcode, + debtorsmaster.customerpoline + FROM debtorsmaster, holdreasons + WHERE debtorsmaster.holdreason=holdreasons.reasoncode + AND debtorsmaster.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; if (isset($_POST['Select'])) { $ErrMsg = _('The details for the customer selected') . ': ' . $_POST['Select'] . ' ' . _('cannot be retrieved because'); @@ -550,23 +550,23 @@ // the order process will ask for branch details later anyway $sql = "SELECT custbranch.brname, - custbranch.branchcode, - custbranch.braddress1, - custbranch.braddress2, - custbranch.braddress3, - custbranch.braddress4, - custbranch.braddress5, - custbranch.braddress6, - custbranch.phoneno, - custbranch.email, - custbranch.defaultlocation, - custbranch.deliverblind, - custbranch.estdeliverydays, - locations.locationname - FROM custbranch INNER JOIN locations - ON custbranch.defaultlocation=locations.loccode - WHERE custbranch.branchcode='" . $_SESSION['Items'.$identifier]->Branch . "' - AND custbranch.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; + custbranch.branchcode, + custbranch.braddress1, + custbranch.braddress2, + custbranch.braddress3, + custbranch.braddress4, + custbranch.braddress5, + custbranch.braddress6, + custbranch.phoneno, + custbranch.email, + custbranch.defaultlocation, + custbranch.deliverblind, + custbranch.estdeliverydays, + locations.locationname + FROM custbranch INNER JOIN locations + ON custbranch.defaultlocation=locations.loccode + WHERE custbranch.branchcode='" . $_SESSION['Items'.$identifier]->Branch . "' + AND custbranch.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; if (isset($_POST['Select'])) { $ErrMsg = _('The customer branch record of the customer selected') . ': ' . $_POST['Select'] . ' ' . _('cannot be retrieved because'); @@ -685,9 +685,9 @@ if($_SESSION['ExistingOrder']!=0) { //need to check that not already dispatched $sql = "SELECT qtyinvoiced - FROM salesorderdetails - WHERE orderno='" . $_SESSION['ExistingOrder'] . "' - AND qtyinvoiced>0"; + FROM salesorderdetails + WHERE orderno='" . $_SESSION['ExistingOrder'] . "' + AND qtyinvoiced>0"; $InvQties = DB_query($sql,$db); @@ -942,8 +942,8 @@ } /*Now figure out if the item is a kit set - the field MBFlag='K'*/ $sql = "SELECT stockmaster.mbflag - FROM stockmaster - WHERE stockmaster.stockid='". $NewItem ."'"; + FROM stockmaster + WHERE stockmaster.stockid='". $NewItem ."'"; $ErrMsg = _('Could not determine if the part being ordered was a kitset or not because'); $DbgMsg = _('The sql that was used to determine if the part being ordered was a kitset or not was '); @@ -1050,17 +1050,15 @@ SELECT loccode, "' . $AssetStockID . '" FROM locations',$db); /*Now the asset has been added to the stock master we can add it to the sales order */ $NewItemDue = date($_SESSION['DefaultDateFormat']); - if (isset($_POST['POLine']){ + if (isset($_POST['POLine'])){ $NewPOLine = $_POST['POLine']; } else { $NewPOLine = 0; } $NewItem = $AssetStockID; include('includes/SelectOrderItems_IntoCart.inc'); - } - - - } + } //end if adding a fixed asset to the order + } //end if the fixed asset selection box was set /*Now do non-quick entry delete/edits/adds */ @@ -1403,9 +1401,7 @@ /* Now show the stock item selection search stuff below */ - if ((isset($_POST['PartSearch']) - AND $_POST['PartSearch']!='' - AND !isset($_POST['QuickEntry']) + if ((!isset($_POST['QuickEntry']) AND !isset($_POST['SelectAsset']))){ echo '<input type="hidden" name="PartSearch" value="' . _('Yes Please') . '">'; Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2010-12-17 21:58:59 UTC (rev 4184) +++ trunk/includes/MiscFunctions.php 2010-12-18 05:18:08 UTC (rev 4185) @@ -12,8 +12,7 @@ }//prnMsg -function reverse_escape($str) -{ +function reverse_escape($str) { $search=array("\\\\","\\0","\\n","\\r","\Z","\'",'\"'); $replace=array("\\","\0","\n","\r","\x1a","'",'"'); return str_replace($search,$replace,$str); @@ -57,63 +56,53 @@ return '<DIV class="'.$Class.'"><B>' . $Prefix . '</B> : ' .$Msg . '</DIV>'; }//getMsg -function IsEmailAddress($email){ +function IsEmailAddress($Email){ - $atIndex = strrpos ($email, "@"); - if ($atIndex === false) - { + $AtIndex = strrpos ($Email, "@"); + if ($AtIndex == false) { return false; // No @ sign is not acceptable. } - if (preg_match('/\\.\\./', $email)) + if (preg_match('/\\.\\./', $Email)){ return false; // > 1 consecutive dot is not allowed. - + } // Check component length limits - $domain = substr ($email, $atIndex+1); - $local = substr ($email, 0, $atIndex); - $localLen = strlen ($local); - $domainLen = strlen ($domain); - if ($localLen < 1 || $localLen > 64) - { + $Domain = substr ($Email, $AtIndex+1); + $Local= substr ($Email, 0, $AtIndex); + $LocalLen = strlen ($Local); + $DomainLen = strlen ($Domain); + if ($LocalLen < 1 || $LocalLen > 64){ // local part length exceeded return false; } - if ($domainLen < 1 || $domainLen > 255) - { + if ($DomainLen < 1 || $DomainLen > 255){ // domain part length exceeded return false; } - if ($local[0] == '.' || $local[$localLen-1] == '.') - { + if ($Local[0] == '.' OR $Local[$LocalLen-1] == '.') { // local part starts or ends with '.' return false; } - if (!preg_match ('/^[A-Za-z0-9\\-\\.]+$/', $domain )) - { + if (!preg_match ('/^[A-Za-z0-9\\-\\.]+$/', $Domain )){ // character not valid in domain part return false; } - if (!preg_match ('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', - str_replace ("\\\\", "" ,$local ) )) - { + if (!preg_match ('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', str_replace ("\\\\", "" ,$Local) )){ // character not valid in local part unless local part is quoted - if (!preg_match ('/^"(\\\\"|[^"])+"$/', - str_replace("\\\\", "", $local) )) - { - return false; + if (!preg_match ('/^"(\\\\"|[^"])+"$/', str_replace("\\\\", "", $Local) )) { + return false; } } // Check for a DNS 'MX' or 'A' record. // Windows supported from PHP 5.3.0 on - so check. - $ret = true; - if (version_compare(PHP_VERSION, '5.3.0') >= 0 - || strtoupper(substr(PHP_OS, 0, 3) !== 'WIN')) { - $ret = checkdnsrr( $domain, "MX" ) || checkdnsrr( $domain, "A" ); + $Ret = true; + if (version_compare(PHP_VERSION, '5.3.0') >= 0 OR strtoupper(substr(PHP_OS, 0, 3) !== 'WIN')) { + $Ret = checkdnsrr( $Domain, 'MX' ) OR checkdnsrr( $Domain, 'A' ); } - return $ret; + return $Ret; } @@ -135,9 +124,9 @@ function pre_var_dump(&$var){ - echo "<div align=left><pre>"; + echo '<div align=left><pre>'; var_dump($var); - echo "</pre></div>"; + echo '</pre></div>'; } @@ -164,18 +153,18 @@ $stack = array(); foreach ($tags as $tag) { $index = count($elements); - if ($tag['type'] == "complete" || $tag['type'] == "open") { + if ($tag['type'] == 'complete' OR $tag['type'] == 'open') { $elements[$index] = new XmlElement; $elements[$index]->name = $tag['tag']; $elements[$index]->attributes = $tag['attributes']; $elements[$index]->content = $tag['value']; - if ($tag['type'] == "open") { // push + if ($tag['type'] == 'open') { // push $elements[$index]->children = array(); $stack[count($stack)] = &$elements; $elements = &$elements[$index]->children; } } - if ($tag['type'] == "close") { // pop + if ($tag['type'] == 'close') { // pop $elements = &$stack[count($stack) - 1]; unset($stack[count($stack) - 1]); } Modified: trunk/sql/mysql/upgrade3.11.1-4.00.sql =================================================================== --- trunk/sql/mysql/upgrade3.11.1-4.00.sql 2010-12-17 21:58:59 UTC (rev 4184) +++ trunk/sql/mysql/upgrade3.11.1-4.00.sql 2010-12-18 05:18:08 UTC (rev 4185) @@ -260,11 +260,11 @@ ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `systypes` VALUES(19, 'Picking List', 0); -ALTER TABLE `prices` ADD `startdate` DATE NOT NULL DEFAULT '0000-00-00' , ADD `enddate` DATE NOT NULL DEFAULT '9999-12-31'; +ALTER TABLE `prices` ADD `startdate` DATE NOT NULL DEFAULT '0000-00-00' , ADD `enddate` DATE NOT NULL DEFAULT '0000-00-00'; ALTER TABLE prices DROP PRIMARY KEY , ADD PRIMARY KEY ( `stockid` , `typeabbrev` , `currabrev` , `debtorno` , `branchcode`, `startdate` , `enddate` ) ; ALTER TABLE purchdata ADD column minorderqty int(11) NOT NULL default 1; -UPDATE prices SET startdate='1999-01-01', enddate=''; +UPDATE prices SET startdate='1999-01-01', enddate='0000-00-00'; ALTER TABLE stockcheckfreeze ADD COLUMN stockcheckdate date NOT NULL; @@ -385,7 +385,6 @@ ALTER TABLE `loctransfers` CHANGE COLUMN `shipqty` `shipqty` double NOT NULL DEFAULT 0.0; -INSERT INTO `config` VALUES ('VersionNumber', '4.00-RC1'); UPDATE `securitytokens` SET `tokenname`='Prices Security' WHERE tokenid=12; ALTER TABLE `www_users` CHANGE `supplierid` `supplierid` VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |