From: <tu...@us...> - 2017-12-20 00:48:38
|
Revision: 7891 http://sourceforge.net/p/web-erp/reponame/7891 Author: turbopt Date: 2017-12-20 00:48:35 +0000 (Wed, 20 Dec 2017) Log Message: ----------- Contracts.php: Move work center handling causing a partial form to appear after the footer when no work centers exist. Modified Paths: -------------- trunk/Contracts.php trunk/doc/Change.log Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2017-12-19 20:49:25 UTC (rev 7890) +++ trunk/Contracts.php 2017-12-20 00:48:35 UTC (rev 7891) @@ -840,6 +840,16 @@ } echo '</p>'; + $sql = "SELECT code, description FROM workcentres INNER JOIN locationusers ON locationusers.loccode=workcentres.location AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1"; + $wcresults = DB_query($sql); + + if (DB_num_rows($wcresults)==0){ + prnMsg( _('There are no work centres set up yet') . '. ' . _('Please use the link below to set up work centres'),'warn'); + echo '<br /><a href="'.$RootPath.'/WorkCentres.php">' . _('Work Centre Maintenance') . '</a>'; + include('includes/footer.php'); + exit; + } + /*Set up form for entry of contract header stuff */ echo '<table class="selection"> @@ -857,7 +867,7 @@ </tr> <tr> <td>' . _('Category') . ':</td> - <td><select name="CategoryID" >'; + <td><select name="CategoryID">'; $sql = "SELECT categoryid, categorydescription FROM stockcategory"; $ErrMsg = _('The stock categories could not be retrieved because'); @@ -872,7 +882,7 @@ } } - echo '</select><a target="_blank" href="'. $RootPath . '/StockCategories.php">' . _('Add or Modify Contract Categories') . '</a></td></tr>'; + echo '</select> <a target="_blank" href="'. $RootPath . '/StockCategories.php">' . _('Add or Modify Contract Categories') . '</a></td></tr>'; $sql = "SELECT locations.loccode, locationname FROM locations INNER JOIN locationusers ON locationusers.loccode=locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1"; $ErrMsg = _('The stock locations could not be retrieved because'); @@ -881,7 +891,7 @@ echo '<tr> <td>' . _('Location') . ':</td> - <td><select name="LocCode" >'; + <td><select name="LocCode">'; while ($myrow=DB_fetch_array($result)){ if (!isset($_SESSION['Contract'.$identifier]->LocCode) or $myrow['loccode']==$_SESSION['Contract'.$identifier]->LocCode){ echo '<option selected="selected" value="'. $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; @@ -891,20 +901,11 @@ } echo '</select></td></tr>'; - $sql = "SELECT code, description FROM workcentres INNER JOIN locationusers ON locationusers.loccode=workcentres.location AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1"; - $result = DB_query($sql); - - if (DB_num_rows($result)==0){ - prnMsg( _('There are no work centres set up yet') . '. ' . _('Please use the link below to set up work centres'),'warn'); - echo '<br /><a href="'.$RootPath.'/WorkCentres.php">' . _('Work Centre Maintenance') . '</a>'; - include('includes/footer.php'); - exit; - } echo '<tr><td>' . _('Default Work Centre') . ': </td><td>'; echo '<select name="DefaultWorkCentre">'; - while ($myrow = DB_fetch_array($result)) { + while ($myrow = DB_fetch_array($wcresults)) { if (isset($_POST['DefaultWorkCentre']) and $myrow['code']==$_POST['DefaultWorkCentre']) { echo '<option selected="selected" value="'.$myrow['code'] . '">' . $myrow['description'] . '</option>'; } else { @@ -913,6 +914,7 @@ } //end while loop DB_free_result($result); + DB_free_result($wcresults); echo '</select></td> </tr> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2017-12-19 20:49:25 UTC (rev 7890) +++ trunk/doc/Change.log 2017-12-20 00:48:35 UTC (rev 7891) @@ -1,5 +1,6 @@ webERP Change Log +11/19/17 PaulT: Contracts.php: Move work center handling causing a partial form to appear after the footer when no work centers exist. 11/19/17 PaulT: Contract_Readin.php: Add customerref field to query to appear in the form when a contract is modified. 11/18/17 PaulT: ReportCreator.php: PHP 7.1 array compatibility change. (Reported in forums by rjonesbsink) 11/18/17 PaulT: BOMIndented.php, BOMIndentedReverse.php: Adjust PDF position values, and add UoM, remove stray 0-9 string output. (Reported in forums by Paul Becker) |