From: <aga...@us...> - 2014-04-30 17:31:12
|
Revision: 6702 http://sourceforge.net/p/web-erp/reponame/6702 Author: agaluski Date: 2014-04-30 17:31:08 +0000 (Wed, 30 Apr 2014) Log Message: ----------- Add new field to workorders table to store closing comments Allow updates to comments in WorkOrderEntry.php even if other edits are not allowed Allow closecomments to be entered and viewed in WorkOrderCosting.php Modified Paths: -------------- trunk/WorkOrderCosting.php trunk/WorkOrderEntry.php trunk/sql/mysql/upgrade4.11-4.12.sql Modified: trunk/WorkOrderCosting.php =================================================================== --- trunk/WorkOrderCosting.php 2014-04-29 12:57:39 UTC (rev 6701) +++ trunk/WorkOrderCosting.php 2014-04-30 17:31:08 UTC (rev 6702) @@ -44,7 +44,8 @@ locations.locationname, workorders.requiredby, workorders.startdate, - workorders.closed + workorders.closed, + closecomments FROM workorders INNER JOIN locations ON workorders.loccode=locations.loccode WHERE workorders.wo='" . $_POST['WO'] . "'", @@ -516,7 +517,7 @@ } //end of standard costing section } // end loop around the items on the work order - $CloseWOResult =DB_query("UPDATE workorders SET closed=1 WHERE wo='" .$_POST['WO'] . "'", + $CloseWOResult =DB_query("UPDATE workorders SET closed=1, closecomments = '". $_POST['CloseComments'] ."' WHERE wo='" .$_POST['WO'] . "'", $db, _('Could not update the work order to closed because:'), _('The SQL used to close the work order was:'), @@ -543,7 +544,24 @@ $WorkOrderRow['closed']=1; }//end close button hit by user +if ($WorkOrderRow['closed']==0){ + $ReadOnly=''; +} else{ + $ReadOnly='readonly'; + if (!isset($_POST['CloseComments'])) { + $_POST['CloseComments'] = $WorkOrderRow['closecomments']; + } +} +echo '<tr> + <td colspan="9"> + + <div class="centre"> + <textarea ' . $ReadOnly . ' style="width:100%" rows="5" cols="80" name="CloseComments" >' . $_POST['CloseComments'] . '</textarea> + </div> + </td> + </tr>'; + if ($WorkOrderRow['closed']==0){ echo '<tr> <td colspan="9"> Modified: trunk/WorkOrderEntry.php =================================================================== --- trunk/WorkOrderEntry.php 2014-04-29 12:57:39 UTC (rev 6701) +++ trunk/WorkOrderEntry.php 2014-04-30 17:31:08 UTC (rev 6702) @@ -196,8 +196,12 @@ if (!isset($Offset)) { $Offset=0; } - if($Offset<0)$Offset=0; - if($Offset>$ListPageMax)$Offset=$ListPageMax; + if($Offset<0){ + $Offset=0; + } + if($Offset>$ListPageMax){ + $Offset=$ListPageMax; + } $sql = $sql . ' LIMIT ' . $_SESSION['DisplayRecordsMax'].' OFFSET ' . strval($_SESSION['DisplayRecordsMax']*$Offset); @@ -355,6 +359,9 @@ if (!isset($_POST['WOComments'.$i])) { $_POST['WOComments'.$i]=''; } + $sql[] = "UPDATE woitems SET comments = '". $_POST['WOComments'.$i] ."' + WHERE wo='" . $_POST['WO'] . "' + AND stockid='" . $_POST['OutputItem'.$i] . "'"; if (isset($_POST['QtyRecd'.$i]) AND $_POST['QtyRecd'.$i]>$_POST['OutputQty'.$i]){ $_POST['OutputQty'.$i]=$_POST['QtyRecd'.$i]; //OutputQty must be >= Qty already reced } @@ -376,14 +383,12 @@ } $sql[] = "UPDATE woitems SET qtyreqd = '". $_POST['OutputQty' . $i] . "', nextlotsnref = '". $_POST['NextLotSNRef'.$i] ."', - stdcost ='" . $Cost . "', - comments = '". $_POST['WOComments'.$i] ."' + stdcost ='" . $Cost . "' WHERE wo='" . $_POST['WO'] . "' AND stockid='" . $_POST['OutputItem'.$i] . "'"; } elseif (isset($_POST['HasWOSerialNos'.$i]) AND $_POST['HasWOSerialNos'.$i]==false) { $sql[] = "UPDATE woitems SET qtyreqd = '". $_POST['OutputQty' . $i] . "', - nextlotsnref = '". $_POST['NextLotSNRef'.$i] ."', - comments = '". $_POST['WOComments'.$i] ."' + nextlotsnref = '". $_POST['NextLotSNRef'.$i] ."' WHERE wo='" . $_POST['WO'] . "' AND stockid='" . $_POST['OutputItem'.$i] . "'"; } Modified: trunk/sql/mysql/upgrade4.11-4.12.sql =================================================================== --- trunk/sql/mysql/upgrade4.11-4.12.sql 2014-04-29 12:57:39 UTC (rev 6701) +++ trunk/sql/mysql/upgrade4.11-4.12.sql 2014-04-30 17:31:08 UTC (rev 6702) @@ -29,6 +29,7 @@ ALTER table pricematrix ADD KEY currabrev(`currabrev`); ALTER table pricematrix ADD KEY stockid(`stockid`); ALTER TABLE `debtortrans` CHANGE `consignment` `consignment` VARCHAR( 20 ) NOT NULL DEFAULT ''; +ALTER TABLE `workorders` ADD `closecomments` LONGBLOB NULL DEFAULT NULL ; UPDATE config SET confvalue='4.12' WHERE confname='VersionNumber'; |