0
votes

I got error when upgrading drupal 6 module to drupal 7. can anyone help me resolve this problem thanks

Notice: Undefined property: stdClass::$ket in milih_relasi_ledger() (line 2399 of C:\xampp5.6\htdocs\simkie7\sites\all\modules\product\display_ket\display_ket.module). Notice: Undefined property: stdClass::$ket in milih_relasi_ledger() (line 2399 of C:\xampp5.6\htdocs\simkie7\sites\all\modules\product\display_ket\display_ket.module). Notice: Undefined property: stdClass::$ket in milih_relasi_ledger() (line 2399 of C:\xampp5.6\htdocs\simkie7\sites\all\modules\product\display_ket\display_ket.module). Notice: Undefined property: stdClass::$ket in milih_relasi_ledger() (line 2399 of C:\xampp5.6\htdocs\simkie7\sites\all\modules\product\display_ket\display_ket.module).

Here my code

function milih_relasi_ledger(){
  global $user;
  db_set_active('data'); 
    //cost center
  $relasi = db_query('SELECT * FROM {relasibisnis} order by koderelasi');
  $p_rel = array(NULL => t('-- Pilih Relasi --'));
  foreach($relasi as $barisrelasi)
    //while ($barisrelasi = db_fetch_object($relasi))
     {
    $p_rel[$barisrelasi->koderelasi] = t($barisrelasi->koderelasi).'-'.$barisrelasi->ket.':' .substr(str_replace(array(" - "," -","- "),"-",$barisrelasi->namarelasi),0,50);
  }   
  db_set_active('default');  
  return $p_rel;
}
1
A bit more details please. What module? Your or third party module?MilanG
ket is a colum from relasibisnisipin upin

1 Answers

0
votes

Using this you can terminate the current notices, but I would suggest if you can share the whole code from that function then it would be great!

function milih_relasi_ledger() {
  global $user;
  $ket = NULL; // or you can use $ket = '';
  db_set_active('data');
  // cost center
  $relasi = db_query('SELECT * FROM {relasibisnis} order by koderelasi');
  $p_rel = array(NULL => t('-- Pilih Relasi --'));
  foreach ($relasi as $barisrelasi) {
  // while ($barisrelasi = db_fetch_object($relasi))
    $p_rel[$barisrelasi->koderelasi] = t($barisrelasi->koderelasi) . '-' . $barisrelasi->ket . ':' . substr(str_replace(array(" - ", " -", "- "), "-", $barisrelasi->namarelasi), 0, 50);
  }
  db_set_active('default');
  return $p_rel;
}