本文整理汇总了PHP中Contrat类的典型用法代码示例。如果您正苦于以下问题:PHP Contrat类的具体用法?PHP Contrat怎么用?PHP Contrat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Contrat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadBox
/**
* 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 = " . $user->id;
}
if ($user->societe_id) {
$sql .= " 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"));
}
}
示例2: CommandeFournisseur
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') {
示例3: update
/**
* 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;
}
示例4: ContratLigne
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);
示例5: while
$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"> </td>';
print '<td align="right" nowrap="nowrap">';
$contrat->fetch_lines();
print $contrat->getLibStatut(4);
print "</td>\n";
print '</tr>';
示例6: GETPOST
$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);
示例7: GETPOST
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");
示例8: CommandeFournisseur
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);
示例9: GETPOST
<?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;
}
示例10: update
/**
* 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;
}
//.........这里部分代码省略.........
示例11: testContratDelete
/**
* 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;
}
示例12: testVerifyNumRef
/**
* 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;
}
示例13: Contrat
$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&leftmenu=contracts&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&leftmenu=contracts&mode=4&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;
示例14: GETPOST
$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)
{
示例15: GETPOST
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">';