From: <ice...@us...> - 2013-10-21 12:05:25
|
Revision: 6365 http://sourceforge.net/p/web-erp/reponame/6365 Author: icedlava Date: 2013-10-21 12:05:22 +0000 (Mon, 21 Oct 2013) Log Message: ----------- Put back ability to reclone without selecting another item again. Fix the inadvertently removed error messages. Modified Paths: -------------- trunk/StockClone.php Modified: trunk/StockClone.php =================================================================== --- trunk/StockClone.php 2013-10-20 15:48:37 UTC (rev 6364) +++ trunk/StockClone.php 2013-10-21 12:05:22 UTC (rev 6365) @@ -40,7 +40,10 @@ if (($myrow[0]==0) && ($_POST['OldStockID'] != '')) { $_POST['New'] =1; } else { - $_POST['New']=0; + prnMsg(_('The stock code entered is already in the database - duplicate stock codes are prohibited by the system. Try choosing an alternative stock code'),'error'); + $Errors[1] = 'DuplicateStockID'; + $_POST['New']=0; + $_POST['StockID'] = $_POST['OldStockID']; } } @@ -266,7 +269,8 @@ WHERE stockid='" . $_POST['StockID'] ."'",$db); if (DB_num_rows($result)==1){ prnMsg(_('The stock code entered is already in the database - duplicate stock codes are prohibited by the system. Try choosing an alternative stock code'),'error'); - exit; + $Errors[$i] = 'DuplicateStockID'; + //exit; } else { $sql = "INSERT INTO stockmaster (stockid, description, @@ -542,10 +546,10 @@ unset($_POST['ShrinkFactor']); unset($_POST['Pansize']); unset($_POST['StockID']); - unset($_POST['OldStockID']); + //unset($_POST['OldStockID']); foreach ($ItemDescriptionLanguages as $DescriptionLanguage) { unset($_POST['Description_' . str_replace('.','_',$DescriptionLanguage)]); - $_POST['New'] = 0; //do not show input form again + $_POST['New'] = 1; //do not show input form again } }//Reset the form variables }//Stock records finished @@ -567,12 +571,12 @@ <input type="hidden" name="New" value="'.$_POST['New'].'" /> <table class="selection">'; -if ($_POST['StockID'] == '' || ($_POST['StockID'] == $_POST['OldStockID']) ||isset($_POST['UpdateCategories'])) { +if ($_POST['StockID'] == '' || ($_POST['StockID'] == $_POST['OldStockID']) || isset($_POST['UpdateCategories'])) { /*If the page was called without $StockID or empty $StockID then a new cloned stock item is to be entered. Show a form with a part Code field, otherwise show form for editing with only a hidden OldStockID field. */ - if ($_POST['New']==1) { + //if ($_POST['New']==1) { $StockIDStyle= !empty($_POST['StockID']) && ($_POST['StockID'] != $_POST['OldStockID'])? '' : ' style="color:red;border: 2px solid red;background-color:#fddbdb;" '; $StockID= !empty($_POST['StockID'])? $_POST['StockID']:$_POST['OldStockID']; echo '<tr> @@ -582,7 +586,7 @@ </td> </tr>'; - } + //} } if ( (!isset($_POST['UpdateCategories']) AND ($InputError!=1)) OR $_POST['New']== 1 ) { // Must be modifying an existing item and no changes made yet @@ -648,7 +652,7 @@ } -if ($_POST['New'] == 1) { +//if ($_POST['New'] == 1) { if (isset($_POST['Description'])) { $Description = $_POST['Description']; } else { @@ -1091,7 +1095,7 @@ echo '<input type="submit" name="submit" value="' . _('Insert New Item') . '" />'; echo '<input type="submit" name="UpdateCategories" style="visibility:hidden;width:1px" value="' . _('Categories') . '" />'; -} +//} echo '</div> </div> </form>'; |