| 47 | rodolico | 1 | <?php 
 | 
        
           |  |  | 2 |    include_once( '../../header.php' );
 | 
        
           |  |  | 3 |    define( DEBUG, true );
 | 
        
           |  |  | 4 |    if ( isset( $_POST["submit"] ) && $_POST["submit"] == 'Save Modifications' ) {
 | 
        
           |  |  | 5 |       overwriteLicense( $_REQUEST['license_id'], $_REQUEST['client_id'], $_REQUEST['device_id'], $_REQUEST['license_product_id'], $_REQUEST['license'], $_REQUEST['added_date'], $_REQUEST['removed_date'], true  );
 | 
        
           |  |  | 6 |       header('Location: index.html');
 | 
        
           |  |  | 7 |    }
 | 
        
           |  |  | 8 |    // make them go back to the index page if they access this directly
 | 
        
           |  |  | 9 |    if ( ! isset( $_REQUEST[ 'license_id'] ) ) header('Location: index.html');
 | 
        
           |  |  | 10 |    $adding = $_REQUEST[ 'license_id'] == -1;
 | 
        
           |  |  | 11 |    if ( ! $adding ) {
 | 
        
           |  |  | 12 |       $currentLicense = queryDatabaseExtended( 'select * from license where license_id = ' . makeSafeSQLValue( $_REQUEST['license_id'] ) );
 | 
        
           |  |  | 13 |       $currentLicense = $currentLicense['data'][0];
 | 
        
           |  |  | 14 |    }
 | 
        
           |  |  | 15 | ?>
 | 
        
           |  |  | 16 | <?xml version="1.0" encoding="utf-8"?>
 | 
        
           |  |  | 17 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
 | 
        
           |  |  | 18 | <html xmlns="http://www.w3.org/1999/xhtml">
 | 
        
           |  |  | 19 |    <head>
 | 
        
           |  |  | 20 |       <title>Computer Asset Management Program - License - Edit</title>
 | 
        
           |  |  | 21 |       <link rel="stylesheet" type="text/css" href="../../camp.css">
 | 
        
           |  |  | 22 |    </head>
 | 
        
           |  |  | 23 |    <body>
 | 
        
           |  |  | 24 |       <?php include_once('../../menu.php'); ?>
 | 
        
           |  |  | 25 |       <div id="content">
 | 
        
           |  |  | 26 |          <h1 align='center'>Warning: Edits are not validated. Use Caution.</h1>
 | 
        
           |  |  | 27 |          <h2 align='center'>Only use this to correct mistakes, not to move a license</h2>
 | 
        
           |  |  | 28 |       <?php if ( DEBUG ) { print '<pre>'; print_r( $currentLicense ); print '</pre>'; } ?>
 | 
        
           |  |  | 29 |       <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
 | 
        
           |  |  | 30 |          <input type='hidden' name='license_id' value='<?php print $_REQUEST[ 'license_id']; ?>' />
 | 
        
           |  |  | 31 |          <table border='1'>
 | 
        
           |  |  | 32 |             <tr>
 | 
        
           |  |  | 33 |                <td>Client</td>
 | 
        
           |  |  | 34 |                <td>
 | 
        
           |  |  | 35 |                   <select name='client_id'>
 | 
        
           |  |  | 36 |                   <?php print queryToSelect( 'select client_id,name from client where removed_date is null order by name', $adding ? '' : $currentLicense['client_id'] ); ?>
 | 
        
           |  |  | 37 |                   </select>
 | 
        
           |  |  | 38 |                </td>
 | 
        
           |  |  | 39 |             </tr>
 | 
        
           |  |  | 40 |             <tr>
 | 
        
           |  |  | 41 |                <td>Machine</td>
 | 
        
           |  |  | 42 |                <td>
 | 
        
           |  |  | 43 |                   <select name='device_id'>
 | 
        
           |  |  | 44 |                   <?php 
 | 
        
           |  |  | 45 |                   if ( $adding || ! $currentLicense['device_id'] )
 | 
        
           |  |  | 46 |                      print "<option value=-1 selected>Available</option>\n";
 | 
        
           |  |  | 47 |                   else {
 | 
        
           |  |  | 48 |                      print "<option value=-1>Available</option>\n";
 | 
        
           |  |  | 49 |                   }
 | 
        
           |  |  | 50 |                   print queryToSelect( "select device.device_id,device.name from device where device_type_id in (select device_type_id from device_type where show_as_system = 'Y') order by device.name", $adding ? '' : $currentLicense['device_id']); ?>
 | 
        
           |  |  | 51 |                   </select>
 | 
        
           |  |  | 52 |                </td>
 | 
        
           |  |  | 53 |             </tr>
 | 
        
           |  |  | 54 |             <tr>
 | 
        
           |  |  | 55 |                <td>Product</td>
 | 
        
           |  |  | 56 |                <td>
 | 
        
           |  |  | 57 |                   <select name='license_product_id'>
 | 
        
           |  |  | 58 |                   <?php print queryToSelect( 'select license_product_id,name from license_product order by name', $adding ? '' : $currentLicense['license_product_id']); ?>
 | 
        
           |  |  | 59 |                   </select>
 | 
        
           |  |  | 60 |                </td>
 | 
        
           |  |  | 61 |             </tr>
 | 
        
           |  |  | 62 |             <tr>
 | 
        
           |  |  | 63 |                <td>License</td>
 | 
        
           |  |  | 64 |                <td>
 | 
        
           |  |  | 65 |                   <textarea name='license' cols="50" rows="2"><?php print $adding ? '' : $currentLicense['license']; ?></textarea>
 | 
        
           |  |  | 66 |                </td>
 | 
        
           |  |  | 67 |             </tr>
 | 
        
           |  |  | 68 |             <tr>
 | 
        
           |  |  | 69 |                <td>Added Date (YYYY-MM-DD)</td>
 | 
        
           |  |  | 70 |                <td>
 | 
        
           |  |  | 71 |                   <input type=text name='added_date' value='<?php print $adding ? '' : $currentLicense['added_date']; ?>' />
 | 
        
           |  |  | 72 |                </td>
 | 
        
           |  |  | 73 |             </tr>
 | 
        
           |  |  | 74 |             <tr>
 | 
        
           |  |  | 75 |                <td>Removed Date (YYYY-MM-DD)</td>
 | 
        
           |  |  | 76 |                <td>
 | 
        
           |  |  | 77 |                   <input type=text name='removed_date' value='<?php print $adding ? '' : $currentLicense['removed_date']; ?>' />
 | 
        
           |  |  | 78 |                </td>
 | 
        
           |  |  | 79 |             </tr>
 | 
        
           |  |  | 80 |             <tr>
 | 
        
           |  |  | 81 |                <td colspan='2' align='center'><input type="submit" value="Save Modifications" name="submit"></td>
 | 
        
           |  |  | 82 |             </tr>
 | 
        
           |  |  | 83 |          </table>
 | 
        
           |  |  | 84 |       </div>
 | 
        
           |  |  | 85 |    </body>
 | 
        
           |  |  | 86 | </html>
 |