getIndexName.diff

webmyster, 07/30/2012 07:39 AM

Download (4.69 KB)

View differences:

inc/commondbchild.class.php (working copy)
440 440
   function cleanDBonItemDelete ($itemtype, $item_id) {
441 441
      global $DB;
442 442

  
443
      $query = "SELECT `".$this->getIndexName()."`
443
      $query = "SELECT `".static::getIndexName()."`
444 444
                FROM `".$this->getTable()."`";
445 445

  
446 446
      if ($itemtype == $this->itemtype) {
......
540 540
         $items_id = -99;
541 541
      }
542 542

  
543
      $query = "SELECT `$db_field`, `".$this->getIndexName()."`
543
      $query = "SELECT `$db_field`, `".static::getIndexName()."`
544 544
                FROM `" . $this->getTable() . "`
545 545
                WHERE `".$this->items_id."` = '".$item->getID()."'";
546 546

  
......
563 563

  
564 564
         if ($setDefault) {
565 565
            echo "<input title='" . sprintf(__s('Default %s'), $this->getTypeName(1)) .
566
                   "' type='radio' name='_default_email' value='".$data[$this->getIndexName()]."'".
566
                   "' type='radio' name='_default_email' value='".$data[static::getIndexName()]."'".
567 567
                   ($canedit?' ':' disabled').($data['is_default'] ? ' checked' : ' ').">&nbsp;";
568 568
         }
569 569

  
570
         $input_name  = $html_field . "[" . $data[$this->getIndexName()] . "]";
570
         $input_name  = $html_field . "[" . $data[static::getIndexName()] . "]";
571 571
         $input_value = $data[$db_field];
572 572

  
573 573
         if (!$canedit
inc/ticketsatisfaction.class.php (working copy)
50 50
   /**
51 51
    * for use showFormHeader
52 52
   **/
53
   function getIndexName() {
53
   static function getIndexName() {
54 54
      return 'tickets_id';
55 55
   }
56 56

  
inc/networkportinstantiation.class.php (working copy)
61 61
   public $canHaveVirtualPort    = true;
62 62
   public $haveMAC               = true;
63 63

  
64
   function getIndexName() {
64
   static function getIndexName() {
65 65
      return 'networkports_id';
66 66
   }
67 67

  
inc/commondbtm.class.php (working copy)
132 132
         return false;
133 133
      }
134 134

  
135
      return $this->getFromDBByQuery("WHERE `".$this->getTable()."`.`".$this->getIndexName()."` = '$ID'");
135
      return $this->getFromDBByQuery("WHERE `".$this->getTable()."`.`".static::getIndexName()."` = '$ID'");
136 136
   }
137 137

  
138 138
   /**
......
175 175
   **/
176 176
   function getID() {
177 177

  
178
      if (isset($this->fields[$this->getIndexName()])) {
179
         return $this->fields[$this->getIndexName()];
178
      if (isset($this->fields[static::getIndexName()])) {
179
         return $this->fields[static::getIndexName()];
180 180
      }
181 181
      return -1;
182 182
   }
......
237 237
    *
238 238
    * @return name of the index field
239 239
   **/
240
   function getIndexName() {
240
   static function getIndexName() {
241 241
      return "id";
242 242
   }
243 243

  
......
939 939
         return false;
940 940
      }
941 941

  
942
      if (!$this->getFromDB($input[$this->getIndexName()])) {
942
      if (!$this->getFromDB($input[static::getIndexName()])) {
943 943
         return false;
944 944
      }
945 945

  
......
1176 1176
         return false;
1177 1177
      }
1178 1178

  
1179
      if (!$this->getFromDB($input[$this->getIndexName()])) {
1179
      if (!$this->getFromDB($input[static::getIndexName()])) {
1180 1180
         return false;
1181 1181
      }
1182 1182

  
......
1351 1351
   **/
1352 1352
   function restore(array $input, $history=1) {
1353 1353

  
1354
      if (!$this->getFromDB($input[$this->getIndexName()])) {
1354
      if (!$this->getFromDB($input[static::getIndexName()])) {
1355 1355
         return false;
1356 1356
      }
1357 1357

  
......
3695 3695
      }
3696 3696

  
3697 3697
      if (!$this->isField('notepad')
3698
          || !isset($this->fields[$this->getIndexName()])) {
3698
          || !isset($this->fields[static::getIndexName()])) {
3699 3699
         return false;
3700 3700
      }
3701 3701

  
......
3720 3720
      echo "<tr><td class='tab_bg_2 center'>";
3721 3721
      echo "<input type='hidden' name='id' value='".$this->fields['id']."'>";
3722 3722
      // for all objects without id as primary key
3723
      if ($this->getIndexName() != 'id') {
3724
         echo "<input type='hidden' name='".$this->getIndexName()."' value='".
3725
                $this->fields[$this->getIndexName()]."'>";
3723
      if (static::getIndexName() != 'id') {
3724
         echo "<input type='hidden' name='".static::getIndexName()."' value='".
3725
                $this->fields[static::getIndexName()]."'>";
3726 3726
      }
3727 3727

  
3728 3728
      if ($canedit) {