$langs->load("other"); // Get parameters $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); $myparam = GETPOST('myparam', 'alpha'); // Protection if external user if ($user->societe_id > 0) { //accessforbidden(); } /******************************************************************* * ACTIONS * * Put here all code to do according to value of "action" parameter ********************************************************************/ if ($action == 'add') { $object = new Bails($db); $object->prop1 = $_POST["field1"]; $object->prop2 = $_POST["field2"]; $result = $object->create($user); if ($result > 0) { // Creation OK } // Creation KO $mesg = $object->error; } /*************************************************** * VIEW * * Put here all code to build page ****************************************************/ llxHeader('', 'MyPageName', '');
dol_include_once('/gestimmo/class/mandat.class.php'); //$mandat=new biens($db); //$logement= new Mandat($db); $i = 0; $sql = "SELECT t.rowid , t.ref_interne,t.fk_biens from llx_mandat as t"; $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); } if ($num > 0) { $var = True; while ($i < $num) { $objp = $db->fetch_object($result); print "<td>rowid " . $objp->rowid . " --> </td>"; print "<td>ref interne" . $objp->ref_interne . "---> </td>"; print "<td>biens " . $objp->fk_biens . "</td>"; print "<br>"; $bails = new Bails($db); $idbiens = $objp->fk_biens; print "<td>id biens " . $idbiens . "</td><br>"; $bails->fetch($idbiens); print "<td>retour ref_interne :" . $bails->ref_interne . " -----> </td><br>"; print "<td>retour logement :" . $bails->id . " -----> </td><br>"; $maj = $bails->update_mandat($objp->rowid); // $sql2 = 'UPDATE '.MAIN_DB_PREFIX.'llx_logement set fk_mandat = '.$objp->rowid; // $sql2.= ' WHERE rowid = '.$objp->fk_biens; //$result2 = $db->query($sql2); print $maj; $i++; } }
/** * 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 Bails($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; } }
print '<table style=noborder align="right">'; print '<tr><td align="center" colspan=2>'; print '<input type="submit" name="importadress" class="butAction" value="' . $langs->trans("Save") . '"> '; print '<input type="submit" name="cancel" class="butActionDelete" value="' . $langs->trans("Cancel") . '">'; print '</td></tr>'; print '</table>'; print '</form>'; } else { // Affichage de la fiche du bails gere if ($id) { print_barre_liste($langs->trans("Gestion Bail Immobilier"), "", "", "", "", "", '', 0); // $agf = new Logement($db); //$result = $agf->fetch($id); $formcompany = new FormCompany($db); $formmandat = new FormImmobilier($db); $gestimmo = new Bails($db); $result = $gestimmo->fetch($id); if ($result) { // $head = biens_prepare_head($agf); //dol_fiche_head($head, 'card', $langs->trans("Gestion des biens"), 0, 'address'); // Affichage en mode "édition" if ($action == 'edit') { // $formcompany = new FormCompany($db); $formimmo = new FormImmobilier($db); print_barre_liste($langs->trans("Modification biens"), "", "", "", "", "", '', 0); print '<form name="update" action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n"; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">' . "\n"; print '<input type="hidden" name="action" value="update">' . "\n"; print '<input type="hidden" name="id" value="' . $id . '">' . "\n"; print '<table class="border" width="100%">' . "\n"; print '<tr><td width="30%">' . $langs->trans("Id") . '</td>';