本文整理汇总了PHP中Contrat::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP Contrat::fetch方法的具体用法?PHP Contrat::fetch怎么用?PHP Contrat::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contrat
的用法示例。
在下文中一共展示了Contrat::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GETPOST
$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");
$mesg = '<div class="error">' . $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType") . '</div>';
} else {
$mesg = '<div class="error">' . $object->error . '</div>';
}
}
示例2: GETPOST
}
// 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);
$i = 0;
示例3: GETPOST
$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);
$extralabelslines = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$permissionnote = $user->rights->contrat->creer;
// Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->contrat->creer;
示例4: 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, 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();
//.........这里部分代码省略.........
示例5: Formcontract
}
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 " ";
}
}
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';
print "</table>";
示例6: GETPOST
/**
* \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();
示例7: 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;
}
示例8: Contrat
$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 Contrat($db);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$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
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 {
setEventMessage($object->error, 'errors');
}
} else {
if ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer) {
if (!GETPOST('dateend')) {
$error++;
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), 'errors');
}
if (!$error) {
$object->fetch($id);
示例9: 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;
}
//.........这里部分代码省略.........
示例10: 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;
}
示例11: Form
$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
*/
示例12: GETPOST
$contratid = GETPOST("id");
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'contrat',$contratid,'contrat');
$usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
$object = new Contrat($db);
/*
* Actions
*/
if ($action == 'confirm_active' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->activer)
{
$object->fetch($_GET["id"]);
$result = $object->active_line($user, $_GET["ligne"], $_GET["date"], $_GET["dateend"], $_GET["comment"]);
if ($result > 0)
{
Header("Location: fiche.php?id=".$object->id);
exit;
}
else {
$mesg=$object->error;
}
}
if ($action == 'confirm_closeline' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->activer)
{
$object->fetch($_GET["id"]);
示例13: update
//.........这里部分代码省略.........
$this->total_ttc = 0;
}
// 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.
$localtaxes_type = getLocalTaxesFromRate($this->txtva, 0, $this->societe, $mysoc);
$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, $mysoc, $localtaxes_type);
$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;
}
// if buy price not defined, define buyprice as configured in margin admin
if ($this->pa_ht == 0) {
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) {
return $result;
} else {
$this->pa_ht = $result;
}
}
$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 != '' ? $this->subprice : "null") . ",";
$sql .= " price_ht=" . ($this->price_ht != '' ? $this->price_ht : "null") . ",";
$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 .= ", fk_unit=" . (!$this->fk_unit ? 'NULL' : $this->fk_unit);
$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();
$error++;
//return -1;
}
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) {
$result = $this->insertExtraFields();
if ($result < 0) {
$error++;
}
}
if (empty($error)) {
if (!$notrigger) {
// Call trigger
$result = $this->call_trigger('LINECONTRACT_UPDATE', $user);
if ($result < 0) {
$error++;
$this->db->rollback();
return -1;
}
// End call triggers
}
}
if (empty($error)) {
$this->db->commit();
return 1;
} else {
$this->db->rollback();
$this->errors[] = $this->error;
return -1;
}
}
示例14: ContratLigne
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);
$result = $product->fetch($contractline->fk_product);
示例15: isset
/**
* \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();