0002-pass-api-key-to-selectSupplier-function.patch

guillomovitch, 01/02/2015 12:52 AM

Download (4.59 KB)

View differences:

inc/dell.class.php
65 65
      
66 66
   }
67 67
   
68
   function getSupplierInfo($compSerial=null, $otherserial=null) {
68
   function getSupplierInfo($compSerial=null, $otherserial=null, $key=null) {
69 69
   
70 70
      $info["name"]="Dell";
71
      $info["supplier_url"] = "http://www.dell.com/support/troubleshooting/us/en/04/Index?c=us&l=en&s=bsd&cs=04&t=system&ServiceTag=";
72
      $info["url"] = $info["supplier_url"].$compSerial;
71
      $info["supplier_url"] = "https://api.dell.com/support/v2/assetinfo/warranty/tags.json?";
72
      $info["url"] = $info["supplier_url"]. 'svctags=' . $compSerial . '&apikey=' . $key;
73 73
      return $info;
74 74
   }
75 75
   
......
80 80

  
81 81
}
82 82

  
83
?>
83
?>
inc/postimport.class.php
249 249
         $supplierId=$config->fields["suppliers_id"];
250 250
      }
251 251
      $suppliername=$config->fields["name"];
252
      $supplierkey=$config->fields["supplier_key"];
252 253
      $adddoc=$config->fields["document_adding"];
253 254
      $rubrique=$config->fields["documentcategories_id"];
254 255
      $addcomments=$config->fields["comment_adding"];
......
288 289
         if ($_SESSION["glpiis_ids_visible"]||empty($line["name"])) $dID.= " (".$line["id"].")";
289 290
         echo "<a href='".$link."?id=".$ID."'>".$line["name"].$dID."</a><br>".$otherSerial."</td>";
290 291

  
291
         $url=PluginManufacturersimportsPreImport::selectSupplier($suppliername,$compSerial,$otherSerial);
292
         $url=PluginManufacturersimportsPreImport::selectSupplier($suppliername,$compSerial,$otherSerial,$supplierkey);
292 293

  
293 294
         //On complete l url du support du fournisseur avec le serial
294 295
         echo "<td>".$compSerial."</td>";
......
527 528
   }
528 529
}
529 530

  
530
?>
531
?>
inc/preimport.class.php
85 85
   * @return $url of the supplier
86 86
   *
87 87
   */
88
   static function selectSupplier ($suppliername,$compSerial,$otherserial=null) {
88
   static function selectSupplier ($suppliername,$compSerial,$otherserial=null,$supplierkey=null) {
89 89
      
90 90
      $url = "";
91 91
      if (!empty($suppliername)) {
92 92
         
93 93
         $supplierclass = "PluginManufacturersimports".$suppliername;
94 94
         $supplier = new $supplierclass();
95
         $infos = $supplier->getSupplierInfo($compSerial,$otherserial);
95
         $infos = $supplier->getSupplierInfo($compSerial,$otherserial,$supplierkey);
96 96
         $url = $infos['url'];
97 97
      }
98 98
      return $url;
......
107 107
      $config= new PluginManufacturersimportsConfig();
108 108
      $config->GetFromDB($configID);
109 109
      $suppliername=$config->fields["name"];
110
      $supplierkey=$config->fields["supplier_key"];
110 111
      $supplierUrl=$config->fields["supplier_url"];
111 112
      $supplierId=$config->fields["suppliers_id"];
112 113
      $supplierWarranty=$config->fields["warranty_duration"];
......
141 142
            echo Search::showItem($output_type,Dropdown::getDropdownName("glpi_entities",$line['entities_id']),$item_num,$row_num);
142 143
         }
143 144

  
144
         $url=self::selectSupplier($suppliername,$line["serial"],$otherSerial);
145
         $url=self::selectSupplier($suppliername,$line["serial"],$otherSerial,$supplierkey);
145 146
         //serial
146 147
         echo Search::showItem($output_type,$line["serial"],$item_num,$row_num);
147 148
         //otherserial
......
760 761
   }
761 762
}
762 763

  
763
?>
764
?>
764
-