Ejemplo n.º 1
0
 /**
  *	Load an object from its id and create a new one in database
  *
  *	@param	int		$fromid     Id of object to clone
  * 	@return	int					New id of clone
  */
 function createFromClone($fromid)
 {
     global $user, $langs;
     $error = 0;
     $object = new Immorelever($this->db);
     $this->db->begin();
     // Load source object
     $object->fetch($fromid);
     $object->id = 0;
     $object->statut = 0;
     // Clear fields
     // ...
     // Create clone
     $result = $object->create($user);
     // Other options
     if ($result < 0) {
         $this->error = $object->error;
         $error++;
     }
     if (!$error) {
     }
     // End
     if (!$error) {
         $this->db->commit();
         return $object->id;
     } else {
         $this->db->rollback();
         return -1;
     }
 }
Ejemplo n.º 2
0
    } else {
        Header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
    }
}
/*
 * View
 */
llxheader('', $langs->trans("ReleverCompteur"), '');
$local = new Local($db, $id);
$head = local_prepare_head($local);
$immeuble = new Immeuble($db);
$result = $immeuble->fetch($local->immeuble_id);
if ($result < 0) {
    setEventMessage($immeuble->error, 'errors');
}
$relever = new Immorelever($db);
$relever->fetch_all_by_local($id);
if ($result < 0) {
    setEventMessage($relever->error, 'errors');
}
dol_fiche_head($head, 'compteurrelever', $langs->trans("ReleverCompteur"), 0, 'propertie');
print '<table class="border" width="100%">';
print '<tr><td width="20%">' . $langs->trans("NomLocal") . '</td>';
print '<td>' . $local->nom . '</td></tr>';
print '<tr><td width="20%">' . $langs->trans("Adresse") . '</td>';
print '<td>' . $local->adresse . '</td></tr>';
print '<tr><td width="20%">' . $langs->trans("Commentaire") . '</td>';
print '<td>' . $local->commentaire . '</td></tr>';
print '<tr><td width="20%">' . $langs->trans("Statut") . '</td>';
print '<td>' . $local->statut . '</td></tr>';
print '<tr><td width="20%">' . $langs->trans("Immeuble") . '</td>';