Subversion Repositories computer_asset_manager_v1

Rev

Rev 46 | Rev 69 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 46 Rev 47
Line 57... Line 57...
57
            }
57
            }
58
            // now, locate each license_product_id and update the license information
58
            // now, locate each license_product_id and update the license information
59
            // if product does not exist, add it
59
            // if product does not exist, add it
60
            // thus, spelling counts or you'll get dup entries in license_product table
60
            // thus, spelling counts or you'll get dup entries in license_product table
61
            foreach ( $info as $product => $license ) {
61
            foreach ( $info as $product => $license ) {
-
 
62
               # look for product name, but don't update it if it doesn't exist
-
 
63
               $product_id = getValue( 'license_product', 'license_product_id', 'name', $product, false );
-
 
64
               /*
-
 
65
                * Some software (like Belarc) show product names as publiser - product name, ie
-
 
66
                * Microsoft - Office 2017
-
 
67
                * So, we'll look to see if this is the case here.
-
 
68
                * NOTE: we are only checking if this key is publisher - product and, if so checking for product
-
 
69
                *       however, if it is listed in database as publisher - product and we are just product, it 
-
 
70
                *       will still result in dups.
-
 
71
                */
-
 
72
               if ( ! $product_id ) { 
-
 
73
                  if ( strpos( $product, ' - ' ) !== false ) {
-
 
74
                     $product_id = getValue( 'license_product', 'license_product_id', 'name', substr( $product, strpos( $product, ' - ' ) + 3 ), false );
-
 
75
                  }
-
 
76
               }
-
 
77
               // if we still haven't found it, just add the bloody thing.
-
 
78
               if ( ! $product_id )
62
               $product_id = getValue( 'license_product', 'license_product_id', 'name', $product, true );
79
                  $product_id = getValue( 'license_product', 'license_product_id', 'name', $product, true );
-
 
80
      
63
               $action = updateLicense( $client_id, $machine_id, $product_id, $license );
81
               $action = updateLicense( $client_id, $machine_id, $product_id, $license );
64
               $return .= "<tr>\n";
82
               $return .= "<tr>\n";
65
               $return .= "<td>$action</td><td>$client</td><td>$client_id</td>";
83
               $return .= "<td>$action</td><td>$client</td><td>$client_id</td>";
66
               $return .= "<td>$machine</td><td>$machine_id</td>";
84
               $return .= "<td>$machine</td><td>$machine_id</td>";
67
               $return .= "<td>$product</td><td>$product_id</td><td>$license</td>\n";
85
               $return .= "<td>$product</td><td>$product_id</td><td>$license</td>\n";
Line 85... Line 103...
85
   </head>
103
   </head>
86
   <body>
104
   <body>
87
      <?php include_once('../../menu.php'); ?>
105
      <?php include_once('../../menu.php'); ?>
88
      <div id="content">
106
      <div id="content">
89
      <?php 
107
      <?php 
90
         if ( $_POST["submit"] ) {
108
         if ( isset( $_POST["submit"] ) ) {
91
            $filename = tempnam( '/tmp', 'blk' );
109
            $filename = tempnam( '/tmp', 'blk' );
92
            if ( move_uploaded_file( $_FILES["fileToUpload"]["tmp_name"], $filename ) ) {
110
            if ( move_uploaded_file( $_FILES["fileToUpload"]["tmp_name"], $filename ) ) {
93
               print "<p>Loading Data</p>\n";
111
               print "<p>Loading Data</p>\n";
94
               print processFile( $filename , $_REQUEST['delimiter'], $_REQUEST['encapsulation'], $_REQUEST['escape'], $_REQUEST['notfoundisnull']  );
112
               print processFile( $filename , $_REQUEST['delimiter'], $_REQUEST['encapsulation'], $_REQUEST['escape'], $_REQUEST['notfoundisnull']  );
95
            } else {
113
            } else {