Esempio n. 1
0
 public function copyRecord($id)
 {
     $objSQL = new ClsNaanalSQL();
     $objSQL->addTable($this->module_table);
     $objSQL->addWhereNew($this->module_table, $this->module_id, $id);
     $sql = $objSQL->render();
     $record = $this->_db->getAssoc($sql);
     unset($record[$this->module_id]);
     $objSQL = new ClsNaanalSQL("INSERT");
     $objSQL->addTable($this->module_table);
     foreach ($record as $field => $data) {
         if ($field == "site_id") {
             $objSQL->addValue("site_id", $_GET["siteID"]);
         } else {
             $objSQL->addValue($field, $data);
         }
     }
     $sql = $objSQL->render();
     $this->_db->query($sql);
     $insid = $this->_db->getLastInsertId();
     $efield = new ExtraFields($this->_siteID, $this->data_item_type);
     $records = $efield->getValues($id);
     if ($records) {
         $efield = new ExtraFields($_GET["siteID"], $this->data_item_type);
         foreach ($records as $record) {
             $efield->setValue($record["fieldName"], $record["value"], $insid);
         }
     }
     //if($this->data_item_type===DATA_ITEM_CANDIDATE)
     //{
     $this->copyAttachment($id, $insid, $_GET["siteID"]);
     //}
     return true;
 }