Ejemplo n.º 1
0
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
if ($page == -1) {
    $page = 0;
}
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) {
    $sortorder = "ASC";
}
if (!$sortfield) {
    $sortfield = "name";
}
$object = new Logement($db);
print $object->ref;
print $ref;
$result = $object->fetch($id, $ref);
//  print $id;
// print $result;
if (!empty($conf->gestimmo->enabled)) {
    $upload_dir = $conf->gestimmo->multidir_output[$object->entity] . '/' . dol_sanitizeFileName($object->ref);
}
// elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
$modulepart = 'gestimmo';
/*
 * Action envoie fichier
 */
if (GETPOST('sendit') && !empty($conf->global->MAIN_UPLOAD_DOC)) {
    dol_add_file_process($upload_dir, 0, 1, 'userfile');
Ejemplo n.º 2
0
$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 Logement($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('', 'gestimmo', '');
Ejemplo n.º 3
0
dol_include_once('/core/class/html.formfile.class.php');
$langs->load("products");
$langs->load("bills");
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
/*
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);
*/
$mesg = '';
$object = new Logement($db);
if ($id > 0 || !empty($ref)) {
    $result = $object->fetch($id, $ref);
    $dir = !empty($conf->gestimmo->multidir_output[$object->entity]) ? $conf->gestimmo->multidir_output[$object->entity] : $conf->gestimmo->multidir_output[$object->entity];
    //$dir = "/var/www/dev/immodol/documents/biens";
    dol_syslog("dans PHOTO 2 " . $dir . "id=" . $id . "ref " . $ref);
}
/*
 * Actions
 */
if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && GETPOST('sendit') && !empty($conf->global->MAIN_UPLOAD_DOC)) {
    dol_syslog("Product Create " . $dir);
    if ($object->id) {
        $result = $object->add_photo($dir, $_FILES['userfile']);
    }
}
Ejemplo n.º 4
0
 $i = 0;
 if ($num) {
     while ($i < $num) {
         $obj = $db->fetch_object($resql);
         if ($obj) {
             $titre = "";
             // You can use here results
             print '<tr><td>';
             print "<a href=\"fiche.php?id={$obj->rowid}\">{$obj->rowid}</a>";
             // print $obj->rowid;
             //print $product_static->getNomUrl(1,'',24);
             print '<td>' . $obj->ref_interne . '</td>';
             // print '<td>'.$obj->fk_biens.'</td>';
             //print '<td>'.$obj->getNomUrl(1,'fk_societe').'</td>';
             // ref du biens
             $biens = new Logement($db);
             $biens->fetch($obj->fk_biens);
             // $titre=$biens->ref;
             $titre = $biens->getbiensUrl(1) . $titre;
             print '<td>' . $titre . '</td>';
             print '<td> type: ' . $biens->nb_piece . '</td>';
             print '<td>' . dol_print_date($obj->date_contrat) . '</td>';
             print '<td>' . dol_print_date($obj->fin_validite) . '</td>';
             // print '<td>'.$obj->fk_societe.'</td>';
             //print '<td><a href="../comm/fiche.php?socid='.$obj->fk_soc.'">'.img_object($langs->trans("ShowCompany"),"company").'prop '.$obj->nom.'</a></td>';
             //print '<td>'.$obj->fk_user_mod.'</td>';
             //print '<td><a href="../comm/fiche.php?socid='.$obj->fk_user_mod.'">'.img_object($langs->trans("ShowCompany"),"company").' loc'.$obj->nom.'</a></td>';
             //print '<td>'.$obj->fk_societe.'</td>';
             //print '</td></tr>';
         }
         $i++;
Ejemplo n.º 5
0
     $title = $langs->trans('ContactsAddresses');
     include DOL_DOCUMENT_ROOT . '/core/tpl/bloc_showhide.tpl.php';
 }
 if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
     $blocname = 'notes';
     $title = $langs->trans('Notes');
     include DOL_DOCUMENT_ROOT . '/core/tpl/bloc_showhide.tpl.php';
 }
 $servicepos = GETPOST('servicepos') ? GETPOST('servicepos') : 1;
 // FIXME : not used ?
 $colorb = '666666';
 $arrayothercontracts = $object->getListOfContracts('others');
 /*
  * Lines of contracts
  */
 $productstatic = new Logement($db);
 // Title line for service/
 print '<table class="notopnoleft allwidth">';
 // Array with (n*2)+1 lines
 $cursorline = 1;
 while ($cursorline <= $nbofservices) {
     print '<tr height="16" ' . $bc[false] . '>';
     print '<td class="liste_titre" width="90" style="border-left: 1px solid #' . $colorb . '; border-top: 1px solid #' . $colorb . '; border-bottom: 1px solid #' . $colorb . ';">';
     print $langs->trans("ServiceNb", $cursorline) . '</td>';
     print '<td class="tab" style="border-right: 1px solid #' . $colorb . '; border-top: 1px solid #' . $colorb . '; border-bottom: 1px solid #' . $colorb . ';" rowspan="2">';
     // Area with common detail of line
     print '<table class="notopnoleft" width="100%">';
     $sql = "SELECT cd.rowid, cd.statut, cd.label as label_det, cd.fk_product, cd.description, cd.price_ht, cd.qty,";
     $sql .= " cd.tva_tx, cd.remise_percent, cd.info_bits, cd.subprice,";
     $sql .= " cd.date_ouverture_prevue as date_debut, cd.date_ouverture as date_debut_reelle,";
     $sql .= " cd.date_fin_validite as date_fin, cd.date_cloture as date_fin_reelle,";
Ejemplo n.º 6
0
                dol_syslog("gestimmo::mandat ::fiche error=" . $agf->error, LOG_ERR);
                $mesg = '<div class="error">' . $agf->error . '</div>';
                $action = 'edit';
            }
        } else {
            dol_syslog("gestimmo::site::card error=" . $agf->error, LOG_ERR);
            $mesg = '<div class="error">' . $agf->error . '</div>';
        }
    }
}
/*
 * Action create (fiche bien immo)
*/
if ($action == 'create_confirm') {
    if (!$_POST["cancel"]) {
        $agf = new Logement($db);
        $agf->ref = GETPOST('ref', 'alpha');
        $agf->descriptif = GETPOST('descriptif', 'alpha');
        $agf->entity = getpost('entity');
        $agf->datec = $now;
        $result = $agf->create($user);
        if ($result > 0) {
            if ($url_return) {
                Header("Location: " . $url_return);
            } else {
                Header("Location: " . $_SERVER['PHP_SELF'] . "?action=edit&id=" . $result);
            }
            exit;
        } else {
            dol_syslog("Gestimmo::site::card error=" . $agf->error, LOG_ERR);
            $mesg = '<div class="error">' . $agf->error . '</div>';
Ejemplo n.º 7
0
dol_include_once('/core/class/doleditor.class.php');
dol_include_once('/gestimmo/class/html.formgestimmo.class.php');
dol_include_once('/gestimmo/class/mandat.class.php');
// Security check
//if (!$user->rights->agefodd->lire) accessforbidden();
$mesg = '';
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$id = GETPOST('id', 'int');
$arch = GETPOST('arch', 'int');
$url_return = GETPOST('url_return', 'alpha');
/*
 * Actions delete
*/
if ($action == 'confirm_delete' && $confirm == "yes") {
    $gestimmo = new Logement($db);
    $gestimmo->id = $id;
    $result = $gestimmo->delete($user);
    if ($result > 0) {
        Header("Location: liste.php");
        exit;
    } else {
        dol_syslog("gestimmo::site::card error=" . $agf->error, LOG_ERR);
        $mesg = '<div class="error">' . $langs->trans("AgfDeleteErr") . ':' . $agf->error . '</div>';
    }
}
/*
 * Actions archive/active
*/
if ($action == 'arch_confirm_delete') {
    if ($confirm == "yes") {
Ejemplo n.º 8
0
if (!$res) {
    $res = @(include "../../../main.inc.php");
}
// For "custom" directory
if (!$res) {
    die("Include of main fails");
}
dol_include_once('/core/lib/functions2.lib.php');
dol_include_once('/gestimmo/class/logement.class.php');
dol_include_once('/gestimmo/lib/gestimmo.lib.php');
// Security check
if (!$user->rights->agefodd->lire) {
    accessforbidden();
}
$mesg = '';
$id = GETPOST('id', 'int');
$db->begin();
/*
 * View
*/
llxHeader('', $langs->trans("AgfTeacherSite"));
$agf = new Logement($db);
$agf->info($id);
$head = biens_prepare_head($agf);
dol_fiche_head($head, 'info', $langs->trans("AgfTeacherSite"), 0, 'address');
print '<table width="100%"><tr><td>';
dol_print_object_info($agf);
print '</td></tr></table>';
print '</div>';
$db->close();
llxFooter('$Date: 2010-03-28 19:06:42 +0200 (dim. 28 mars 2010) $ - $Revision: 51 $');
Ejemplo n.º 9
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 Logement($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;
     }
 }