/**
  *  Load data for box to show them later
  *
  *  @param	int		$max        Maximum number of records to load
  *  @return	void
  */
 function loadBox($max = 5)
 {
     global $user, $langs, $db, $conf;
     $this->max = $max;
     include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
     $contractstatic = new Contrat($db);
     $this->info_box_head = array('text' => $langs->trans("BoxTitleLastContracts", $max));
     if ($user->rights->contrat->lire) {
         $sql = "SELECT s.nom, s.rowid as socid,";
         $sql .= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture";
         $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "contrat as c";
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
         }
         $sql .= " WHERE c.fk_soc = s.rowid";
         $sql .= " AND c.entity = " . $conf->entity;
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
             $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = " . $user->societe_id;
         }
         $sql .= " ORDER BY c.date_contrat DESC, c.ref DESC ";
         $sql .= $db->plimit($max, 0);
         $resql = $db->query($sql);
         if ($resql) {
             $num = $db->num_rows($resql);
             $now = dol_now();
             $i = 0;
             while ($i < $num) {
                 $objp = $db->fetch_object($resql);
                 $datec = $db->jdate($objp->datec);
                 $dateterm = $db->jdate($objp->fin_validite);
                 $dateclose = $db->jdate($objp->date_cloture);
                 $late = '';
                 $contractstatic->statut = $objp->fk_statut;
                 $contractstatic->id = $objp->rowid;
                 $result = $contractstatic->fetch_lines();
                 // fin_validite is no more on contract but on services
                 // if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); }
                 $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/contrat/fiche.php?id=" . $objp->rowid);
                 $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->ref ? $objp->ref : $objp->rowid, 'text2' => $late, 'url' => DOL_URL_ROOT . "/contrat/fiche.php?id=" . $objp->rowid);
                 $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $objp->socid);
                 $this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => dol_trunc($objp->nom, 40), 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $objp->socid);
                 $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_print_date($datec, 'day'));
                 $this->info_box_contents[$i][5] = array('td' => 'align="right" class="nowrap"', 'text' => $contractstatic->getLibStatut(6), 'asis' => 1);
                 $i++;
             }
             if ($num == 0) {
                 $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedContracts"));
             }
             $db->free($resql);
         } else {
             $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql);
         }
     } else {
         $this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed"));
     }
 }
if ($type_element == 'supplier_order') {
    // Supplier : Show products from orders.
    require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
    $documentstatic = new CommandeFournisseur($db);
    $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, ';
    $tables_from = MAIN_DB_PREFIX . "commande_fournisseur as c," . MAIN_DB_PREFIX . "commande_fournisseurdet as d";
    $where = " WHERE c.fk_soc = s.rowid AND s.rowid = " . $socid;
    $where .= " AND d.fk_commande = c.rowid";
    $dateprint = 'c.date_valid';
    $doc_number = 'c.ref';
    $thirdTypeSelect = 'supplier';
}
if ($type_element == 'contract') {
    // Supplier : Show products from orders.
    require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
    $documentstatic = new Contrat($db);
    $documentstaticline = new ContratLigne($db);
    $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, ';
    $tables_from = MAIN_DB_PREFIX . "contrat as c," . MAIN_DB_PREFIX . "contratdet as d";
    $where = " WHERE c.fk_soc = s.rowid AND s.rowid = " . $socid;
    $where .= " AND d.fk_contrat = c.rowid";
    $dateprint = 'c.date_valid';
    $doc_number = 'c.ref';
    $thirdTypeSelect = 'customer';
}
$sql = $sql_select;
$sql .= ' d.description as description,';
if ($type_element != 'fichinter' && $type_element != 'contract') {
    $sql .= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty,';
}
if ($type_element == 'contract') {
Beispiel #3
0
	/**
	 *      Update database for contract line
	 *      @param      user        	User that modify
	 *      @param      notrigger	    0=no, 1=yes (no update trigger)
	 *      @return     int         	<0 if KO, >0 if OK
	 */
	function update($user, $notrigger=0)
	{
		global $conf, $langs;

		// Clean parameters
		$this->fk_contrat=trim($this->fk_contrat);
		$this->fk_product=trim($this->fk_product);
		$this->statut=trim($this->statut);
		$this->label=trim($this->label);
		$this->description=trim($this->description);
		$this->tva_tx=trim($this->tva_tx);
		$this->localtax1_tx=trim($this->localtax1_tx);
		$this->localtax2_tx=trim($this->localtax2_tx);
		$this->qty=trim($this->qty);
		$this->remise_percent=trim($this->remise_percent);
		$this->remise=trim($this->remise);
		$this->fk_remise_except=trim($this->fk_remise_except);
		$this->subprice=price2num($this->subprice);
		$this->price_ht=price2num($this->price_ht);
		$this->total_ht=trim($this->total_ht);
		$this->total_tva=trim($this->total_tva);
		$this->total_localtax1=trim($this->total_localtax1);
		$this->total_localtax2=trim($this->total_localtax2);
		$this->total_ttc=trim($this->total_ttc);
		$this->info_bits=trim($this->info_bits);
		$this->fk_user_author=trim($this->fk_user_author);
		$this->fk_user_ouverture=trim($this->fk_user_ouverture);
		$this->fk_user_cloture=trim($this->fk_user_cloture);
		$this->commentaire=trim($this->commentaire);

		// Check parameters
		// Put here code to add control on parameters values

		// Update request
		$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
		$sql.= " fk_contrat='".$this->fk_contrat."',";
		$sql.= " fk_product=".($this->fk_product?"'".$this->fk_product."'":'null').",";
		$sql.= " statut='".$this->statut."',";
		$sql.= " label='".$this->db->escape($this->label)."',";
		$sql.= " description='".$this->db->escape($this->description)."',";
		$sql.= " date_commande=".($this->date_commande!=''?$this->db->idate($this->date_commande):"null").",";
		$sql.= " date_ouverture_prevue=".($this->date_ouverture_prevue!=''?$this->db->idate($this->date_ouverture_prevue):"null").",";
		$sql.= " date_ouverture=".($this->date_ouverture!=''?$this->db->idate($this->date_ouverture):"null").",";
		$sql.= " date_fin_validite=".($this->date_fin_validite!=''?$this->db->idate($this->date_fin_validite):"null").",";
		$sql.= " date_cloture=".($this->date_cloture!=''?$this->db->idate($this->date_cloture):"null").",";
		$sql.= " tva_tx='".$this->tva_tx."',";
		$sql.= " localtax1_tx='".$this->localtax1_tx."',";
		$sql.= " localtax2_tx='".$this->localtax2_tx."',";
		$sql.= " qty='".$this->qty."',";
		$sql.= " remise_percent='".$this->remise_percent."',";
		$sql.= " remise=".($this->remise?"'".$this->remise."'":"null").",";
		$sql.= " fk_remise_except=".($this->fk_remise_except?"'".$this->fk_remise_except."'":"null").",";
		$sql.= " subprice='".$this->subprice."',";
		$sql.= " price_ht='".$this->price_ht."',";
		$sql.= " total_ht='".$this->total_ht."',";
		$sql.= " total_tva='".$this->total_tva."',";
		$sql.= " total_localtax1='".$this->total_localtax1."',";
		$sql.= " total_localtax2='".$this->total_localtax2."',";
		$sql.= " total_ttc='".$this->total_ttc."',";
		$sql.= " info_bits='".$this->info_bits."',";
		$sql.= " fk_user_author=".($this->fk_user_author >= 0?$this->fk_user_author:"NULL").",";
		$sql.= " fk_user_ouverture=".($this->fk_user_ouverture > 0?$this->fk_user_ouverture:"NULL").",";
		$sql.= " fk_user_cloture=".($this->fk_user_cloture > 0?$this->fk_user_cloture:"NULL").",";
		$sql.= " commentaire='".$this->db->escape($this->commentaire)."'";
		$sql.= " WHERE rowid=".$this->id;

		dol_syslog("ContratLigne::update sql=".$sql, LOG_DEBUG);
		$resql = $this->db->query($sql);
		if ($resql)
		{
			$contrat=new Contrat($this->db);
			$contrat->fetch($this->fk_contrat);
			$result=$contrat->update_statut($user);
		}
		else
		{
			$this->error="Error ".$this->db->lasterror();
			dol_syslog("ContratLigne::update ".$this->error, LOG_ERR);
			return -1;
		}

		if (! $notrigger)
		{
			// Appel des triggers
			include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
			$interface=new Interfaces($this->db);
			$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
			if ($result < 0) { $error++; $this->errors=$interface->errors; }
			// Fin appel triggers
		}

		return 1;
	}
Beispiel #4
0
    print '<input type="hidden" name="email" value="' . $invoice->thirdparty->email . '">' . "\n";
    print '<input type="hidden" name="desc" value="' . $langs->trans("Invoice") . ' ' . $invoice->ref . '">' . "\n";
}
// Payment on contract line
if (GETPOST("source") == 'contractline' && $valid) {
    $found = true;
    $langs->load("contracts");
    require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
    $contractline = new ContratLigne($db);
    $result = $contractline->fetch('', $ref);
    if ($result < 0) {
        $mesg = $contractline->error;
        $error++;
    } else {
        if ($contractline->fk_contrat > 0) {
            $contract = new Contrat($db);
            $result = $contract->fetch($contractline->fk_contrat);
            if ($result > 0) {
                $result = $contract->fetch_thirdparty($contract->socid);
            } else {
                $mesg = $contract->error;
                $error++;
            }
        } else {
            $mesg = 'ErrorRecordNotFound';
            $error++;
        }
    }
    $amount = $contractline->total_ttc;
    if ($contractline->fk_product) {
        $product = new Product($db);
Beispiel #5
0
 $sql .= " WHERE c.fk_soc = s.rowid ";
 $sql .= " AND s.rowid = " . $objsoc->id;
 $sql .= " ORDER BY c.datec DESC";
 $resql = $db->query($sql);
 if ($resql) {
     $var = true;
     $num = $db->num_rows($resql);
     if ($num > 0) {
         print '<tr class="liste_titre">';
         print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>' . $langs->trans("LastContracts", $num <= $MAXLIST ? "" : $MAXLIST) . '</td>';
         print '<td align="right"><a href="' . DOL_URL_ROOT . '/contrat/liste.php?socid=' . $objsoc->id . '">' . $langs->trans("AllContracts") . ' (' . $num . ')</a></td></tr></table></td>';
         print '</tr>';
     }
     $i = 0;
     while ($i < $num && $i < $MAXLIST) {
         $contrat = new Contrat($db);
         $objp = $db->fetch_object($resql);
         $var = !$var;
         print "<tr {$bc[$var]}>";
         print '<td nowrap="nowrap">';
         $contrat->id = $objp->id;
         $contrat->ref = $objp->ref ? $objp->ref : $objp->id;
         print $contrat->getNomUrl(1, 12);
         print "</td>\n";
         print '<td align="right" width="80">' . dol_print_date($db->jdate($objp->dc), 'day') . "</td>\n";
         print '<td width="20">&nbsp;</td>';
         print '<td align="right" nowrap="nowrap">';
         $contrat->fetch_lines();
         print $contrat->getLibStatut(4);
         print "</td>\n";
         print '</tr>';
Beispiel #6
0
$langs->load('compta');
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$socid = GETPOST('socid', 'int');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', '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', 'globalcard'));
$object = new Contrat($db);
$extrafields = new ExtraFields($db);
// Load object
if ($id > 0 || !empty($ref) && $action != 'add') {
    $ret = $object->fetch($id, $ref);
    if ($ret > 0) {
        $ret = $object->fetch_thirdparty();
    }
    if ($ret < 0) {
        dol_print_error('', $object->error);
    }
}
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// fetch optionals attributes lines and labels
$extrafieldsline = new ExtraFields($db);
require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
$langs->load("contracts");
$langs->load("companies");
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$socid = GETPOST('socid', 'int');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
// Security check
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'contrat', $id);
$object = new Contrat($db);
/*
 * Ajout d'un nouveau contact
 */
if ($action == 'addcontact' && $user->rights->contrat->creer) {
    $result = $object->fetch($id);
    if ($result > 0 && $id > 0) {
        $contactid = GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid');
        $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
    }
    if ($result >= 0) {
        header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
        exit;
    } else {
        if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
            $langs->load("errors");
Beispiel #8
0
    include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
    $board = new CommandeFournisseur($db);
    $dashboardlines[] = $board->load_board($user);
}
// Number of commercial proposals opened (expired)
if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
    include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
    $board = new Propal($db);
    $dashboardlines[] = $board->load_board($user, "opened");
    // Number of commercial proposals CLOSED signed (billed)
    $dashboardlines[] = $board->load_board($user, "signed");
}
// Number of services enabled (delayed)
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
    include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
    $board = new Contrat($db);
    $dashboardlines[] = $board->load_board($user, "inactives");
    // Number of active services (expired)
    $dashboardlines[] = $board->load_board($user, "expired");
}
// Number of invoices customers (has paid)
if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
    include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
    $board = new Facture($db);
    $dashboardlines[] = $board->load_board($user);
}
// Number of supplier invoices (has paid)
if (!empty($conf->fournisseur->enabled) && !empty($conf->facture->enabled) && $user->rights->facture->lire) {
    include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
    $board = new FactureFournisseur($db);
    $dashboardlines[] = $board->load_board($user);
<?php

require '../config.php';
$get = GETPOST('get');
switch ($get) {
    case 'is-concurrent':
        $fk_contrat = (int) GETPOST('id');
        dol_include_once('/contrat/class/contrat.class.php');
        $c = new Contrat($db);
        $c->fetch($fk_contrat);
        if ($c->id > 0 && $c->array_options['options_concurrent'] == 1) {
            echo 1;
        } else {
            echo 0;
        }
        break;
    default:
        break;
}
Beispiel #10
0
 /**
  *      Update database for contract line
  *
  *      @param	User	$user        	User that modify
  *      @param  int		$notrigger	    0=no, 1=yes (no update trigger)
  *      @return int         			<0 if KO, >0 if OK
  */
 function update($user, $notrigger = 0)
 {
     global $conf, $langs;
     $error = 0;
     // Clean parameters
     $this->fk_contrat = trim($this->fk_contrat);
     $this->fk_product = trim($this->fk_product);
     $this->statut = trim($this->statut);
     $this->label = trim($this->label);
     $this->description = trim($this->description);
     $this->tva_tx = trim($this->tva_tx);
     $this->localtax1_tx = trim($this->localtax1_tx);
     $this->localtax2_tx = trim($this->localtax2_tx);
     $this->qty = trim($this->qty);
     $this->remise_percent = trim($this->remise_percent);
     $this->remise = trim($this->remise);
     $this->fk_remise_except = trim($this->fk_remise_except);
     $this->subprice = price2num($this->subprice);
     $this->price_ht = price2num($this->price_ht);
     $this->total_ht = trim($this->total_ht);
     $this->total_tva = trim($this->total_tva);
     $this->total_localtax1 = trim($this->total_localtax1);
     $this->total_localtax2 = trim($this->total_localtax2);
     $this->total_ttc = trim($this->total_ttc);
     $this->info_bits = trim($this->info_bits);
     $this->fk_user_author = trim($this->fk_user_author);
     $this->fk_user_ouverture = trim($this->fk_user_ouverture);
     $this->fk_user_cloture = trim($this->fk_user_cloture);
     $this->commentaire = trim($this->commentaire);
     // Check parameters
     // Put here code to add control on parameters values
     // Calcul du total TTC et de la TVA pour la ligne a partir de
     // qty, pu, remise_percent et txtva
     // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
     // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
     $tabprice = calcul_price_total($this->qty, $this->price_ht, $this->remise_percent, $this->tva_tx, $this->localtax1_tx, $this->localtax2_tx, 0, 'HT', 0);
     $this->total_ht = $tabprice[0];
     $this->total_tva = $tabprice[1];
     $this->total_ttc = $tabprice[2];
     $this->total_localtax1 = $tabprice[9];
     $this->total_localtax2 = $tabprice[10];
     // Update request
     $sql = "UPDATE " . MAIN_DB_PREFIX . "contratdet SET";
     $sql .= " fk_contrat='" . $this->fk_contrat . "',";
     $sql .= " fk_product=" . ($this->fk_product ? "'" . $this->fk_product . "'" : 'null') . ",";
     $sql .= " statut='" . $this->statut . "',";
     $sql .= " label='" . $this->db->escape($this->label) . "',";
     $sql .= " description='" . $this->db->escape($this->description) . "',";
     $sql .= " date_commande=" . ($this->date_commande != '' ? "'" . $this->db->idate($this->date_commande) . "'" : "null") . ",";
     $sql .= " date_ouverture_prevue=" . ($this->date_ouverture_prevue != '' ? "'" . $this->db->idate($this->date_ouverture_prevue) . "'" : "null") . ",";
     $sql .= " date_ouverture=" . ($this->date_ouverture != '' ? "'" . $this->db->idate($this->date_ouverture) . "'" : "null") . ",";
     $sql .= " date_fin_validite=" . ($this->date_fin_validite != '' ? "'" . $this->db->idate($this->date_fin_validite) . "'" : "null") . ",";
     $sql .= " date_cloture=" . ($this->date_cloture != '' ? "'" . $this->db->idate($this->date_cloture) . "'" : "null") . ",";
     $sql .= " tva_tx='" . $this->tva_tx . "',";
     $sql .= " localtax1_tx='" . $this->localtax1_tx . "',";
     $sql .= " localtax2_tx='" . $this->localtax2_tx . "',";
     $sql .= " qty='" . $this->qty . "',";
     $sql .= " remise_percent='" . $this->remise_percent . "',";
     $sql .= " remise=" . ($this->remise ? "'" . $this->remise . "'" : "null") . ",";
     $sql .= " fk_remise_except=" . ($this->fk_remise_except ? "'" . $this->fk_remise_except . "'" : "null") . ",";
     $sql .= " subprice='" . $this->subprice . "',";
     $sql .= " price_ht='" . $this->price_ht . "',";
     $sql .= " total_ht='" . $this->total_ht . "',";
     $sql .= " total_tva='" . $this->total_tva . "',";
     $sql .= " total_localtax1='" . $this->total_localtax1 . "',";
     $sql .= " total_localtax2='" . $this->total_localtax2 . "',";
     $sql .= " total_ttc='" . $this->total_ttc . "',";
     $sql .= " info_bits='" . $this->info_bits . "',";
     $sql .= " fk_user_author=" . ($this->fk_user_author >= 0 ? $this->fk_user_author : "NULL") . ",";
     $sql .= " fk_user_ouverture=" . ($this->fk_user_ouverture > 0 ? $this->fk_user_ouverture : "NULL") . ",";
     $sql .= " fk_user_cloture=" . ($this->fk_user_cloture > 0 ? $this->fk_user_cloture : "NULL") . ",";
     $sql .= " commentaire='" . $this->db->escape($this->commentaire) . "'";
     $sql .= " WHERE rowid=" . $this->id;
     dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
     $resql = $this->db->query($sql);
     if ($resql) {
         $contrat = new Contrat($this->db);
         $contrat->fetch($this->fk_contrat);
         $result = $contrat->update_statut($user);
     } else {
         $this->error = "Error " . $this->db->lasterror();
         dol_syslog(get_class($this) . "::update " . $this->error, LOG_ERR);
         return -1;
     }
     if (!$notrigger) {
         // Appel des triggers
         include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php";
         $interface = new Interfaces($this->db);
         $result = $interface->run_triggers('MYOBJECT_MODIFY', $this, $user, $langs, $conf);
         if ($result < 0) {
             $error++;
             $this->errors = $interface->errors;
         }
         // Fin appel triggers
     }
     return 1;
 }
Beispiel #11
0
 /**
  * testContratDelete
  *
  * @param	int		$id		Id of contract
  * @return	int
  *
  * @depends	testContratOther
  * The depends says test is run only if previous is ok
  */
 public function testContratDelete($id)
 {
     global $conf, $user, $langs, $db;
     $conf = $this->savconf;
     $user = $this->savuser;
     $langs = $this->savlangs;
     $db = $this->savdb;
     $localobject = new Contrat($this->savdb);
     $result = $localobject->fetch($id);
     $result = $localobject->delete($user);
     print __METHOD__ . " id=" . $id . " result=" . $result . "\n";
     $this->assertLessThan($result, 0);
     return $result;
 }
Beispiel #12
0
    /**
     *	testVerifyNumRef
     *
     *	@return	int
     */
    public function testVerifyNumRef()
    {
    	global $conf,$user,$langs,$db;
		$conf=$this->savconf;
		$user=$this->savuser;
		$langs=$this->savlangs;
		$db=$this->savdb;

		$localobject=new Contrat($this->savdb);
    	$result=$localobject->ref='refthatdoesnotexists';
		$result=$localobject->VerifyNumRef();

		print __METHOD__." result=".$result."\n";
    	$this->assertEquals($result, 0);
    	return $result;
    }
Beispiel #13
0
    $langs->load("contracts");
    include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
    $board = new Contrat($db);
    $board->load_board($user, "inactives");
    $board->warning_delay = $conf->contrat->services->inactifs->warning_delay / 60 / 60 / 24;
    $board->label = $langs->trans("BoardNotActivatedServices");
    $board->url = DOL_URL_ROOT . '/contrat/services.php?mainmenu=commercial&amp;leftmenu=contracts&amp;mode=0';
    $board->img = img_object($langs->trans("Contract"), "contract");
    $rowspan++;
    $dashboardlines[] = $board;
}
// Number of active services (expired)
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
    $langs->load("contracts");
    include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
    $board = new Contrat($db);
    $board->load_board($user, "expired");
    $board->warning_delay = $conf->contrat->services->expires->warning_delay / 60 / 60 / 24;
    $board->label = $langs->trans("BoardRunningServices");
    $board->url = DOL_URL_ROOT . '/contrat/services.php?mainmenu=commercial&amp;leftmenu=contracts&amp;mode=4&amp;filter=expired';
    $board->img = img_object($langs->trans("Contract"), "contract");
    $rowspan++;
    $dashboardlines[] = $board;
}
// Number of invoices customers (has paid)
if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
    $langs->load("bills");
    include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
    $board = new Facture($db);
    $board->load_board($user);
    $board->warning_delay = $conf->facture->client->warning_delay / 60 / 60 / 24;
Beispiel #14
0
	$socid = $user->societe_id;
}

// Get parameters
$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";


$contrat = new Contrat($db);
$contrat->fetch($_GET["id"]);

$upload_dir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($contrat->ref);
$modulepart='contract';


/*
 * Action envoie fichier
 */
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
	require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");

	if (create_exdir($upload_dir) >= 0)
	{
Beispiel #15
0
require_once DOL_DOCUMENT_ROOT . "/product/class/product.class.php";
$langs->load("products");
$langs->load("companies");
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
$statut = GETPOST('statut') ? GETPOST('statut') : 1;
// Security check
$socid = 0;
$id = GETPOST('id', 'int');
if (!empty($user->societe_id)) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'contrat', $id);
$staticcompany = new Societe($db);
$staticcontrat = new Contrat($db);
$staticcontratligne = new ContratLigne($db);
$productstatic = new Product($db);
/*
 * Action
 */
// None
/*
 * View
 */
$now = dol_now();
llxHeader();
print_fiche_titre($langs->trans("ContractsArea"));
//print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">';
Beispiel #16
0
/**
 *      \file       htdocs/contrat/info.php
 *      \ingroup    contrat
 *      \brief      Page des informations d'un contrat
 */
require "../main.inc.php";
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/contract.lib.php';
require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
$langs->load("contracts");
// Security check
$contratid = isset($_GET["id"]) ? $_GET["id"] : '';
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'contrat', $contratid, '');
/*
* View
*/
llxHeader();
$contrat = new Contrat($db);
$contrat->fetch($_GET["id"]);
$contrat->info($_GET["id"]);
$head = contract_prepare_head($contrat);
dol_fiche_head($head, 'info', $langs->trans("Contract"), 0, 'contract');
print '<table width="100%"><tr><td>';
dol_print_object_info($contrat);
print '</td></tr></table>';
print '</div>';
$db->close();
llxFooter();
Beispiel #17
0
require "../main.inc.php";
require_once DOL_DOCUMENT_ROOT . '/core/lib/contract.lib.php';
require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
$langs->load("companies");
$langs->load("contracts");
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$socid = GETPOST('socid', 'int');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
// Security check
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'contrat', $id);
$object = new Contrat($db);
$object->fetch($id, $ref);
/******************************************************************************/
/*                     Actions                                                */
/******************************************************************************/
if ($action == 'setnote_public' && $user->rights->contrat->creer) {
    $result = $object->update_note(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_public')), ENT_QUOTES), '_public');
    if ($result < 0) {
        dol_print_error($db, $object->error);
    }
} else {
    if ($action == 'setnote_private' && $user->rights->contrat->creer) {
        $result = $object->update_note(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_private')), ENT_QUOTES), '_private');
        if ($result < 0) {
            dol_print_error($db, $object->error);
        }
Beispiel #18
0
$langs->load('compta');
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$socid = GETPOST('socid', 'int');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', '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', 'globalcard'));
$object = new Contrat($db);
$extrafields = new ExtraFields($db);
// Load object
if ($id > 0 || !empty($ref) && $action != 'add') {
    $ret = $object->fetch($id, $ref);
    if ($ret > 0) {
        $ret = $object->fetch_thirdparty();
    }
    if ($ret < 0) {
        dol_print_error('', $object->error);
    }
}
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// fetch optionals attributes lines and labels
$extrafieldsline = new ExtraFields($db);
Beispiel #19
0
 /**
  *      Update database for contract line
  *
  *      @param	User	$user        	User that modify
  *      @param  int		$notrigger	    0=no, 1=yes (no update trigger)
  *      @return int         			<0 if KO, >0 if OK
  */
 function update($user, $notrigger = 0)
 {
     global $conf, $langs;
     $error = 0;
     // Clean parameters
     $this->fk_contrat = trim($this->fk_contrat);
     $this->fk_product = trim($this->fk_product);
     $this->statut = trim($this->statut);
     $this->label = trim($this->label);
     $this->description = trim($this->description);
     $this->tva_tx = trim($this->tva_tx);
     $this->localtax1_tx = trim($this->localtax1_tx);
     $this->localtax2_tx = trim($this->localtax2_tx);
     $this->qty = trim($this->qty);
     $this->remise_percent = trim($this->remise_percent);
     $this->remise = trim($this->remise);
     $this->fk_remise_except = trim($this->fk_remise_except);
     $this->subprice = price2num($this->subprice);
     $this->price_ht = price2num($this->price_ht);
     $this->total_ht = trim($this->total_ht);
     $this->total_tva = trim($this->total_tva);
     $this->total_localtax1 = trim($this->total_localtax1);
     $this->total_localtax2 = trim($this->total_localtax2);
     $this->total_ttc = trim($this->total_ttc);
     $this->info_bits = trim($this->info_bits);
     $this->fk_user_author = trim($this->fk_user_author);
     $this->fk_user_ouverture = trim($this->fk_user_ouverture);
     $this->fk_user_cloture = trim($this->fk_user_cloture);
     $this->commentaire = trim($this->commentaire);
     // Check parameters
     // Put here code to add control on parameters values
     // Calcul du total TTC et de la TVA pour la ligne a partir de
     // qty, pu, remise_percent et txtva
     // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
     // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
     $tabprice = calcul_price_total($this->qty, $this->price_ht, $this->remise_percent, $this->tva_tx, $this->localtax1_tx, $this->localtax2_tx, 0, 'HT', 0, 1);
     $this->total_ht = $tabprice[0];
     $this->total_tva = $tabprice[1];
     $this->total_ttc = $tabprice[2];
     $this->total_localtax1 = $tabprice[9];
     $this->total_localtax2 = $tabprice[10];
     if (empty($this->pa_ht)) {
         $this->pa_ht = 0;
     }
     // si prix d'achat non renseigné et utilisé pour calcul des marges alors prix achat = prix vente
     if ($this->pa_ht == 0) {
         if ($this->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) {
             $this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
         }
     }
     $this->db->begin();
     // Update request
     $sql = "UPDATE " . MAIN_DB_PREFIX . "contratdet SET";
     $sql .= " fk_contrat='" . $this->fk_contrat . "',";
     $sql .= " fk_product=" . ($this->fk_product ? "'" . $this->fk_product . "'" : 'null') . ",";
     $sql .= " statut='" . $this->statut . "',";
     $sql .= " label='" . $this->db->escape($this->label) . "',";
     $sql .= " description='" . $this->db->escape($this->description) . "',";
     $sql .= " date_commande=" . ($this->date_commande != '' ? "'" . $this->db->idate($this->date_commande) . "'" : "null") . ",";
     $sql .= " date_ouverture_prevue=" . ($this->date_ouverture_prevue != '' ? "'" . $this->db->idate($this->date_ouverture_prevue) . "'" : "null") . ",";
     $sql .= " date_ouverture=" . ($this->date_ouverture != '' ? "'" . $this->db->idate($this->date_ouverture) . "'" : "null") . ",";
     $sql .= " date_fin_validite=" . ($this->date_fin_validite != '' ? "'" . $this->db->idate($this->date_fin_validite) . "'" : "null") . ",";
     $sql .= " date_cloture=" . ($this->date_cloture != '' ? "'" . $this->db->idate($this->date_cloture) . "'" : "null") . ",";
     $sql .= " tva_tx='" . $this->tva_tx . "',";
     $sql .= " localtax1_tx='" . $this->localtax1_tx . "',";
     $sql .= " localtax2_tx='" . $this->localtax2_tx . "',";
     $sql .= " qty='" . $this->qty . "',";
     $sql .= " remise_percent='" . $this->remise_percent . "',";
     $sql .= " remise=" . ($this->remise ? "'" . $this->remise . "'" : "null") . ",";
     $sql .= " fk_remise_except=" . ($this->fk_remise_except ? "'" . $this->fk_remise_except . "'" : "null") . ",";
     $sql .= " subprice='" . $this->subprice . "',";
     $sql .= " price_ht='" . $this->price_ht . "',";
     $sql .= " total_ht='" . $this->total_ht . "',";
     $sql .= " total_tva='" . $this->total_tva . "',";
     $sql .= " total_localtax1='" . $this->total_localtax1 . "',";
     $sql .= " total_localtax2='" . $this->total_localtax2 . "',";
     $sql .= " total_ttc='" . $this->total_ttc . "',";
     $sql .= " fk_product_fournisseur_price=" . (!empty($this->fk_fournprice) ? $this->fk_fournprice : "NULL") . ",";
     $sql .= " buy_price_ht='" . price2num($this->pa_ht) . "',";
     $sql .= " info_bits='" . $this->info_bits . "',";
     $sql .= " fk_user_author=" . ($this->fk_user_author >= 0 ? $this->fk_user_author : "NULL") . ",";
     $sql .= " fk_user_ouverture=" . ($this->fk_user_ouverture > 0 ? $this->fk_user_ouverture : "NULL") . ",";
     $sql .= " fk_user_cloture=" . ($this->fk_user_cloture > 0 ? $this->fk_user_cloture : "NULL") . ",";
     $sql .= " commentaire='" . $this->db->escape($this->commentaire) . "'";
     $sql .= " WHERE rowid=" . $this->id;
     dol_syslog(get_class($this) . "::update", LOG_DEBUG);
     $resql = $this->db->query($sql);
     if ($resql) {
         $contrat = new Contrat($this->db);
         $contrat->fetch($this->fk_contrat);
         $result = $contrat->update_statut($user);
     } else {
         $this->error = "Error " . $this->db->lasterror();
         $this->db->rollback();
         return -1;
     }
     if (!$notrigger) {
         // Call trigger
         $result = $this->call_trigger('LINECONTRACT_UPDATE', $user);
         if ($result < 0) {
             $error++;
             $this->db->rollback();
             return -1;
         }
         // End call triggers
     }
     $this->db->commit();
     return 1;
 }
require "../main.inc.php";
require_once DOL_DOCUMENT_ROOT . '/core/lib/contract.lib.php';
require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
$langs->load("companies");
$langs->load("contracts");
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$socid = GETPOST('socid', 'int');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
// Security check
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'contrat', $id);
$object = new Contrat($db);
$object->fetch($id, $ref);
$permissionnote = $user->rights->contrat->creer;
// Used by the include of actions_setnotes.inc.php
/*
 * Actions
 */
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php';
// Must be include, not includ_once
/*
 * View
 */
llxHeader();
$form = new Form($db);
if ($id > 0 || !empty($ref)) {
    dol_htmloutput_mesg($mesg);
    die("Include of main fails");
}
// Class
dol_include_once("/immobilier/class/contrat.class.php");
dol_include_once('/immobilier/lib/immobilier.lib.php');
// Langs
$langs->load("immobilier@immobilier");
$id = GETPOST('id', 'int');
$mesg = '';
$limit = $conf->liste_limit;
/*
* loyer et paiement par contrat
*
*/
llxheader('', $langs->trans("bilancontrat"), '');
$contrat = new Contrat($db);
$result = $contrat->fetch($id);
$head = contrat_prepare_head($contrat);
dol_fiche_head($head, 'info', $langs->trans("Imoinfo"), 0, 'agreement');
$sql = "(SELECT l.periode_du as date , l.montant_tot as debit, 0 as credit , l.nom as des";
$sql .= " FROM " . MAIN_DB_PREFIX . "immo_loyer as l";
$sql .= " WHERE l.contrat_id =" . $id;
$sql .= ")";
$sql .= "UNION (SELECT p.date_paiement as date, 0 as debit , p.montant as credit, p.commentaire as des";
$sql .= " FROM " . MAIN_DB_PREFIX . "immo_paie as p";
$sql .= " WHERE p.contrat_id =" . $id;
$sql .= ")";
$sql .= "ORDER BY date";
$result = $db->query($sql);
if ($result) {
    $num_lignes = $db->num_rows($result);
Beispiel #22
0
//$langs->setDefaultLang('en_US'); 	// To change default language of $langs
$langs->load("main");
// To load language file for default language
@set_time_limit(0);
// Load user and its permissions
$result = $user->fetch('', 'admin');
// Load user for login 'admin'. Comment line to run as anonymous user.
if (!$result > 0) {
    dol_print_error('', $user->error);
    exit;
}
$user->getrights();
print "***** " . $script_file . " (" . $version . ") *****\n";
if (!isset($argv[1])) {
    // Check parameters
    print "Usage: " . $script_file . " id_thirdparty ...\n";
    exit;
}
print '--- start' . "\n";
print 'Argument id_thirdparty=' . $argv[1] . "\n";
// Start of transaction
$db->begin();
require_once DOL_DOCUMENT_ROOT . "/contrat/class/contrat.class.php";
// Create invoice object
$obj = new Contrat($db);
$obj->socid = $argv[1];
$listofcontractsforcompany = $obj->getListOfContracts('all');
print_r($listofcontractsforcompany);
// -------------------- END OF YOUR CODE --------------------
$db->close();
return $error;
Beispiel #23
0
	if ($socid) $sql.= " AND s.rowid = ".$socid;
	$sql.= " ORDER BY c.tms DESC";
	$sql.= $db->plimit(5, 0);

	$resql=$db->query($sql);
	if ($resql)
	{
		$num = $db->num_rows($resql);

		if ($num > 0)
		{
			print '<table class="noborder" width="100%">';
			print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("LastContracts",5).'</td></tr>';
			$i = 0;

			$staticcontrat=new Contrat($db);

			$var=false;
			while ($i < $num)
			{
				$obj = $db->fetch_object($resql);
				print "<tr ".$bc[$var]."><td><a href=\"../contrat/fiche.php?id=".$obj->contratid."\">".img_object($langs->trans("ShowContract","contract"))." ".$obj->ref."</a></td>";
				print '<td>';
                $companystatic->id=$objp->rowid;
                $companystatic->name=$objp->name;
                $companystatic->canvas=$objp->canvas;
                print $companystatic->getNomUrl(1,'customer',44);
				print '</td>'."\n";
				print "<td align=\"right\">".$staticcontrat->LibStatut($obj->statut,3)."</td></tr>\n";
				$var=!$var;
				$i++;
Beispiel #24
0
         print '</a></td>';
     }
     print '</tr></table>';
     print '</td><td colspan="3">';
     if ($action == 'contrat') {
         print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
         print '<tr><td>';
         $htmlcontract = new Formcontract($db);
         //print "$socid,$selected,$htmlname";
         $htmlcontract->select_contract($object->socid, $object->fk_contrat, 'contratid');
         print '</td>';
         print '<td align="left"><input type="submit" class="button" value="' . $langs->trans("Modify") . '"></td>';
         print '</tr></table>';
     } else {
         if ($object->fk_contrat) {
             $contratstatic = new Contrat($db);
             $contratstatic->fetch($object->fk_contrat);
             //print '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$selected.'">'.$projet->title.'</a>';
             print $contratstatic->getNomUrl(0, '', 1);
         } else {
             print "&nbsp;";
         }
     }
     print '</td>';
     print '</tr>';
 }
 // Statut
 print '<tr><td>' . $langs->trans("Status") . '</td><td colspan="3">' . $object->getLibStatut(4) . '</td></tr>';
 // Other attributes
 $cols = 3;
 include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
Beispiel #25
0
 print '</td>';
 print '<td class="liste_titre" align="center">';
 $arrayofoperators = array('<' => '<', '>' => '>');
 print $form->selectarray('filter_op2', $arrayofoperators, $filter_op2, 1);
 print ' ';
 $filter_date2 = dol_mktime(0, 0, 0, $op2month, $op2day, $op2year);
 print $form->select_date($filter_date2, 'op2', 0, 0, 1, '', 1, 0, 1);
 print '</td>';
 print '<td align="right">';
 $arrayofstatus = array('0' => $langs->trans("ServiceStatusInitial"), '4' => $langs->trans("ServiceStatusRunning"), '4&filter=notexpired' => $langs->trans("ServiceStatusNotLate"), '4&filter=expired' => $langs->trans("ServiceStatusLate"), '5' => $langs->trans("ServiceStatusClosed"));
 print $form->selectarray('search_status', $arrayofstatus, strstr($search_status, ',') ? -1 : $search_status, 1);
 print '</td>';
 print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
 print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
 print "</td></tr>\n";
 $contractstatic = new Contrat($db);
 $productstatic = new Product($db);
 $var = True;
 while ($i < min($num, $limit)) {
     $obj = $db->fetch_object($resql);
     $var = !$var;
     print "<tr " . $bc[$var] . ">";
     print '<td>';
     $contractstatic->id = $obj->cid;
     $contractstatic->ref = $obj->ref ? $obj->ref : $obj->cid;
     print $contractstatic->getNomUrl(1, 16);
     print '</td>';
     // Service
     print '<td>';
     if ($obj->pid) {
         $productstatic->id = $obj->pid;
/**
 *      \file       htdocs/contrat/info.php
 *      \ingroup    contrat
 *      \brief      Page des informations d'un contrat
 */
require "../main.inc.php";
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/contract.lib.php';
require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
$langs->load("contracts");
// Security check
$contratid = GETPOST("id", 'int');
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'contrat', $contratid, '');
/*
* View
*/
llxHeader();
$contrat = new Contrat($db);
$contrat->fetch($contratid);
$contrat->info($contratid);
$head = contract_prepare_head($contrat);
dol_fiche_head($head, 'info', $langs->trans("Contract"), 0, 'contract');
print '<table width="100%"><tr><td>';
dol_print_object_info($contrat);
print '</td></tr></table>';
print '</div>';
$db->close();
llxFooter();
 public function update(Contrat $contrat)
 {
     $query = $this->_db->prepare('UPDATE t_contrat SET numero=:numero, dateCreation=:dateCreation, 
     prixVente=:prixVente, avance=:avance, modePaiement=:modePaiement, numeroCheque=:numeroCheque,
     nombreMois=:nombreMois, dureePaiement=:dureePaiement, echeance=:echeance,  
     note=:note, updated=:updated, updatedBy=:updatedBy WHERE id=:id') or die(print_r($this->_db->errorInfo()));
     $query->bindValue(':id', $contrat->id());
     $query->bindValue(':numero', $contrat->numero());
     $query->bindValue(':dateCreation', $contrat->dateCreation());
     $query->bindValue(':prixVente', $contrat->prixVente());
     $query->bindValue(':avance', $contrat->avance());
     $query->bindValue(':modePaiement', $contrat->modePaiement());
     $query->bindValue(':dureePaiement', $contrat->dureePaiement());
     $query->bindValue(':numeroCheque', $contrat->numeroCheque());
     $query->bindValue(':nombreMois', $contrat->nombreMois());
     $query->bindValue(':echeance', $contrat->echeance());
     $query->bindValue(':note', $contrat->note());
     $query->bindValue(':updated', $contrat->updated());
     $query->bindValue(':updatedBy', $contrat->updatedBy());
     $query->execute();
     $query->closeCursor();
 }
Beispiel #28
0
 } elseif ($tmp == 'NotConfigured') {
     print $langs->trans($tmp);
 } else {
     print $tmp;
 }
 print '</td>' . "\n";
 print '<td align="center">';
 if ($conf->global->CONTRACT_ADDON == "{$file}") {
     print img_picto($langs->trans("Activated"), 'switch_on');
 } else {
     print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setmod&amp;value=' . $file . '">';
     print img_picto($langs->trans("Disabled"), 'switch_off');
     print '</a>';
 }
 print '</td>';
 $contract = new Contrat($db);
 $contract->initAsSpecimen();
 // Info
 $htmltooltip = '';
 $htmltooltip .= '' . $langs->trans("Version") . ': <b>' . $module->getVersion() . '</b><br>';
 $nextval = $module->getNextValue($mysoc, $contract);
 if ("{$nextval}" != $langs->trans("NotAvailable")) {
     // Keep " on nextval
     $htmltooltip .= '' . $langs->trans("NextValue") . ': ';
     if ($nextval) {
         if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
             $nextval = $langs->trans($nextval);
         }
         $htmltooltip .= $nextval . '<br>';
     } else {
         $htmltooltip .= $langs->trans($module->error) . '<br>';
Beispiel #29
0
/**
 *  Create a contract document on disk using template defined into CONTRACT_ADDON_PDF
 *
 *  @param	DoliDB		$db  			objet base de donnee
 *  @param	Contrat		$object			Object contract
 *  @param	string		$modele			force le modele a utiliser ('' par defaut)
 *  @param	Translate	$outputlangs	objet lang a utiliser pour traduction
 *  @param  int			$hidedetails    Hide details of lines
 *  @param  int			$hidedesc       Hide description
 *  @param  int			$hideref        Hide ref
 *  @return int         				0 if KO, 1 if OK
 * @deprecated Use the new function generateDocument of Contrat class
 * @see Contrat::generateDocument()
 */
function contract_pdf_create(DoliDB $db, Contrat $object, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
    dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
    return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
Beispiel #30
0
$html = new Form($db);
$formcompany= new FormCompany($db);
$contactstatic=new Contact($db);
$userstatic=new User($db);


/* *************************************************************************** */
/*                                                                             */
/* Mode vue et edition                                                         */
/*                                                                             */
/* *************************************************************************** */
$id = $_GET["id"];
if ($id > 0)
{
	$contrat = New Contrat($db);
	if ($contrat->fetch($id) > 0)
	{
		if ($mesg) print $mesg;

		$soc = new Societe($db);
		$soc->fetch($contrat->socid);

	    $head = contract_prepare_head($contrat);

		$hselected=1;

		dol_fiche_head($head, $hselected, $langs->trans("Contract"), 0, 'contract');

		/*
		 *   Contrat