From: <te...@us...> - 2012-07-13 08:36:06
|
Revision: 5498 http://web-erp.svn.sourceforge.net/web-erp/?rev=5498&view=rev Author: tehonu Date: 2012-07-13 08:35:54 +0000 (Fri, 13 Jul 2012) Log Message: ----------- Ricard: Flag on locations to allow (or deny) internal stock requests from that location. Modified Paths: -------------- trunk/InternalStockRequest.php trunk/Locations.php trunk/sql/mysql/upgrade4.08-4.09.sql Modified: trunk/InternalStockRequest.php =================================================================== --- trunk/InternalStockRequest.php 2012-07-13 07:58:18 UTC (rev 5497) +++ trunk/InternalStockRequest.php 2012-07-13 08:35:54 UTC (rev 5498) @@ -189,6 +189,7 @@ $sql="SELECT loccode, locationname FROM locations + WHERE internalrequest = 1 ORDER BY locationname"; $result=DB_query($sql, $db); Modified: trunk/Locations.php =================================================================== --- trunk/Locations.php 2012-07-13 07:58:18 UTC (rev 5497) +++ trunk/Locations.php 2012-07-13 08:35:54 UTC (rev 5498) @@ -69,7 +69,8 @@ taxprovinceid = '" . $_POST['TaxProvince'] . "', cashsalecustomer ='" . $_POST['CashSaleCustomer'] . "', cashsalebranch ='" . $_POST['CashSaleBranch'] . "', - managed = '" . $_POST['Managed'] . "' + managed = '" . $_POST['Managed'] . "', + internalrequest = '" . $_POST['InternalRequest'] . "' WHERE loccode = '" . $SelectedLocation . "'"; $ErrMsg = _('An error occurred updating the') . ' ' . $SelectedLocation . ' ' . _('location record because'); @@ -95,6 +96,7 @@ unset($_POST['CashSaleBranch']); unset($SelectedLocation); unset($_POST['Contact']); + unset($_POST['InternalRequest']); } elseif ($InputError !=1) { @@ -106,6 +108,13 @@ $_POST['Managed'] = 0; } + /* Set the InternalRequest field to 1 if it is checked, otherwise 0 */ + if($_POST['InternalRequest'] == 'Yes') { + $_POST['InternalRequest'] = 1; + } else { + $_POST['InternalRequest'] = 0; + } + /*SelectedLocation is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new Location form */ $sql = "INSERT INTO locations (loccode, @@ -123,7 +132,8 @@ taxprovinceid, cashsalecustomer, cashsalebranch, - managed ) + managed, + internalrequest) VALUES ('" . $_POST['LocCode'] . "', '" . $_POST['LocationName'] . "', '" . $_POST['DelAdd1'] ."', @@ -139,7 +149,8 @@ '" . $_POST['TaxProvince'] . "', '" . $_POST['CashSaleCustomer'] . "', '" . $_POST['CashSaleBranch'] . "', - '" . $_POST['Managed'] . "')"; + '" . $_POST['Managed'] . "', + '" . $_POST['InternalRequest'] . "')"; $ErrMsg = _('An error occurred inserting the new location record because'); $DbgMsg = _('The SQL used to insert the location record was'); @@ -182,6 +193,7 @@ unset($_POST['Managed']); unset($SelectedLocation); unset($_POST['Contact']); + unset($_POST['InternalRequest']); } @@ -438,7 +450,8 @@ taxprovinceid, cashsalecustomer, cashsalebranch, - managed + managed, + internalrequest FROM locations WHERE loccode='" . $SelectedLocation . "'"; @@ -461,6 +474,7 @@ $_POST['CashSaleCustomer'] = $myrow['cashsalecustomer']; $_POST['CashSaleBranch'] = $myrow['cashsalebranch']; $_POST['Managed'] = $myrow['managed']; + $_POST['InternalRequest'] = $myrow['internalrequest']; echo '<input type="hidden" name="SelectedLocation" value="' . $SelectedLocation . '" />'; @@ -596,6 +610,20 @@ <td>' . _('Counter Sales Branch Code') . ':' . '</td> <td><input type="text" name="CashSaleBranch" value="' . $_POST['CashSaleBranch'] . '" size="11" maxlength="10" /></td> </tr>'; + echo '<tr> + <td>' . _('Allow internal requests?') . ':</td> + <td><select name="InternalRequest">'; + if ($_POST['InternalRequest']==1){ + echo '<option selected="selected" value="1">' . _('Yes') . '</option>'; + } else { + echo '<option value="1">' . _('Yes') . '</option>'; + } + if ($_POST['InternalRequest']==0){ + echo '<option selected="selected" value="0">' . _('No') . '</option>'; + } else { + echo '<option value="0">' . _('No') . '</option>'; + } + /* This functionality is not written yet ... <tr><td><?php echo _('Enable Warehouse Management') . ':'; ?></td> Modified: trunk/sql/mysql/upgrade4.08-4.09.sql =================================================================== --- trunk/sql/mysql/upgrade4.08-4.09.sql 2012-07-13 07:58:18 UTC (rev 5497) +++ trunk/sql/mysql/upgrade4.08-4.09.sql 2012-07-13 08:35:54 UTC (rev 5498) @@ -10,4 +10,6 @@ INSERT INTO scripts VALUES ('InternalStockCategoriesByRole.php','15','Daintains the stock categories to be used as internal for any user security role'); +ALTER TABLE `locations` ADD `internalrequest` TINYINT( 4 ) NOT NULL DEFAULT '1' COMMENT 'Allow (1) or not (0) internal request from this location'; + UPDATE config SET confvalue='4.08.2' WHERE confname='VersionNumber'; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |