Пример #1
0
// Security check
//if (!$user->rights->agefodd->lire) accessforbidden();
$mesg = '';
$now = dol_now();
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$id = GETPOST('id', 'int');
$arch = GETPOST('arch', 'int');
$url_return = GETPOST('url_return', 'alpha');
// Langs
$langs->load("immobilier@immobilier");
/*
 * Actions delete
*/
if ($action == 'confirm_delete' && $confirm == "yes") {
    $gestimmo = new Mandat($db);
    $gestimmo->id = $id;
    $result = $gestimmo->delete($user);
    if ($result > 0) {
        Header("Location: liste.php");
        exit;
    } else {
        dol_syslog("gestimmo::mandat::card error=" . $agf->error, LOG_ERR);
        $mesg = '<div class="error">' . $langs->trans("mandat ERREUR") . ':' . $agf->error . '</div>';
    }
}
/*
 * Actions archive/active
*/
/*
 * Action update (fiche mandat)
Пример #2
0
$id         = GETPOST('id','int');
$action     = GETPOST('action','alpha');
$myparam    = GETPOST('myparam','alpha');
*/
$action = "list";
// 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 Mandat($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
****************************************************/
$texte = "Listes des mandats";
Пример #3
0
 $objp = $db->fetch_object($resql);
 $var = !$var;
 print "<tr {$bc[$var]}>";
 //print '<td>';
 $biensstatic->id = $objp->rowid;
 $biensstatic->ref = $objp->adresse;
 $biensstatic->type = $objp->loyer;
 $bienstatic->fk_mandat = $objp->fk_mandat;
 //print $biensstatic->getNomUrl(1,'supplier');
 //Print $objp->rowid;
 //print '<a href="fiche.php?id='.$objp->rowid.'">';
 //print img_object($langs->trans("ShowContract"),"contract").' '.(isset($objp->rowid) ? $objp->rowid : $obj->cid) .'</a>';
 //print '</td>';
 print "<td> <a href=\"fiche.php?id={$objp->rowid}\">{$objp->ref}</a></td>";
 //   print '<td>'.$objp->ref.'</td>'."\n";
 $supplier = new Mandat($db);
 $supplier->fetch($objp->fk_mandat);
 if ($objp->fk_mandat > 0) {
     $titre = $supplier->getmandatUrl(1) . $titre . $supplier->ref_interne . " </br>du :  " . dol_print_date($supplier->date_contrat);
 } else {
     $titre = "Pas de Mandat de location";
 }
 print '<td>' . $titre . '</td>';
 print '<td>' . $objp->adresse . '</td>';
 print '<td>' . $objp->town . '</td>';
 print '<td> Type ' . $objp->nb_piece . '</td>' . "\n";
 //$companystatic->nom=$objp->nom;
 //$companystatic->id=$objp->socid;
 //print '<td>'.$companystatic->getNomUrl(1,'supplier').'</td>';
 //print '<td align="right">'.price($objp->loyer).'</td>';
 //	print '<td align="right">'.$objp->qty.'</td>';
Пример #4
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 Mandat($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;
     }
 }
Пример #5
0
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$socid = GETPOST('socid', 'int');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$mesg = GETPOST('msg', 'alpha');
$datecontrat = '';
// Security check
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'contrat', $id);
$usehm = !empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE : 0;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('contractcard'));
$object = new Mandat($db);
/*
 * Actions
 */
// Activation du mandats apres creation
if ($action == 'confirm_active' && $confirm == 'yes' && $user->rights->contrat->activer) {
    $object->fetch($id);
    $result = $object->active_line($user, GETPOST('ligne'), GETPOST('date'), GETPOST('dateend'), GETPOST('comment'));
    if ($result > 0) {
        header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
        exit;
    } else {
        $mesg = $object->error;
    }
} else {
    if ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer) {
Пример #6
0
                dol_syslog("gestimmo::bails::card error=" . $gestimmo->error, LOG_ERR);
                $mesg = '<div class="error">' . $gestimmo->error . '</div>';
                //pour gere le retour en cas d erreur
                $action = 'edit';
            }
        }
    }
}
/*
 * Action create (fiche bails immo)
*/
if ($action == 'create_confirm') {
    if (!$_POST["cancel"]) {
        $gestimmo = new Bails($db);
        // Pour rensegner les valeurs du bails
        $staticmandat = new Mandat($db);
        $idmandat = GETPOST('fk_mandat');
        $staticresult = $staticmandat->fetch($idmandat);
        //  print $staticmandat->id;
        // todo champs pour la creation du bail
        $gestimmo->fk_prop = $staticmandat->fk_soc;
        $gestimmo->fk_loc = GETPOST('fk_loc', 'int');
        $gestimmo->fk_logement = $staticmandat->fk_biens;
        $gestimmo->fk_mandat = GETPOST('fk_mandat', 'int');
        $gestimmo->Type = GETPOST('Type', 'alpha');
        $gestimmo->Date_location = GETPOST('Date_location', 'alpha');
        $gestimmo->Depot_garantie = GETPOST('Depot_garantie', 'alpha');
        $gestimmo->date_fin = GETPOST('date_fin', 'alpha');
        $gestimmo->entity = getpost('entity');
        $result = $gestimmo->create($user);
        if ($result > 0) {